< Summary

Information
Class: Syki.Front.Pages.Academic.AcademicPeriodsPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Academic/AcademicPeriodsPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 72
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%
GetNotFoundMessage()0%620%

File(s)

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

#LineLine coverage
 1@namespace Syki.Front.Pages.Academic
 2
 3@page "/academic/academic-periods"
 4@attribute [Authorize(Roles = "Academic")]
 5
 6<SykiPageTitle Title="Períodos" />
 7
 8<MudContainer Class="my-4 px-4">
 9    <SykiPageHeader Icon="@Icons.Material.Filled.CalendarMonth" Title="Períodos" ButtonText="Período Acadêmico" OnClick=
 10    <SykiPageAlert Text="Utilize os períodos acadêmicos para organizar as informações durante o ano letivo." />
 11    <MudContainer Class="px-0 mb-4">
 12        <MudDataGrid Class="pa-4" Items="@_periods" 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            </Columns>
 21            <NoRecordsContent>
 22                @(GetNotFoundMessage())
 23            </NoRecordsContent>
 24            <PagerContent>
 25                <SykiDataGridPager T="@AcademicPeriodOut" />
 26            </PagerContent>
 27        </MudDataGrid>
 28    </MudContainer>
 29</MudContainer>
 30
 31@inject IDialogService DialogService
 32@inject GetAcademicPeriodsClient Client
 33@inject IBrowserViewportService BrowserViewportService
 34
 35@code
 36{
 37    private bool _loading;
 38    private string _searchString;
 039    private List<AcademicPeriodOut> _periods = [];
 40
 41    protected override async Task OnInitializedAsync()
 42    {
 043        _loading = true;
 044        _periods = await Client.Get();
 045        _loading = false;
 046    }
 47
 048    private Func<AcademicPeriodOut, bool> _quickFilter => x => _searchString.IsIn(x.Id);
 49
 50    private async Task OpenDialog()
 51    {
 052        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 053        var options = new DialogOptions {
 054            MaxWidth = MaxWidth.ExtraSmall,
 055            FullWidth = true,
 056            FullScreen = breakpoint == Breakpoint.Xs,
 057        };
 58
 059        var dialog = await DialogService.ShowAsync<CreateAcademicPeriodDialog>("", options);
 60
 061        var result = await dialog.Result;
 62
 063        if (result!.Canceled) return;
 64
 065        await OnInitializedAsync();
 066    }
 67
 68    private string GetNotFoundMessage()
 69    {
 070        return (_searchString.IsEmpty()) ? "Não existem períodos acadêmicos cadastrados ainda." : "Nenhum período acadêm
 71    }
 72}