< Summary

Information
Class: Syki.Front.Pages.Academic.AcademicEnrollmentPeriodsPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Academic/AcademicEnrollmentPeriodsPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 32
Coverable lines: 32
Total lines: 97
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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%
get__quickFilter()100%210%
OpenDialog()0%620%
OpenEditDialog()0%620%
GetNotFoundMessage()0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Academic/AcademicEnrollmentPeriodsPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Academic
 2
 3@page "/academic/enrollment-periods"
 4@attribute [Authorize(Roles = "Academic")]
 5
 6<SykiPageTitle Title="Matrículas" />
 7
 8<MudContainer Class="my-4 px-4">
 9    <SykiPageHeader Icon="@Icons.Material.Filled.Article" Title="Matrículas" ButtonText="Período de Matrícula" OnClick="
 10    <SykiPageAlert Text="Utilize os períodos de matrícula para organizar as informações durante o ano letivo."/>
 11    <MudContainer Class="px-0 mb-4">
 12        <MudDataGrid Class="pa-4" Items="@_periodos" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" Dense=
 13            <ToolBarContent>
 14                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por ano"/>
 15            </ToolBarContent>
 16            <Columns>
 17                <PropertyColumn Property="x => x.Id" Title="Id" />
 18                <PropertyColumn Property="x => x.StartAt" Title="Início" />
 19                <PropertyColumn Property="x => x.EndAt" Title="Fim" />
 20                <TemplateColumn CellClass="d-flex justify-end">
 21                    <CellTemplate>
 022                        <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Edit" OnClick="@(() => OpenEdit
 23                    </CellTemplate>
 24                </TemplateColumn>
 25            </Columns>
 26            <NoRecordsContent>
 27                @(GetNotFoundMessage())
 28            </NoRecordsContent>
 29            <PagerContent>
 30                <SykiDataGridPager T="@EnrollmentPeriodOut" />
 31            </PagerContent>
 32        </MudDataGrid>
 33    </MudContainer>
 34</MudContainer>
 35
 36@inject IDialogService DialogService
 37@inject GetEnrollmentPeriodsClient Client
 38@inject IBrowserViewportService BrowserViewportService
 39
 40@code
 41{
 42    private bool _loading;
 43    private string _searchString;
 044    private List<EnrollmentPeriodOut> _periodos = [];
 45
 46    protected override async Task OnInitializedAsync()
 47    {
 048        _loading = true;
 049        _periodos = await Client.Get();
 050        _loading = false;
 051    }
 52
 053    private Func<EnrollmentPeriodOut, bool> _quickFilter => x => _searchString.IsIn(x.Id);
 54
 55    private async Task OpenDialog()
 56    {
 057        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 058        var options = new DialogOptions {
 059            MaxWidth = MaxWidth.ExtraSmall,
 060            FullWidth = true,
 061            FullScreen = breakpoint == Breakpoint.Xs,
 062        };
 63
 064        var dialog = await DialogService.ShowAsync<CreateEnrollmentPeriodDialog>("", options);
 65
 066        var result = await dialog.Result;
 67
 068        if (result!.Canceled) return;
 69
 070        await OnInitializedAsync();
 071    }
 72
 73    private async Task OpenEditDialog(EnrollmentPeriodOut item)
 74    {
 075        var parameters = new DialogParameters<UpdateEnrollmentPeriodDialog>();
 076        parameters.Add(x => x.Period, item);
 77
 078        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 079        var options = new DialogOptions {
 080            MaxWidth = MaxWidth.ExtraSmall,
 081            FullWidth = true,
 082            FullScreen = breakpoint == Breakpoint.Xs,
 083        };
 084        var dialog = await DialogService.ShowAsync<UpdateEnrollmentPeriodDialog>("", parameters, options);
 85
 086        var result = await dialog.Result;
 87
 088        if (result!.Canceled) return;
 89
 090        await OnInitializedAsync();
 091    }
 92
 93    private string GetNotFoundMessage()
 94    {
 095        return (_searchString.IsEmpty()) ? "Não existem períodos de matrícula cadastrados ainda." : "Nenhum período de m
 96    }
 97}