fix(pos): show the post-payment receipt sheet (was rendered in the wrong view)
CI/CD / CI · API (dotnet build + test) (push) Has been cancelled
CI/CD / CI · Admin API (dotnet build) (push) Has been cancelled
CI/CD / CI · Dashboard (tsc) (push) Has been cancelled
CI/CD / CI · Admin Web (tsc) (push) Has been cancelled
CI/CD / CI · Website (tsc) (push) Has been cancelled
CI/CD / CI · Koja (tsc) (push) Has been cancelled
CI/CD / Deploy · all services (push) Has been cancelled
CI/CD / CI · API (dotnet build + test) (push) Has been cancelled
CI/CD / CI · Admin API (dotnet build) (push) Has been cancelled
CI/CD / CI · Dashboard (tsc) (push) Has been cancelled
CI/CD / CI · Admin Web (tsc) (push) Has been cancelled
CI/CD / CI · Website (tsc) (push) Has been cancelled
CI/CD / CI · Koja (tsc) (push) Has been cancelled
CI/CD / Deploy · all services (push) Has been cancelled
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 <noreply@anthropic.com>
This commit is contained in:
@@ -293,10 +293,14 @@ export function Pos2Screen() {
|
|||||||
notify.success(`پرداخت ${fmt(paid)} تومان ثبت شد`);
|
notify.success(`پرداخت ${fmt(paid)} تومان ثبت شد`);
|
||||||
queryClient.invalidateQueries({ queryKey: ["tables-board", cafeId] });
|
queryClient.invalidateQueries({ queryKey: ["tables-board", cafeId] });
|
||||||
queryClient.invalidateQueries({ queryKey: ["orders-open", cafeId] });
|
queryClient.invalidateQueries({ queryKey: ["orders-open", cafeId] });
|
||||||
backToBoard();
|
// Clear the cart + close the pay sheet, but STAY on the order view so the
|
||||||
// Keep the paid order id so the cashier can still print the receipt after
|
// payment-success sheet (which lives in this view) renders and the cashier
|
||||||
// the cart is cleared (the success sheet below uses it).
|
// can print the receipt. Going back to the board happens on dismiss.
|
||||||
|
clearSession();
|
||||||
|
setPayTarget(null);
|
||||||
|
setCartOpen(false);
|
||||||
if (!isLocalOrder(justPaidOrderId)) setPaidOrderId(justPaidOrderId);
|
if (!isLocalOrder(justPaidOrderId)) setPaidOrderId(justPaidOrderId);
|
||||||
|
else backToBoard();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof ApiClientError && e.code.startsWith("POS_DEVICE")) {
|
if (e instanceof ApiClientError && e.code.startsWith("POS_DEVICE")) {
|
||||||
notify.error(posDeviceMsg(e));
|
notify.error(posDeviceMsg(e));
|
||||||
@@ -616,7 +620,7 @@ export function Pos2Screen() {
|
|||||||
|
|
||||||
{paidOrderId && (
|
{paidOrderId && (
|
||||||
<div dir="rtl" className="fixed inset-0 z-[65] flex items-center justify-center p-4">
|
<div dir="rtl" className="fixed inset-0 z-[65] flex items-center justify-center p-4">
|
||||||
<div className="absolute inset-0 bg-black/50" onClick={() => setPaidOrderId(null)} />
|
<div className="absolute inset-0 bg-black/50" onClick={() => { setPaidOrderId(null); backToBoard(); }} />
|
||||||
<div className="relative w-full max-w-sm rounded-2xl bg-card p-6 text-center shadow-2xl">
|
<div className="relative w-full max-w-sm rounded-2xl bg-card p-6 text-center shadow-2xl">
|
||||||
<div className="mx-auto mb-3 flex size-14 items-center justify-center rounded-full bg-emerald-100 text-emerald-600">
|
<div className="mx-auto mb-3 flex size-14 items-center justify-center rounded-full bg-emerald-100 text-emerald-600">
|
||||||
<Check className="size-7" />
|
<Check className="size-7" />
|
||||||
@@ -633,7 +637,7 @@ export function Pos2Screen() {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setPaidOrderId(null)}
|
onClick={() => { setPaidOrderId(null); backToBoard(); }}
|
||||||
className="flex min-h-[48px] w-full items-center justify-center rounded-xl bg-muted text-sm font-medium text-foreground hover:bg-accent"
|
className="flex min-h-[48px] w-full items-center justify-center rounded-xl bg-muted text-sm font-medium text-foreground hover:bg-accent"
|
||||||
>
|
>
|
||||||
سفارش جدید
|
سفارش جدید
|
||||||
|
|||||||
Reference in New Issue
Block a user