fix(pos-selfpay): direct payment + confirm from modal, no partial payments
This commit is contained in:
@@ -793,6 +793,7 @@ export default function RegisterPage() {
|
||||
setShowClearConfirm(false);
|
||||
setSelfpayPaymentReady(false);
|
||||
setSelfpayEmail('');
|
||||
setShowSelfpayPaymentMethods(false);
|
||||
};
|
||||
|
||||
const searchCustomers = async (query: string) => {
|
||||
@@ -1674,17 +1675,8 @@ export default function RegisterPage() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{/* POS-SELFPAY-FLOW: confirm button after payment added in selfpay */}
|
||||
{isSelfpayMode && selfpayPaymentReady && !paymentMethod && !showSelfpayPaymentMethods && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void confirmSale()}
|
||||
disabled={processing || cart.length === 0 || paidCents <= 0 || paidCents > totals.total}
|
||||
className="mt-3 w-full min-h-16 rounded-xl bg-[#1B4332] text-lg font-bold text-white disabled:opacity-40"
|
||||
>
|
||||
{processing ? 'Confirmando…' : '✅ Confirmar e imprimir'}
|
||||
</button>
|
||||
)}
|
||||
{/* POS-SELFPAY-FLOW: confirm button no longer needed — direct flow */}
|
||||
{/* (Removed: payment directly triggers confirmSale from the modal) */}
|
||||
<div className="mt-3 grid grid-cols-2 gap-2">
|
||||
{!isSelfpayMode && (
|
||||
<button
|
||||
@@ -1854,8 +1846,19 @@ export default function RegisterPage() {
|
||||
key={method.id}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
// POS-SELFPAY-FLOW: no partial payments — directly add full payment and confirm
|
||||
setShowSelfpayPaymentMethods(false);
|
||||
setPaymentMethod(method);
|
||||
const allocation: PaymentAllocation = {
|
||||
id: generateIdempotencyKey(),
|
||||
methodCode: method.code,
|
||||
methodLabel: method.label,
|
||||
kind: method.kind,
|
||||
amountCents: remainingCents,
|
||||
...(method.kind === 'cash' ? { tenderedCents: remainingCents } : {}),
|
||||
changeCents: 0,
|
||||
};
|
||||
setPayments([allocation]);
|
||||
void confirmSale();
|
||||
}}
|
||||
disabled={remainingCents === 0}
|
||||
className={`min-h-16 rounded-xl px-2 font-bold text-white disabled:opacity-40 ${method.kind === 'cash' ? 'bg-green-600' : method.kind === 'card' ? 'bg-blue-600' : 'bg-slate-700'}`}
|
||||
|
||||
Reference in New Issue
Block a user