diff --git a/index.php b/index.php index 749119f..46b4f3a 100644 --- a/index.php +++ b/index.php @@ -3751,6 +3751,7 @@ document.addEventListener('DOMContentLoaded', function() { }); } + const companySettings = ; const invoiceType = ''; initInvoiceForm('productSearchInput', 'searchSuggestions', 'invoiceItemsTableBody', 'grandTotal', 'subtotal', 'totalVat'); initInvoiceForm('editProductSearchInput', 'editSearchSuggestions', 'editInvoiceItemsTableBody', 'edit_grandTotal', 'edit_subtotal', 'edit_totalVat'); @@ -3818,21 +3819,54 @@ document.addEventListener('DOMContentLoaded', function() { `; }); + // Company Logo and Header Construction + const logoUrl = companySettings.company_logo || ''; + const logoImg = logoUrl ? `` : ''; + const companyName = companySettings.company_name || 'Accounting System'; + const companyAddress = (companySettings.company_address || '').replace(/\n/g, '
'); + const companyVat = companySettings.vat_number ? `

VAT: ${companySettings.vat_number}

` : ''; + const companyPhone = companySettings.company_phone ? `

Tel: ${companySettings.company_phone}

` : ''; + + // Quotation Header Construction + const quotDate = data.quotation_date; + const quotValid = data.valid_until || 'N/A'; + const quotNo = 'QUO-' + data.id.toString().padStart(5, '0'); + const customerName = data.customer_name || 'Walk-in Customer'; + const statusBadge = `${data.status.toUpperCase()}`; + content.innerHTML = `
-
-
-

QUOTATION

-

No: QUO-${data.id.toString().padStart(5, '0')}

-

Date: ${data.quotation_date}

-

Valid Until: ${data.valid_until || 'N/A'}

-
-
-

${data.customer_name || 'Walk-in Customer'}

-

Status: ${data.status.toUpperCase()}

+
+
+
+ ${logoImg} +

${companyName}

+

${companyAddress}

+ ${companyVat} + ${companyPhone} +
+
+

Quotation

+
${statusBadge}
+
+

No: ${quotNo}

+

Date: ${quotDate}

+

Valid Until: ${quotValid}

+
+
- + +
+
+
+

To

+
${customerName}
+
+
+
+ +
@@ -3859,10 +3893,11 @@ document.addEventListener('DOMContentLoaded', function() {
#
+
-

Terms & Conditions:

+

Terms & Conditions:

  • Quotation is valid until the date mentioned above.
  • Prices are inclusive of VAT where applicable.
  • @@ -3873,6 +3908,9 @@ document.addEventListener('DOMContentLoaded', function() {
+
+

Generated by ${companyName}

+
`; @@ -3899,7 +3937,6 @@ document.addEventListener('DOMContentLoaded', function() { editBtn.onclick = function() { const editModal = new bootstrap.Modal(document.getElementById('editQuotationModal')); modal.hide(); - // Trigger the existing edit button click logic or manually populate const originalEditBtn = document.querySelector(`.edit-quotation-btn[data-json*='"id":${data.id},']`) || document.querySelector(`.edit-quotation-btn[data-json*='"id":${data.id}']`); if (originalEditBtn) originalEditBtn.click(); @@ -4387,11 +4424,29 @@ document.addEventListener('DOMContentLoaded', function() { table:not(.table-formal), .bg-light:not(.invoice-info-card):not(.p-3), .modal-backdrop { display: none !important; } body { background: white !important; margin: 0 !important; padding: 0 !important; } .main-content { margin: 0 !important; padding: 0 !important; background: white !important; } - .modal { position: absolute !important; left: 0 !important; top: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; display: block !important; visibility: visible !important; background: white !important; } - #viewInvoiceModal { display: block !important; background: white !important; } - #viewInvoiceModal .modal-dialog { max-width: 100% !important; width: 100% !important; margin: 0 !important; padding: 0 !important; } - #viewInvoiceModal .modal-content { border: none !important; box-shadow: none !important; background: white !important; } - #viewInvoiceModal .modal-body { padding: 0 !important; margin: 0 !important; background: white !important; } + + /* Hide all modals by default */ + .modal { display: none !important; } + + /* Show ONLY the active modal */ + .modal.show { + position: absolute !important; + left: 0 !important; + top: 0 !important; + margin: 0 !important; + padding: 0 !important; + overflow: visible !important; + display: block !important; + visibility: visible !important; + background: white !important; + width: 100% !important; + height: 100% !important; + } + + .modal.show .modal-dialog { max-width: 100% !important; width: 100% !important; margin: 0 !important; padding: 0 !important; } + .modal.show .modal-content { border: none !important; box-shadow: none !important; background: white !important; } + .modal.show .modal-body { padding: 0 !important; margin: 0 !important; background: white !important; } + .table-bordered th, .table-bordered td { border: 1px solid #dee2e6 !important; } .bg-light { background-color: #f8f9fa !important; -webkit-print-color-adjust: exact; } .text-primary { color: #0d6efd !important; -webkit-print-color-adjust: exact; } @@ -4399,7 +4454,7 @@ document.addEventListener('DOMContentLoaded', function() { /* Ensure the modal is the only thing visible */ body > *:not(.main-content):not(.modal) { display: none !important; } - .main-content > *:not(#viewInvoiceModal):not(.modal) { display: none !important; } + .main-content > *:not(.modal) { display: none !important; } } .invoice-logo { max-height: 80px; width: auto; } .invoice-header { border-bottom: 2px solid #333; padding-bottom: 20px; } @@ -5099,27 +5154,7 @@ document.addEventListener('DOMContentLoaded', function() { }); - +