| | 1 | | @namespace Syki.Front.Features.Teacher.CreateLessonAttendance |
| | 2 | |
|
| | 3 | | <MudDialog> |
| | 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="ClassLessonOut" |
| | 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> |
| 0 | 30 | | <MudTd DataLabel="Aula">@context.Number</MudTd> |
| 0 | 31 | | <MudTd DataLabel="Data">@context.Date</MudTd> |
| 0 | 32 | | <MudTd DataLabel="Horário">@context.Schedule</MudTd> |
| 0 | 33 | | <MudTd DataLabel="Status">@context.Status.GetDescription()</MudTd> |
| | 34 | | <MudTd DataLabel="Frequência"> |
| 0 | 35 | | @if (context.Status == ClassLessonStatus.Finalized) |
| | 36 | | { |
| | 37 | | <MudProgressLinear Color="Color.Primary" Rounded="true" Size="Size.Large" Value="@decimal.ToDoub |
| | 38 | | <MudText Typo="Typo.body1"> |
| 0 | 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 | | [CascadingParameter] |
| 0 | 54 | | IMudDialogInstance MudDialog { get; set; } |
| | 55 | |
|
| | 56 | | [Parameter] |
| 0 | 57 | | public EventCallback<Guid> OnRowClick { get; set; } |
| | 58 | |
|
| | 59 | | [Parameter] |
| 0 | 60 | | public List<ClassLessonOut> Lessons { get; set; } = []; |
| | 61 | |
|
| | 62 | | protected override async Task OnInitializedAsync() |
| | 63 | | { |
| 0 | 64 | | await base.OnInitializedAsync(); |
| | 65 | |
|
| 0 | 66 | | var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| 0 | 67 | | var options = MudDialog.Options with |
| 0 | 68 | | { |
| 0 | 69 | | FullWidth = true, |
| 0 | 70 | | CloseButton = true, |
| 0 | 71 | | MaxWidth = MaxWidth.Medium, |
| 0 | 72 | | FullScreen = breakpoint == Breakpoint.Xs |
| 0 | 73 | | }; |
| 0 | 74 | | await MudDialog.SetOptionsAsync(options); |
| | 75 | |
|
| 0 | 76 | | Lessons = Lessons.Where(x => x.Date <= DateTime.UtcNow.ToDateOnly()).ToList(); |
| 0 | 77 | | } |
| | 78 | |
|
| | 79 | | private void Close() |
| | 80 | | { |
| 0 | 81 | | MudDialog.Cancel(); |
| 0 | 82 | | } |
| | 83 | |
|
| | 84 | | private async Task HandleRowClick(TableRowClickEventArgs<ClassLessonOut> row) |
| | 85 | | { |
| 0 | 86 | | Close(); |
| 0 | 87 | | await OnRowClick.InvokeAsync(row.Item.Id); |
| 0 | 88 | | } |
| | 89 | | } |