| | 1 | | @namespace Syki.Front.Pages.Student |
| | 2 | |
|
| | 3 | | @page "/student/exam-grades" |
| | 4 | | @attribute [Authorize(Roles = "Student")] |
| | 5 | |
|
| | 6 | | <SykiPageTitle Title="Notas" /> |
| | 7 | |
|
| | 8 | | <MudContainer Class="my-4 px-4"> |
| | 9 | | <SykiPageHeader Icon="@Icons.Material.Filled.StickyNote2" Title="Notas" /> |
| | 10 | | <MudAlert Class="my-4 pl-6" NoIcon="true" Severity="Severity.Normal" Variant="Variant.Text" Elevation="1"> |
| | 11 | | <MudText>A nota mínima para ser aprovado é <b>7.00</b></MudText> |
| | 12 | | </MudAlert> |
| | 13 | | <MudContainer Class="px-0"> |
| | 14 | | <MudCard> |
| | 15 | | <MudCardContent Class="px-6"> |
| 0 | 16 | | @if (_loading) |
| | 17 | | { |
| | 18 | | <MudProgressLinear Color="Color.Info" Indeterminate="true" /> |
| | 19 | | } |
| | 20 | | else |
| | 21 | | { |
| | 22 | | <MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2"> |
| | 23 | | <MudProgressLinear Color="@GetAverageNoteColor(_student.AverageNote)" Max="10" Rounded="true" Si |
| | 24 | | <MudText Typo="Typo.body1"> |
| | 25 | | <b>@_student.AverageNote.Format()</b> |
| | 26 | | </MudText> |
| | 27 | | </MudProgressLinear> |
| | 28 | | <MudTooltip Text="Nota média das disciplinas finalizadas" Arrow="true" Placement="Placement.Bott |
| | 29 | | <MudIconButton Icon="@Icons.Material.Filled.Info" Size="Size.Small" /> |
| | 30 | | </MudTooltip> |
| | 31 | | </MudStack> |
| | 32 | | } |
| | 33 | | </MudCardContent> |
| | 34 | | </MudCard> |
| | 35 | | </MudContainer> |
| | 36 | |
|
| | 37 | | <MudContainer Class="px-0 my-4"> |
| | 38 | | <MudContainer Class="px-0 mb-4"> |
| | 39 | | <MudTable |
| | 40 | | T="StudentExamGradeOut" |
| | 41 | | Items="@_disciplines" |
| | 42 | | Breakpoint="Breakpoint.Sm" |
| | 43 | | Dense="true" |
| | 44 | | Class="pa-4" |
| | 45 | | Hover="true" |
| | 46 | | Filter="@_quickFilter" |
| | 47 | | Loading="@_loading" |
| | 48 | | RowsPerPage="100" |
| | 49 | | > |
| | 50 | | <ToolBarContent> |
| | 51 | | <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por nome ou status"/> |
| | 52 | | </ToolBarContent> |
| | 53 | | <HeaderContent> |
| | 54 | | <MudTh>Disciplina</MudTh> |
| | 55 | | <MudTh>Período</MudTh> |
| | 56 | | <MudTh>Status</MudTh> |
| | 57 | | <MudTh>N1</MudTh> |
| | 58 | | <MudTh>N2</MudTh> |
| | 59 | | <MudTh>N3</MudTh> |
| | 60 | | <MudTh>Média</MudTh> |
| | 61 | | </HeaderContent> |
| | 62 | | <RowTemplate> |
| | 63 | | <MudTd DataLabel="Disciplina">@context.Discipline</MudTd> |
| | 64 | | <MudTd DataLabel="Período">@context.Period</MudTd> |
| | 65 | | <MudTd DataLabel="Status">@context.StudentDisciplineStatus.GetDescription()</MudTd> |
| | 66 | | <MudTd DataLabel="N1">@context.GetNote(ExamType.N1)</MudTd> |
| | 67 | | <MudTd DataLabel="N2">@context.GetNote(ExamType.N2)</MudTd> |
| | 68 | | <MudTd DataLabel="N3">@context.GetNote(ExamType.N3)</MudTd> |
| | 69 | | <MudTd DataLabel="Média"> |
| | 70 | | <MudProgressLinear Color="@GetAverageNoteColor(context.AverageNote)" Max="10" Rounded="true" Siz |
| | 71 | | <MudText Typo="Typo.body1"> |
| | 72 | | <b>@context.AverageNote.Format()</b> |
| | 73 | | </MudText> |
| | 74 | | </MudProgressLinear> |
| | 75 | | </MudTd> |
| | 76 | | </RowTemplate> |
| | 77 | | <LoadingContent> |
| 0 | 78 | | @if (_breakpoint == Breakpoint.Xs) |
| | 79 | | { |
| | 80 | | <MudProgressLinear Color="Color.Info" Indeterminate="true"/> |
| | 81 | | } |
| | 82 | | </LoadingContent> |
| | 83 | | </MudTable> |
| | 84 | | </MudContainer> |
| | 85 | | </MudContainer> |
| | 86 | | </MudContainer> |
| | 87 | |
|
| | 88 | | @inject IBrowserViewportService BrowserViewportService |
| | 89 | | @inject GetStudentAverageNoteClient AverageNotesClient |
| | 90 | | @inject GetStudentExamGradesClient StudentExamGradesClient |
| | 91 | |
|
| | 92 | | @code |
| | 93 | | { |
| | 94 | | private bool _loading; |
| | 95 | | private string _searchString; |
| | 96 | | private Breakpoint _breakpoint; |
| 0 | 97 | | private GetStudentAverageNoteOut _student = new(); |
| 0 | 98 | | private List<StudentExamGradeOut> _disciplines = []; |
| | 99 | |
|
| 0 | 100 | | private Func<StudentExamGradeOut, bool> _quickFilter => x => _searchString.IsIn(x.Discipline, x.StudentDisciplineSta |
| | 101 | |
|
| | 102 | | protected override async Task OnInitializedAsync() |
| | 103 | | { |
| 0 | 104 | | _loading = true; |
| 0 | 105 | | _breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| 0 | 106 | | _disciplines = await StudentExamGradesClient.Get(); |
| 0 | 107 | | _student = await AverageNotesClient.Get(); |
| 0 | 108 | | _loading = false; |
| 0 | 109 | | } |
| | 110 | |
|
| | 111 | | private Color GetAverageNoteColor(decimal averageNote) |
| | 112 | | { |
| 0 | 113 | | return averageNote >= 7 ? Color.Tertiary : Color.Error; |
| | 114 | | } |
| | 115 | | } |