diff --git a/src/Somnia.GuestLog/Components/Controls/SectionTitle.razor b/src/Somnia.GuestLog/Components/Controls/SectionTitle.razor
new file mode 100644
index 0000000..86f8993
--- /dev/null
+++ b/src/Somnia.GuestLog/Components/Controls/SectionTitle.razor
@@ -0,0 +1,12 @@
+
+ @Title
+
+
+
+@code {
+ [Parameter, EditorRequired]
+ public string Title { get; set; }
+
+ [Parameter]
+ public Typo TextTypo { get; set; } = Typo.subtitle1;
+}
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Components/Controls/UploadStatusSelectorDialog.razor b/src/Somnia.GuestLog/Components/Controls/UploadStatusSelectorDialog.razor
new file mode 100644
index 0000000..e823e6f
--- /dev/null
+++ b/src/Somnia.GuestLog/Components/Controls/UploadStatusSelectorDialog.razor
@@ -0,0 +1,62 @@
+@using Somnia.GuestLog.Enums.Models
+@using Somnia.GuestLog.Models.DTOs
+@using Somnia.GuestLog.Services
+
+@inject ILocalizerService Localizer;
+
+
+
+ @LanguageLocale.control_UploadStatusSelectorDialog_dialogTitle
+
+
+
+
+ @foreach (UploadStatus option in Enum.GetValues())
+ {
+
+ @Localizer.GetEnumValue(option)
+
+ }
+
+
+
+
+ @LanguageLocale.general_btnCancel
+
+
+ @LanguageLocale.general_btnSave
+
+
+
+
+@code {
+ [CascadingParameter]
+ private IMudDialogInstance MudDialog { get; set; } = null!;
+
+ [Parameter]
+ public UploadStatus CurrentStatus { get; set; } = new();
+
+ private UploadStatus? selectedStatus = null;
+
+ private string? selectErrorText = null;
+
+ private void Cancel() => MudDialog.Cancel();
+
+ private void Submit()
+ {
+ if (selectedStatus == null || selectedStatus == CurrentStatus)
+ {
+ selectErrorText = LanguageLocale.general_validation_invalidOption;
+ return;
+ }
+
+ //Clear errors.
+ selectErrorText = null;
+
+ DialogResult dialogResult = DialogResult.Ok(selectedStatus.Value);
+ MudDialog.Close(dialogResult);
+ }
+}
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Components/Forms/StayEntryFilterForm.razor b/src/Somnia.GuestLog/Components/Forms/StayEntryFilterForm.razor
index 751c328..2ae0c30 100644
--- a/src/Somnia.GuestLog/Components/Forms/StayEntryFilterForm.razor
+++ b/src/Somnia.GuestLog/Components/Forms/StayEntryFilterForm.razor
@@ -1,8 +1,10 @@
@using System.ComponentModel
+@using Somnia.GuestLog.Enums.Models
@using Somnia.GuestLog.Models.DTOs
@using Somnia.GuestLog.Services
@inject IDataListService dataListService;
+@inject ILocalizerService Localizer;
@@ -26,6 +28,15 @@
}
+
+ @foreach (UploadStatus option in Enum.GetValues())
+ {
+
+ @Localizer.GetEnumValue(option)
+
+ }
+
diff --git a/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor b/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor
index 10cecfa..7dee2fd 100644
--- a/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor
+++ b/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor
@@ -7,18 +7,16 @@
@inject IDataListService dataListService;
@inject IValidator stayValidator;
@inject IDialogService dialogService;
-@inject IUserMessageService userMessage
+@inject IUserMessageService userMessage;
+@inject ILocalizerService Localizer;
-
+
-
- @LanguageLocale.control_StayEntryForm_sectionDetails
-
-
+
-
+ @if (FormMode == FormMode.ReadOnly)
+ {
+
+
+
+
+
+ @if (Model.StayUploadStatusTime != null)
+ {
+
+ }
+
+
+ }
+
-
- @LanguageLocale.control_StayEntryForm_sectionGuests
-
-
+
@if (!ReadOnly)
{
@@ -124,6 +135,7 @@
private bool ReadOnly => FormMode == FormMode.ReadOnly;
+ private int stayDetailPanelSize => FormMode == FormMode.ReadOnly ? 9 : 12;
private MudForm _form = null!;
diff --git a/src/Somnia.GuestLog/Components/Pages/StayEntries/StayEntryDetail.razor b/src/Somnia.GuestLog/Components/Pages/StayEntries/StayEntryDetail.razor
index 6ccc86d..d676633 100644
--- a/src/Somnia.GuestLog/Components/Pages/StayEntries/StayEntryDetail.razor
+++ b/src/Somnia.GuestLog/Components/Pages/StayEntries/StayEntryDetail.razor
@@ -1,5 +1,6 @@
@attribute [Route($"{GuestConsts.Page_StayEntry_Detail}")]
+@using Somnia.GuestLog.Enums.Models
@using Somnia.GuestLog.Models.DTOs;
@using Somnia.GuestLog.Services;
@@ -8,12 +9,15 @@
@inject NavigationManager Navigation
@inject IGuestDocumentEntityService guestDocService
@inject IStayEntryEntityService stayService
+@inject ILocalizerService Localizer;
-Somnia - Guest Docs - Details
+Somnia - Stays - Details
- Stay Entry - "@StayId"
+
+ @LanguageLocale.page_StayEntryDetail_pageTitle - "@StayId"
+
@@ -28,7 +32,27 @@
@if (stayModel is not null)
{
- @CreateTimeString
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @LanguageLocale.page_StayEntryList_btnUpdateUploadStatus
+
+
+
+
}
@@ -42,21 +66,6 @@
StayEntryDTO? stayModel = null;
- private string? CreateTimeString
- {
- get
- {
- if (stayModel is null)
- {
- return null;
- }
-
- List textList = [];
- textList.Add($"Created at: {stayModel.CreateTime?.ToString() ?? "???"}");
- textList.Add($"Last Update Time: {stayModel.UpdateTime?.ToString() ?? "???"}");
- return string.Join("; ", textList);
- }
- }
protected override async Task OnInitializedAsync()
{
@@ -67,6 +76,11 @@
return;
} *@
+ await LoadModelAsync();
+ }
+
+ private async Task LoadModelAsync()
+ {
//Get model from db.
stayModel = await stayService.GetDtoByIdAsync(StayId, queryConfig: new(IncludeGuests: true));
if (stayModel is null)
@@ -77,6 +91,9 @@
}
}
+
+ #region Event Handlers
+
private void BtnEdit()
{
userMessage.ShowMessage("Not implemented yet!", MessageKind.Info);
@@ -88,4 +105,68 @@
Navigation.NavigateTo(uri);
}
+ private async Task BtnUpdateUploadStatus()
+ {
+ Debug.Assert(stayModel != null && stayModel.Id != null);
+
+ DialogOptions dialogOptions = new()
+ {
+ MaxWidth = MaxWidth.Medium,
+ FullWidth = true,
+ BackdropClick = true,
+ CloseOnEscapeKey = true,
+ };
+
+ bool? confirmed = await DialogService.ShowMessageBoxAsync(
+ title: LanguageLocale.general_confirmTitle,
+ message: LanguageLocale.general_confirmAdvanceOperationMsg,
+ yesText: LanguageLocale.general_btnContinue,
+ noText: LanguageLocale.general_btnCancel,
+ options: dialogOptions);
+
+ if (confirmed == null || confirmed.Value == false)
+ {
+ return;
+ }
+
+ var parameters =
+ new DialogParameters { { x => x.CurrentStatus, stayModel.StayUploadStatus } };
+ var dialog = await DialogService.ShowAsync(parameters: parameters, options: dialogOptions);
+ DialogResult? dialogRs = await dialog.Result;
+
+ if (dialogRs is null || dialogRs.Canceled)
+ {
+ return;
+ }
+
+ UploadStatus? newUploadStatus = await dialog.GetReturnValueAsync();
+
+ if (newUploadStatus is null)
+ {
+ userMessage.ShowMessage("Error! No upload status selected!", MessageKind.Error);
+ return;
+ }
+
+ var loadingDialog = await DialogService.ShowAsync();
+
+ //Update StayEntry
+ Result rs = await stayService.UpdateEntryUploadStatusAsync(stayModel.Id.Value, newUploadStatus.Value);
+ if (!rs.IsSuccess)
+ {
+ userMessage.ShowResultWithMessage(rs, "Error updating UploadStatus");
+ loadingDialog.Close();
+ return;
+ }
+
+ //Reload model.
+ await LoadModelAsync();
+ loadingDialog.Close();
+
+ string txtNewStatus = Localizer.GetEnumValue(newUploadStatus);
+ string successMsg = string.Format(LanguageLocale.page_StayEntryDetail_uploadStatusSuccessMsg, txtNewStatus);
+ userMessage.ShowMessage(successMsg, MessageKind.Success);
+ }
+
+ #endregion
+
}
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Models/DTOs/StayEntryFilterDTO.cs b/src/Somnia.GuestLog/Models/DTOs/StayEntryFilterDTO.cs
index 104639c..30b8b60 100644
--- a/src/Somnia.GuestLog/Models/DTOs/StayEntryFilterDTO.cs
+++ b/src/Somnia.GuestLog/Models/DTOs/StayEntryFilterDTO.cs
@@ -1,3 +1,5 @@
+using Somnia.GuestLog.Enums.Models;
+
namespace Somnia.GuestLog.Models.DTOs;
public class StayEntryFilterDTO
@@ -7,4 +9,6 @@ public class StayEntryFilterDTO
public string? RoomNumber { get; set; }
public string? PaymentMethod { get; set; }
+
+ public UploadStatus? StayUploadStatus { get; set; }
}
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx b/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx
index 319e609..2fa47cd 100644
--- a/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx
+++ b/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx
@@ -177,6 +177,7 @@
En Progreso...
Configurar Columnas
¡Eliminar no se puede deshacer!
+ Operación Avanzada. Sólo continuar si sabes lo que estás haciendo
¿Confirmar?
Eliminar
Crear
@@ -186,6 +187,7 @@
Buscar
Guaradar
Cancelar
+ Continuar
No hay resultados
Mostrar todos los elementos
Usa '%' como comodín
@@ -204,6 +206,7 @@
Código Postal
Formato invalido
+ Opción inválida
OK
@@ -254,6 +257,10 @@
Lista Estancias
Nueva Estancia
No se puede eliminar una estancia que ha sido enviada
+ Modificar Estado de envío
+
+ Estancia
+ Estado de envío modificado. Nuevo estado: '{0}'
Nueva Estancia
@@ -273,6 +280,7 @@
Detalles estancia
Lista de Huéspedes
+ Estado de envío
Añadir Huésped
Buscar dirección
@@ -284,4 +292,8 @@
Usar Huésped
Huéspedes sugeridos
+ Modificar estado de envío
+ Estado de envío actual
+ Nuevo estado de envío
+
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Resources/LanguageLocale.resx b/src/Somnia.GuestLog/Resources/LanguageLocale.resx
index 94b85ef..fccdd57 100644
--- a/src/Somnia.GuestLog/Resources/LanguageLocale.resx
+++ b/src/Somnia.GuestLog/Resources/LanguageLocale.resx
@@ -177,6 +177,7 @@
In Progress...
Configure Columns
Deleting can not be undone!
+ Advanced operation. Only proceed if you know what you are doing
Confirm?
Delete
Create
@@ -186,6 +187,7 @@
Search
Save
Cancel
+ Continue
No Results!
Show all elements
Use '%' as wildcard
@@ -204,6 +206,7 @@
Zip Code
Invalid Format
+ Invalid Option
OK
@@ -254,6 +257,10 @@
Entry List
New Stay
A StayEntry can't be deleted after it has been uploaded!
+ Update Upload Status
+
+ Stay Entry
+ Upload status updated. New Status: '{0}'
New Stay
@@ -273,6 +280,7 @@
Stay Details
Guest List
+ Upload Status
Add Guest
Search Address
@@ -284,4 +292,8 @@
Use Guest
Suggested Guests
+ Edit Upload Status
+ Current Upload Status
+ New Upload Status
+
\ No newline at end of file
diff --git a/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs b/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs
index 45e076a..50dc44a 100644
--- a/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs
+++ b/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs
@@ -198,6 +198,8 @@ public class StayEntryEntityService(
e => EF.Functions.Like(e.RoomNumber, $"%{filter.RoomNumber}%"));
query = query.WhereIf(!string.IsNullOrEmpty(filter.PaymentMethod),
e => e.PaymentMethod == filter.PaymentMethod);
+ query = query.WhereIf(filter.StayUploadStatus != null,
+ e => e.StayUploadStatus == filter.StayUploadStatus);
query = query.OrderByDescending(e => e.DateIn)
.ThenByDescending(e => e.UpdateTime);