From 89c38081e6b67364b5a2b73967b1854995965932 Mon Sep 17 00:00:00 2001 From: TheR00st3r Date: Wed, 13 Nov 2024 23:21:59 +0100 Subject: [PATCH] Add Initial Support for Revoke Tickets --- Models/Ticket.cs | 2 +- .../ParticipantSignInPlaceComponent.razor.cs | 6 +- Pages/Management.razor.cs | 13 +-- Pages/Settings.razor | 26 +++--- Pages/Settings.razor.cs | 82 +++++++++---------- Program.cs | 4 +- Services/ZXingBarcodeService.cs | 14 ++-- 7 files changed, 71 insertions(+), 76 deletions(-) diff --git a/Models/Ticket.cs b/Models/Ticket.cs index 89849e0..2dbc1c0 100644 --- a/Models/Ticket.cs +++ b/Models/Ticket.cs @@ -87,7 +87,7 @@ public class Participant : IStoreObject public Seat Seat { get; set; } [JsonPropertyName("revoked")] - public bool Revoked { get; set; } + public int Revoked { get; set; } } public class User diff --git a/Pages/Components/ParticipantSignInPlaceComponent.razor.cs b/Pages/Components/ParticipantSignInPlaceComponent.razor.cs index c33bb70..6cbd337 100644 --- a/Pages/Components/ParticipantSignInPlaceComponent.razor.cs +++ b/Pages/Components/ParticipantSignInPlaceComponent.razor.cs @@ -74,13 +74,13 @@ public bool IsPaid public bool IsCoronaChecked { - get => _SettingsService.RetrieveEnableTwoGVerification() ? SignInPlace != null && SignInPlace.CoronaCheck != default : true; + get => !_SettingsService.RetrieveEnableTwoGVerification() || SignInPlace != null && SignInPlace.CoronaCheck != default; set => ActionWithSave(() => SignInPlace.CoronaCheck = value ? DateTimeOffset.Now : default); } public bool IsCoronaTestChecked { - get => _SettingsService.RetrieveEnableCovidTest() ? SignInPlace != null && SignInPlace.CoronaTestCheck != default : true; + get => !_SettingsService.RetrieveEnableCovidTest() || SignInPlace != null && SignInPlace.CoronaTestCheck != default; set => ActionWithSave(() => SignInPlace.CoronaTestCheck = value ? DateTimeOffset.Now : default); } @@ -88,7 +88,7 @@ public bool IsCoronaTestChecked public bool IsTermsChecked { - get => _SettingsService.RetrieveEnableTermsChecked() ? SignInPlace != null && SignInPlace.Terms != default : true; + get => !_SettingsService.RetrieveEnableTermsChecked() || SignInPlace != null && SignInPlace.Terms != default; set => ActionWithSave(() => SignInPlace.Terms = value ? DateTimeOffset.Now : default); } diff --git a/Pages/Management.razor.cs b/Pages/Management.razor.cs index 6f4ced4..d5ce8a5 100644 --- a/Pages/Management.razor.cs +++ b/Pages/Management.razor.cs @@ -1,8 +1,8 @@ -using Microsoft.JSInterop; using EventulaEntranceClient.Services; -using Microsoft.AspNetCore.WebUtilities; -using Microsoft.AspNetCore.Components; using EventulaEntranceClient.Services.Interfaces; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.WebUtilities; +using Microsoft.JSInterop; using System.Timers; namespace EventulaEntranceClient.Pages; @@ -36,7 +36,7 @@ public partial class Management private EventulaApiService _EventulaApiService { get; set; } [Inject] - private SettingsService _SettingsService{ get; set; } + private SettingsService _SettingsService { get; set; } [Inject] @@ -50,7 +50,7 @@ public partial class Management private string _LastTicket = string.Empty; - public List ParticipantSignInPlaces { get; set; } + public List ParticipantSignInPlaces { get; set; } public List Participants { get; set; } = new List(); @@ -190,8 +190,9 @@ public async Task ProcessImage(string imageString) var ticketRequest = await _EventulaApiService.RequestTicket(qrCode).ConfigureAwait(false); if (ticketRequest?.Participant != null) { - if(ticketRequest.Participant.Revoked) + if (ticketRequest.Participant.Revoked != 0) { + // Todo Add Participant but disallow them to sign in await _JSRuntime.InvokeAsync("PlayAudio", "revokedParticipantSound"); } else diff --git a/Pages/Settings.razor b/Pages/Settings.razor index a5acc99..82e69ba 100644 --- a/Pages/Settings.razor +++ b/Pages/Settings.razor @@ -2,49 +2,49 @@ -
+

Settings

- +
- +
- +
- +
-

+

- +
-

+

-

+

-

+

-

+

@@ -55,8 +55,8 @@
-