97 lines
3.5 KiB
Plaintext
97 lines
3.5 KiB
Plaintext
@page "/register"
|
|
@using System.ComponentModel.DataAnnotations
|
|
@using Entities.Contracts
|
|
|
|
@inject ISnackbar Snackbar
|
|
|
|
|
|
<MudText Typo="Typo.h2"> Create Account </MudText>
|
|
|
|
<EditForm Model="@_userForRegistration" OnValidSubmit="Register" FormName="RegistrationForm">
|
|
<DataAnnotationsValidator />
|
|
<MudGrid>
|
|
<MudItem xs="12" sm="7">
|
|
<MudCard>
|
|
<MudCardContent>
|
|
<MudTextField Label="Name" HelperText="Max. 8 characters"
|
|
@bind-Value="_userForRegistration.Name" For="@(() => _userForRegistration.Email)" />
|
|
<MudTextField Label="Email" Class="mt-3"
|
|
@bind-Value="_userForRegistration.Email" For="@(() => _userForRegistration.Email)" />
|
|
<MudTextField Label="Password" HelperText="Choose a strong password" Class="mt-3"
|
|
@bind-Value="_userForRegistration.Password" For="@(() => _userForRegistration.Password)" InputType="InputType.Password" />
|
|
<MudTextField Label="Password" HelperText="Repeat the password" Class="mt-3"
|
|
@bind-Value="_userForRegistration.ConfirmPassword" For="@(() => _userForRegistration.ConfirmPassword)" InputType="InputType.Password" />
|
|
<MudRadioGroup T="UserRoles" Label="Roles" @bind-Value="_userForRegistration.Roles">
|
|
@foreach (UserRoles item in Enum.GetValues(typeof(UserRoles)))
|
|
{
|
|
if (item != UserRoles.Administrator)
|
|
{
|
|
<MudRadio Value="@item">@item.ToString()</MudRadio>
|
|
}
|
|
}
|
|
</MudRadioGroup>
|
|
<MudStack Row="true">
|
|
|
|
<MudTextField Label="Class"
|
|
HelperText="Enter a class number between 1 and 14."
|
|
Class="mt-3"
|
|
@bind-Value="_userForRegistration.Class"
|
|
For="@(() => _userForRegistration.Class)"
|
|
InputType="InputType.Number"
|
|
Required="true"
|
|
RequiredError="Class is required." />
|
|
|
|
<MudTextField Label="Grade"
|
|
HelperText="Enter a grade number between 1 and 6."
|
|
Class="mt-3"
|
|
@bind-Value="_userForRegistration.Grade"
|
|
For="@(() => _userForRegistration.Grade)"
|
|
InputType="InputType.Number"
|
|
Required="true"
|
|
RequiredError="Grade is required." />
|
|
</MudStack>
|
|
|
|
<MudTextField Label="Phone Number"
|
|
HelperText="Enter your phone number (optional, 7-20 digits)."
|
|
Class="mt-3"
|
|
@bind-Value="_userForRegistration.PhoneNumber"
|
|
For="@(() => _userForRegistration.PhoneNumber)"
|
|
InputType="InputType.Telephone" /> <MudTextField Label="Home Address"
|
|
HelperText="Enter your home address (optional, max 200 characters)."
|
|
Class="mt-3"
|
|
@bind-Value="_userForRegistration.HomeAddress"
|
|
For="@(() => _userForRegistration.HomeAddress)"
|
|
Lines="3" />
|
|
</MudCardContent>
|
|
<MudCardActions>
|
|
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary" Class="ml-auto">Register</MudButton>
|
|
</MudCardActions>
|
|
</MudCard>
|
|
|
|
</MudItem>
|
|
<MudItem xs="12" sm="5">
|
|
<MudPaper Class="pa-4 mud-height-full">
|
|
<MudText Typo="Typo.subtitle2">Validation Summary</MudText>
|
|
@if (success)
|
|
{
|
|
<MudText Color="Color.Success">Success</MudText>
|
|
}
|
|
else
|
|
{
|
|
<MudText Color="@Color.Error">
|
|
<ValidationSummary />
|
|
</MudText>
|
|
}
|
|
</MudPaper>
|
|
</MudItem>
|
|
<MudItem xs="12">
|
|
<MudText Typo="Typo.body2" Align="Align.Center">
|
|
Fill out the form correctly to see the success message.
|
|
</MudText>
|
|
</MudItem>
|
|
</MudGrid>
|
|
|
|
</EditForm>
|
|
|
|
|