Added localization

This commit is contained in:
2025-11-29 22:34:54 +01:00
parent 6819d1e38b
commit f930d9e408
9 changed files with 605 additions and 91 deletions

View File

@@ -1,7 +1,10 @@
@using Microsoft.AspNetCore.Localization
@using OneForMe.Services
@inject LocalizationService Localizer
@model OneForMe.Models.Order
@{
ViewData["Title"] = "Order Details";
ViewData["Title"] = Model.CreatorName;
}
<div class="container mt-5">
@@ -10,15 +13,15 @@
<div class="card shadow mb-4">
<div class="card-body">
<h2>@Model.CreatorName</h2>
<p class="text-muted">Order Code: <strong>@Model.OrderCode</strong></p>
<p>Created by: <strong>@Model.CreatorName</strong></p>
<p>Status: <span class="badge @(Model.IsClosed ? "bg-danger" : "bg-success")">@(Model.IsClosed ? "Closed" : "Open")</span></p>
<p class="text-muted">@Localizer.Get("Code"): <strong>@Model.OrderCode</strong></p>
<p>@Localizer.Get("CreatedBy"): <strong>@Model.CreatorName</strong></p>
<p>@Localizer.Get("Status"): <span class="badge @(Model.IsClosed ? "bg-danger" : "bg-success")">@(Model.IsClosed ? Localizer.Get("Closed") : Localizer.Get("Open"))</span></p>
</div>
</div>
<div class="card shadow mb-4">
<div class="card-header bg-primary text-white">
<h5 class="mb-0">Menu Items</h5>
<h5 class="mb-0">@Localizer.Get("MenuItems")</h5>
</div>
<div class="card-body">
@if (Model.MenuItems.Any())
@@ -26,8 +29,8 @@
<table class="table table-hover">
<thead>
<tr>
<th>Item</th>
<th>Price</th>
<th>@Localizer.Get("Item")</th>
<th>@Localizer.Get("Price")</th>
</tr>
</thead>
<tbody>
@@ -43,14 +46,14 @@
}
else
{
<p class="text-muted">No items added yet</p>
<p class="text-muted">@Localizer.Get("NoItemsAdded")</p>
}
</div>
</div>
<div class="card shadow">
<div class="card-header bg-info text-white">
<h5 class="mb-0">Orders (@Model.OrderItems.Count)</h5>
<h5 class="mb-0">@Localizer.Get("Orders") (@Model.OrderItems.Count)</h5>
</div>
<div class="card-body">
@if (Model.OrderItems.Any())
@@ -58,10 +61,10 @@
<table class="table table-hover">
<thead>
<tr>
<th>Participant</th>
<th>Item</th>
<th>Qty</th>
<th>Total</th>
<th>@Localizer.Get("Participant")</th>
<th>@Localizer.Get("Item")</th>
<th>@Localizer.Get("Qty")</th>
<th>@Localizer.Get("Total")</th>
</tr>
</thead>
<tbody>
@@ -79,7 +82,7 @@
}
else
{
<p class="text-muted">No orders yet</p>
<p class="text-muted">@Localizer.Get("NoOrdersYet")</p>
}
</div>
</div>
@@ -88,27 +91,27 @@
<div class="col-md-4">
<div class="card shadow mb-4 bg-light">
<div class="card-body">
<h5>Share Order</h5>
<p>Send this link to others:</p>
<h5>@Localizer.Get("ShareOrder")</h5>
<p>@Localizer.Get("SendLinkToOthers")</p>
<div class="input-group">
<input type="text" class="form-control" id="shareLink" value="@(Context.Request.Scheme)://@(Context.Request.Host)/order/join?code=@Model.OrderCode" readonly>
<button class="btn btn-outline-primary" onclick="copyToClipboard()">Copy</button>
<button class="btn btn-outline-primary" onclick="copyToClipboard()">@Localizer.Get("Copy")</button>
</div>
</div>
</div>
<div class="card shadow mb-4">
<div class="card-body">
<h5>Quick Stats</h5>
<p>Total Items: <strong>@Model.MenuItems.Count</strong></p>
<p>Total Orders: <strong>@Model.OrderItems.Count</strong></p>
<p>Total Revenue: <strong>$@Model.OrderItems.Sum(oi => oi.MenuItem.Price * oi.Quantity).ToString("F2")</strong></p>
<h5>@Localizer.Get("QuickStats")</h5>
<p>@Localizer.Get("TotalItems"): <strong>@Model.MenuItems.Count</strong></p>
<p>@Localizer.Get("TotalOrders"): <strong>@Model.OrderItems.Count</strong></p>
<p>@Localizer.Get("TotalRevenue"): <strong>$@Model.OrderItems.Sum(oi => oi.MenuItem.Price * oi.Quantity).ToString("F2")</strong></p>
</div>
</div>
@if (!Model.IsClosed)
{
<a href="#" class="btn btn-danger w-100">Close Order</a>
<a href="#" class="btn btn-danger w-100">@Localizer.Get("CloseOrder")</a>
}
</div>
</div>
@@ -119,6 +122,6 @@ function copyToClipboard() {
const link = document.getElementById('shareLink');
link.select();
document.execCommand('copy');
alert('Link copied to clipboard!');
alert('@Localizer.Get("LinkCopied")');
}
</script>