diff --git a/StandManager/Components/Pages/ScanNew.razor b/StandManager/Components/Pages/ScanNew.razor index 8f7a4e0..467ccec 100644 --- a/StandManager/Components/Pages/ScanNew.razor +++ b/StandManager/Components/Pages/ScanNew.razor @@ -21,99 +21,22 @@
- -
- -
- @if (openManual) + @if (!openManual) { -
-
-
- -
- @if (!string.IsNullOrWhiteSpace(invalidCode)) - { -
- Errore: @invalidCode -
- } - -
- -
-
- -
-
-
- } - - @if (openScan) - { -
-
-
- - -
-
- -

Inquadra il QR Code

-
- - @if (!string.IsNullOrWhiteSpace(invalidCode)) - { -
-
-
- Errore: @invalidCode -
-
-
- -
-
- } - -
- -
-
- } - - @if (!openManual && !openScan) - {
- @@ -124,24 +47,94 @@

Scan QR Code

- Align the QR code within the frame to automatically detect and identify the client. + Allinea il QR code per il riconoscimento automatico dei dati del cliente.

+
+ + @if (!string.IsNullOrWhiteSpace(confirmationMessage)) + { +
+ Conferma: @confirmationMessage +
+ } + +
+
+ +
+
+
+ + @if (!string.IsNullOrWhiteSpace(invalidMessage)) + { +
+ Errore: @invalidMessage +
+ } + + @if (openScan) + { +
+ +
+ } +
+ } + + @if (openManual) + { +
+
+ + @if (!string.IsNullOrWhiteSpace(confirmationMessage)) + { +
+ Conferma: @confirmationMessage +
+ } + +
+ +
+ + @if (!string.IsNullOrEmpty(invalidMessage)) + { +
+ Errore: @invalidMessage +
+ } +
+
+ +
+
+ +
+
+
+
+ } + + @if (!openManual && !openScan) + {
- -
@@ -154,13 +147,12 @@
@code { - [Parameter] public EventCallback Close { get; set; } - [Parameter] public EventCallback Help { get; set; } private bool openManual { get; set; } = false; private bool openScan { get; set; } = false; private string registrationCode { get; set; } = string.Empty; - private string invalidCode { get; set; } = string.Empty; + private string invalidMessage { get; set; } = string.Empty; + private string confirmationMessage { get; set; } = string.Empty; // Scanner private ElementReference videoRef; @@ -184,8 +176,9 @@ private void OnManual() { + openScan = false; openManual = true; - invalidCode = string.Empty; + invalidMessage = string.Empty; } private async Task GoTo() @@ -196,49 +189,52 @@ if (iscrizione != null) { - invalidCode = string.Empty; + invalidMessage = string.Empty; var result = await _dialogService.OpenAsync("Conferma Numero Partecipanti", new Dictionary() { { "RagioneSociale", iscrizione.RagioneSociale }, { "Partecipanti", iscrizione.Partecipanti } }, - new DialogOptions() { Width = "400px", CloseDialogOnOverlayClick = false } + new DialogOptions() { Width = "600px", CloseDialogOnOverlayClick = false } ); - if (result == null) await Reset(); + if (result != null) + { + var numPartecipanti = (int)result; - var numPartecipanti = (int)result; + iscrizione.ScanCompleto = true; + iscrizione.DataScan = DateTime.Now; + iscrizione.Partecipanti = numPartecipanti; + await _managerService.IscrizioneEventoService.Salva(iscrizione); - iscrizione.ScanCompleto = true; - iscrizione.DataScan = DateTime.Now; - iscrizione.Partecipanti = numPartecipanti; - await _managerService.IscrizioneEventoService.Salva(iscrizione); - - await Reset(); + confirmationMessage = $"La presenza di {iscrizione.RagioneSociale} รจ confermata con {iscrizione.Partecipanti} partecipanti "; + StateHasChanged(); + } } else { - invalidCode = "Codice non trovato."; + invalidMessage = "Codice non trovato."; } } else { - invalidCode = "Il codice inserito non risulta corretto!"; + if (!string.IsNullOrEmpty(registrationCode.Trim())) + invalidMessage = "Il codice inserito non risulta corretto!"; } - } - private async Task UndoChoice() - { - openManual = false; - registrationCode = string.Empty; - await StopScan(); - openScan = false; + if (openScan) + { + isScanning = false; + await StartScan(); + } } private async Task OnScan() { + openManual = false; openScan = true; + // Delay per crazione tag