- 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,51 +27,79 @@
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>
<!-- Center content -->
<div class="d-flex flex-column align-items-center justify-content-center text-center flex-fill px-3">
<div class="mb-5">
<div class="qr-shell">
<span class="ti ti-qrcode qr-icon"></span>
@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>
}
<!-- corner accents -->
<span class="qr-corner tl"></span>
<span class="qr-corner tr"></span>
<span class="qr-corner bl"></span>
<span class="qr-corner br"></span>
<!-- 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">
<div class="qr-shell">
<span class="ti ti-qrcode qr-icon"></span>
<!-- corner accents -->
<span class="qr-corner tl"></span>
<span class="qr-corner tr"></span>
<span class="qr-corner bl"></span>
<span class="qr-corner br"></span>
</div>
</div>
<div style="max-width: 320px;">
<h1 class="h2 mb-2 fw-bold">Scan QR Code</h1>
<p class="text-secondary mb-0">
Align the QR code within the frame to automatically detect and identify the client.
</p>
</div>
</div>
<div style="max-width: 320px;">
<h1 class="h2 mb-2 fw-bold">Scan QR Code</h1>
<p class="text-secondary mb-0">
Align the QR code within the frame to automatically detect and identify the client.
</p>
<div class="pb-4">
<div class="d-grid gap-3">
<button type="button"
class="btn btn-lg btn-primary d-inline-flex align-items-center justify-content-center gap-2"
@onclick="OnScan">
<span class="ti ti-scan fs-3"></span>
<span>Scan Code</span>
</button>
<button type="button"
class="btn btn-link text-secondary fw-bold"
@onclick="OnManual">
Enter code manually
</button>
</div>
<div style="height: .5rem;"></div>
</div>
</div>
<!-- Bottom actions -->
<div class="pb-4">
<div class="d-grid gap-3">
<button type="button"
class="btn btn-lg btn-primary d-inline-flex align-items-center justify-content-center gap-2"
@onclick="OnScan">
<span class="ti ti-scan fs-3"></span>
<span>Scan Code</span>
</button>
<button type="button"
class="btn btn-link text-secondary fw-bold"
@onclick="OnManual">
Enter code manually
</button>
</div>
<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;
}
}