| | | 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 Absolute="false"> |
| | | 9 | | <MudProgressCircular Color="Color.Info" Indeterminate Size="Size.Large" /> |
| | | 10 | | </MudOverlay> |
| | 0 | 11 | | <MudForm @ref="@_form"> |
| | 0 | 12 | | <MudCard Class="px-4 pt-0 pb-4"> |
| | 0 | 13 | | <MudImage Src="logo_512x512.png" Alt="Syki" Elevation="25" Class="rounded-lg mx-20 mt-10 mb-10"/> |
| | 0 | 14 | | @if (_saved) |
| | 0 | 15 | | { |
| | 0 | 16 | | <MudAlert NoIcon Class="mx-4 mb-4" Severity="Severity.Success" Variant="Variant.Text" ContentAlignment=" |
| | | 17 | | <MudText>Verifique seu email e utilize o link para definir sua senha de acesso.</MudText> |
| | | 18 | | </MudAlert> |
| | | 19 | | } |
| | | 20 | | else |
| | | 21 | | { |
| | | 22 | | <MudAlert NoIcon Class="mx-4" Severity="Severity.Info" Variant="Variant.Text" ContentAlignment="Horizont |
| | | 23 | | <MudText Align="Align.Center">Cadastre seu email para ter acesso ao sistema.</MudText> |
| | | 24 | | </MudAlert> |
| | | 25 | | <MudCardContent Class="px-0 mx-4 pt-8 pb-0"> |
| | | 26 | | <SykiTextField Label="Email" @bind-Value="@_email" /> |
| | | 27 | | </MudCardContent> |
| | | 28 | | <MudCardActions> |
| | | 29 | | <MudButton |
| | | 30 | | OnClick="@Submit" |
| | | 31 | | Size="Size.Large" |
| | | 32 | | Color="Color.Primary" |
| | | 33 | | Variant="Variant.Filled" |
| | | 34 | | Class="mx-auto mb-4 px-12 my-0" |
| | | 35 | | > |
| | | 36 | | Cadastrar |
| | | 37 | | </MudButton> |
| | | 38 | | </MudCardActions> |
| | | 39 | | } |
| | | 40 | | </MudCard> |
| | | 41 | | </MudForm> |
| | | 42 | | </MudContainer> |
| | | 43 | | |
| | | 44 | | @inject ISnackbar Snackbar |
| | | 45 | | @inject NavigationManager Nav |
| | | 46 | | @inject HealthClient HealthClient |
| | | 47 | | @inject CreatePendingUserRegisterClient CreatePendingUserRegisterClient |
| | | 48 | | |
| | | 49 | | @code |
| | | 50 | | { |
| | | 51 | | private bool _saved; |
| | | 52 | | private bool _loading; |
| | | 53 | | private MudForm _form; |
| | | 54 | | private string _email; |
| | | 55 | | |
| | | 56 | | protected override async Task OnInitializedAsync() |
| | | 57 | | { |
| | 0 | 58 | | await HealthClient.Get(); |
| | 0 | 59 | | } |
| | | 60 | | |
| | | 61 | | private async Task Submit() |
| | | 62 | | { |
| | 0 | 63 | | await _form.Validate(); |
| | 0 | 64 | | if (!_form.IsValid) return; |
| | | 65 | | |
| | 0 | 66 | | _loading = true; |
| | 0 | 67 | | var response = await CreatePendingUserRegisterClient.Create(_email); |
| | 0 | 68 | | if (response.IsSuccess) |
| | | 69 | | { |
| | 0 | 70 | | _saved = true; |
| | | 71 | | } |
| | | 72 | | else |
| | | 73 | | { |
| | 0 | 74 | | Snackbar.Add(response.Error.Message, Severity.Error); |
| | | 75 | | } |
| | 0 | 76 | | _loading = false; |
| | 0 | 77 | | } |
| | | 78 | | } |