Features Added: - Standard e-commerce properties (Price, Weight, shipping fields) - Order management with Create/Edit views and shipping information - ShippingRates system for weight-based shipping calculations - Comprehensive test coverage with JWT authentication tests - Sample data seeder with 5 orders demonstrating full workflow - Photo upload functionality for products - Multi-cryptocurrency payment support (BTC, XMR, USDT, etc.) Database Changes: - Added ShippingRates table - Added shipping fields to Orders (Name, Address, City, PostCode, Country) - Renamed properties to standard names (BasePrice to Price, ProductWeight to Weight) - Added UpdatedAt timestamps to models UI Improvements: - Added Create/Edit views for Orders - Added ShippingRates management UI - Updated navigation menu with Shipping option - Enhanced Order Details view with shipping information Sample Data: - 3 Categories (Electronics, Clothing, Books) - 5 Products with various prices - 5 Shipping rates (Royal Mail options) - 5 Orders in different statuses (Pending to Delivered) - 3 Crypto payments demonstrating payment flow Security: - All API endpoints secured with JWT authentication - No public endpoints - client apps must authenticate - Privacy-focused design with minimal data collection Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
218 lines
10 KiB
Plaintext
218 lines
10 KiB
Plaintext
@model LittleShop.DTOs.OrderDto
|
|
|
|
@{
|
|
ViewData["Title"] = "Edit Order";
|
|
}
|
|
|
|
<div class="row mb-4">
|
|
<div class="col">
|
|
<h1><i class="fas fa-edit"></i> Edit Order #@Model?.Id</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h5><i class="fas fa-user"></i> Order Information</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post" asp-area="Admin" asp-controller="Orders" asp-action="Edit" asp-route-id="@Model?.Id">
|
|
@Html.AntiForgeryToken()
|
|
@if (ViewData.ModelState[""] != null && ViewData.ModelState[""].Errors.Count > 0)
|
|
{
|
|
<div class="alert alert-danger" role="alert">
|
|
@foreach (var error in ViewData.ModelState[""].Errors)
|
|
{
|
|
<div>@error.ErrorMessage</div>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label class="form-label">Order ID</label>
|
|
<input class="form-control" value="@Model?.Id" readonly />
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label class="form-label">Customer Reference</label>
|
|
<input class="form-control" value="@Model?.IdentityReference" readonly />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h6 class="mt-4 mb-3">Shipping Information</h6>
|
|
|
|
<div class="mb-3">
|
|
<label for="ShippingName" class="form-label">Recipient Name</label>
|
|
<input name="ShippingName" id="ShippingName" value="@Model?.ShippingName" class="form-control" required />
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="ShippingAddress" class="form-label">Shipping Address</label>
|
|
<textarea name="ShippingAddress" id="ShippingAddress" class="form-control" rows="2" required>@Model?.ShippingAddress</textarea>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="ShippingCity" class="form-label">City</label>
|
|
<input name="ShippingCity" id="ShippingCity" value="@Model?.ShippingCity" class="form-control" required />
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="ShippingPostCode" class="form-label">Post Code</label>
|
|
<input name="ShippingPostCode" id="ShippingPostCode" value="@Model?.ShippingPostCode" class="form-control" required />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="ShippingCountry" class="form-label">Country</label>
|
|
<input name="ShippingCountry" id="ShippingCountry" value="@Model?.ShippingCountry" class="form-control" required />
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="Status" class="form-label">Order Status</label>
|
|
<select name="Status" id="Status" class="form-select">
|
|
<option value="0" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.PendingPayment)">Pending Payment</option>
|
|
<option value="1" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.PaymentReceived)">Payment Received</option>
|
|
<option value="2" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.Processing)">Processing</option>
|
|
<option value="3" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.Shipped)">Shipped</option>
|
|
<option value="4" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.Delivered)">Delivered</option>
|
|
<option value="5" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.Cancelled)">Cancelled</option>
|
|
<option value="6" selected="@(Model?.Status == LittleShop.Enums.OrderStatus.Refunded)">Refunded</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="TrackingNumber" class="form-label">Tracking Number</label>
|
|
<input name="TrackingNumber" id="TrackingNumber" value="@Model?.TrackingNumber" class="form-control" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="Notes" class="form-label">Order Notes</label>
|
|
<textarea name="Notes" id="Notes" class="form-control" rows="3">@Model?.Notes</textarea>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<a href="@Url.Action("Details", new { id = Model?.Id })" class="btn btn-secondary">
|
|
<i class="fas fa-arrow-left"></i> Back to Details
|
|
</a>
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fas fa-save"></i> Save Changes
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Order Items -->
|
|
<div class="card mt-4">
|
|
<div class="card-header">
|
|
<h5><i class="fas fa-shopping-cart"></i> Order Items</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
@if (Model?.Items?.Any() == true)
|
|
{
|
|
<div class="table-responsive">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Product</th>
|
|
<th>Quantity</th>
|
|
<th>Unit Price</th>
|
|
<th>Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model.Items)
|
|
{
|
|
<tr>
|
|
<td>@item.ProductName</td>
|
|
<td>@item.Quantity</td>
|
|
<td>£@item.UnitPrice</td>
|
|
<td>£@item.TotalPrice</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th colspan="3">Total Amount</th>
|
|
<th>£@Model.TotalAmount</th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<p class="text-muted">No items in this order.</p>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h5><i class="fas fa-info-circle"></i> Order Summary</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<dl>
|
|
<dt>Created</dt>
|
|
<dd>@Model?.CreatedAt.ToString("dd/MM/yyyy HH:mm")</dd>
|
|
|
|
<dt>Updated</dt>
|
|
<dd>@Model?.UpdatedAt.ToString("dd/MM/yyyy HH:mm")</dd>
|
|
|
|
@if (Model?.PaidAt != null)
|
|
{
|
|
<dt>Paid</dt>
|
|
<dd>@Model.PaidAt.Value.ToString("dd/MM/yyyy HH:mm")</dd>
|
|
}
|
|
|
|
@if (Model?.ShippedAt != null)
|
|
{
|
|
<dt>Shipped</dt>
|
|
<dd>@Model.ShippedAt.Value.ToString("dd/MM/yyyy HH:mm")</dd>
|
|
}
|
|
|
|
<dt>Total Amount</dt>
|
|
<dd class="h5">£@Model?.TotalAmount</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Payment Information -->
|
|
@if (Model?.Payments?.Any() == true)
|
|
{
|
|
<div class="card mt-3">
|
|
<div class="card-header">
|
|
<h5><i class="fas fa-credit-card"></i> Payments</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
@foreach (var payment in Model.Payments)
|
|
{
|
|
<div class="mb-2">
|
|
<span class="badge bg-info">@payment.Currency</span>
|
|
<span class="badge @(payment.Status == LittleShop.Enums.PaymentStatus.Paid ? "bg-success" : "bg-warning")">
|
|
@payment.Status
|
|
</span>
|
|
<small class="d-block mt-1">Amount: @payment.RequiredAmount</small>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div> |