- Inizio pagina ScanNew

This commit is contained in:
2025-12-23 18:03:41 +01:00
parent ea417dc09e
commit 6e8be72f3b
2 changed files with 99 additions and 47 deletions

View File

@ -38,7 +38,7 @@
private bool showCodiceCliente { get; set; } = false;
private bool showForm { get; set; } = false;
private InvitoEventoViewModel invito { get; set; } = new InvitoEventoViewModel();
private Component_Registrazione registrazione { get; set; }
private Component_Registrazione registrazione { get; set; } = new();
private string codiceFornito { get; set; }

View File

@ -1,9 +1,13 @@
@page "/activate-qr-scan"
@using StandManager.Components.Layout
@inject NavigationManager Nav
@layout PublicLayout
@inject IJSRuntime JS
@inject BodyClassService BodyClass
@rendermode InteractiveServer
<PageTitle>Scan Code</PageTitle>
<div class="page" style="min-height: 100dvh;">
<div class="page-wrapper" style="min-height: 100dvh;">
<div class="container container-tight py-4 d-flex flex-column" style="min-height: 100dvh;">
@ -14,7 +18,7 @@
class="btn btn-icon btn-ghost-secondary rounded-circle"
aria-label="Chiudi"
@onclick="OnClose">
<span class="ti ti-x fs-2"></span>
<i class="fa fa-x footer-icon"></i>
</button>
<div class="flex-fill"></div>
@ -23,10 +27,38 @@
class="btn btn-icon btn-ghost-secondary rounded-circle"
aria-label="Aiuto"
@onclick="OnHelp">
<span class="ti ti-help fs-2"></span>
<i class="fa fa-question footer-icon"></i>
</button>
</div>
@if (openManual)
{
<div class="d-flex flex-column align-items-center justify-content-center text-center flex-fill px-3">
<div class="row">
<div class="col-12 mb-3">
<RadzenTextBox @bind-Value="@registrationCode" Placeholder="Inserirci il codice" Style="width: 100%;" />
@if (!string.IsNullOrEmpty(invalidCode))
{
<div class="text-danger mt-1">@invalidCode</div>
}
</div>
<div class="col-6 mb-3">
<button type="button" class="btn btn-primary w-100" @onclick="GoTo">
Invia
</button>
</div>
<div class="col-6 mb-3">
<button type="button" class="btn btn-default w-100" @onclick="UndoChoice">
Annulla
</button>
</div>
</div>
</div>
}
<!-- Bottom actions -->
@if (!openManual && !openScan)
{
<!-- Center content -->
<div class="d-flex flex-column align-items-center justify-content-center text-center flex-fill px-3">
<div class="mb-5">
@ -49,7 +81,6 @@
</div>
</div>
<!-- Bottom actions -->
<div class="pb-4">
<div class="d-grid gap-3">
<button type="button"
@ -68,6 +99,7 @@
<div style="height: .5rem;"></div>
</div>
}
</div>
</div>
@ -79,26 +111,46 @@
[Parameter] public EventCallback Scan { get; set; }
[Parameter] public EventCallback Manual { get; set; }
private bool openManual { get; set; } = false;
private bool openScan { get; set; } = false;
private string registrationCode { get; set; }
private string invalidCode = string.Empty;
private async Task OnClose()
{
if (Close.HasDelegate) await Close.InvokeAsync();
else Nav.NavigateTo("/");
Nav.NavigateTo("/");
}
private async Task OnHelp()
{
if (Help.HasDelegate) await Help.InvokeAsync();
}
private async Task OnScan()
{
if (Scan.HasDelegate) await Scan.InvokeAsync();
// qui poi ci attacchi la logica di attivazione camera/scan
}
private async Task OnManual()
{
if (Manual.HasDelegate) await Manual.InvokeAsync();
// es: Nav.NavigateTo("/enter-code");
openManual = true;
}
private async Task GoTo()
{
var code = Guid.Empty;
if (Guid.TryParse(registrationCode, out code))
{
var iscrizione = await _managerService.IscrizioneEventoService.RicercaPer(filtro: x => x.Id == code);
var ok = await _dialogService.Confirm($"Il numero di persone indicate per questo evento è {iscrizione.Partecipanti}", $"Benvenuto {iscrizione.RagioneSociale}", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" });
}
else invalidCode = "Il codice inserito non risulta corretto!";
}
private async Task UndoChoice()
{
openManual = false;
openScan = false;
}
}