add archive endpoint to user , driver , car ,order ,trip and update trip fails also update saidecar

This commit is contained in:
m7amedez5511
2026-07-02 19:04:51 +03:00
parent c33778012a
commit d225291b70
29 changed files with 2096 additions and 432 deletions

View File

@@ -22,6 +22,14 @@ function fmtDate(iso?: string | null): string {
return new Date(iso).toLocaleDateString("ar-SA", { year: "numeric", month: "long", day: "numeric" });
}
function fmtAmount(n?: string | number | null): string {
if (n == null) return "—";
const num = typeof n === "string" ? parseFloat(n) : n;
if (Number.isNaN(num)) return "—";
return `${num.toFixed(2)} ر.س`;
}
export function ArchivedOrderDetailModal({ order, onClose }: ArchivedOrderDetailModalProps) {
const s = ORDER_STATUS_MAP[order.currentStatus] ?? ORDER_STATUS_MAP.Created;
@@ -53,7 +61,7 @@ export function ArchivedOrderDetailModal({ order, onClose }: ArchivedOrderDetail
<DetailRow label="اسم المستلم" value={order.recipientName} />
<DetailRow label="رقم الجوال" value={order.recipientPhone} mono />
<DetailRow label="الكمية" value={String(order.quantity)} />
<DetailRow label="الإجمالي الفرعي" value={order.subTotal != null ? `${order.subTotal.toFixed(2)} ر.س` : "—"} mono />
<DetailRow label="الإجمالي الفرعي" value={fmtAmount(order.subTotal)} mono />
<DetailRow label="تاريخ الإنشاء" value={fmtDate(order.createdAt)} />
<DetailRow label="آخر تحديث" value={fmtDate(order.updatedAt)} />

View File

@@ -4,9 +4,12 @@ import { Spinner } from "../../UI";
import { ORDER_STATUS_MAP } from "../OrderDetailBanel";
import type { ArchivedOrder } from "@/src/types/order";
function fmtAmount(n?: number | null): string {
function fmtAmount(n?: string | number | null): string {
if (n == null) return "—";
return `${n.toFixed(2)} ر.س`;
const num = typeof n === "string" ? parseFloat(n) : n;
if (Number.isNaN(num)) return "—";
return `${num.toFixed(2)} ر.س`;
}
const cardStyle: React.CSSProperties = {