fix(pos-selfpay): add Confirmar button after payment + print-only receipt

This commit is contained in:
Deploy
2026-08-26 22:11:08 +02:00
parent eb655e109f
commit 971411e1c2

View File

@@ -1659,19 +1659,32 @@ export default function RegisterPage() {
)}
{/* POS-SELFPAY-FLOW: in selfpay mode, hide payment methods until email is captured */}
{(!isSelfpayMode || selfpayPaymentReady) && (
<div className="mt-3 grid grid-cols-2 gap-2">
{config.paymentMethods.map((method) => (
<>
<div className="mt-3 grid grid-cols-2 gap-2">
{config.paymentMethods.map((method) => (
<button
key={method.id}
type="button"
onClick={() => setPaymentMethod(method)}
disabled={cart.length === 0 || processing || remainingCents === 0}
className={`min-h-14 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'}`}
>
{method.kind === 'cash' ? '💵' : method.kind === 'card' ? '💳' : '◉'} {method.label}
</button>
))}
</div>
{/* POS-SELFPAY-FLOW: confirm button after payment added in selfpay */}
{isSelfpayMode && selfpayPaymentReady && !paymentMethod && (
<button
key={method.id}
type="button"
onClick={() => setPaymentMethod(method)}
disabled={cart.length === 0 || processing || remainingCents === 0}
className={`min-h-14 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'}`}
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"
>
{method.kind === 'cash' ? '💵' : method.kind === 'card' ? '💳' : '◉'} {method.label}
{processing ? 'Confirmando…' : '✅ Confirmar e imprimir'}
</button>
))}
</div>
)}
</>
)}
<div className="mt-3 grid grid-cols-2 gap-2">
{!isSelfpayMode && (
@@ -2119,8 +2132,13 @@ export default function RegisterPage() {
{receipt && (
<ReceiptModal
receipt={receipt}
initialEmail={customer?.email ?? receipt.customerEmail ?? ''}
initialEmail={
isSelfpayMode
? selfpayEmail || undefined
: customer?.email ?? receipt.customerEmail ?? ''
}
onDelivered={resetCashier}
showActions={!isSelfpayMode}
onReturn={
config?.session && config?.terminal
? (orderId, latest) => {