@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 docIdValidator; Somnia - Guest Docs - Details Guest Document - "@docId" @LanguageLocale.general_btnEdit @LanguageLocale.general_btnReturn @if (documentModel is not null) { } @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); } }