Add paidAt field and display to order details and table

Introduces the optional 'paidAt' field to the Order interface and updates both the order details page and the order table to display the payment date. Also adds sorting by 'paidAt' in the order table and improves date formatting for both order and payment dates.
This commit is contained in:
NotII
2025-07-26 22:32:47 +02:00
parent 639277dc2b
commit f1e7583219
2 changed files with 55 additions and 2 deletions

View File

@@ -53,6 +53,8 @@ interface Order {
totalItemPrice: number;
}>;
totalPrice: number;
orderDate: Date;
paidAt?: Date;
trackingNumber?: string;
telegramUsername?: string;
telegramBuyerId?: string;
@@ -774,6 +776,43 @@ export default function OrderDetailsPage() {
{/* Right Column - Actions and Status */}
<div className="space-y-6">
{/* Order Information Card */}
<Card>
<CardHeader>
<CardTitle className="text-lg font-medium">Order Information</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
<div>
<Label className="text-sm font-medium text-zinc-500">Order Date</Label>
<div className="text-sm mt-1">
{order?.orderDate ? new Date(order.orderDate).toLocaleDateString("en-GB", {
day: '2-digit',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
hour12: false
}) : "-"}
</div>
</div>
{order?.paidAt && (
<div>
<Label className="text-sm font-medium text-zinc-500">Paid At</Label>
<div className="text-sm mt-1 text-green-600 font-medium">
{new Date(order.paidAt).toLocaleDateString("en-GB", {
day: '2-digit',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
hour12: false
})}
</div>
</div>
)}
</CardContent>
</Card>
{/* Order Actions Card */}
<Card>
<CardHeader>