Rifacimento della UI secondo STILE_UI.md
Adotta lo stile condiviso delle app Integry: superfici piatte, raggi ampi, spaziature a scala fissa, gerarchia data dallo spazio prima che dalla decorazione. La palette storica di SteUP resta intatta; sono stati aggiunti solo i ruoli che mancavano (workspace, surfaceMuted, divider, inkMuted e le triplette dei toni semantici). Fondamenta - tokens.css: ruoli colore, scale di spazio/raggi/tipografia, curve di movimento e scala z-index semantica. Unica fonte di verita': pilotano anche le variabili CSS di MudBlazor. - Inter variabile ospitata in locale (133KB) al posto di Nunito da Google Fonts: l'app lavora offline, un font che arriva dalla rete in campo non arriva. - base.css: shell applicativa e comportamenti da app nativa — niente selezione testo, niente menu al tocco lungo, niente lampo grigio sul tap, niente rimbalzo elastico, niente zoom a doppio tocco, scroll con inerzia. - mudblazor-overrides.css: MudBlazor appiattito (elevation 0, nessun tint, target 44/48, etichette in caso naturale). - Rimossi Bootstrap (CSS, icone e JS) e i 996 righe di CSS con ambito per componente del vecchio sistema: erano tutti inutilizzati. Struttura - Navigazione flottante in basso con icona piena sulla voce attiva; da 720px diventa colonna laterale. Il MudFabMenu e' sostituito da un bottom sheet: stessa funzione, bersagli molto piu' grandi. - Testata alta col titolo a sinistra, fusa con la pagina. - Nel form scheda il salvataggio sta in una barra ancorata in fondo, non in coda a uno scroll lungo. - Scelta di punto vendita e articoli a schermo intero con ricerca; la selezione multipla usa righe da 56px invece di un menu a tendina. - Urgenza scelta a pillole invece che da una select. Stato e riscontro - StatusBadgeHelper: tono, icona ed etichetta di ogni stato in un punto solo, cosi' lo stesso stato si presenta identico ovunque. - Scheletri al posto degli spinner; l'overlay bloccante dice sempre cosa sta facendo; gli stati vuoti suggeriscono la mossa successiva. - Rimosso il ritardo artificiale di 250ms in InspectionCard, che non attendeva nulla. DESIGN.md riscritto sul nuovo sistema. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,174 +24,225 @@
|
||||
@inject ILogger<ModalFormScheda> Logger
|
||||
@implements IDisposable
|
||||
|
||||
@*
|
||||
Form scheda: la schermata dove il rilevatore passa la maggior parte del
|
||||
turno. Struttura a shell — testata, corpo scorrevole, barra azioni ancorata
|
||||
in fondo (STILE_UI §6.13) — così il salvataggio resta sempre sotto il
|
||||
pollice invece di stare in fondo a uno scroll lungo.
|
||||
*@
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<MudForm ReadOnly="ReadOnly" @ref="_form">
|
||||
<HeaderLayout Cancel="true" OnCancel="@Cancel" Title="Scheda"/>
|
||||
<div class="app-shell">
|
||||
|
||||
<div class="content">
|
||||
<HeaderLayout Title="@(IsNew ? "Nuova scheda" : ReadOnly ? "Scheda" : "Modifica scheda")"
|
||||
Subtitle="@Scheda.DescrizioneReparto"
|
||||
Cancel="true" OnCancel="@Cancel" Compact="true"/>
|
||||
|
||||
<CardFormModal Title="Reparto" Loading="SteupDataService.Reparti.IsNullOrEmpty()">
|
||||
<MudSelectExtended T="JtbFasiDto?" Variant="Variant.Text"
|
||||
@bind-Value="Scheda.Reparto" ToStringFunc="@(x => x?.Descrizione)"
|
||||
@bind-Value:after="OnAfterChangeReparto" Required="true"
|
||||
RequiredError="Reparto obbligatorio">
|
||||
@foreach (var fasi in SteupDataService.Reparti)
|
||||
<div class="app-scroll">
|
||||
<div class="page-width stack stack-10" style="padding-bottom: var(--space-lg);">
|
||||
|
||||
@if (IsBozza)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@fasi">
|
||||
@fasi.Descrizione
|
||||
</MudSelectItemExtended>
|
||||
<div class="feedback feedback--warning" role="status">
|
||||
<i class="feedback__icon ri-edit-line" aria-hidden="true"></i>
|
||||
<span>Questa scheda è una bozza: completala per poterla inviare.</span>
|
||||
</div>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Motivo" Loading="SteupDataService.TipiAttività.IsNullOrEmpty()">
|
||||
<MudSelectExtended ReadOnly="@Scheda.CodJfas.IsNullOrEmpty()" T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Scheda.ActivityTypeId" @bind-Value:after="OnAfterChangeValue"
|
||||
Required="true" RequiredError="Motivo obbligatorio">
|
||||
@foreach (var type in SteupDataService.TipiAttività.Where(x => x.CodJfas.EqualsIgnoreCase(Scheda.CodJfas!)))
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select"
|
||||
Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</CardFormModal>
|
||||
|
||||
@if (FileLoading)
|
||||
{
|
||||
<CardFormModal Title="Immagini">
|
||||
<div class="container-attached">
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-3"/>
|
||||
</div>
|
||||
</CardFormModal>
|
||||
}
|
||||
else if (!AttachedList.IsNullOrEmpty())
|
||||
{
|
||||
<CardFormModal Title="Immagini">
|
||||
<div class="container-attached">
|
||||
<div class="scroll-attached">
|
||||
@foreach (var item in AttachedList!.Select((p, index) => new { p, index }))
|
||||
<CardFormModal Title="Reparto" Loading="SteupDataService.Reparti.IsNullOrEmpty()">
|
||||
<MudSelectExtended T="JtbFasiDto?" Variant="Variant.Text"
|
||||
@bind-Value="Scheda.Reparto" ToStringFunc="@(x => x?.Descrizione)"
|
||||
@bind-Value:after="OnAfterChangeReparto" Required="true"
|
||||
Placeholder="Scegli il reparto"
|
||||
RequiredError="Indica il reparto">
|
||||
@foreach (var fasi in SteupDataService.Reparti)
|
||||
{
|
||||
<MudCard>
|
||||
@if (!item.p.ThumbPath.IsNullOrEmpty())
|
||||
{
|
||||
<MudCardMedia Image="@item.p.ThumbPath" Height="100"/>
|
||||
}
|
||||
<MudCardContent Class="image_card">
|
||||
<MudText Typo="Typo.subtitle1"><b>@item.p.Name</b></MudText>
|
||||
@if (item.p.ToUpload)
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@fasi">
|
||||
@fasi.Descrizione
|
||||
</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Motivo" Loading="SteupDataService.TipiAttività.IsNullOrEmpty()">
|
||||
@if (Scheda.CodJfas.IsNullOrEmpty())
|
||||
{
|
||||
<p class="t-meta">Scegli prima il reparto.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended T="string?" Variant="Variant.Text"
|
||||
@bind-Value="Scheda.ActivityTypeId"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
Required="true" Placeholder="Scegli il motivo"
|
||||
RequiredError="Indica il motivo">
|
||||
@foreach (var type in SteupDataService.TipiAttività.Where(x => x.CodJfas.EqualsIgnoreCase(Scheda.CodJfas!)))
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select"
|
||||
Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</CardFormModal>
|
||||
|
||||
@* --- Articoli: il compito primario della schermata --- *@
|
||||
<CardFormModal Title="Articoli" Count="@ArticoliCount">
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<div class="barcode-field">
|
||||
<input type="text" inputmode="numeric" placeholder="Digita o scansiona un codice"
|
||||
aria-label="Codice a barre"
|
||||
value="@ManualBarcode" @oninput="OnManualBarcodeInput"
|
||||
@onkeydown="OnManualBarcodeKey"/>
|
||||
<button type="button" class="barcode-field__send"
|
||||
disabled="@(ManualBarcode.IsNullOrEmpty())"
|
||||
aria-label="Aggiungi il codice" @onclick="OnManualBarcodeSet">
|
||||
<i class="ri-arrow-right-line" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!Scheda.Articoli.IsNullOrEmpty())
|
||||
{
|
||||
<div class="art-list" style="margin-top: var(--space-sm);">
|
||||
@foreach (var articolo in Scheda.Articoli)
|
||||
{
|
||||
<div class="art-item" @key="articolo.Barcode">
|
||||
<div class="art-item__text">
|
||||
<div class="art-item__name">@articolo.Descrizione</div>
|
||||
<div class="art-item__code selectable">@articolo.Barcode</div>
|
||||
</div>
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<MudIconButton Variant="Variant.Outlined"
|
||||
Icon="@Icons.Material.Rounded.Close"
|
||||
Size="Size.Small" Color="Color.Error"
|
||||
OnClick="@(() => OnRemoveAttached(item.index))"/>
|
||||
<button type="button" class="art-item__remove"
|
||||
aria-label="@($"Rimuovi {articolo.Descrizione}")"
|
||||
@onclick="@(() => RemoveArt(articolo.Barcode))">
|
||||
<i class="ri-close-line" aria-hidden="true"></i>
|
||||
</button>
|
||||
}
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else if (ReadOnly)
|
||||
{
|
||||
<p class="t-meta">Nessun articolo.</p>
|
||||
}
|
||||
|
||||
@if (NetworkService.ConnectionAvailable && !ReadOnly)
|
||||
{
|
||||
<button type="button" class="action-tile" style="margin-top: var(--space-sm);"
|
||||
@onclick="@OpenSelectArt">
|
||||
<span class="action-tile__icon action-tile__icon--neutral">
|
||||
<i class="ri-list-check-2" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="action-tile__label">Scegli dalla griglia</span>
|
||||
<i class="nav-list__chevron ri-arrow-right-s-line" aria-hidden="true"></i>
|
||||
</button>
|
||||
}
|
||||
</CardFormModal>
|
||||
|
||||
@* --- Foto --- *@
|
||||
<CardFormModal Title="Foto" Count="@FotoCount" Loading="FileLoading">
|
||||
@if (!AttachedList.IsNullOrEmpty())
|
||||
{
|
||||
<div class="attach-strip">
|
||||
@foreach (var item in AttachedList!.Select((p, index) => new { p, index }))
|
||||
{
|
||||
<div class="attach-item">
|
||||
@if (!item.p.ThumbPath.IsNullOrEmpty())
|
||||
{
|
||||
<img class="attach-item__img" src="@item.p.ThumbPath"
|
||||
alt="@item.p.Name"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="attach-item__placeholder">
|
||||
<span class="spinner" aria-label="Elaborazione"></span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (item.p.ToUpload && !ReadOnly)
|
||||
{
|
||||
<button type="button" class="attach-item__remove"
|
||||
aria-label="@($"Rimuovi la foto {item.p.Name}")"
|
||||
@onclick="@(() => OnRemoveAttached(item.index))">
|
||||
<i class="ri-close-line" aria-hidden="true"></i>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else if (ReadOnly)
|
||||
{
|
||||
<p class="t-meta">Nessuna foto.</p>
|
||||
}
|
||||
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<button type="button" class="action-tile" style="margin-top: var(--space-sm);"
|
||||
@onclick="@OpenAddAttached">
|
||||
<span class="action-tile__icon action-tile__icon--primary">
|
||||
<i class="ri-camera-line" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="action-tile__label">Aggiungi una foto</span>
|
||||
</button>
|
||||
}
|
||||
</CardFormModal>
|
||||
|
||||
@* --- Urgenza: pillole invece di un menu a tendina --- *@
|
||||
<CardFormModal Title="Entro quando">
|
||||
<div class="option-row">
|
||||
@foreach (var opzione in ScadenzaOptions)
|
||||
{
|
||||
<button type="button" class="option"
|
||||
disabled="@ReadOnly"
|
||||
aria-pressed="@(Scheda.Scadenza == opzione.Value ? "true" : "false")"
|
||||
@onclick="@(() => SetScadenza(opzione.Value))">
|
||||
@opzione.Label
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</CardFormModal>
|
||||
}
|
||||
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Persona di riferimento">
|
||||
<MudTextField FullWidth="true" T="string?" Variant="Variant.Text"
|
||||
Placeholder="Nome di chi ha seguito il controllo"
|
||||
@bind-Value="Scheda.Responsabile" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Note">
|
||||
<MudTextField @key="_noteFieldKey" T="string?" Variant="Variant.Text" Lines="3"
|
||||
Placeholder="Cosa hai rilevato"
|
||||
@bind-Value="Scheda.Note" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<button type="button" class="action-tile" style="margin-top: var(--space-sm);"
|
||||
@onclick="@SuggestActivityDescription">
|
||||
<span class="action-tile__icon action-tile__icon--info">
|
||||
<i class="ri-lightbulb-line" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="action-tile__label">Usa una nota ricorrente</span>
|
||||
<i class="nav-list__chevron ri-arrow-right-s-line" aria-hidden="true"></i>
|
||||
</button>
|
||||
}
|
||||
</CardFormModal>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<div class="container-button ripple-container">
|
||||
<MudButton Class="button-settings green-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||
Size="Size.Medium"
|
||||
OnClick="@OpenAddAttached"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi foto
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<CardFormModal Title="Articoli">
|
||||
@if (!ReadOnly)
|
||||
{
|
||||
<div class="input-manual-barcode">
|
||||
<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"/>
|
||||
</div>
|
||||
}
|
||||
@if (!Scheda.Articoli.IsNullOrEmpty())
|
||||
{
|
||||
<div class="art-list">
|
||||
@foreach (var articolo in Scheda.Articoli)
|
||||
{
|
||||
<MudChip T="string" OnClose="@(() => RemoveArt(articolo.Barcode))"
|
||||
style="height: auto;">
|
||||
<MudStack Direction="Column" Spacing="0" class="py-1">
|
||||
<MudText Typo="Typo.subtitle2" Style="line-height: 1.1; font-weight: 700;">
|
||||
@articolo.Descrizione
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Style="line-height: 1.5;">
|
||||
Barcode: @articolo.Barcode
|
||||
</MudText>
|
||||
</MudStack>
|
||||
</MudChip>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</CardFormModal>
|
||||
|
||||
@if (NetworkService.ConnectionAvailable && !ReadOnly)
|
||||
{
|
||||
<div class="container-button ripple-container">
|
||||
<MudButton Class="button-settings red-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Balance"
|
||||
Size="Size.Medium"
|
||||
OnClick="@OpenSelectArt"
|
||||
Variant="Variant.Outlined">
|
||||
Consulta articoli
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<CardFormModal Title="Scadenza">
|
||||
<MudSelectExtended FullWidth="true" T="int" Variant="Variant.Text"
|
||||
@bind-Value="@Scheda.Scadenza" @bind-Value:after="OnAfterChangeValue">
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="24H" Value="3"/>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 Settimana" Value="2"/>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 Mese" Value="1"/>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="2 Mesi" Value="0"/>
|
||||
</MudSelectExtended>
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Responsabile">
|
||||
<MudTextField FullWidth="true" T="string?" Variant="Variant.Text"
|
||||
@bind-Value="Scheda.Responsabile" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</CardFormModal>
|
||||
|
||||
<CardFormModal Title="Note">
|
||||
<MudTextField @key="_noteFieldKey" T="string?" Variant="Variant.Text" Lines="3"
|
||||
@bind-Value="Scheda.Note" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</CardFormModal>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings primary-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Description"
|
||||
Size="Size.Medium"
|
||||
OnClick="@SuggestActivityDescription"
|
||||
Variant="Variant.Outlined">
|
||||
Suggerisci note descrittive
|
||||
</MudButton>
|
||||
</div>
|
||||
|
||||
@if (!LabelSave.IsNullOrEmpty())
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton OnClick="@Save" Color="Color.Primary" Variant="Variant.Filled" FullWidth="true">
|
||||
@LabelSave
|
||||
@* Barra azioni ancorata: il salvataggio non si cerca mai. *@
|
||||
<div class="action-bar">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true"
|
||||
Disabled="@(!IsDirty)" OnClick="@Submit">
|
||||
@(LabelSave ?? (IsNew ? "Salva" : "Aggiorna"))
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
@@ -203,7 +254,7 @@
|
||||
</MudDialog>
|
||||
|
||||
<SpinnerOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
<LoaderLayout Visible="OnLoading" Text="@TextLoading"/>
|
||||
<SpinnerOverlay VisibleOverlay="OnLoading" Message="@TextLoading"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
@@ -215,6 +266,45 @@
|
||||
|
||||
private string? ManualBarcode { get; set; }
|
||||
|
||||
private bool IsBozza => Scheda.Bozza;
|
||||
|
||||
private string ArticoliCount => Scheda.Articoli.Count == 0
|
||||
? "nessuno"
|
||||
: Scheda.Articoli.Count == 1 ? "1" : Scheda.Articoli.Count.ToString();
|
||||
|
||||
private string FotoCount => AttachedList is null or { Count: 0 }
|
||||
? "nessuna"
|
||||
: AttachedList.Count.ToString();
|
||||
|
||||
// I valori sono quelli di ScadenzaEnum. Come pillole invece che in un menu
|
||||
// a tendina: si scelgono con un tocco solo e si vede subito quale e' attiva.
|
||||
private static readonly (int Value, string Label)[] ScadenzaOptions =
|
||||
[
|
||||
(3, "24 ore"),
|
||||
(2, "1 settimana"),
|
||||
(1, "1 mese"),
|
||||
(0, "2 mesi")
|
||||
];
|
||||
|
||||
private void SetScadenza(int value)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
Scheda.Scadenza = value;
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private void OnManualBarcodeInput(ChangeEventArgs e)
|
||||
{
|
||||
ManualBarcode = e.Value?.ToString();
|
||||
}
|
||||
|
||||
// Invio da tastiera: il codice digitato si conferma senza cercare il pulsante.
|
||||
private void OnManualBarcodeKey(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Key is "Enter" or "NumpadEnter") OnManualBarcodeSet();
|
||||
}
|
||||
|
||||
//Overlay
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user