diff --git a/SteUp.Shared/Components/Pages/IspezionePage.razor b/SteUp.Shared/Components/Pages/IspezionePage.razor index 90457cd..ab72537 100644 --- a/SteUp.Shared/Components/Pages/IspezionePage.razor +++ b/SteUp.Shared/Components/Pages/IspezionePage.razor @@ -35,25 +35,28 @@ @($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}") -
- @if (NetworkService.IsNetworkAvailable()) - { - + @if (SteupDataService.InspectionPageState.Ispezione.Stato != StatusEnum.Completata) + { +
+ @if (NetworkService.IsNetworkAvailable()) + { + - - } - else - { - - } -
+ + } + else + { + + } +
+ } @@ -61,6 +64,7 @@ { } diff --git a/SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor b/SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor index d657cf8..b4a6c2a 100644 --- a/SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor +++ b/SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor @@ -27,21 +27,34 @@
- @if (NetworkService.IsNetworkAvailable()) + @if (Stato != StatusEnum.Completata) { - - - + if (NetworkService.IsNetworkAvailable()) + { + + + + } + else + { + + Modifica + + + Cancella + + } } else { - - Modifica - - - Cancella + + Visualizza }
@@ -55,6 +68,7 @@ @code{ [Parameter] public string CodMdep { get; set; } = string.Empty; [Parameter] public DateTime Data { get; set; } + [Parameter] public StatusEnum Stato { get; set; } [Parameter] public required Scheda Scheda { get; set; } [Parameter] public EventCallback OnSchedaModified { get; set; } [Parameter] public EventCallback OnSchedaDeleted { get; set; } @@ -72,7 +86,7 @@ private async Task DeleteScheda() { var result = await _messageBox.ShowAsync(); - + if (result is true) { VisibleOverlay = true; @@ -80,15 +94,18 @@ if (Scheda.ActivityId != null) await IntegrySteupService.DeleteScheda(Scheda.ActivityId); - + var deleteScheda = await IspezioniService.DeleteSchedaAsync(Scheda.Id); if (deleteScheda) await OnSchedaDeleted.InvokeAsync(Scheda); - + VisibleOverlay = false; StateHasChanged(); } } + private void ViewScheda() => + _ = Dialog.OpenFormScheda(CodMdep, Data, false, Scheda, true); + private async Task ExportScheda() { VisibleOverlay = true; @@ -109,12 +126,12 @@ ParentActivityId = Scheda.Ispezione?.ActivityId } ); - + if (apiResponse != null) { Scheda.ActivityId = apiResponse.ActivityIdScheda; SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione; - + await IspezioniService.UpdateActivityIdIspezioneAsync(CodMdep, Data, UserSession.User.Username, apiResponse.ActivityIdIspezione ); diff --git a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor index c722eed..12ef106 100644 --- a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor +++ b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor @@ -20,7 +20,7 @@ - + @@ -89,21 +89,24 @@ } - -
- - Aggiungi foto - -
+ + @if (!ReadOnly) + { +
+ + Aggiungi foto + +
+ }
- @@ -129,7 +132,7 @@ } - @if (!IsView) + @if (NetworkService.ConnectionAvailable && !ReadOnly) {
!NetworkService.ConnectionAvailable; - private string? ManualBarcode { get; set; } //Overlay @@ -262,7 +264,7 @@ SaveSchedaResponseDto? apiResponse = null; try { - if (!IsView) + if (NetworkService.ConnectionAvailable) { apiResponse = await IntegrySteupService.SaveScheda( new SaveRequestDto diff --git a/SteUp.Shared/Core/Helpers/ModalHelper.cs b/SteUp.Shared/Core/Helpers/ModalHelper.cs index b8565bf..692214f 100644 --- a/SteUp.Shared/Core/Helpers/ModalHelper.cs +++ b/SteUp.Shared/Core/Helpers/ModalHelper.cs @@ -28,7 +28,7 @@ public static class ModalHelper } public async Task OpenFormScheda(string codMdep, DateTime data, - bool isNew = false, Scheda? scheda = null) + bool isNew = false, Scheda? scheda = null, bool readOnly = false) { scheda = isNew && scheda == null ? new Scheda() : scheda; @@ -39,6 +39,7 @@ public static class ModalHelper { x => x.CodMdep, codMdep }, { x => x.Data, data }, { x => x.IsNew, isNew }, + { x => x.ReadOnly, readOnly }, { x => x.Scheda, scheda } }, new DialogOptions