< Summary

Information
Class: Syki.Front.Pages.Cross.RegisterPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Cross/RegisterPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 106
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
OnInitializedAsync()100%210%
SkipUserRegister()100%210%
Submit()0%2040%

File(s)

/home/runner/work/syki/syki/Front/Pages/Cross/RegisterPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Cross
 2
 3@page "/register"
 4
 5<SykiPageTitle Title="Cadastro" />
 6
 7<MudContainer Class="mt-4 mb-8" MaxWidth="MaxWidth.ExtraSmall">
 8    <MudOverlay @bind-Visible="@_loading" LightBackground="true" Absolute="false">
 9        <MudProgressCircular Color="Color.Info" Indeterminate="true" Size="Size.Large" />
 10    </MudOverlay>
 011    <MudForm @ref="@_form">
 012        <MudCard Class="px-4 pt-0 pb-4">
 013            <MudImage Src="logo_512x512.png" Alt="Syki" Elevation="25" Class="rounded-lg mx-20 mt-10 mb-10"/>
 014            @if (_saved)
 015            {
 016                <MudAlert NoIcon="true" Class="mx-4 mb-4" Severity="Severity.Success" Variant="Variant.Text" ContentAlig
 17                    <MudText>Verifique seu email e utilize o link para definir sua senha de acesso.</MudText>
 18                </MudAlert>
 19            }
 20            else
 21            {
 22                <AuthorizeView Policy="@FrontPolicy.SkipUserRegister">
 23                    <MudButton
 24                        OnClick="@SkipUserRegister"
 25                        EndIcon="@Icons.Material.Filled.Login"
 26                        IconSize="Size.Medium"
 27                        Size="Size.Large"
 28                        Color="Color.Tertiary"
 29                        Variant="Variant.Filled"
 30                        Class="mx-auto mb-4 px-12 my-0"
 31                    >
 32                        Testar sem cadastro
 33                    </MudButton>
 34                    <MudStack Row="true" Spacing="0" AlignItems="AlignItems.Center" Justify="Justify.Center">
 35                        <MudDivider DividerType="DividerType.FullWidth" Class="mt-2 mb-6" Style="width: 40%" />
 36                        <MudIcon Icon="@Icons.Material.Filled.TripOrigin" Size="Size.Large" Class="mb-4" />
 37                        <MudDivider DividerType="DividerType.FullWidth" Class="mt-2 mb-6" Style="width: 40%" />
 38                    </MudStack>
 39                </AuthorizeView>
 40
 41                <MudAlert NoIcon="true" Class="mx-4" Severity="Severity.Info" Variant="Variant.Text" ContentAlignment="H
 42                    <MudText Align="Align.Center">Cadastre seu email para ter acesso ao sistema.</MudText>
 43                </MudAlert>
 44                <MudCardContent Class="px-0 mx-4 pt-8 pb-0">
 45                    <SykiTextField Label="Email" @bind-Value="@_email" />
 46                </MudCardContent>
 47                <MudCardActions>
 48                    <MudButton
 49                        OnClick="@Submit"
 50                        Size="Size.Large"
 51                        Color="Color.Primary"
 52                        Variant="Variant.Filled"
 53                        Class="mx-auto mb-4 px-12 my-0"
 54                    >
 55                        Cadastrar
 56                    </MudButton>
 57                </MudCardActions>
 58            }
 59        </MudCard>
 60    </MudForm>
 61</MudContainer>
 62
 63@inject ISnackbar Snackbar
 64@inject NavigationManager Nav
 65@inject HealthClient HealthClient
 66@inject SkipUserRegisterClient SkipUserRegisterClient
 67@inject CreatePendingUserRegisterClient CreatePendingUserRegisterClient
 68
 69@code
 70{
 71    private bool _saved;
 72    private bool _loading;
 73    private MudForm _form;
 74    private string _email;
 75
 76    protected override async Task OnInitializedAsync()
 77    {
 078        await HealthClient.Get();
 079    }
 80
 81    private async Task SkipUserRegister()
 82    {
 083        _loading = true;
 084        await SkipUserRegisterClient.Skip();
 085        Nav.NavigateTo("/");
 086        _loading = false;
 087    }
 88
 89    private async Task Submit()
 90    {
 091        await _form.Validate();
 092        if (!_form.IsValid) return;
 93
 094        _loading = true;
 095        var response = await CreatePendingUserRegisterClient.Create(_email);
 096        if (response.IsSuccess())
 97        {
 098            _saved = true;
 99        }
 100        else
 101        {
 0102            Snackbar.Add(response.GetError().Message, Severity.Error);
 103        }
 0104        _loading = false;
 0105    }
 106}