| | | 1 | | @namespace Syki.Front.Features.Cross.ViewNotifications |
| | | 2 | | |
| | | 3 | | <MudDialog> |
| | | 4 | | <TitleContent> |
| | | 5 | | <SykiDialogTitle Icon="@Icons.Material.Filled.Notifications" Text="Notificações" /> |
| | | 6 | | </TitleContent> |
| | | 7 | | <DialogContent> |
| | | 8 | | <MudDataGrid |
| | | 9 | | Class="mb-4" |
| | | 10 | | Hover |
| | | 11 | | Loading="@_loading" |
| | | 12 | | T="@UserNotificationOut" |
| | | 13 | | RowClass="cursor-pointer" |
| | | 14 | | RowClick="@HandleRowClick" |
| | 0 | 15 | | Items="@_notifications.OrderByDescending(d => d.CreatedAt)" |
| | | 16 | | > |
| | | 17 | | <Columns> |
| | | 18 | | <PropertyColumn Property="x => x.Title" Title="Título" /> |
| | | 19 | | <PropertyColumn Property="x => x.Description" Title="Descrição" /> |
| | | 20 | | <PropertyColumn Property="x => x.CreatedAt.ToLocalTime()" Title="Criada em" /> |
| | | 21 | | </Columns> |
| | | 22 | | <NoRecordsContent> |
| | 0 | 23 | | @(GetNotFoundMessage()) |
| | | 24 | | </NoRecordsContent> |
| | | 25 | | </MudDataGrid> |
| | | 26 | | </DialogContent> |
| | | 27 | | </MudDialog> |
| | | 28 | | |
| | | 29 | | @inject NavigationManager Nav |
| | | 30 | | @inject GetUserNotificationsClient GetUserNotificationsClient |
| | | 31 | | |
| | | 32 | | @code |
| | | 33 | | { |
| | | 34 | | private bool _loading; |
| | 0 | 35 | | private List<UserNotificationOut> _notifications = []; |
| | | 36 | | |
| | | 37 | | protected override async Task OnInitializedAsync() |
| | | 38 | | { |
| | 0 | 39 | | _loading = true; |
| | 0 | 40 | | _notifications = await GetUserNotificationsClient.Get(); |
| | 0 | 41 | | _loading = false; |
| | 0 | 42 | | } |
| | | 43 | | |
| | | 44 | | private async Task HandleRowClick(DataGridRowClickEventArgs<UserNotificationOut> row) |
| | | 45 | | { |
| | 0 | 46 | | await Task.FromResult(0); |
| | 0 | 47 | | if (row.Item.Title == "Nota adicionada") |
| | | 48 | | { |
| | 0 | 49 | | Nav.NavigateTo("/student/notes"); |
| | | 50 | | } |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | private string GetNotFoundMessage() |
| | | 54 | | { |
| | 0 | 55 | | return "Não existem notificações cadastradas ainda."; |
| | | 56 | | } |
| | | 57 | | } |