document.addEventListener('DOMContentLoaded', function () { const barcodeInput = document.getElementById('barcode-scanner-input'); const productSearchInput = document.getElementById('product-search'); const productGrid = document.getElementById('product-grid'); const cartItemsContainer = document.getElementById('cart-items'); const cartItemCount = document.getElementById('cart-item-count'); const cartSubtotal = document.getElementById('cart-subtotal'); const cartTax = document.getElementById('cart-tax'); const cartTotal = document.getElementById('cart-total'); const completeSaleBtn = document.getElementById('complete-sale-btn'); const cancelSaleBtn = document.getElementById('cancel-sale-btn'); const printLastInvoiceBtn = document.getElementById('print-last-invoice-btn'); const cartPlaceholder = document.getElementById('cart-placeholder'); const productGridPlaceholder = document.getElementById('product-grid-placeholder'); let cart = []; const TAX_RATE = 0.00; // ========================================================================= // CORE FUNCTIONS // ========================================================================= const showToast = (message, type = 'success') => { // A simple toast notification function (can be replaced with a library) const toast = document.createElement('div'); toast.className = `toast show align-items-center text-white bg-${type} border-0`; toast.innerHTML = `
PKR ${parseFloat(product.price).toFixed(2)}
| Item | Qty | Price | Actions |
|---|---|---|---|
| ${item.name} | PKR ${parseFloat(item.price).toFixed(2)} |