From 1264606410242b44b70e149c1dc362025b0c3598 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Sun, 21 Jun 2026 22:17:14 +0330 Subject: [PATCH] fix(pos): show the post-payment receipt sheet (was rendered in the wrong view) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The payment-success sheet with the "چاپ فاکتور" button lives in the order-view return, but confirmPay called backToBoard() which switched to the board view — so the sheet never rendered and the cashier couldn't print after paying. Now payment clears the cart + closes the pay sheet but STAYS on the order view, so the success sheet shows; returning to the board happens when the cashier taps "سفارش جدید" or the backdrop. Offline/local orders still go straight to the board. Co-Authored-By: Claude Opus 4.8 --- web/dashboard/src/components/pos2/pos2-screen.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/dashboard/src/components/pos2/pos2-screen.tsx b/web/dashboard/src/components/pos2/pos2-screen.tsx index 839607e..4155912 100644 --- a/web/dashboard/src/components/pos2/pos2-screen.tsx +++ b/web/dashboard/src/components/pos2/pos2-screen.tsx @@ -293,10 +293,14 @@ export function Pos2Screen() { notify.success(`پرداخت ${fmt(paid)} تومان ثبت شد`); queryClient.invalidateQueries({ queryKey: ["tables-board", cafeId] }); queryClient.invalidateQueries({ queryKey: ["orders-open", cafeId] }); - backToBoard(); - // Keep the paid order id so the cashier can still print the receipt after - // the cart is cleared (the success sheet below uses it). + // Clear the cart + close the pay sheet, but STAY on the order view so the + // payment-success sheet (which lives in this view) renders and the cashier + // can print the receipt. Going back to the board happens on dismiss. + clearSession(); + setPayTarget(null); + setCartOpen(false); if (!isLocalOrder(justPaidOrderId)) setPaidOrderId(justPaidOrderId); + else backToBoard(); } catch (e) { if (e instanceof ApiClientError && e.code.startsWith("POS_DEVICE")) { notify.error(posDeviceMsg(e)); @@ -616,7 +620,7 @@ export function Pos2Screen() { {paidOrderId && (
-
setPaidOrderId(null)} /> +
{ setPaidOrderId(null); backToBoard(); }} />
@@ -633,7 +637,7 @@ export function Pos2Screen() {