diff --git a/PizzaBot/Components/Pages/Admin.razor b/PizzaBot/Components/Pages/Admin.razor index 85498d0..737dba3 100644 --- a/PizzaBot/Components/Pages/Admin.razor +++ b/PizzaBot/Components/Pages/Admin.razor @@ -12,16 +12,24 @@

Order Locking

- +} +else +{ + + +} + +@if (ShowUnlockConfirmation) +{ +

Order(s) have already been marked as payed. If you unlock payment information WILL be lost!

+ +}

Global Message

@@ -136,15 +144,33 @@ bool WrongDeletionPasscode = false; string DeletionPasscode = ""; + bool ShowUnlockConfirmation = false; + void SaveNewPizzaConfig(EditContext editContext) { GlobalStuffService.SetConfig(PConfig); GlobalStuffService.ShouldBalance = true; } - void ToggleOrdersLocked() + void LockOrders() { - GlobalStuffService.SetOrdersLocked(!GlobalStuffService.OrdersLocked); + GlobalStuffService.SetOrdersLocked(true); + } + + void UnlockOrders() + { + if(PizzaDBService.GetAllResults().Where(o => o.hasPaid).Count() > 0) + { + ShowUnlockConfirmation = true; + return; + } + GlobalStuffService.SetOrdersLocked(false); + } + + void ConfirmedUnlockOrders() + { + ShowUnlockConfirmation = false; + GlobalStuffService.SetOrdersLocked(false); } void SetGlobalMessage() @@ -164,4 +190,4 @@ { PConfig = GlobalStuffService.GetConfig() ?? new PizzaConfig(); } -} \ No newline at end of file + } diff --git a/PizzaBot/Components/PricePerPieceDisplay.razor b/PizzaBot/Components/PricePerPieceDisplay.razor new file mode 100644 index 0000000..cbc550d --- /dev/null +++ b/PizzaBot/Components/PricePerPieceDisplay.razor @@ -0,0 +1,11 @@ +@inject GlobalStuffService GlobalStuffService +@using System.Globalization + +

Price per 🍕: @((GlobalStuffService.GetConfig().Price / (GlobalStuffService.GetConfig().Fragments * 100.0f)).ToString("C2", CultureInfo.CreateSpecificCulture("de-DE")))

+ +