Closes #4: Attempting to unlock orders when one has already been
marked as payed explains consequences and prompts for confirmation
This commit is contained in:
parent
4305800e09
commit
ceaa1696fd
2 changed files with 48 additions and 11 deletions
|
|
@ -12,16 +12,24 @@
|
|||
|
||||
|
||||
<h4>Order Locking</h4>
|
||||
<button @onclick="ToggleOrdersLocked" class="btn btn-danger">
|
||||
@if (GlobalStuffService.OrdersLocked)
|
||||
{
|
||||
<button @onclick="UnlockOrders" class="btn btn-danger">
|
||||
<span>Unlock Orders</span>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button @onclick="LockOrders" class="btn btn-danger">
|
||||
<span>Lock Orders</span>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
|
||||
@if (ShowUnlockConfirmation)
|
||||
{
|
||||
<p style="font-size: 2em; color: red;">Order(s) have already been marked as payed. If you unlock payment information WILL be lost!</p>
|
||||
<button @onclick="ConfirmedUnlockOrders" class="btn btn-danger">I understand the risks. Unlock anyways</button>
|
||||
}
|
||||
|
||||
|
||||
<h4>Global Message</h4>
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
11
PizzaBot/Components/PricePerPieceDisplay.razor
Normal file
11
PizzaBot/Components/PricePerPieceDisplay.razor
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@inject GlobalStuffService GlobalStuffService
|
||||
@using System.Globalization
|
||||
|
||||
<p>Price per 🍕: @((GlobalStuffService.GetConfig().Price / (GlobalStuffService.GetConfig().Fragments * 100.0f)).ToString("C2", CultureInfo.CreateSpecificCulture("de-DE")))</p>
|
||||
|
||||
<style>
|
||||
p{
|
||||
font-size: 0.6em;
|
||||
color: gray;
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue