This commit is contained in:
2026-03-02 16:12:58 +01:00
parent 8fbeaf8637
commit 99a5395a1f
4 changed files with 76 additions and 52 deletions

View File

@@ -35,6 +35,8 @@
@($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}")
</MudChip>
</div>
@if (SteupDataService.InspectionPageState.Ispezione.Stato != StatusEnum.Completata)
{
<div class="action-scheda-group">
@if (NetworkService.IsNetworkAvailable())
{
@@ -54,6 +56,7 @@
OnClick="@(() => CreateNewScheda(group.Key))"/>
}
</div>
}
</div>
</TitleContent>
<ChildContent>
@@ -61,6 +64,7 @@
{
<SchedaCard Scheda="scheda" OnSchedaDeleted="OnSchedaDeleted"
OnSchedaModified="OnSchedaModified"
Stato="@SteupDataService.InspectionPageState.Ispezione.Stato"
CodMdep="@SteupDataService.InspectionPageState.Ispezione.CodMdep"
Data="@SteupDataService.InspectionPageState.Ispezione.Data"/>
}

View File

@@ -27,11 +27,16 @@
</div>
<div class="scheda-card-action">
@if (NetworkService.IsNetworkAvailable())
@if (Stato != StatusEnum.Completata)
{
<MudFab Color="Color.Info" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Edit" OnClick="@UpdateScheda"/>
<MudFab Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Delete" OnClick="@DeleteScheda"/>
<MudFab Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Rounded.CloudSync" OnClick="@ExportScheda"/>
if (NetworkService.IsNetworkAvailable())
{
<MudFab Color="Color.Info" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Edit"
OnClick="@UpdateScheda"/>
<MudFab Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Rounded.Delete"
OnClick="@DeleteScheda"/>
<MudFab Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Rounded.CloudSync"
OnClick="@ExportScheda"/>
}
else
{
@@ -44,6 +49,14 @@
Cancella
</MudButton>
}
}
else
{
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.RemoveRedEye"
Color="Color.Info" Size="Size.Small" OnClick="@ViewScheda">
Visualizza
</MudButton>
}
</div>
</div>
</div>
@@ -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<Scheda> OnSchedaModified { get; set; }
[Parameter] public EventCallback<Scheda> OnSchedaDeleted { get; set; }
@@ -89,6 +103,9 @@
}
}
private void ViewScheda() =>
_ = Dialog.OpenFormScheda(CodMdep, Data, false, Scheda, true);
private async Task ExportScheda()
{
VisibleOverlay = true;

View File

@@ -20,7 +20,7 @@
<MudDialog Class="customDialog-form">
<DialogContent>
<MudForm @ref="_form">
<MudForm ReadOnly="ReadOnly" @ref="_form">
<HeaderLayout Cancel="true" OnCancel="@Cancel" LabelSave="@LabelSave"
OnSave="Save" Title="Scheda"/>
@@ -90,6 +90,8 @@
</CardFormModal>
}
@if (!ReadOnly)
{
<div class="container-button ripple-container">
<MudButton Class="button-settings green-icon"
FullWidth="true"
@@ -100,10 +102,11 @@
Aggiungi foto
</MudButton>
</div>
}
<CardFormModal Title="Articoli">
<div class="input-manual-barcode">
<MudTextField FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text"
<MudTextField FullWidth="true" T="string?" Variant="Variant.Text"
@bind-Value="ManualBarcode" Placeholder="Digita manualmente il codice"/>
<MudIconButton Color="Color.Primary" OnClick="@OnManualBarcodeSet"
Size="Size.Small" Icon="@Icons.Material.Rounded.Send"/>
@@ -129,7 +132,7 @@
}
</CardFormModal>
@if (!IsView)
@if (NetworkService.ConnectionAvailable && !ReadOnly)
{
<div class="container-button ripple-container">
<MudButton Class="button-settings red-icon"
@@ -190,10 +193,9 @@
[Parameter] public required string CodMdep { get; set; }
[Parameter] public required DateTime Data { get; set; }
[Parameter] public bool IsNew { get; set; }
[Parameter] public bool ReadOnly { get; set; }
[Parameter] public Scheda Scheda { get; set; } = new();
private bool IsView => !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

View File

@@ -28,7 +28,7 @@ public static class ModalHelper
}
public async Task<DialogResult?> 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