Rivedi la scelta del punto vendita
La schermata era dichiarata a tutto schermo ma usciva dentro un riquadro con lo sfondo visibile ai lati: la misura da dialog di conferma si applicava anche ai dialog FullScreen, perche' nulla la escludeva. Ora le schermate a tutto schermo riempiono il display. Ogni punto vendita era un <div> con role="button": adesso e' un bottone vero, raggiungibile da tastiera e annunciato per quello che e', con il chevron che dice che porta altrove. L'indirizzo si ferma a due righe: serve a distinguere due negozi con lo stesso nome, non a essere letto per intero, e teneva l'elenco lungo da scorrere. I punti vendita su cui c'e' gia' un'ispezione aperta oggi lo dichiarano: quel tocco riapre l'ispezione esistente invece di crearne una nuova, ed e' meglio saperlo prima. (Il CSS della riga e' entrato nel commit precedente, adiacente a quello delle azioni di testata.) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,49 @@
|
|||||||
@using SteUp.Shared.Core.Dto
|
@using SteUp.Shared.Core.Dto
|
||||||
|
@using SteUp.Shared.Core.Helpers
|
||||||
@using SteUp.Shared.Core.Interface.LocalDb
|
@using SteUp.Shared.Core.Interface.LocalDb
|
||||||
@inject IIspezioniService IspezioniService
|
@inject IIspezioniService IspezioniService
|
||||||
|
|
||||||
<div class="list-card panel--tappable" @onclick="StartInspection" role="button" tabindex="0"
|
@*
|
||||||
aria-label="@($"Apri ispezione su {PuntoVendita.CodMdep} {PuntoVendita.Descrizione}")">
|
Riga di scelta di un punto vendita. E' un <button>: si raggiunge da
|
||||||
|
tastiera, il lettore di schermo la annuncia per quello che e', e il tocco
|
||||||
|
si comporta come quello nativo. Il chevron dice che porta altrove.
|
||||||
|
*@
|
||||||
|
|
||||||
<div class="t-ident">@PuntoVendita.CodMdep</div>
|
<button type="button" class="list-card shop-card panel--tappable" @onclick="StartInspection"
|
||||||
<h3 class="list-card__title">@PuntoVendita.Descrizione</h3>
|
aria-label="@AriaLabel">
|
||||||
|
<span class="shop-card__text">
|
||||||
|
<span class="t-ident">@PuntoVendita.CodMdep</span>
|
||||||
|
<span class="list-card__title">@PuntoVendita.Descrizione</span>
|
||||||
|
|
||||||
@if (!Luogo.IsNullOrEmpty())
|
@if (!Luogo.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<p class="list-card__meta">@Luogo</p>
|
<span class="list-card__meta">@Luogo</span>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
|
@if (Aperta)
|
||||||
|
{
|
||||||
|
@* Toccando si riapre l'ispezione di oggi invece di crearne una
|
||||||
|
nuova: meglio dirlo prima del tocco. *@
|
||||||
|
<span class="list-card__badges badge-row">
|
||||||
|
<Badge Spec="@ApertaBadge"/>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<i class="shop-card__chevron ri-arrow-right-s-line" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public PuntoVenditaDto PuntoVendita { get; set; } = null!;
|
[Parameter] public PuntoVenditaDto PuntoVendita { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public EventCallback OnStarting { get; set; }
|
[Parameter] public EventCallback OnStarting { get; set; }
|
||||||
|
|
||||||
|
/// Vero se il rilevatore ha gia' un'ispezione aperta oggi su questo punto vendita.
|
||||||
|
[Parameter] public bool Aperta { get; set; }
|
||||||
|
|
||||||
|
private static readonly StatusBadgeHelper.BadgeSpec ApertaBadge =
|
||||||
|
new("info", "ri-play-circle-line", "Ispezione di oggi");
|
||||||
|
|
||||||
// Indirizzo, citta', CAP e provincia su una riga sola con separatore " · ":
|
// Indirizzo, citta', CAP e provincia su una riga sola con separatore " · ":
|
||||||
// sono metadati, non meritano tre chip che fanno rumore.
|
// sono metadati, non meritano tre chip che fanno rumore.
|
||||||
private string Luogo => string.Join(" · ", new[]
|
private string Luogo => string.Join(" · ", new[]
|
||||||
@@ -30,6 +55,10 @@
|
|||||||
}
|
}
|
||||||
.Where(x => !x.IsNullOrEmpty()));
|
.Where(x => !x.IsNullOrEmpty()));
|
||||||
|
|
||||||
|
private string AriaLabel => Aperta
|
||||||
|
? $"Riprendi l'ispezione di oggi su {PuntoVendita.CodMdep} {PuntoVendita.Descrizione}"
|
||||||
|
: $"Apri ispezione su {PuntoVendita.CodMdep} {PuntoVendita.Descrizione}";
|
||||||
|
|
||||||
private async Task StartInspection()
|
private async Task StartInspection()
|
||||||
{
|
{
|
||||||
await OnStarting.InvokeAsync();
|
await OnStarting.InvokeAsync();
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
@using SteUp.Shared.Components.Layout
|
@using SteUp.Shared.Components.Layout
|
||||||
@using SteUp.Shared.Components.SingleElements.Card
|
@using SteUp.Shared.Components.SingleElements.Card
|
||||||
@using SteUp.Shared.Core.Dto
|
@using SteUp.Shared.Core.Dto
|
||||||
|
@using SteUp.Shared.Core.Enum
|
||||||
|
@using SteUp.Shared.Core.Interface.LocalDb
|
||||||
|
@inject IIspezioniService IspezioniService
|
||||||
|
|
||||||
@*
|
@*
|
||||||
Scelta del punto vendita: schermata intera, non un riquadro. L'elenco e'
|
Scelta del punto vendita: schermata intera, non un riquadro. L'elenco e'
|
||||||
@@ -60,7 +63,9 @@
|
|||||||
{
|
{
|
||||||
<div class="card-list">
|
<div class="card-list">
|
||||||
<Virtualize Items="FilteredList" Context="puntoVendita" OverscanCount="6">
|
<Virtualize Items="FilteredList" Context="puntoVendita" OverscanCount="6">
|
||||||
<ShopCard PuntoVendita="puntoVendita" OnStarting="@(() => _busy = true)"/>
|
<ShopCard PuntoVendita="puntoVendita"
|
||||||
|
Aperta="@HaIspezioneOggi(puntoVendita)"
|
||||||
|
OnStarting="@(() => _busy = true)"/>
|
||||||
</Virtualize>
|
</Virtualize>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -83,9 +88,30 @@
|
|||||||
? null
|
? null
|
||||||
: FilteredList.Count == 1 ? "1 punto vendita" : $"{FilteredList.Count} punti vendita";
|
: FilteredList.Count == 1 ? "1 punto vendita" : $"{FilteredList.Count} punti vendita";
|
||||||
|
|
||||||
|
// I codici su cui il rilevatore ha gia' un'ispezione aperta oggi. Si legge
|
||||||
|
// una volta sola: toccare una di quelle righe riapre l'ispezione esistente
|
||||||
|
// invece di crearne una nuova, e la riga deve poterlo dire.
|
||||||
|
private HashSet<string> _aperteOggi = [];
|
||||||
|
|
||||||
private void Cancel() => MudDialog.Cancel();
|
private void Cancel() => MudDialog.Cancel();
|
||||||
|
|
||||||
protected override void OnInitialized() => ApplyFilters();
|
private bool HaIspezioneOggi(PuntoVenditaDto pv) =>
|
||||||
|
pv.CodMdep is not null && _aperteOggi.Contains(pv.CodMdep);
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
ApplyFilters();
|
||||||
|
|
||||||
|
var oggi = DateTime.Today;
|
||||||
|
var ispezioni = await IspezioniService.GetAllIspezioni(UserSession.User.Username);
|
||||||
|
|
||||||
|
_aperteOggi = ispezioni
|
||||||
|
.Where(x => x.Data.Date == oggi && x.Stato != StatusEnum.Completata && x.CodMdep is not null)
|
||||||
|
.Select(x => x.CodMdep!)
|
||||||
|
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnFilterInput(ChangeEventArgs e)
|
private void OnFilterInput(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -318,6 +318,27 @@
|
|||||||
width: calc(100vw - 48px);
|
width: calc(100vw - 48px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* La misura da riquadro qui sopra vale per i dialog di conferma. Le schermate
|
||||||
|
aperte a tutto schermo (scelta punto vendita, scelta articoli) sono
|
||||||
|
schermate: devono riempire il display, non restare in una scatola con lo
|
||||||
|
sfondo che si vede ai lati. */
|
||||||
|
.mud-dialog.mud-dialog-fullscreen {
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
background-color: var(--workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mud-dialog.mud-dialog-fullscreen .mud-dialog-content {
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
.mud-dialog-title {
|
.mud-dialog-title {
|
||||||
padding: var(--space-lg) var(--space-lg) 0;
|
padding: var(--space-lg) var(--space-lg) 0;
|
||||||
font-family: var(--font-sans);
|
font-family: var(--font-sans);
|
||||||
|
|||||||
Reference in New Issue
Block a user