From a02b3ea7cc243029478e48a75496981ad7017cc1 Mon Sep 17 00:00:00 2001 From: MMD Date: Wed, 23 Sep 2026 22:01:14 +0330 Subject: [PATCH] fix(edit-modal): restore the proforma upload section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proforma FileList existed in prod_v5 (a181a87) but was dropped when the prod_v2 EditModal redesign (de177f3) was merged — that branch predates the feature and its version of the file was taken wholesale to keep the new tabbed layout, silently discarding the proforma block. Restores the state, the load effect, the saved patch field and the upload UI (on the تاریخ tab, next to the invoice card), using the current authenticated download/preview helpers rather than the removed urlOf. --- frontend/src/pages/Dashboard/EditModal.tsx | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frontend/src/pages/Dashboard/EditModal.tsx b/frontend/src/pages/Dashboard/EditModal.tsx index 1d536c3..6b10617 100644 --- a/frontend/src/pages/Dashboard/EditModal.tsx +++ b/frontend/src/pages/Dashboard/EditModal.tsx @@ -86,6 +86,7 @@ export function EditModal({ quoteId, onClose }: EditModalProps) { const [selectedProjects, setSelectedProjects] = useState([]); const [notes, setNotes] = useState(""); const [invoices, setInvoices] = useState([]); + const [proformas, setProformas] = useState([]); const [itemRows, setItemRows] = useState([]); const [tsCards, setTsCards] = useState([]); const [quoteDate, setQuoteDate] = useState(null); @@ -189,6 +190,10 @@ export function EditModal({ quoteId, onClose }: EditModalProps) { .list(quoteId, "invoice") .then((list) => alive && setInvoices(list)) .catch(() => alive && setInvoices([])); + void api.files + .list(quoteId, "proforma") + .then((list) => alive && setProformas(list)) + .catch(() => alive && setProformas([])); return () => { alive = false; }; @@ -314,6 +319,7 @@ export function EditModal({ quoteId, onClose }: EditModalProps) { next.projects = [...selectedProjects]; next.notes = notes.trim(); next.invoices = invoices; + next.proformas = proformas; const tsIdMap: Record = {}; const newTermsheets: Termsheet[] = []; @@ -865,6 +871,25 @@ export function EditModal({ quoteId, onClose }: EditModalProps) { loadPreview={(a) => api.files.previewUrl(q.id, "invoice", a.id!)} /> + + {/* پیش‌فاکتورها — در همه‌ی مراحل چرخه‌ی پیشنهاد قابل افزودن/ویرایش است */} +
+
پیش‌فاکتورها
+ api.files.upload(q.id, "proforma", f)} + onDelete={(a) => + a.id && + void api.files.remove(q.id, "proforma", a.id).catch((err) => + toast.error(err instanceof Error ? err.message : "حذف پیش‌فاکتور ناموفق بود"), + ) + } + onDownload={(a) => api.files.download(q.id, "proforma", a.id!, a.name)} + loadPreview={(a) => api.files.previewUrl(q.id, "proforma", a.id!)} + label="افزودن پیش‌فاکتور" + /> +
)}