From 970ad0f91857d68f8939810f891eb3e92539d9a5 Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Date: Sat, 27 Jul 2024 14:03:25 -0400 Subject: [PATCH] Self Notification Subscription Management --- BLAZAMGui/Layouts/AppUserButton.razor | 9 +++ .../EditNotificationSubscriptionRow.razor | 15 +++-- .../NotificaionSubscriptionEditor.razor | 34 +++++++++++ .../Notifications/NotificationSettings.razor | 29 +-------- .../OUNotificationSubscriptions.razor | 60 ++++++++++++++++--- 5 files changed, 108 insertions(+), 39 deletions(-) create mode 100644 BLAZAMGui/UI/Settings/Notifications/NotificaionSubscriptionEditor.razor diff --git a/BLAZAMGui/Layouts/AppUserButton.razor b/BLAZAMGui/Layouts/AppUserButton.razor index 385c5510..5ca02aa6 100644 --- a/BLAZAMGui/Layouts/AppUserButton.razor +++ b/BLAZAMGui/Layouts/AppUserButton.razor @@ -34,6 +34,9 @@ @AppLocalization["Profile Settings"] + + @AppLocalization["Notification Settings"] + @AppLocalization["Documentation"] @@ -58,8 +61,14 @@ + + + + + @code { AppModal? profileModal; + AppModal? notificationsModal; /// /// Indicates whether the notification panel is open /// diff --git a/BLAZAMGui/UI/Settings/Notifications/EditNotificationSubscriptionRow.razor b/BLAZAMGui/UI/Settings/Notifications/EditNotificationSubscriptionRow.razor index 4c12b319..ba3436dd 100644 --- a/BLAZAMGui/UI/Settings/Notifications/EditNotificationSubscriptionRow.razor +++ b/BLAZAMGui/UI/Settings/Notifications/EditNotificationSubscriptionRow.razor @@ -1,4 +1,4 @@ - +@inject IStringLocalizer AppLocalization @foreach (var type in Enum.GetValues(typeof(NotificationType))) { @@ -11,7 +11,6 @@ ValueChanged=@((bool val)=>{ToggleType(originalEnum,val);}) Value="@(Subscription.NotificationTypes.FirstOrDefault(x=>x.NotificationType==originalEnum)!=null)" /> - } @@ -29,9 +28,13 @@ @if (Subscription.Id == 0) { - + + @AppLocalization["Create"] + } else @@ -40,10 +43,12 @@ diff --git a/BLAZAMGui/UI/Settings/Notifications/NotificaionSubscriptionEditor.razor b/BLAZAMGui/UI/Settings/Notifications/NotificaionSubscriptionEditor.razor new file mode 100644 index 00000000..8785e10c --- /dev/null +++ b/BLAZAMGui/UI/Settings/Notifications/NotificaionSubscriptionEditor.razor @@ -0,0 +1,34 @@ + + + + + @if (_selectedOU != null) + { + + + + } + + + + +@code{ + [Parameter] + public AppUser User {get;set;} + + IDirectoryEntryAdapter? _selectedOU = null; + + + private async void ouChanged(IDirectoryEntryAdapter entry) + { + var ou = (IADOrganizationalUnit)entry; + if (ou != null) + { + _selectedOU = ou; + await InvokeAsync(StateHasChanged); + } + } + +} \ No newline at end of file diff --git a/BLAZAMGui/UI/Settings/Notifications/NotificationSettings.razor b/BLAZAMGui/UI/Settings/Notifications/NotificationSettings.razor index 9e4b1a39..1a050404 100644 --- a/BLAZAMGui/UI/Settings/Notifications/NotificationSettings.razor +++ b/BLAZAMGui/UI/Settings/Notifications/NotificationSettings.razor @@ -1,5 +1,5 @@ @inherits AppComponentBase -

@AppLocalization["Managee Notifications"]

+

@AppLocalization["Manage Notifications"]

@if (_selectedUser != null) { - - - - - @if (_selectedOU != null) - { - - - - } - - - + } @code { - IDirectoryEntryAdapter? _selectedOU = null; IList Users = new List(); AppUser? _selectedUser = null; protected override async Task OnInitializedAsync() @@ -37,15 +22,7 @@ if (value == null) value = String.Empty; return Users.Where(x => x.Username.Contains(value)); } - private async void ouChanged(IDirectoryEntryAdapter entry) - { - var ou = (IADOrganizationalUnit)entry; - if (ou != null) - { - _selectedOU = ou; - await InvokeAsync(StateHasChanged); - } - } + diff --git a/BLAZAMGui/UI/Settings/Notifications/OUNotificationSubscriptions.razor b/BLAZAMGui/UI/Settings/Notifications/OUNotificationSubscriptions.razor index 1351b69f..9f3343fb 100644 --- a/BLAZAMGui/UI/Settings/Notifications/OUNotificationSubscriptions.razor +++ b/BLAZAMGui/UI/Settings/Notifications/OUNotificationSubscriptions.razor @@ -2,28 +2,52 @@ @inject OUNotificationService ouNotificationService + + + @(AppLocalization["Notification Settings for "]+_ou.CanonicalName) + + + + + + @AppLocalization["Events"] + + + @AppLocalization["Delivery"] + + + @AppLocalization[" "] + + + @AppLocalization[" "] + + - + @{ + bool first = true; + } @foreach (var type in Enum.GetValues(typeof(NotificationType))) { var originalEnum = (NotificationType)type; - + @originalEnum.ToString() + first=false; + } - + @AppLocalization["In App"] @AppLocalization["To Email"] - + @AppLocalization["Block"] - + @AppLocalization["Save"] @@ -37,10 +61,24 @@ + OnDeleted="DeleteExisting" /> } } + else + { + + + + @AppLocalization["No subscriptions are set for this OU"] + + + } + + + + + @@ -50,10 +88,16 @@ - - @AppLocalization["Effective Notification Settings"] + + + + + + + @(AppLocalization["Effective Notification Settings for "]+_ou.CanonicalName) +