< Summary

Information
Class: Syki.Front.Pages.Teacher.TeacherClassesPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Teacher/TeacherClassesPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 63
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%
OnInitializedAsync()100%210%
GoToClass(...)100%210%
get__quickFilter()100%210%
GetNotFoundMessage()0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Teacher/TeacherClassesPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Teacher
 2
 3@page "/teacher/classes"
 4@attribute [Authorize(Roles = "Teacher")]
 5
 6<SykiPageTitle Title="Turmas" />
 7
 8<MudContainer Class="my-4 px-4">
 9    <SykiPageHeader Icon="@Icons.Material.Filled.CenterFocusStrong" Title="Turmas" />
 10    <SykiPageAlert Text="Em uma mesma turma podem estudar alunos de diferentes cursos." />
 11    <MudContainer Class="px-0 mb-4">
 12        <MudDataGrid Class="pa-4" Items="@_classes" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" Dense="
 13            <ToolBarContent>
 14                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por qualquer atributo" />
 15            </ToolBarContent>
 16            <Columns>
 17                <PropertyColumn Property="x => x.Discipline" Title="Disciplina" />
 18                <PropertyColumn Property="x => x.Period" Title="Período" />
 19                <PropertyColumn Property="x => x.SchedulesInline" Title="Horário" />
 20                <TemplateColumn CellClass="d-flex justify-end">
 21                    <CellTemplate>
 022                        <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Filled.RemoveRedEye" OnClick="@(() => Go
 23                    </CellTemplate>
 24                </TemplateColumn>
 25            </Columns>
 26            <NoRecordsContent>
 27                @(GetNotFoundMessage())
 28            </NoRecordsContent>
 29            <PagerContent>
 30                <SykiDataGridPager T="TeacherClassesOut" />
 31            </PagerContent>
 32        </MudDataGrid>
 33    </MudContainer>
 34</MudContainer>
 35
 36@inject NavigationManager Nav
 37@inject GetTeacherClassesClient GetTeacherClassesClient
 38
 39@code
 40{
 41    private bool _loading;
 42    private string _searchString;
 043    private List<TeacherClassesOut> _classes = [];
 44
 45    protected override async Task OnInitializedAsync()
 46    {
 047        _loading = true;
 048        _classes = await GetTeacherClassesClient.Get();
 049        _loading = false;
 050    }
 51
 52    private void GoToClass(TeacherClassesOut item)
 53    {
 054        Nav.NavigateTo($"/teacher/classes/{item.Id}");
 055    }
 56
 057    private Func<TeacherClassesOut, bool> _quickFilter => x => _searchString.IsIn(x.Discipline, x.Period);
 58
 59    private string GetNotFoundMessage()
 60    {
 061        return _searchString.IsEmpty() ? "Não existem turmas cadastradas ainda." : "Nenhuma turma encontrada.";
 62    }
 63}