< Summary

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

File(s)

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

#LineLine coverage
 1@using Syki.Front.Features.Academic.CreateCourseCurriculum
 2
 3@namespace Syki.Front.Pages.Academic
 4
 5@page "/academic/course-curriculums"
 6@attribute [Authorize(Roles = "Academic")]
 7
 8<SykiPageTitle Title="Grades" />
 9
 10<MudContainer Class="my-4 px-4">
 11    <SykiPageHeader Icon="@Icons.Material.Filled.AccountTree" Title="Grades" ButtonText="Nova Grade" OnClick="@OpenDialo
 12    <SykiPageAlert Text="Um mesmo curso pode ter várias grades diferentes ao longo do tempo, com diferentes disciplinas.
 13    <MudContainer Class="px-0 mb-4">
 14        <MudDataGrid Class="pa-4" T="CourseCurriculumOut" Items="@_grades" QuickFilter="@_quickFilter" Hover="true" Load
 15            <ToolBarContent>
 16                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por curso ou grade" />
 17            </ToolBarContent>
 18            <Columns>
 19                <PropertyColumn Property="x => x.Name" Title="Nome" />
 20                <PropertyColumn Property="x => x.CourseName" Title="Curso" />
 21                <TemplateColumn CellClass="d-flex justify-end">
 22                    <CellTemplate>
 23                        <MudIconButton
 24                            Size="@Size.Small"
 25                            Icon="@Icons.Material.Filled.RemoveRedEye"
 026                            OnClick="@(() => OpenDisciplinesDialog(context.Item))"
 27                        />
 28                    </CellTemplate>
 29                </TemplateColumn>
 30            </Columns>
 31            <NoRecordsContent>
 32                @(GetNotFoundMessage())
 33            </NoRecordsContent>
 34            <PagerContent>
 35                <SykiDataGridPager T="CourseCurriculumOut" />
 36            </PagerContent>
 37        </MudDataGrid>
 38    </MudContainer>
 39</MudContainer>
 40
 41@inject IDialogService DialogService
 42@inject GetCourseCurriculumsClient Client
 43@inject IBrowserViewportService BrowserViewportService
 44
 45@code
 46{
 47    private bool _loading;
 48    private string _searchString;
 049    private List<CourseCurriculumOut> _grades = [];
 50
 51    protected override async Task OnInitializedAsync()
 52    {
 053        _loading = true;
 054        _grades = await Client.Get();
 055        _loading = false;
 056    }
 57
 58    private async Task OpenDisciplinesDialog(CourseCurriculumOut courseCurriculum)
 59    {
 060        var parameters = new DialogParameters<CourseCurriculumDisciplinesDialog>();
 061        parameters.Add(x => x.Disciplines, courseCurriculum.Disciplines);
 62
 063        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 064        var options = new DialogOptions {
 065            MaxWidth = MaxWidth.Medium,
 066            FullWidth = true,
 067            FullScreen = breakpoint == Breakpoint.Xs,
 068        };
 069        await DialogService.ShowAsync<CourseCurriculumDisciplinesDialog>(courseCurriculum.Name, parameters, options);
 070    }
 71
 072    private Func<CourseCurriculumOut, bool> _quickFilter => x => _searchString.IsIn(x.Name, x.CourseName);
 73
 74    private async Task OpenDialog()
 75    {
 076        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 077        var options = new DialogOptions {
 078            MaxWidth = MaxWidth.Medium,
 079            FullWidth = true,
 080            FullScreen = breakpoint.IsIn(Breakpoint.Xs, Breakpoint.Sm),
 081        };
 082        var dialog = await DialogService.ShowAsync<CreateCourseCurriculumDialog>("", options);
 83
 084        var result = await dialog.Result;
 85
 086        if (result!.Canceled) return;
 87
 088        await OnInitializedAsync();
 089    }
 90
 91    private string GetNotFoundMessage()
 92    {
 093        return (_searchString.IsEmpty()) ? "Não existem grades cadastradas ainda." : "Nenhuma grade encontrada.";
 94    }
 95}