Compare commits

..

5 commits

Author SHA1 Message Date
Max
a815a61460 changed date display in archive to dmy 2024-05-17 03:35:54 +02:00
Tea
810a35e646 missed some changes on last commit 2024-04-17 15:13:55 +02:00
Tea
ceaa1696fd Closes #4: Attempting to unlock orders when one has already been
marked as payed explains consequences and prompts for confirmation
2024-04-17 15:09:28 +02:00
Tea
4305800e09 closes #8 : price per piece displayed on list, order and edit pages 2024-04-16 20:20:06 +02:00
Tea
53e5a0ac25 closes #7
Global message supports markdown using commonmark notation
global message is now input using a TextArea so multiple lines can be
used
2024-04-16 18:51:22 +02:00
8 changed files with 76 additions and 23 deletions

View file

@ -18,7 +18,7 @@
<QuickGrid Pagination="Pagination" Items="@ArchiveService.GetAllEntries().AsQueryable()"> <QuickGrid Pagination="Pagination" Items="@ArchiveService.GetAllEntries().AsQueryable()">
@if (ShowDate) @if (ShowDate)
{ {
<PropertyColumn Property="@(e => e.date)" Format="yyyy.MM.dd" Sortable="true" InitialSortDirection="SortDirection.Descending" IsDefaultSortColumn="true" /> <PropertyColumn Property="@(e => e.date)" Format="dd.MM.yyyy" Sortable="true" InitialSortDirection="SortDirection.Descending" IsDefaultSortColumn="true" />
} }
@if (ShowPizzaTotal) @if (ShowPizzaTotal)
{ {

View file

@ -7,10 +7,19 @@
} }
@if (GlobalStuffService.Message.Length >= 2) @if (GlobalStuffService.Message.Length >= 2)
{ {
<p style="font-size: 1.5em; color: limegreen;"> @GlobalStuffService.Message </p> <div class="global_message"> @((MarkupString)Markdig.Markdown.ToHtml(GlobalStuffService.Message)) </div>
} }
<style>
.global_message > * {
color: limegreen;
}
.global_message > p {
font-size: 1.5em;
}
</style>
@code{ @code{
protected override void OnInitialized() protected override void OnInitialized()
{ {

View file

@ -12,20 +12,28 @@
<h4>Order Locking</h4> <h4>Order Locking</h4>
<button @onclick="ToggleOrdersLocked" class="btn btn-danger">
@if (GlobalStuffService.OrdersLocked) @if (GlobalStuffService.OrdersLocked)
{ {
<button @onclick="UnlockOrders" class="btn btn-danger">
<span>Unlock Orders</span> <span>Unlock Orders</span>
</button>
} }
else else
{ {
<button @onclick="LockOrders" class="btn btn-danger">
<span>Lock Orders</span> <span>Lock Orders</span>
}
</button> </button>
}
@if (ShowUnlockConfirmation)
{
<p style="font-size: 1em; 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 consequences. Unlock anyways</button>
}
<h4>Global Message</h4> <h4>Global Message</h4>
<InputText @bind-Value=GlobalMessage id="Message" /> <InputTextArea @bind-Value=GlobalMessage id="Message" />
<button @onclick="SetGlobalMessage"> <button @onclick="SetGlobalMessage">
Confirm Message Confirm Message
</button> </button>
@ -136,15 +144,33 @@
bool WrongDeletionPasscode = false; bool WrongDeletionPasscode = false;
string DeletionPasscode = ""; string DeletionPasscode = "";
bool ShowUnlockConfirmation = false;
void SaveNewPizzaConfig(EditContext editContext) void SaveNewPizzaConfig(EditContext editContext)
{ {
GlobalStuffService.SetConfig(PConfig); GlobalStuffService.SetConfig(PConfig);
GlobalStuffService.ShouldBalance = true; 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() void SetGlobalMessage()

View file

@ -27,7 +27,8 @@
<ValidationMessage For="() => Order.Name" /> <ValidationMessage For="() => Order.Name" />
</div> </div>
<label for="PiecesGroup" style="margin-top: 1em;">Pieces</label> <label for="PiecesGroup" style="margin-top: 1em;">Pieces</label>
<span style="font-size: 0.7em;">One slice = ca. @GlobalStuffService.GetSizeOfSliceInCM2().ToString("F0") cm<sup>2</sup></span> <span style="font-size: 0.6em; color: gray;">One slice = ca. @GlobalStuffService.GetSizeOfSliceInCM2().ToString("F0") cm<sup>2</sup></span>
<PricePerPieceDisplay />
<div class="row" id="PiecesGroup"> <div class="row" id="PiecesGroup">
<div class="form-group col"> <div class="form-group col">
<label for="meatPieces">🍖</label> <label for="meatPieces">🍖</label>
@ -49,7 +50,8 @@
<label for="priorityMeat" style="text-align:center;"> Priority </label> <label for="priorityMeat" style="text-align:center;"> Priority </label>
<p style="text-align:center; font-size: 0.8em; margin: 0;"> <p style="text-align:center; font-size: 0.8em; margin: 0;">
The balancing algorithm tries to avoid changes of the corresponding Variable <br /> The balancing algorithm tries to avoid changes of the corresponding Variable <br />
<i style="font-size: 0.8em;">E.g. If you want to only get pieces from your chosen category put the slider all the way to the left</i></p> <i style="font-size: 0.8em;">E.g. If you want to only get pieces from your chosen category put the slider all the way to the left</i>
</p>
<div class="priority-slider-container"> <div class="priority-slider-container">
<div> Category </div> <div> Category </div>

View file

@ -22,7 +22,8 @@
@Order.Name @Order.Name
</h3> </h3>
<label for="PiecesGroup" style="margin-top: 1em;">Pieces</label> <label for="PiecesGroup" style="margin-top: 1em;">Pieces</label>
<span style="font-size: 0.7em;">One slice = ca. @GlobalStuffService.GetSizeOfSliceInCM2().ToString("F0") cm<sup>2</sup></span> <span style="font-size: 0.6em; color: gray;">One slice = ca. @GlobalStuffService.GetSizeOfSliceInCM2().ToString("F0") cm<sup>2</sup></span>
<PricePerPieceDisplay />
<div class="row" id="PiecesGroup"> <div class="row" id="PiecesGroup">
<div class="form-group col"> <div class="form-group col">
<label for="meatPieces">🍖</label> <label for="meatPieces">🍖</label>

View file

@ -10,7 +10,10 @@
<PageTitle>Pizza List</PageTitle> <PageTitle>Pizza List</PageTitle>
<div style="display: flex; "> <div style="display: flex; ">
<div style="display: flex; flex-direction:column;">
<TotalPizzasDisplay /> <TotalPizzasDisplay />
<PricePerPieceDisplay />
</div>
<div style ="display: flex; flex-direction:column; margin-left:auto; align-items:flex-end;"> <div style ="display: flex; flex-direction:column; margin-left:auto; align-items:flex-end;">
<OrderButton /> <OrderButton />
<HelpButton /> <HelpButton />

View 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>

View file

@ -15,6 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="8.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">