SHA256
- Added DocumentNumber validations. - Added new page to see GuestDocument details.
81 lines
2.3 KiB
Plaintext
81 lines
2.3 KiB
Plaintext
@attribute [Route($"{GuestConsts.Page_GuestDocs_Detail}")]
|
|
|
|
@using Somnia.GuestLog.Models.DTOs;
|
|
@using Somnia.GuestLog.Services;
|
|
|
|
@inject ISnackbar Snackbar
|
|
@inject IDialogService DialogService
|
|
@inject NavigationManager Navigation
|
|
@inject IGuestDocumentService guestDocService
|
|
|
|
|
|
@inject FluentValidation.IValidator<GuestDocIdDTO> docIdValidator;
|
|
|
|
|
|
<PageTitle>Somnia - Guest Docs - Details</PageTitle>
|
|
|
|
<MudStack Row="true" Class="my-4">
|
|
<MudText Typo="Typo.h4" GutterBottom="true">Guest Document - "@docId"</MudText>
|
|
<MudSpacer />
|
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
|
OnClick="() => BtnEdit()">
|
|
@LanguageLocale.general_btnEdit
|
|
</MudButton>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
|
@LanguageLocale.general_btnReturn
|
|
</MudButton>
|
|
</MudStack>
|
|
|
|
@if (documentModel is not null)
|
|
{
|
|
<GuestDocForm @ref="_form" Model="documentModel" ReadOnly="true" />
|
|
}
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public string? docId { get; set; }
|
|
|
|
GuestDocForm _form = null!;
|
|
|
|
GuestDocumentDTO? documentModel = null;
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (docId is null)
|
|
{
|
|
Snackbar.Add("No GuestDocument provided!!", Severity.Error);
|
|
Navigation.NotFound();
|
|
return;
|
|
}
|
|
|
|
GuestDocIdDTO? docIdModel = GuestDocIdDTO.DecodeFromString(docId);
|
|
if (docIdModel is null)
|
|
{
|
|
Snackbar.Add($"Provided GuestDocId can't be decoded: '{docId}'", Severity.Error);
|
|
Navigation.NotFound();
|
|
return;
|
|
}
|
|
|
|
//Get model from db.
|
|
documentModel = await guestDocService.GetDtoByIdAsync(docIdModel.DocumentType, docIdModel.DocumentNum);
|
|
if (documentModel is null)
|
|
{
|
|
Snackbar.Add($"GuestDocument not found with ID: '{docId}'", Severity.Error);
|
|
Navigation.NotFound();
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void BtnEdit()
|
|
{
|
|
Snackbar.Add("Not implemented yet!", Severity.Info);
|
|
}
|
|
|
|
private void BtnReturn()
|
|
{
|
|
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
|
}
|
|
} |