new updates
This commit is contained in:
parent
ed140fd00d
commit
653e954bbb
@ -44,7 +44,7 @@
|
||||
|
||||
if (value) {
|
||||
valueElement.textContent = value;
|
||||
container.style.display = 'block';
|
||||
container.style.display = '';
|
||||
} else {
|
||||
valueElement.textContent = '';
|
||||
container.style.display = 'none';
|
||||
@ -176,22 +176,28 @@
|
||||
const tr = document.createElement('tr');
|
||||
const englishName = escapeHtml(item.name_en || item.name || 'Item');
|
||||
const arabicName = escapeHtml(item.name_ar || '');
|
||||
const itemNameHtml = arabicName
|
||||
? `<div class="invoice-item-name">${englishName}</div><div class="invoice-item-secondary">${arabicName}</div>`
|
||||
: `<div class="invoice-item-name">${englishName}</div>`;
|
||||
const vatRateText = `${(Number.isFinite(parseFloat(item.vat_rate)) ? parseFloat(item.vat_rate) : 0).toFixed(2)}%`;
|
||||
const itemDetails = [];
|
||||
if (arabicName) {
|
||||
itemDetails.push(arabicName);
|
||||
}
|
||||
itemDetails.push(`VAT ${vatRateText}`);
|
||||
const itemNameHtml = `
|
||||
<div class="invoice-item-name">${englishName}</div>
|
||||
<div class="invoice-item-secondary">${itemDetails.join(' • ')}</div>
|
||||
`;
|
||||
|
||||
tr.innerHTML = `
|
||||
<td class="text-center invoice-line-no">${index + 1}</td>
|
||||
<td>${itemNameHtml}</td>
|
||||
<td class="text-center">${formatQty(item.quantity)}</td>
|
||||
<td class="text-end invoice-amount">${formatInvoiceCurrency(item.unit_price, 3)}</td>
|
||||
<td class="text-end">${(Number.isFinite(parseFloat(item.vat_rate)) ? parseFloat(item.vat_rate) : 0).toFixed(2)}%</td>
|
||||
<td class="text-end invoice-amount">${formatInvoiceCurrency(item.total_price, 3)}</td>
|
||||
`;
|
||||
body.appendChild(tr);
|
||||
});
|
||||
} else {
|
||||
body.innerHTML = '<tr><td colspan="6" class="text-center text-muted py-4">No invoice items / لا توجد أصناف</td></tr>';
|
||||
body.innerHTML = '<tr><td colspan="5" class="text-center text-muted py-4">No invoice items / لا توجد أصناف</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,7 +260,7 @@
|
||||
|
||||
if (Array.isArray(payments) && payments.length > 0) {
|
||||
if (paymentsBody) {
|
||||
payments.forEach((payment) => {
|
||||
payments.slice(0, 3).forEach((payment) => {
|
||||
const paymentChip = document.createElement('div');
|
||||
paymentChip.className = 'invoice-payment-pill';
|
||||
paymentChip.innerHTML = `
|
||||
@ -266,6 +272,13 @@
|
||||
`;
|
||||
paymentsBody.appendChild(paymentChip);
|
||||
});
|
||||
|
||||
if (payments.length > 3) {
|
||||
const moreChip = document.createElement('div');
|
||||
moreChip.className = 'invoice-payment-pill invoice-payment-pill--more';
|
||||
moreChip.textContent = `+${payments.length - 3} more payments`;
|
||||
paymentsBody.appendChild(moreChip);
|
||||
}
|
||||
}
|
||||
if (paymentsSection) paymentsSection.style.display = 'block';
|
||||
} else if (paymentsSection) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user