diff --git a/MiniSpace.Web/src/MiniSpace.Web/Components/RadzenPostCard.razor b/MiniSpace.Web/src/MiniSpace.Web/Components/RadzenPostCard.razor index 5ea09ab64..5c332ce62 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Components/RadzenPostCard.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Components/RadzenPostCard.razor @@ -33,7 +33,8 @@ - + @(Post.TextContent) diff --git a/MiniSpace.Web/src/MiniSpace.Web/DTO/StudentDto.cs b/MiniSpace.Web/src/MiniSpace.Web/DTO/StudentDto.cs index 629e4c423..f05da8759 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/DTO/StudentDto.cs +++ b/MiniSpace.Web/src/MiniSpace.Web/DTO/StudentDto.cs @@ -9,6 +9,7 @@ public class StudentDto public string Email { get; set; } public string FirstName { get; set; } public string LastName { get; set; } + public string FullName => $"{FirstName} {LastName}"; public int NumberOfFriends { get; set; } public Guid ProfileImage { get; set; } public string Description { get; set; } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Models/Events/SearchEventsModel.cs b/MiniSpace.Web/src/MiniSpace.Web/Models/Events/SearchEventsModel.cs index 727644eae..0e026c914 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Models/Events/SearchEventsModel.cs +++ b/MiniSpace.Web/src/MiniSpace.Web/Models/Events/SearchEventsModel.cs @@ -12,7 +12,7 @@ public class SearchEventsModel public OrganizationModel Organization { get; set; } public string Category { get; set; } public string State { get; set; } - public IEnumerable Friends { get; set; } + public HashSet Friends { get; set; } public string FriendsEngagementType { get; set; } public DateTime DateFrom { get; set; } public DateTime DateTo { get; set; } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Account/ShowAccount.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Account/ShowAccount.razor index ccf90f556..bfb1ab0bb 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Account/ShowAccount.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Account/ShowAccount.razor @@ -39,7 +39,7 @@ } - + @if (studentDto.State == "valid") diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageOrganizations.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageOrganizations.razor index e3118819e..d24515519 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageOrganizations.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageOrganizations.razor @@ -17,7 +17,12 @@ @if (!pageInitialized) { -

Loading...

+
+ + + +
} else { diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageReports.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageReports.razor index 8ba6a53a4..f2709724b 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageReports.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageReports.razor @@ -20,7 +20,12 @@ @if (!pageInitialized) { -

Loading...

+
+ + + +
} @if (pageInitialized && adminId != Guid.Empty) { @@ -200,5 +205,6 @@ Width = "700px", Height = "600px", Resizable = true, Draggable = true, AutoFocusFirstElement = false }); + StateHasChanged(); } } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageStudents.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageStudents.razor index 1df447a56..dcb167112 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageStudents.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/ManageStudents.razor @@ -13,7 +13,12 @@ @if (!pageInitialized) { -

Loading...

+
+ + + +
} @if (pageInitialized && adminId != Guid.Empty) { diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/EventsSearchDialog.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/EventsSearchDialog.razor index 6bc6443ae..5c7660358 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/EventsSearchDialog.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/EventsSearchDialog.razor @@ -76,6 +76,11 @@

Select an organization (also suborganizations are included in results):

+ + + + + @@ -188,18 +193,25 @@ StateHasChanged(); } - private static void ConvertOrganizationDtoList(IEnumerable input, IList result, Guid? rootId) + private void ConvertOrganizationDtoList(IEnumerable input, IList result, Guid? rootId) { result.Clear(); foreach (var organization in input) { - result.Add(new OrganizationModel() + var newNode = new OrganizationModel() { Id = organization.Id, Name = organization.Name, RootId = rootId ?? organization.Id, Children = new List() - }); + }; + + if (SearchEventsModel.Organization.Id == organization.Id) + { + selectedItem = newNode; + } + + result.Add(newNode); } } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/InviteFriendsToEventDialog.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/InviteFriendsToEventDialog.razor index cde004a66..96c7d18a3 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/InviteFriendsToEventDialog.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/InviteFriendsToEventDialog.razor @@ -21,17 +21,20 @@ @foreach (var friend in friends) { - - - - - Friend - @($"{friend.StudentDetails.FirstName} {friend.StudentDetails.LastName}") - + @if (friend.StudentDetails != null) + { + + + + + Friend + @($"{friend.StudentDetails?.FirstName} {friend.StudentDetails?.LastName}") + + - - + + } } @@ -60,8 +63,10 @@ { foreach (var friend in friends) { + if (friend.StudentDetails == null) continue; + Console.WriteLine(friend.StudentDetails.ProfileImage); var result = await MediaFilesService.GetFileAsync(friend.StudentDetails.ProfileImage); - images[friend.FriendId] = result?.Base64Content ?? "images/user_default.png"; + images[friend.StudentDetails.Id] = result?.Base64Content ?? "images/user_default.png"; } } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventCreate.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventCreate.razor index 0cdca58ed..c7efbebd6 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventCreate.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventCreate.razor @@ -146,7 +146,8 @@ @if (publishInfo == 2) { - + - + - + - + - + - + - + @@ -67,10 +73,12 @@ - + - + - + - + - + - + - + @@ -108,7 +121,8 @@ @if (publishInfo == 2) { - + - + diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsOrganize.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsOrganize.razor index 83baa90d2..d73c2c6f1 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsOrganize.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsOrganize.razor @@ -16,6 +16,7 @@ @inject IEventsService EventsService @inject IIdentityService IdentityService @inject NavigationManager NavigationManager +@inject Blazored.LocalStorage.ILocalStorageService LocalStorage

Organize events

@@ -108,24 +109,14 @@ { organizerId = IdentityService.GetCurrentUserId(); searchOrganizerEventsModel.OrganizerId = organizerId; - - var tmp = await EventsService.SearchOrganizerEventsAsync(searchOrganizerEventsModel.OrganizerId, - searchOrganizerEventsModel.Name, searchOrganizerEventsModel.State, - searchOrganizerEventsModel.DateFrom.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), - searchOrganizerEventsModel.DateTo.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), - searchOrganizerEventsModel.Pageable); - if (tmp.Content != null) + + var searchOrganizerEventsCriteria = await LocalStorage.GetItemAsync("searchOrganizerEventsCriteria"); + if (searchOrganizerEventsCriteria != null) { - totalPages = tmp.Content.TotalPages; - totalElements = tmp.Content.TotalElements; - events = tmp.Content.Content; + searchOrganizerEventsModel = searchOrganizerEventsCriteria; } - else - { - totalPages = 0; - totalElements = 0; - events = new List(); - } + + await SearchOrganizerEvents(); } pageInitialized = true; @@ -152,6 +143,31 @@ }; } + private async Task SearchOrganizerEvents() + { + if (IdentityService.IsAuthenticated && IdentityService.GetCurrentUserRole() == "organizer") + { + var response = await EventsService.SearchOrganizerEventsAsync(searchOrganizerEventsModel.OrganizerId, + searchOrganizerEventsModel.Name, searchOrganizerEventsModel.State, + searchOrganizerEventsModel.DateFrom.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), + searchOrganizerEventsModel.DateTo.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), + searchOrganizerEventsModel.Pageable); + if (response.Content != null) + { + totalPages = response.Content.TotalPages; + totalElements = response.Content.TotalElements; + events = response.Content.Content; + } + else + { + totalPages = 0; + totalElements = 0; + events = new List(); + } + + await LocalStorage.SetItemAsync("searchOrganizerEventsCriteria", searchOrganizerEventsModel); + } + } private async void SelectedPageChanged(int pageNumber) { @@ -175,12 +191,13 @@ Width = "800px", Resizable = true, Draggable = true, AutoFocusFirstElement = false }); - await OnInitializedAsync(); + await SearchOrganizerEvents(); } private async Task ClearFilters() { searchOrganizerEventsModel = InitializeOrganizerSearchModel(); - await OnInitializedAsync(); + searchOrganizerEventsModel.OrganizerId = organizerId; + await SearchOrganizerEvents(); } } diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsSearch.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsSearch.razor index 887fc8e9f..101428815 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsSearch.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsSearch.razor @@ -22,7 +22,7 @@ @inject IStudentsService StudentsService @inject IIdentityService IdentityService @inject NavigationManager NavigationManager - +@inject Blazored.LocalStorage.ILocalStorageService LocalStorage