diff --git a/assets/js/main.js b/assets/js/main.js index ead9433..45bb5fc 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -582,6 +582,28 @@ document.addEventListener('DOMContentLoaded', () => { updateCart(); }; + window.clearCart = function() { + if (cart.length === 0) return; + Swal.fire({ + title: 'Clear Cart?', + text: "Are you sure you want to remove all items from the cart?", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#dc3545', + cancelButtonColor: '#6c757d', + confirmButtonText: 'Yes, clear it!' + }).then((result) => { + if (result.isConfirmed) { + cart = []; + cartDiscountInput.value = 0; + currentOrderId = null; + isLoyaltyRedemption = false; + updateCart(); + showToast("Cart cleared", "success"); + } + }); + }; + // --- Payment Selection Logic --- function renderPaymentMethods() { if (!paymentMethodsContainer) return; @@ -937,4 +959,4 @@ document.addEventListener('DOMContentLoaded', () => { }); }); } -}); +}); \ No newline at end of file diff --git a/pos.php b/pos.php index 457a407..65a908f 100644 --- a/pos.php +++ b/pos.php @@ -252,65 +252,112 @@ if (!$loyalty_settings) { - -