| | 1 | | @using Syki.Front.Features.Teacher.AddExamGradeNote |
| | 2 | |
|
| | 3 | | @namespace Syki.Front.Pages.Teacher |
| | 4 | |
|
| | 5 | | <MudContainer Class="mb-4 px-0"> |
| | 6 | | <MudDataGrid |
| | 7 | | T="TeacherClassStudentOut" |
| | 8 | | Class="pa-4" |
| | 9 | | Items="@_students" |
| | 10 | | QuickFilter="@_quickFilter" |
| | 11 | | Hover="true" |
| | 12 | | Dense="true" |
| | 13 | | Loading="@_loading" |
| | 14 | | RowsPerPage="100" |
| | 15 | | > |
| | 16 | | <ToolBarContent> |
| | 17 | | <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por nome" /> |
| | 18 | | </ToolBarContent> |
| | 19 | | <Columns> |
| | 20 | | <PropertyColumn Property="x => x.Name" Title="Nome" /> |
| | 21 | | <PropertyColumn Property="x => x.GetNote(ExamType.N1)" Title="N1" /> |
| | 22 | | <PropertyColumn Property="x => x.GetNote(ExamType.N2)" Title="N2" /> |
| | 23 | | <PropertyColumn Property="x => x.GetNote(ExamType.N3)" Title="N3" /> |
| | 24 | | <PropertyColumn Property="x => x.AverageNote.Format()" Title="Média" /> |
| | 25 | | <TemplateColumn CellClass="d-flex justify-end"> |
| | 26 | | <CellTemplate> |
| 0 | 27 | | <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Filled.StickyNote2" OnClick="@(() => AddNote |
| | 28 | | </CellTemplate> |
| | 29 | | </TemplateColumn> |
| | 30 | | </Columns> |
| | 31 | | <NoRecordsContent> |
| | 32 | | @(GetNotFoundMessage()) |
| | 33 | | </NoRecordsContent> |
| | 34 | | <PagerContent> |
| | 35 | | </PagerContent> |
| | 36 | | </MudDataGrid> |
| | 37 | | </MudContainer> |
| | 38 | |
|
| 0 | 39 | | <AddExamGradeNotesDialog @ref="@_dialog" AfterSubmit="@Load" /> |
| 0 | 40 | |
|
| 0 | 41 | | @inject GetTeacherClassClient GetTeacherClassClient |
| 0 | 42 | |
|
| 0 | 43 | | @code |
| 0 | 44 | | { |
| | 45 | | [Parameter] |
| 0 | 46 | | public Guid ClassId { get; set; } |
| | 47 | |
|
| | 48 | | private AddExamGradeNotesDialog _dialog; |
| | 49 | |
|
| | 50 | | private bool _loading; |
| | 51 | | private string _searchString; |
| 0 | 52 | | private TeacherClassOut _class = new(); |
| 0 | 53 | | private List<TeacherClassStudentOut> _students = []; |
| | 54 | |
|
| | 55 | | protected override async Task OnInitializedAsync() |
| | 56 | | { |
| 0 | 57 | | await Load(); |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | private async Task Load() |
| | 61 | | { |
| 0 | 62 | | _loading = true; |
| 0 | 63 | | _class = await GetTeacherClassClient.Get(ClassId); |
| 0 | 64 | | _students = _class.Students.OrderBy(x => x.Name).ToList(); |
| 0 | 65 | | _loading = false; |
| 0 | 66 | | } |
| | 67 | |
|
| | 68 | | private async Task AddNote(TeacherClassStudentOut item) |
| | 69 | | { |
| 0 | 70 | | await _dialog.Open(item); |
| 0 | 71 | | } |
| | 72 | |
|
| 0 | 73 | | private Func<TeacherClassStudentOut, bool> _quickFilter => x => _searchString.IsIn(x.Name); |
| | 74 | |
|
| | 75 | | private string GetNotFoundMessage() |
| | 76 | | { |
| 0 | 77 | | return (_searchString.IsEmpty()) ? "Não existem alunos matriculados ainda." : "Nenhum aluno encontrado."; |
| | 78 | | } |
| | 79 | | } |