| | 1 | | @namespace Syki.Front.Features.Teacher.CreateLessonAttendance |
| | 2 | |
|
| | 3 | | <MudDialog @bind-Visible="@_visible" Options="@_options"> |
| | 4 | | <TitleContent> |
| | 5 | | <MudText Typo="Typo.h6"> |
| | 6 | | <MudIcon Icon="@Icons.Material.Filled.Class" Class="mr-1 mb-n1" /> |
| | 7 | | Selecione uma aula |
| | 8 | | </MudText> |
| | 9 | | </TitleContent> |
| | 10 | | <DialogContent> |
| | 11 | | <MudTable |
| | 12 | | T="LessonOut" |
| | 13 | | Items="@_lessons" |
| | 14 | | Class="mb-4" |
| | 15 | | Breakpoint="Breakpoint.Sm" |
| | 16 | | Dense="true" |
| | 17 | | Hover="true" |
| | 18 | | RowClass="cursor-pointer" |
| | 19 | | OnRowClick="@HandleRowClick" |
| | 20 | | RowsPerPage="100" |
| | 21 | | > |
| | 22 | | <HeaderContent> |
| | 23 | | <MudTh>Aula</MudTh> |
| | 24 | | <MudTh>Data</MudTh> |
| | 25 | | <MudTh>Horário</MudTh> |
| | 26 | | <MudTh>Status</MudTh> |
| | 27 | | <MudTh>Frequência</MudTh> |
| | 28 | | </HeaderContent> |
| | 29 | | <RowTemplate> |
| | 30 | | <MudTd DataLabel="Aula">@context.Number</MudTd> |
| | 31 | | <MudTd DataLabel="Data">@context.Date</MudTd> |
| | 32 | | <MudTd DataLabel="Horário">@context.Schedule</MudTd> |
| | 33 | | <MudTd DataLabel="Status">@context.Status.GetDescription()</MudTd> |
| | 34 | | <MudTd DataLabel="Frequência"> |
| 0 | 35 | | @if (context.Status == LessonStatus.Finalized) |
| | 36 | | { |
| | 37 | | <MudProgressLinear Color="Color.Primary" Rounded="true" Size="Size.Large" Value="@decimal.ToDoub |
| | 38 | | <MudText Typo="Typo.body1"> |
| | 39 | | <b>@context.Frequency.Format()%</b> |
| | 40 | | </MudText> |
| | 41 | | </MudProgressLinear> |
| | 42 | | } |
| | 43 | | </MudTd> |
| | 44 | | </RowTemplate> |
| | 45 | | </MudTable> |
| | 46 | | </DialogContent> |
| | 47 | | </MudDialog> |
| | 48 | |
|
| | 49 | | @inject IBrowserViewportService BrowserViewportService |
| | 50 | |
|
| | 51 | | @code |
| | 52 | | { |
| | 53 | | [Parameter] |
| 0 | 54 | | public EventCallback<Guid> OnRowClick { get; set; } |
| | 55 | |
|
| | 56 | | private bool _visible; |
| 0 | 57 | | private List<LessonOut> _lessons = []; |
| | 58 | |
|
| 0 | 59 | | private readonly DialogOptions _options = new() |
| 0 | 60 | | { |
| 0 | 61 | | FullWidth = true, |
| 0 | 62 | | CloseButton = true, |
| 0 | 63 | | MaxWidth = MaxWidth.Medium, |
| 0 | 64 | | }; |
| | 65 | |
|
| | 66 | | public async Task Open(List<LessonOut> lessons) |
| | 67 | | { |
| 0 | 68 | | var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| 0 | 69 | | _options.FullScreen = breakpoint == Breakpoint.Xs; |
| 0 | 70 | | _lessons = lessons.Where(x => x.Date <= DateTime.Now.ToDateOnly()).ToList(); |
| 0 | 71 | | _visible = true; |
| 0 | 72 | | } |
| | 73 | |
|
| | 74 | | private void Close() |
| | 75 | | { |
| 0 | 76 | | _visible = false; |
| 0 | 77 | | } |
| | 78 | |
|
| | 79 | | private async Task HandleRowClick(TableRowClickEventArgs<LessonOut> row) |
| | 80 | | { |
| 0 | 81 | | Close(); |
| 0 | 82 | | await OnRowClick.InvokeAsync(row.Item.Id); |
| 0 | 83 | | } |
| | 84 | | } |