| | | 1 | | @namespace Syki.Front.Pages.Academic |
| | | 2 | | |
| | | 3 | | @page "/academic/classes/{id:guid}" |
| | | 4 | | @attribute [Authorize(Roles = "Academic")] |
| | | 5 | | |
| | | 6 | | <SykiPageTitle Title="Turma" /> |
| | | 7 | | |
| | | 8 | | <MudContainer Class="my-4 px-4"> |
| | 0 | 9 | | @if (_loading) |
| | | 10 | | { |
| | | 11 | | <MudSkeleton Animation="Animation.Wave" /> |
| | | 12 | | } |
| | | 13 | | else |
| | | 14 | | { |
| | | 15 | | <MudGrid Class="align-center"> |
| | | 16 | | <MudItem xs="12" sm="9" md="9" lg="9"> |
| | | 17 | | <MudStack Row AlignItems="AlignItems.Center"> |
| | | 18 | | <MudIcon Icon="@Icons.Material.Filled.CenterFocusStrong" Class="mb-1" Size="Size.Large" /> |
| | 0 | 19 | | <MudText Typo="Typo.h5" Style="font-weight: bold">@_class.Discipline</MudText> |
| | | 20 | | </MudStack> |
| | | 21 | | </MudItem> |
| | | 22 | | <MudItem xs="12" sm="3" md="3" lg="3" Class="d-flex justify-end"> |
| | | 23 | | <MudTabs Elevation="0" Rounded Outlined TabPanelClass="px-6" @bind-ActivePanelIndex="@_index" MinimumTab |
| | | 24 | | <MudTabPanel Text="Aulas" ID='"panel_0"'></MudTabPanel> |
| | | 25 | | <MudTabPanel Text="Alunos" ID='"panel_1"'></MudTabPanel> |
| | | 26 | | </MudTabs> |
| | | 27 | | </MudItem> |
| | | 28 | | </MudGrid> |
| | | 29 | | } |
| | | 30 | | |
| | 0 | 31 | | @if (_index == 0) |
| | | 32 | | { |
| | | 33 | | <MudCard Class="my-4 px-2"> |
| | | 34 | | <MudCardContent> |
| | 0 | 35 | | @if (_loading) |
| | | 36 | | { |
| | | 37 | | <MudSkeleton Animation="Animation.Wave" /> |
| | | 38 | | } |
| | | 39 | | else |
| | | 40 | | { |
| | | 41 | | <MudGrid Justify="Justify.FlexStart" Spacing="1"> |
| | | 42 | | <MudItem xs="12" sm="6" md="6" lg="6"> |
| | | 43 | | <MudStack Spacing="1"> |
| | 0 | 44 | | <MudText><strong>Professor:</strong> @_class.Teacher</MudText> |
| | 0 | 45 | | <MudText><strong>Status:</strong> @_class.Status.GetDescription()</MudText> |
| | 0 | 46 | | <MudText><strong>Alunos:</strong> @_class.FillRatio</MudText> |
| | 0 | 47 | | <MudText><strong>Horário:</strong> @_class.SchedulesInline</MudText> |
| | | 48 | | </MudStack> |
| | | 49 | | </MudItem> |
| | | 50 | | <MudItem xs="12" sm="6" md="6" lg="6"> |
| | | 51 | | <MudStack Spacing="1"> |
| | 0 | 52 | | <MudText><strong>Período:</strong> @_class.Period</MudText> |
| | 0 | 53 | | <MudText><strong>Aulas Concluídas:</strong> @_class.Progress</MudText> |
| | 0 | 54 | | <MudText><strong>Carga Horária:</strong> @_class.Workload</MudText> |
| | | 55 | | <MudStack Row AlignItems="AlignItems.Center"> |
| | | 56 | | <MudText><strong>Frequência:</strong></MudText> |
| | 0 | 57 | | @if (_class.Lessons.Any(x => x.Status == ClassLessonStatus.Finalized)) |
| | | 58 | | { |
| | | 59 | | <MudProgressLinear Color="Color.Primary" Rounded Size="Size.Large" Value="@decim |
| | | 60 | | <MudText Typo="Typo.body1"> |
| | 0 | 61 | | <b>@_class.Frequency.Format()%</b> |
| | | 62 | | </MudText> |
| | | 63 | | </MudProgressLinear> |
| | | 64 | | } |
| | | 65 | | </MudStack> |
| | | 66 | | </MudStack> |
| | | 67 | | </MudItem> |
| | | 68 | | <MudItem> |
| | | 69 | | <MudStack Spacing="1"> |
| | | 70 | | </MudStack> |
| | | 71 | | </MudItem> |
| | | 72 | | </MudGrid> |
| | | 73 | | } |
| | | 74 | | </MudCardContent> |
| | | 75 | | </MudCard> |
| | | 76 | | |
| | | 77 | | <MudContainer Class="px-0 mb-4"> |
| | | 78 | | <MudTable |
| | | 79 | | Items="@GetLessons()" |
| | | 80 | | Class="pa-4" |
| | | 81 | | Dense |
| | | 82 | | Hover |
| | | 83 | | Loading="@_loading" |
| | | 84 | | Filter="@_quickFilter" |
| | | 85 | | RowsPerPage="10" |
| | | 86 | | > |
| | | 87 | | <ToolBarContent> |
| | | 88 | | <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por qualquer atributo" |
| | | 89 | | </ToolBarContent> |
| | | 90 | | <HeaderContent> |
| | | 91 | | <MudTh>Aula</MudTh> |
| | | 92 | | <MudTh>Data</MudTh> |
| | | 93 | | <MudTh>Horário</MudTh> |
| | | 94 | | <MudTh>Status</MudTh> |
| | | 95 | | <MudTh>Frequência</MudTh> |
| | | 96 | | </HeaderContent> |
| | | 97 | | <RowTemplate> |
| | 0 | 98 | | <MudTd DataLabel="Aula">@context.Number</MudTd> |
| | 0 | 99 | | <MudTd DataLabel="Data">@context.Date</MudTd> |
| | 0 | 100 | | <MudTd DataLabel="Horário">@context.Schedule</MudTd> |
| | 0 | 101 | | <MudTd DataLabel="Status">@context.Status.GetDescription()</MudTd> |
| | | 102 | | <MudTd DataLabel="Frequência"> |
| | 0 | 103 | | @if (context.Status == ClassLessonStatus.Finalized) |
| | | 104 | | { |
| | | 105 | | <MudProgressLinear Color="Color.Primary" Rounded Size="Size.Large" Value="@decimal.ToDouble( |
| | | 106 | | <MudText Typo="Typo.body1"> |
| | 0 | 107 | | <b>@context.Frequency.Format()%</b> |
| | | 108 | | </MudText> |
| | | 109 | | </MudProgressLinear> |
| | | 110 | | } |
| | | 111 | | </MudTd> |
| | | 112 | | </RowTemplate> |
| | | 113 | | <LoadingContent> |
| | 0 | 114 | | @if (_breakpoint == Breakpoint.Xs) |
| | | 115 | | { |
| | | 116 | | <MudProgressLinear Color="Color.Info" Indeterminate /> |
| | | 117 | | } |
| | | 118 | | </LoadingContent> |
| | | 119 | | <NoRecordsContent> |
| | 0 | 120 | | @(GetNotFoundMessage()) |
| | | 121 | | </NoRecordsContent> |
| | | 122 | | <PagerContent> |
| | | 123 | | <SykiTablePager /> |
| | | 124 | | </PagerContent> |
| | | 125 | | </MudTable> |
| | | 126 | | </MudContainer> |
| | | 127 | | } |
| | | 128 | | else |
| | | 129 | | { |
| | | 130 | | <MudContainer Class="px-0 my-4"> |
| | | 131 | | <MudTable |
| | | 132 | | Items="@_students" |
| | | 133 | | Class="pa-4" |
| | | 134 | | Hover |
| | | 135 | | Loading="@_loading" |
| | | 136 | | Dense |
| | | 137 | | RowsPerPage="10" |
| | | 138 | | Filter="@_quickFilterStudents" |
| | | 139 | | > |
| | | 140 | | <ToolBarContent> |
| | | 141 | | <SykiDataGridSearchTextField @bind-Value="@_searchStringStudents" Placeholder="Busque por nome" /> |
| | | 142 | | </ToolBarContent> |
| | | 143 | | <HeaderContent> |
| | | 144 | | <MudTh>Nome</MudTh> |
| | | 145 | | <MudTh>N1</MudTh> |
| | | 146 | | <MudTh>N2</MudTh> |
| | | 147 | | <MudTh>N3</MudTh> |
| | | 148 | | <MudTh>Média</MudTh> |
| | | 149 | | <MudTh>Frequência</MudTh> |
| | | 150 | | </HeaderContent> |
| | | 151 | | <RowTemplate> |
| | 0 | 152 | | <MudTd DataLabel="Nome">@context.Name</MudTd> |
| | 0 | 153 | | <MudTd DataLabel="N1">@context.GetNote(ClassNoteType.N1)</MudTd> |
| | 0 | 154 | | <MudTd DataLabel="N2">@context.GetNote(ClassNoteType.N2)</MudTd> |
| | 0 | 155 | | <MudTd DataLabel="N3">@context.GetNote(ClassNoteType.N3)</MudTd> |
| | 0 | 156 | | <MudTd DataLabel="Média">@context.AverageNote.Format()</MudTd> |
| | | 157 | | <MudTd DataLabel="Frequência"> |
| | 0 | 158 | | @if (ShowFrequencyColumn()) |
| | | 159 | | { |
| | | 160 | | <MudProgressLinear Color="Color.Primary" Rounded Size="Size.Large" Value="@decimal.ToDouble( |
| | | 161 | | <MudText Typo="Typo.body1"> |
| | 0 | 162 | | <b>@context.Frequency.Format()%</b> |
| | | 163 | | </MudText> |
| | | 164 | | </MudProgressLinear> |
| | | 165 | | } |
| | | 166 | | </MudTd> |
| | | 167 | | </RowTemplate> |
| | | 168 | | <NoRecordsContent> |
| | 0 | 169 | | @(GetStudentsNotFoundMessage()) |
| | | 170 | | </NoRecordsContent> |
| | | 171 | | <PagerContent> |
| | | 172 | | <SykiTablePager/> |
| | | 173 | | </PagerContent> |
| | | 174 | | </MudTable> |
| | | 175 | | </MudContainer> |
| | | 176 | | } |
| | | 177 | | </MudContainer> |
| | | 178 | | |
| | | 179 | | @inject GetAcademicClassClient GetAcademicClassClient |
| | | 180 | | @inject IBrowserViewportService BrowserViewportService |
| | | 181 | | |
| | | 182 | | @code |
| | | 183 | | { |
| | | 184 | | [Parameter] |
| | 0 | 185 | | public Guid Id { get; set; } |
| | | 186 | | |
| | | 187 | | private int _index; |
| | | 188 | | private bool _loading; |
| | | 189 | | private string _searchString; |
| | | 190 | | private string _searchStringStudents; |
| | 0 | 191 | | private GetAcademicClassOut _class = new(); |
| | 0 | 192 | | private List<AcademicClassStudentOut> _students = []; |
| | | 193 | | |
| | | 194 | | private Breakpoint _breakpoint; |
| | | 195 | | |
| | | 196 | | protected override async Task OnInitializedAsync() |
| | | 197 | | { |
| | 0 | 198 | | _breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync(); |
| | 0 | 199 | | await Load(); |
| | 0 | 200 | | } |
| | | 201 | | |
| | | 202 | | private bool ShowFrequencyColumn() |
| | | 203 | | { |
| | 0 | 204 | | return _class.Lessons.Any(x => x.Status == ClassLessonStatus.Finalized); |
| | | 205 | | } |
| | | 206 | | |
| | | 207 | | private async Task Load() |
| | | 208 | | { |
| | 0 | 209 | | _loading = true; |
| | 0 | 210 | | var response = await GetAcademicClassClient.Get(Id); |
| | 0 | 211 | | if (response.IsSuccess) |
| | | 212 | | { |
| | 0 | 213 | | _class = response.Success; |
| | 0 | 214 | | _students = _class.Students.OrderBy(x => x.Name).ToList(); |
| | | 215 | | } |
| | 0 | 216 | | _loading = false; |
| | 0 | 217 | | } |
| | | 218 | | |
| | | 219 | | private IEnumerable<ClassLessonOut> GetLessons() |
| | | 220 | | { |
| | 0 | 221 | | return _class.Lessons.OrderBy(x => x.Number).ToList(); |
| | | 222 | | } |
| | | 223 | | |
| | 0 | 224 | | private Func<ClassLessonOut, bool> _quickFilter => x => _searchString.IsIn(x.Date.ToShortDateString(), x.Schedule, x |
| | 0 | 225 | | private Func<AcademicClassStudentOut, bool> _quickFilterStudents => x => _searchStringStudents.IsIn(x.Name); |
| | | 226 | | |
| | | 227 | | private string GetNotFoundMessage() |
| | | 228 | | { |
| | 0 | 229 | | return (_searchString.IsEmpty()) ? "Não existem aulas ainda." : "Nenhuma aula encontrada."; |
| | | 230 | | } |
| | | 231 | | |
| | | 232 | | private string GetStudentsNotFoundMessage() |
| | | 233 | | { |
| | 0 | 234 | | return (_searchString.IsEmpty()) ? "Não existem alunos matriculados ainda." : "Nenhum aluno encontrado."; |
| | | 235 | | } |
| | | 236 | | } |