From baa3c4d1a5ec4ad210bc824c5e683c1d9abea59c Mon Sep 17 00:00:00 2001 From: Amadeusz Nowak Date: Thu, 16 May 2024 23:21:02 +0200 Subject: [PATCH] (#57) add showing signed up and interested friends in event --- .../Admin/Dialogs/ManageStudentDialog.razor | 3 +- .../Dialogs/ParticipantDetailsDialog.razor | 150 ++++++++++++++++++ .../MiniSpace.Web/Pages/Events/Event.razor | 85 ++++++++-- 3 files changed, 223 insertions(+), 15 deletions(-) create mode 100644 MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/ParticipantDetailsDialog.razor diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/Dialogs/ManageStudentDialog.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/Dialogs/ManageStudentDialog.razor index 907395c3d..7050e4de6 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/Dialogs/ManageStudentDialog.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Admin/Dialogs/ManageStudentDialog.razor @@ -142,7 +142,7 @@ Date of birth - @(StudentDto.DateOfBirth.ToLocalTime().ToString(dateFormat)) + @(StudentDto.DateOfBirth.ToLocalTime().ToString(shortDateFormat)) @@ -172,6 +172,7 @@ public StudentDto StudentDto { get; set; } private const string dateFormat = "dd/MM/yyyy HH:mm"; + private const string shortDateFormat = "dd/MM/yyyy"; protected override async Task OnInitializedAsync() { diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/ParticipantDetailsDialog.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/ParticipantDetailsDialog.razor new file mode 100644 index 000000000..53f576ed1 --- /dev/null +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Dialogs/ParticipantDetailsDialog.razor @@ -0,0 +1,150 @@ +@page "/events/{EventId}/participants/{ParticipantDto.Id}/details" +@using MiniSpace.Web.Areas.Students +@using Radzen +@using MiniSpace.Web.DTO +@inject DialogService DialogService +@inject IIdentityService IdentityService +@inject IStudentsService StudentsService + +@if (dialogInitialized) +{ + + + + + + Identification + + + + + + + + + + + + + + + + + + + + + + + + + + Personal info + + + + + + + First name + @(studentDto.FirstName) + + + + Last name + @(studentDto.LastName) + + + + + + Email + @(studentDto.Email) + + + + Description + @(studentDto.Description) + + + + + + + + + + + + + + + + + Other info + + + + + + + Status + @(studentDto.State.Normalize()) + + + + Email notifications + @(studentDto.EmailNotifications) + + + + + + Date of birth + @(studentDto.DateOfBirth.ToLocalTime().ToString(shortDateFormat)) + + + + Created at + @(studentDto.CreatedAt.ToLocalTime().ToString(dateFormat)) + + + + + + + + + + + + + + + + + + +} + +@code { + [Parameter] + public string EventId { get; set; } + [Parameter] + public ParticipantDto ParticipantDto { get; set; } + + private StudentDto studentDto = new(); + private bool dialogInitialized = false; + + private const string dateFormat = "dd/MM/yyyy HH:mm"; + private const string shortDateFormat = "dd/MM/yyyy"; + + protected override async Task OnInitializedAsync() + { + studentDto = await StudentsService.GetStudentAsync(ParticipantDto.StudentId); + await base.OnInitializedAsync(); + dialogInitialized = true; + } +} diff --git a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Event.razor b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Event.razor index 0ee939dd3..d6eb49452 100644 --- a/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Event.razor +++ b/MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Event.razor @@ -160,8 +160,43 @@ @if (IdentityService.IsAuthenticated && !IsUserEventOrganizer(ev)) { + + + + + + + + + + + - + + + + + + + + + } @if (IdentityService.IsAuthenticated && IsUserEventOrganizer(ev)) @@ -169,19 +204,20 @@ + Data="@signedUpStudents" ColumnWidth="100px" LogicalFilterOperator="LogicalFilterOperator.Or"> - - - + @@ -190,13 +226,19 @@ + Data="@interestedStudents" ColumnWidth="100px" LogicalFilterOperator="LogicalFilterOperator.Or"> - - + + + + @@ -292,6 +334,21 @@ }); } + private async Task OpenParticipantDetailsDialog(ParticipantDto participantDto, string term) + { + await DialogService.OpenAsync($"Details of the {term}:", + new Dictionary() + { + { "EventId", EventId }, + { "ParticipantDto", participantDto } + }, + new DialogOptions() + { + Width = "700px", Height = "600px", Resizable = true, Draggable = true, + AutoFocusFirstElement = false + }); + } + private async void SignUpToEvent(EventDto eventDto) { await EventsService.SignUpToEventAsync(eventDto.Id, studentId); @@ -322,7 +379,7 @@ private async void RemoveEventParticipant(EventDto eventDto, ParticipantDto participant) { - await EventsService.RemoveEventParticipant(ev.Id, participant.StudentId); + await EventsService.RemoveEventParticipant(eventDto.Id, participant.StudentId); signedUpStudents.Remove(participant); await signedUpDataGrid.Reload(); }