< Summary

Information
Class: Syki.Front.Features.Teacher.CreateLessonAttendance.ClassLessonsDialog
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Features/Teacher/CreateLessonAttendance/ClassLessonsDialog.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 84
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
get_OnRowClick()100%210%
.ctor()100%210%
Open()100%210%
Close()100%210%
HandleRowClick()100%210%

File(s)

/home/runner/work/syki/syki/Front/Features/Teacher/CreateLessonAttendance/ClassLessonsDialog.razor

#LineLine coverage
 1@namespace Syki.Front.Features.Teacher.CreateLessonAttendance
 2
 3<MudDialog @bind-Visible="@_visible" Options="@_options">
 4    <TitleContent>
 5        <MudText Typo="Typo.h6">
 6            <MudIcon Icon="@Icons.Material.Filled.Class" Class="mr-1 mb-n1" />
 7            Selecione uma aula
 8        </MudText>
 9    </TitleContent>
 10    <DialogContent>
 11        <MudTable
 12            T="LessonOut"
 13            Items="@_lessons"
 14            Class="mb-4"
 15            Breakpoint="Breakpoint.Sm"
 16            Dense="true"
 17            Hover="true"
 18            RowClass="cursor-pointer"
 19            OnRowClick="@HandleRowClick"
 20            RowsPerPage="100"
 21        >
 22            <HeaderContent>
 23                <MudTh>Aula</MudTh>
 24                <MudTh>Data</MudTh>
 25                <MudTh>Horário</MudTh>
 26                <MudTh>Status</MudTh>
 27                <MudTh>Frequência</MudTh>
 28            </HeaderContent>
 29            <RowTemplate>
 30                <MudTd DataLabel="Aula">@context.Number</MudTd>
 31                <MudTd DataLabel="Data">@context.Date</MudTd>
 32                <MudTd DataLabel="Horário">@context.Schedule</MudTd>
 33                <MudTd DataLabel="Status">@context.Status.GetDescription()</MudTd>
 34                <MudTd DataLabel="Frequência">
 035                    @if (context.Status == LessonStatus.Finalized)
 36                    {
 37                        <MudProgressLinear Color="Color.Primary" Rounded="true" Size="Size.Large" Value="@decimal.ToDoub
 38                            <MudText Typo="Typo.body1">
 39                                <b>@context.Frequency.Format()%</b>
 40                            </MudText>
 41                        </MudProgressLinear>
 42                    }
 43                </MudTd>
 44            </RowTemplate>
 45        </MudTable>
 46    </DialogContent>
 47</MudDialog>
 48
 49@inject IBrowserViewportService BrowserViewportService
 50
 51@code
 52{
 53    [Parameter]
 054    public EventCallback<Guid> OnRowClick { get; set; }
 55
 56    private bool _visible;
 057    private List<LessonOut> _lessons = [];
 58
 059    private readonly DialogOptions _options = new()
 060    {
 061        FullWidth = true,
 062        CloseButton = true,
 063        MaxWidth = MaxWidth.Medium,
 064    };
 65
 66    public async Task Open(List<LessonOut> lessons)
 67    {
 068        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 069        _options.FullScreen = breakpoint == Breakpoint.Xs;
 070        _lessons = lessons.Where(x => x.Date <= DateTime.Now.ToDateOnly()).ToList();
 071        _visible = true;
 072    }
 73
 74    private void Close()
 75    {
 076        _visible = false;
 077    }
 78
 79    private async Task HandleRowClick(TableRowClickEventArgs<LessonOut> row)
 80    {
 081        Close();
 082        await OnRowClick.InvokeAsync(row.Item.Id);
 083    }
 84}