mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Extract totals table for statements into separate methods
This commit is contained in:
parent
50a666b1ce
commit
6c32d905ae
@ -135,9 +135,7 @@ class Design extends BaseDesign
|
||||
],
|
||||
'statement-invoice-table-totals' => [
|
||||
'id' => 'statement-invoice-table-totals',
|
||||
'elements' => [
|
||||
['element' => 'p', 'content' => '$outstanding_label: $outstanding'],
|
||||
],
|
||||
'elements' => $this->statementInvoiceTableTotals(),
|
||||
],
|
||||
'statement-payment-table' => [
|
||||
'id' => 'statement-payment-table',
|
||||
@ -145,9 +143,7 @@ class Design extends BaseDesign
|
||||
],
|
||||
'statement-payment-table-totals' => [
|
||||
'id' => 'statement-payment-table-totals',
|
||||
'elements' => [
|
||||
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), 1000)],
|
||||
],
|
||||
'elements' => $this->statementPaymentTableTotals(),
|
||||
],
|
||||
'statement-aging-table' => [
|
||||
'id' => 'statement-aging-table',
|
||||
@ -377,6 +373,17 @@ class Design extends BaseDesign
|
||||
];
|
||||
}
|
||||
|
||||
public function statementInvoiceTableTotals(): array
|
||||
{
|
||||
if ($this->type !== self::STATEMENT) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
['element' => 'p', 'content' => '$outstanding_label: $outstanding'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent method for building payments table within statement.
|
||||
*
|
||||
@ -413,6 +420,17 @@ class Design extends BaseDesign
|
||||
];
|
||||
}
|
||||
|
||||
public function statementPaymentTableTotals(): array
|
||||
{
|
||||
if ($this->type !== self::STATEMENT) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), 1000)],
|
||||
];
|
||||
}
|
||||
|
||||
public function statementAgingTable(): array
|
||||
{
|
||||
if ($this->type !== self::STATEMENT) {
|
||||
|
@ -297,7 +297,12 @@
|
||||
<script>
|
||||
// Clear up space a bit, if [product-table, tasks-table, delivery-note-table] isn't present.
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
['product-table', 'task-table', 'delivery-note-table'].forEach((tableIdentifier) => {
|
||||
let tables = [
|
||||
'product-table', 'task-table', 'delivery-note-table',
|
||||
'statement-invoice-table', 'statement-payment-table', 'statement-aging-table-totals',
|
||||
];
|
||||
|
||||
tables.forEach((tableIdentifier) => {
|
||||
document.getElementById(tableIdentifier).childElementCount === 0
|
||||
? document.getElementById(tableIdentifier).style.display = 'none'
|
||||
: '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user