diff --git a/artifacts/tx-os/public/opengraph.jpg b/artifacts/tx-os/public/opengraph.jpg index 4aa3e468..4ebcab26 100644 Binary files a/artifacts/tx-os/public/opengraph.jpg and b/artifacts/tx-os/public/opengraph.jpg differ diff --git a/artifacts/tx-os/src/components/order-service-modal.tsx b/artifacts/tx-os/src/components/order-service-modal.tsx index ca3bf371..6cc6ad2e 100644 --- a/artifacts/tx-os/src/components/order-service-modal.tsx +++ b/artifacts/tx-os/src/components/order-service-modal.tsx @@ -30,6 +30,7 @@ type Props = { imageUrl?: string | null; } | null; resolveImage: (url: string | null | undefined) => string | null; + initialNotes?: string | null; }; export function OrderServiceModal({ @@ -37,6 +38,7 @@ export function OrderServiceModal({ onOpenChange, service, resolveImage, + initialNotes, }: Props) { const { t, i18n } = useTranslation(); const lang = i18n.language; @@ -49,10 +51,10 @@ export function OrderServiceModal({ useEffect(() => { if (open) { - setNotes(""); + setNotes((initialNotes ?? "").slice(0, NOTES_MAX)); setImgErrored(false); } - }, [open, service?.id]); + }, [open, service?.id, initialNotes]); if (!service) return null; const name = lang === "ar" ? service.nameAr : service.nameEn; diff --git a/artifacts/tx-os/src/locales/ar.json b/artifacts/tx-os/src/locales/ar.json index 0efb5df0..208b3cb9 100644 --- a/artifacts/tx-os/src/locales/ar.json +++ b/artifacts/tx-os/src/locales/ar.json @@ -134,6 +134,7 @@ "cancelFailed": "تعذّر إلغاء الطلب", "restoreFailed": "تعذّر استعادة الطلب", "delete": "حذف", + "reorder": "اطلب مجددًا", "deleteConfirmTitle": "حذف هذا الطلب؟", "deleteConfirmBody": "سيتم حذف الطلب نهائياً من سجلّك.", "deleteConfirm": "نعم، احذف", diff --git a/artifacts/tx-os/src/locales/en.json b/artifacts/tx-os/src/locales/en.json index 58591b10..84262b38 100644 --- a/artifacts/tx-os/src/locales/en.json +++ b/artifacts/tx-os/src/locales/en.json @@ -134,6 +134,7 @@ "cancelFailed": "Could not cancel the order", "restoreFailed": "Could not restore the order", "delete": "Delete", + "reorder": "Reorder", "deleteConfirmTitle": "Delete this order?", "deleteConfirmBody": "This will permanently remove the order from your history.", "deleteConfirm": "Yes, delete", diff --git a/artifacts/tx-os/src/pages/my-orders.tsx b/artifacts/tx-os/src/pages/my-orders.tsx index 6ebeaf33..696a009b 100644 --- a/artifacts/tx-os/src/pages/my-orders.tsx +++ b/artifacts/tx-os/src/pages/my-orders.tsx @@ -21,8 +21,10 @@ import { PackageCheck, XCircle, Trash2, + RotateCcw, } from "lucide-react"; import { Button } from "@/components/ui/button"; +import { OrderServiceModal } from "@/components/order-service-modal"; import { AlertDialog, AlertDialogAction, @@ -156,9 +158,11 @@ function OrderImage({ function OrderCard({ order, onDelete, + onReorder, }: { order: ServiceOrder; onDelete: (id: number) => void; + onReorder: (order: ServiceOrder) => void; }) { const { t, i18n } = useTranslation(); const queryClient = useQueryClient(); @@ -172,7 +176,9 @@ function OrderCard({ const img = resolveServiceImageUrl(order.service.imageUrl); const cancellable = order.status === "pending" || order.status === "received"; - const deletable = isFinished(order.status); + const finished = isFinished(order.status); + const deletable = finished; + const reorderable = finished; const handleCancel = () => { const previousStatus = order.status; @@ -258,8 +264,19 @@ function OrderCard({ - {(cancellable || deletable) && ( + {(cancellable || finished) && (
+ {reorderable && ( + + )} {cancellable && (
@@ -585,6 +622,16 @@ export default function MyOrdersPage() { + + { + if (!o) setReorderTarget(null); + }} + service={reorderTarget?.service ?? null} + resolveImage={resolveServiceImageUrl} + initialNotes={reorderTarget?.notes ?? null} + /> ); }