< Summary

Information
Class: Syki.Front.Pages.Academic.AcademicCourseOfferingsPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Academic/AcademicCourseOfferingsPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 76
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/AcademicCourseOfferingsPage.razor

#LineLine coverage
 1@using Syki.Front.Features.Academic.CreateCourseOffering
 2
 3@namespace Syki.Front.Pages.Academic
 4
 5@page "/academic/course-offerings"
 6@attribute [Authorize(Roles = "Academic")]
 7
 8<SykiPageTitle Title="Ofertas" />
 9
 10<MudContainer Class="my-4 px-4">
 11    <SykiPageHeader Icon="@Icons.Material.Filled.PlaylistAddCheck" Title="Ofertas" ButtonText="Nova Oferta" OnClick="@Op
 12    <SykiPageAlert Text="Uma oferta de curso pode acontecer a cada período, com variações de campus, turno e grade." />
 13    <MudContainer Class="px-0 mb-4">
 14        <MudDataGrid Class="pa-4" Items="@_ofertas" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" Dense="
 15            <ToolBarContent>
 16                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por qualquer atributo" />
 17            </ToolBarContent>
 18            <Columns>
 19                <PropertyColumn Property="x => x.Campus" Title="Campus" />
 20                <PropertyColumn Property="x => x.Period" Title="Período" />
 21                <PropertyColumn Property="x => x.Shift.GetDescription()" Title="Turno" />
 22                <PropertyColumn Property="x => x.Course" Title="Curso" />
 23                <PropertyColumn Property="x => x.CourseCurriculum" Title="Grade" />
 24            </Columns>
 25            <NoRecordsContent>
 26                @(GetNotFoundMessage())
 27            </NoRecordsContent>
 28            <PagerContent>
 29                <SykiDataGridPager T="CourseOfferingOut" />
 30            </PagerContent>
 31        </MudDataGrid>
 32    </MudContainer>
 33</MudContainer>
 34
 35@inject IDialogService DialogService
 36@inject GetCourseOfferingsClient GetCourseOfferingsClient
 37@inject IBrowserViewportService BrowserViewportService
 38
 39@code
 40{
 41    private bool _loading;
 42    private string _searchString;
 043    private List<CourseOfferingOut> _ofertas = [];
 44
 45    protected override async Task OnInitializedAsync()
 46    {
 047        _loading = true;
 048        _ofertas = await GetCourseOfferingsClient.Get();
 049        _loading = false;
 050    }
 51
 052    private Func<CourseOfferingOut, bool> _quickFilter => x =>
 053        _searchString.IsIn(x.Campus, x.Period, x.Shift.GetDescription(), x.Course, x.CourseCurriculum);
 54
 55    private async Task OpenDialog()
 56    {
 057        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 058        var options = new DialogOptions {
 059            MaxWidth = MaxWidth.Small,
 060            FullWidth = true,
 061            FullScreen = breakpoint == Breakpoint.Xs,
 062        };
 063        var dialog = await DialogService.ShowAsync<CreateCourseOfferingDialog>("", options);
 64
 065        var result = await dialog.Result;
 66
 067        if (result!.Canceled) return;
 68
 069        await OnInitializedAsync();
 070    }
 71
 72    private string GetNotFoundMessage()
 73    {
 074        return (_searchString.IsEmpty()) ? "Não existem ofertas cadastradas ainda." : "Nenhuma oferta encontrada.";
 75    }
 76}