Migliora IspezionePage e form scheda (design review impeccable)
Ispezione: - Stato sync visibile: badge per-scheda (Da inviare/Inviato) e contatore "N da inviare" per reparto (nuovo SchedaSyncHelper) - Completamento: progresso reale nell'overlay + spunta di successo; NON completa se una scheda fallisce (resta editabile, schede "Da inviare") - Export reparto/completamento blindati: conferma + guardia anti doppio-tap, try/finally che libera sempre l'overlay - Accento corallo unico per l'azione "invia"; target di tocco >=44px; empty state; solo il primo pannello espanso di default - Tasto "Invia" nascosto sulle schede gia inviate - Messaggio d'errore comprensibile in campo (dettaglio tecnico nei log) - Fix OnSchedaModified (index >= 0) Aspetto card: - SchedaCard e InspectionCard: superficie Carta + hairline border + ombra morbida (nuovo token --card-box-shadow); pagina con tinta Grigio Campo - SchedaCard compattata Form scheda (ModalFormScheda): - Tasto Salva/Aggiorna full-width - Fix "Suggerisci note descrittive": la nota selezionata ora viene inserita nel campo (metodo async sul thread UI + OnAfterChangeValue) StatusEnum: etichette in sentence-case Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,19 @@
|
||||
<div class="scheda-card">
|
||||
<div class="scheda-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="scheda-title" Typo="Typo.subtitle1">
|
||||
<b>@Scheda.ActivityTypeId</b>
|
||||
</MudText>
|
||||
<div class="scheda-title-group">
|
||||
<MudText Class="scheda-title" Typo="Typo.subtitle1">
|
||||
<b>@Scheda.ActivityTypeId</b>
|
||||
</MudText>
|
||||
|
||||
@{
|
||||
var syncState = Scheda.GetSyncState();
|
||||
}
|
||||
<MudChip T="string" Class="sync-badge" Icon="@syncState.GetIcon()"
|
||||
Size="Size.Small" Variant="Variant.Filled" Color="@syncState.GetColor()">
|
||||
@syncState.ToLabel()
|
||||
</MudChip>
|
||||
</div>
|
||||
|
||||
<div class="sub-info-section">
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.PhotoCamera" Size="Size.Small" Color="Color.Default">
|
||||
@@ -31,29 +41,26 @@
|
||||
<div class="scheda-card-action">
|
||||
@if (Ispezione.Stato != StatusEnum.Completata)
|
||||
{
|
||||
if (NetworkService.IsNetworkAvailable())
|
||||
<div class="action-secondary">
|
||||
<MudFab Color="Color.Default" Size="Size.Medium" StartIcon="@Icons.Material.Rounded.Edit"
|
||||
aria-label="Modifica scheda" OnClick="@UpdateScheda"/>
|
||||
<MudFab Color="Color.Error" Size="Size.Medium" StartIcon="@Icons.Material.Rounded.Delete"
|
||||
aria-label="Elimina scheda" OnClick="@DeleteScheda"/>
|
||||
</div>
|
||||
@if (NetworkService.IsNetworkAvailable() && syncState == SyncState.DaInviare)
|
||||
{
|
||||
<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
|
||||
{
|
||||
<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.Primary" Size="Size.Medium" StartIcon="@Icons.Material.Rounded.CloudUpload"
|
||||
Label="Invia" aria-label="Invia scheda al server" OnClick="@ExportScheda"/>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudFab Color="Color.Info" Size="Size.Small" StartIcon="@Icons.Material.Rounded.RemoveRedEye"
|
||||
OnClick="@ViewScheda"/>
|
||||
<MudFab Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Rounded.CloudSync"
|
||||
OnClick="@ExportImg"/>
|
||||
<div class="action-secondary">
|
||||
<MudFab Color="Color.Default" Size="Size.Medium" StartIcon="@Icons.Material.Rounded.RemoveRedEye"
|
||||
aria-label="Visualizza scheda" OnClick="@ViewScheda"/>
|
||||
</div>
|
||||
<MudFab Color="Color.Primary" Size="Size.Medium" StartIcon="@Icons.Material.Rounded.CloudUpload"
|
||||
Label="Invia foto" aria-label="Invia foto al server" OnClick="@ExportImg"/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -112,52 +119,74 @@
|
||||
|
||||
private async Task ExportScheda()
|
||||
{
|
||||
// Guardia anti doppio-tap: invio irreversibile al server.
|
||||
if (VisibleOverlay) return;
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var apiResponse = await IntegrySteupService.SaveScheda(
|
||||
new SaveRequestDto
|
||||
{
|
||||
LocalIdScheda = Scheda.Id,
|
||||
ActivityTypeId = Scheda.ActivityTypeId,
|
||||
CodJfas = Scheda.CodJfas,
|
||||
CodMdep = Ispezione.CodMdep,
|
||||
DataCreazione = Ispezione.Data,
|
||||
Note = Scheda.Note,
|
||||
PersonaRif = Scheda.Responsabile,
|
||||
Barcodes = Scheda.Articoli.ConvertAll(x => x.Barcode),
|
||||
Scandeza = (ScadenzaEnum)Scheda.Scadenza,
|
||||
ParentActivityId = Scheda.Ispezione?.ActivityId
|
||||
}
|
||||
);
|
||||
|
||||
if (apiResponse != null)
|
||||
try
|
||||
{
|
||||
Scheda.ActivityId = apiResponse.ActivityIdScheda;
|
||||
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||
|
||||
await IspezioniService.UpdateActivityIdIspezioneAsync(Ispezione.CodMdep, Ispezione.Data,
|
||||
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
||||
var apiResponse = await IntegrySteupService.SaveScheda(
|
||||
new SaveRequestDto
|
||||
{
|
||||
LocalIdScheda = Scheda.Id,
|
||||
ActivityTypeId = Scheda.ActivityTypeId,
|
||||
CodJfas = Scheda.CodJfas,
|
||||
CodMdep = Ispezione.CodMdep,
|
||||
DataCreazione = Ispezione.Data,
|
||||
Note = Scheda.Note,
|
||||
PersonaRif = Scheda.Responsabile,
|
||||
Barcodes = Scheda.Articoli.ConvertAll(x => x.Barcode),
|
||||
Scandeza = (ScadenzaEnum)Scheda.Scadenza,
|
||||
ParentActivityId = Scheda.Ispezione?.ActivityId
|
||||
}
|
||||
);
|
||||
await IspezioniService.UpdateActivityIdSchedaAsync(Scheda.Id, Scheda.ActivityId);
|
||||
}
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
if (apiResponse != null)
|
||||
{
|
||||
Scheda.ActivityId = apiResponse.ActivityIdScheda;
|
||||
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||
|
||||
await IspezioniService.UpdateActivityIdIspezioneAsync(Ispezione.CodMdep, Ispezione.Data,
|
||||
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
||||
);
|
||||
await IspezioniService.UpdateActivityIdSchedaAsync(Scheda.Id, Scheda.ActivityId);
|
||||
|
||||
// Notifica il genitore così il contatore "da inviare" del reparto si aggiorna.
|
||||
await OnSchedaModified.InvokeAsync(Scheda);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExportImg()
|
||||
{
|
||||
if (Scheda.ImageNames == null) return;
|
||||
if (VisibleOverlay || Scheda.ImageNames == null) return;
|
||||
|
||||
var fileList = (await FileManager.GetInspectionFiles(Ispezione, Scheda.ImageNames))?
|
||||
.Where(x => x.ToUpload).ToList();
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
if (fileList == null) return;
|
||||
|
||||
foreach (var file in fileList)
|
||||
try
|
||||
{
|
||||
await IntegrySteupService.UploadFile(Scheda.ActivityId!, file.FileBytes!, file.Name!);
|
||||
var fileList = (await FileManager.GetInspectionFiles(Ispezione, Scheda.ImageNames))?
|
||||
.Where(x => x.ToUpload).ToList();
|
||||
|
||||
if (fileList == null) return;
|
||||
|
||||
foreach (var file in fileList)
|
||||
{
|
||||
await IntegrySteupService.UploadFile(Scheda.ActivityId!, file.FileBytes!, file.Name!);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user