Added localization
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
@using OneForMe.Services
|
||||
@inject LocalizationService Localizer
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create Order";
|
||||
ViewData["Title"] = Localizer["CreateOrder"];
|
||||
}
|
||||
|
||||
<div class="container mt-5">
|
||||
@@ -7,43 +10,43 @@
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow">
|
||||
<div class="card-body p-5">
|
||||
<h2 class="mb-4">Create New Order</h2>
|
||||
<h2 class="mb-4">@Localizer["CreateNewOrder"]</h2>
|
||||
|
||||
<form method="post" id="createOrderForm">
|
||||
<div class="mb-3">
|
||||
<label for="creatorName" class="form-label">Order Name</label>
|
||||
<label for="creatorName" class="form-label">@Localizer["OrderName"]</label>
|
||||
<input type="text" class="form-control" id="creatorName" name="creatorName" placeholder="e.g., Pizza Party" required>
|
||||
<small class="text-muted">Give your order a name</small>
|
||||
<small class="text-muted">@Localizer["GiveOrderName"]</small>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h5 class="mb-3">Menu Items</h5>
|
||||
<p class="text-muted">Add items that people can order</p>
|
||||
<h5 class="mb-3">@Localizer["MenuItems"]</h5>
|
||||
<p class="text-muted">@Localizer["AddItemsThatPeopleCanOrder"]</p>
|
||||
|
||||
<div id="itemsContainer">
|
||||
<div class="item-row mb-3">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" placeholder="Item name (e.g., Margherita Pizza)" name="itemNames[]">
|
||||
<input type="text" class="form-control" placeholder="@Localizer["EnterItemName"]" name="itemNames[]">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" class="form-control" placeholder="Price" name="itemPrices[]" step="0.01" min="0">
|
||||
<input type="number" class="form-control" placeholder="@Localizer["Price"]" name="itemPrices[]" step="0.01" min="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-secondary mb-3" id="addItemBtn">+ Add Another Item</button>
|
||||
<button type="button" class="btn btn-secondary mb-3" id="addItemBtn">+ @Localizer["AddMenuItem"]</button>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">Create Order</button>
|
||||
<a href="/Home/Dashboard" class="btn btn-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">@Localizer["CreateOrder"]</button>
|
||||
<a href="/Home/Dashboard" class="btn btn-secondary">@Localizer["Cancel"]</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -60,13 +63,13 @@ document.getElementById('addItemBtn').addEventListener('click', function() {
|
||||
newRow.innerHTML = `
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" placeholder="Item name" name="itemNames[]">
|
||||
<input type="text" class="form-control" placeholder="@Localizer["ItemName"]" name="itemNames[]">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" class="form-control" placeholder="Price" name="itemPrices[]" step="0.01" min="0">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="this.closest('.item-row').remove()">Remove</button>
|
||||
<input type="number" class="form-control" placeholder="@Localizer["Price"]" name="itemPrices[]" step="0.01" min="0">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="this.closest('.item-row').remove()">@Localizer["Remove"]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
@@ -1,7 +1,10 @@
|
||||
@using OneForMe.Services
|
||||
@inject LocalizationService Localizer
|
||||
|
||||
@model OneForMe.Models.Order
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Join Order";
|
||||
ViewData["Title"] = Localizer["JoinOrder"];
|
||||
}
|
||||
|
||||
<div class="container mt-5">
|
||||
@@ -10,14 +13,14 @@
|
||||
<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 class="text-muted">@Localizer["Code"]: <strong>@Model.OrderCode</strong></p>
|
||||
<p>@Localizer["CreatedBy"]: <strong>@Model.CreatorName</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="mb-0">Available Items</h5>
|
||||
<h5 class="mb-0">@Localizer["MenuItems"]</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (Model.MenuItems.Any())
|
||||
@@ -26,19 +29,19 @@
|
||||
<input type="hidden" name="orderId" value="@Model.Id">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="participantName" class="form-label">Your Name</label>
|
||||
<input type="text" class="form-control" id="participantName" name="participantName" placeholder="Enter your name" required>
|
||||
<label for="participantName" class="form-label">@Localizer["YourName"]</label>
|
||||
<input type="text" class="form-control" id="participantName" name="participantName" placeholder="@Localizer["EnterYourName"]" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="participantEmail" class="form-label">Your Email (optional)</label>
|
||||
<input type="email" class="form-control" id="participantEmail" name="participantEmail" placeholder="Enter your email">
|
||||
<label for="participantEmail" class="form-label">@Localizer["YourEmail"]</label>
|
||||
<input type="email" class="form-control" id="participantEmail" name="participantEmail" placeholder="@Localizer["EnterYourEmail"]">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="menuItemId" class="form-label">Select Item</label>
|
||||
<label for="menuItemId" class="form-label">@Localizer["SelectItem"]</label>
|
||||
<select class="form-select" id="menuItemId" name="menuItemId" required onchange="updatePrice()">
|
||||
<option value="">-- Choose an item --</option>
|
||||
<option value="">-- @Localizer["ChooseAnItem"] --</option>
|
||||
@foreach (var item in Model.MenuItems)
|
||||
{
|
||||
<option value="@item.Id" data-price="@item.Price.ToString("F2")">@item.Name - $@item.Price.ToString("F2")</option>
|
||||
@@ -47,21 +50,21 @@
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="quantity" class="form-label">Quantity</label>
|
||||
<label for="quantity" class="form-label">@Localizer["Qty"]</label>
|
||||
<input type="number" class="form-control" id="quantity" name="quantity" value="1" min="1" required>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Total:</strong> $<span id="totalPrice">0.00</span>
|
||||
<strong>@Localizer["Total"]:</strong> $<span id="totalPrice">0.00</span>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success">Add to Order</button>
|
||||
<a href="/Home/Dashboard" class="btn btn-secondary">Back to Dashboard</a>
|
||||
<button type="submit" class="btn btn-success">@Localizer["AddToOrder"]</button>
|
||||
<a href="/Home/Dashboard" class="btn btn-secondary">@Localizer["BackToDashboard"]</a>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="text-muted">No items available for this order</p>
|
||||
<p class="text-muted">@Localizer["NoItemsAvailable"]</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +73,7 @@
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header bg-info text-white">
|
||||
<h5 class="mb-0">Current Orders (@Model.OrderItems.Count)</h5>
|
||||
<h5 class="mb-0">@Localizer["CurrentOrders"] (@Model.OrderItems.Count)</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (Model.OrderItems.Any())
|
||||
@@ -78,10 +81,10 @@
|
||||
<table class="table table-sm table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Item</th>
|
||||
<th>Qty</th>
|
||||
<th>Total</th>
|
||||
<th>@Localizer["Participant"]</th>
|
||||
<th>@Localizer["Item"]</th>
|
||||
<th>@Localizer["Qty"]</th>
|
||||
<th>@Localizer["Total"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -91,7 +94,7 @@
|
||||
<td>@orderItem.ParticipantName</td>
|
||||
<td>@orderItem.MenuItem?.Name</td>
|
||||
<td>@orderItem.Quantity</td>
|
||||
<td>$@(orderItem.MenuItem?.Price * orderItem.Quantity ?? 0).ToString("F2")</td>
|
||||
<td>$@((orderItem.MenuItem?.Price * orderItem.Quantity ?? 0).ToString("F2"))</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@@ -103,8 +106,8 @@
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Person</th>
|
||||
<th>Owes</th>
|
||||
<th>@Localizer["Person"]</th>
|
||||
<th>@Localizer["Owes"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -121,14 +124,14 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="text-muted">No one has ordered yet</p>
|
||||
<p class="text-muted">@Localizer["NoOrdersYet"]</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<h5>Order Total</h5>
|
||||
<h5>@Localizer["OrderTotal"]</h5>
|
||||
<h3 class="text-success">$@Model.OrderItems.Sum(oi => oi.MenuItem.Price * oi.Quantity).ToString("F2")</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user