SHA256
GuestLog - GuestDocument fixes & improvements:
- Use GuestDocument Details page to see details. - Added GuestDocument stays in details page. Other minor changes: - Updated validators to use ValueValidator base class. - Changed Snackbar settings to show them better. - Added Empty Debug page to test things. This page wont be updated in git, all test must be local-only.
This commit is contained in:
+7
-7
@@ -26,7 +26,7 @@
|
||||
}
|
||||
</MudSelect>
|
||||
<MudTextField @bind-Value="Model.DocumentNum" For="@(() => Model.DocumentNum)" Label="@LanguageLocale.dto_GuestDocument_DocumentNum"
|
||||
Immediate="true" Required ReadOnly="@ReadOnlyDocId" />
|
||||
Required ReadOnly="@ReadOnlyDocId" />
|
||||
</MudStack>
|
||||
|
||||
<MudStack Row style="@FieldMarginY">
|
||||
@@ -34,7 +34,7 @@
|
||||
Clearable OpenTo="OpenTo.Year" Editable />
|
||||
|
||||
<MudTextField @bind-Value="Model.SupportNum" For="@(() => Model.SupportNum)" Label="@LanguageLocale.dto_GuestDocument_SupportNum"
|
||||
Immediate="true" Required="@isSuportNumberRequired" Mask="@(new PatternMask("aaa000000"))"
|
||||
Required="@isSuportNumberRequired" Mask="@(new PatternMask("aaa000000"))"
|
||||
OnBlur="@(() => Model.SupportNum = Model.SupportNum?.ToUpper())" />
|
||||
</MudStack>
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
|
||||
<MudTextField @bind-Value="Model.Name" For="@(() => Model.Name)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_Name"
|
||||
Immediate="true" OnBlur="@(() => Model.Name = Model.Name?.ToUpper())" />
|
||||
OnBlur="@(() => Model.Name = Model.Name?.ToUpper())" />
|
||||
<MudTextField @bind-Value="Model.Surname" For="@(() => Model.Surname)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_Surname"
|
||||
Immediate="true" OnBlur="@(() => Model.Surname = Model.Surname?.ToUpper())" />
|
||||
OnBlur="@(() => Model.Surname = Model.Surname?.ToUpper())" />
|
||||
<MudTextField @bind-Value="Model.Surname2" For="@(() => Model.Surname2)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_Surname2"
|
||||
Immediate="true" OnBlur="@(() => Model.Surname2 = Model.Surname2?.ToUpper())" />
|
||||
OnBlur="@(() => Model.Surname2 = Model.Surname2?.ToUpper())" />
|
||||
|
||||
<MudStack Row style="@FieldMarginY">
|
||||
<MudDatePicker @bind-Date="Model.BirthDate" For="@(() => Model.BirthDate)" Label="@LanguageLocale.dto_GuestDocument_BirthDate"
|
||||
@@ -83,10 +83,10 @@
|
||||
<MudStack Row>
|
||||
<MudTextField @bind-Value="Model.PhoneNumber" For="@(() => Model.PhoneNumber)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_PhoneNumber"
|
||||
InputType="InputType.Telephone" Immediate="true" />
|
||||
InputType="InputType.Telephone" />
|
||||
<MudTextField @bind-Value="Model.EmailAddress" For="@(() => Model.EmailAddress)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_EmailAddress"
|
||||
InputType="InputType.Email" Immediate="true" />
|
||||
InputType="InputType.Email" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
@@ -0,0 +1,15 @@
|
||||
@page "/debug/empty"
|
||||
|
||||
|
||||
@inject ILogger<Empty> logger;
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IDialogService DialogService
|
||||
|
||||
<PageTitle>DEBUG - Empty</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3" GutterBottom="true" Class="mt-2">Empty Page for Debug</MudText>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -7,9 +7,7 @@
|
||||
@inject IDialogService DialogService
|
||||
@inject NavigationManager Navigation
|
||||
@inject IGuestDocumentService guestDocService
|
||||
|
||||
|
||||
@inject FluentValidation.IValidator<GuestDocIdDTO> docIdValidator;
|
||||
@inject IStayEntryService stayService
|
||||
|
||||
|
||||
<PageTitle>Somnia - Guest Docs - Details</PageTitle>
|
||||
@@ -17,8 +15,8 @@
|
||||
<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()">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Edit"
|
||||
OnClick="() => BtnEdit()" Disabled>
|
||||
@LanguageLocale.general_btnEdit
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||
@@ -29,7 +27,46 @@
|
||||
|
||||
@if (documentModel is not null)
|
||||
{
|
||||
<GuestDocForm @ref="_form" Model="documentModel" ReadOnly="true" />
|
||||
<MudTabs Elevation="3" Rounded="true" ApplyEffectsToContainer="true" TabPanelsClass="pa-4" KeepPanelsAlive="true"
|
||||
Centered>
|
||||
|
||||
<MudTabPanel Text="Details" Icon="@Icons.Material.Filled.Info">
|
||||
<GuestDocForm @ref="_form" Model="documentModel" ReadOnly="true" />
|
||||
</MudTabPanel>
|
||||
|
||||
<MudTabPanel Text="Stays" ToolTip="Guest stays" OnClick="LoadTabGuestStays" Icon="@Icons.Material.Filled.Bed">
|
||||
<MudText>Total Stays: @(guestStaysLoading ? "Loading..." : guestStayList.Count())</MudText>
|
||||
<MudTable Items="@guestStayList" Hover="true" Loading="@guestStaysLoading" Class="mt-2" Elevation="2">
|
||||
<HeaderContent>
|
||||
<MudTh>@LanguageLocale.dto_StayEntry_DateIn</MudTh>
|
||||
<MudTh>@LanguageLocale.dto_StayEntry_DateOut</MudTh>
|
||||
<MudTh>@LanguageLocale.dto_StayEntry_RoomCount</MudTh>
|
||||
<MudTh>@LanguageLocale.dto_StayEntry_RoomNumber</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_DateIn">
|
||||
@context.DateIn
|
||||
</MudTd>
|
||||
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_DateOut">
|
||||
@context.DateOut
|
||||
</MudTd>
|
||||
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_RoomCount">
|
||||
@context.RoomCount
|
||||
</MudTd>
|
||||
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_RoomNumber">
|
||||
@context.RoomNumber
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
<NoRecordsContent>
|
||||
<MudText>@LanguageLocale.general_noResults</MudText>
|
||||
</NoRecordsContent>
|
||||
<LoadingContent>
|
||||
<MudSkeleton Height="50px" Class="mx-4" />
|
||||
</LoadingContent>
|
||||
</MudTable>
|
||||
</MudTabPanel>
|
||||
|
||||
</MudTabs>
|
||||
}
|
||||
|
||||
@code {
|
||||
@@ -42,6 +79,10 @@
|
||||
GuestDocumentDTO? documentModel = null;
|
||||
|
||||
|
||||
IEnumerable<StayEntryDTO> guestStayList = [];
|
||||
bool guestStaysLoading = true;
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (docId is null)
|
||||
@@ -78,4 +119,22 @@
|
||||
{
|
||||
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
||||
}
|
||||
|
||||
private async Task LoadTabGuestStays()
|
||||
{
|
||||
//Only load when there is no data.
|
||||
if (guestStayList.Count() > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (documentModel is null || documentModel.DocumentType is null || documentModel.DocumentNum is null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
guestStaysLoading = true;
|
||||
guestStayList = await stayService.GetStaysWithGuest(documentModel.DocumentType, documentModel.DocumentNum);
|
||||
guestStaysLoading = false;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
<MudText Typo="Typo.h4" GutterBottom="true">@LanguageLocale.page_GuestDocList_pageTitle</MudText>
|
||||
<MudSpacer />
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||
StartIcon="@Icons.Material.Filled.Search" OnClick="() => SearchDataAsync()">
|
||||
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnSearchDataAsync()">
|
||||
@LanguageLocale.general_btnSearch
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||
@@ -26,31 +26,7 @@
|
||||
</MudStack>
|
||||
|
||||
<MudPaper Class="pa-4 my-4" Elevation="2" Height="100%">
|
||||
<MudForm Model="@docFilter">
|
||||
<MudStack Row Breakpoint="Breakpoint.LgAndDown" StretchItems="StretchItems.All">
|
||||
<MudStack Row style="margin-block: 0.2em;">
|
||||
<MudSelect @bind-Value="docFilter.DocumentType" For="@(() => docFilter.DocumentType)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_DocumentType">
|
||||
@foreach (string docType in dataListService.GetDataListByName(GuestConsts.DataList_DocumentTypes))
|
||||
{
|
||||
<MudSelectItem Value="docType">
|
||||
@dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, docType)
|
||||
</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
<MudTextField @bind-Value="docFilter.DocumentNumber" For="@(() => docFilter.DocumentNumber)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_DocumentNum" />
|
||||
</MudStack>
|
||||
<MudStack Row style="margin-block: 0.2em;">
|
||||
<MudTextField @bind-Value="docFilter.Name" For="@(() => docFilter.Name)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_Name"
|
||||
HelperText="@LanguageLocale.general_wildcardHelperText" HelperTextOnFocus="true" />
|
||||
<MudTextField @bind-Value="docFilter.Surname" For="@(() => docFilter.Surname)"
|
||||
Label="@LanguageLocale.dto_GuestDocument_Surname"
|
||||
HelperText="@LanguageLocale.general_wildcardHelperText" HelperTextOnFocus="true" />
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</MudForm>
|
||||
<GuestDocumentFilterForm @bind-Filter="docFilter" />
|
||||
</MudPaper>
|
||||
|
||||
<MudDataGrid @ref="_dataGrid" T="GuestDocumentDTO" Items="@guestDocList" Loading="@_dataLoading" ReadOnly="true"
|
||||
@@ -126,14 +102,6 @@
|
||||
|
||||
#region Data Loading
|
||||
|
||||
private async Task SearchDataAsync()
|
||||
{
|
||||
docFilter.Name = docFilter.Name?.ToUpper();
|
||||
docFilter.Surname = docFilter.Surname?.ToUpper();
|
||||
|
||||
await LoadDataAsync();
|
||||
}
|
||||
|
||||
private async Task LoadDataAsync(bool showMsg = true)
|
||||
{
|
||||
_dataLoading = true;
|
||||
@@ -152,23 +120,27 @@
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private async Task BtnSearchDataAsync()
|
||||
{
|
||||
docFilter.Name = docFilter.Name?.ToUpper();
|
||||
docFilter.Surname = docFilter.Surname?.ToUpper();
|
||||
|
||||
await LoadDataAsync();
|
||||
}
|
||||
|
||||
private async Task BtnConfigureColumnsClick(MouseEventArgs args)
|
||||
{
|
||||
_dataGrid.ShowColumnsPanel(args);
|
||||
}
|
||||
|
||||
|
||||
private async Task BtnViewDetails(GuestDocumentDTO item)
|
||||
{
|
||||
var parameters =
|
||||
new DialogParameters<GuestDocDetailsDialog> { { x => x.DocumentDTO, item } };
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = true,
|
||||
CloseOnEscapeKey = true,
|
||||
};
|
||||
GuestDocIdDTO idDto = GuestDocIdDTO.BuildFromDto(item) ?? throw new InvalidOperationException();
|
||||
|
||||
await DialogService.ShowAsync<GuestDocDetailsDialog>("GuestDoc Details", parameters, options);
|
||||
string itemId = GuestDocIdDTO.EncodeAsString(idDto);
|
||||
string uri = GuestConsts.Page_GuestDocs_Detail.Replace(GuestConsts.Page_GuestDocs_Detail_Param_DocId, itemId);
|
||||
Navigation.NavigateTo(uri);
|
||||
}
|
||||
|
||||
private async Task BtnDeleteItem(GuestDocumentDTO item)
|
||||
|
||||
Reference in New Issue
Block a user