Added order item delete functionality

This commit is contained in:
2025-11-30 17:38:28 +01:00
parent bfda6dae0b
commit 8ad3085833
5 changed files with 49 additions and 1 deletions

View File

@@ -94,7 +94,7 @@
<div class="col-md-6 mb-3">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">@order.Name</h5>
<h5 class="card-title">@order.Name <span class="badge @(order.IsCompleted ? "bg-success" : "bg-warning text-dark")" style="float: right">@Localizer.Get(order.IsClosed ? (order.IsCompleted ? "Completed" : "Closed") : "Open")</span></h5>
<p class="card-text">
<small class="text-muted">@Localizer.Get("Code"): <strong>@order.OrderCode</strong></small><br>
<small class="text-muted">@Localizer.Get("CreatedBy"): @order.CreatorName</small><br>

View File

@@ -106,7 +106,9 @@
<th>@Localizer.Get("Participant")</th>
<th>@Localizer.Get("Item")</th>
<th>@Localizer.Get("Qty")</th>
<th>@Localizer.Get("Comments")</th>
<th>@Localizer.Get("Total")</th>
<th>@Localizer.Get("Actions")</th>
</tr>
</thead>
<tbody>
@@ -116,7 +118,17 @@
<td>@orderItem.ParticipantName</td>
<td>@orderItem.MenuItem?.Name</td>
<td>@orderItem.Quantity</td>
<td>@orderItem.Comments</td>
<td>@Localizer["Currency", (orderItem.MenuItem?.Price * orderItem.Quantity ?? 0).ToString("F2")]</td>
<td>
@if (User.Identity?.Name == orderItem.ParticipantEmail)
{
<form method="post" action="/order/deleteitem" onsubmit="return confirm('@Localizer.Get("ConfirmDeleteOrderItem")');">
<input type="hidden" name="orderItemId" value="@orderItem.Id" />
<button type="submit" class="btn btn-sm btn-danger">@Localizer.Get("Delete")</button>
</form>
}
</td>
</tr>
}
</tbody>