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