Refactor 'product-table-footer' to 'table-totals'

This commit is contained in:
Benjamin Beganović 2020-11-04 11:23:06 +01:00
parent 14b11ecbbd
commit e222aa8620
2 changed files with 13 additions and 13 deletions

View File

@ -106,9 +106,9 @@ class Design extends BaseDesign
'id' => 'product-table', 'id' => 'product-table',
'elements' => $this->productTable(), 'elements' => $this->productTable(),
], ],
'product-table-footer' => [ 'table-totals' => [
'id' => 'product-table-footer', 'id' => 'table-totals',
'elements' => $this->tableFooter(), 'elements' => $this->tableTotals(),
], ],
'footer-elements' => [ 'footer-elements' => [
'id' => 'footer', 'id' => 'footer',
@ -257,13 +257,13 @@ class Design extends BaseDesign
return $elements; return $elements;
} }
public function tableFooter() public function tableTotals(): array
{ {
$variables = $this->context['pdf_variables']['total_columns']; $variables = $this->context['pdf_variables']['total_columns'];
$elements = [ $elements = [
['element' => 'div', 'elements' => [ ['element' => 'div', 'elements' => [
['element' => 'span', 'content' => '$entity.public_notes', 'properties' => ['data-element' => 'product-table-public-notes-label']], ['element' => 'span', 'content' => '$entity.public_notes', 'properties' => ['data-element' => 'total-table-public-notes-label']],
]], ]],
]; ];

View File

@ -88,11 +88,11 @@
text-align: right; text-align: right;
} }
#product-table-footer { #table-totals {
page-break-inside: avoid; page-break-inside: avoid;
} }
#product-table-footer > * { #table-totals > * {
display: grid; display: grid;
grid-template-columns: 3fr 1fr 1fr; grid-template-columns: 3fr 1fr 1fr;
padding-top: .5rem; padding-top: .5rem;
@ -100,16 +100,16 @@
gap: 20px; gap: 20px;
} }
#product-table-footer #table-totals
> * > *
[data-element='product-table-balance-due-label'], [data-element='total-table-balance-due-label'],
#product-table-footer #table-totals
> * > *
[data-element='product-table-balance-due'] { [data-element='total-table-balance-due'] {
font-weight: bold; font-weight: bold;
} }
#product-table-footer > * > :last-child { #table-totals > * > :last-child {
text-align: right; text-align: right;
padding-right: 1rem; padding-right: 1rem;
} }
@ -137,7 +137,7 @@
<table id="product-table" cellspacing="0"></table> <table id="product-table" cellspacing="0"></table>
<div id="product-table-footer" cellspacing="0"></div> <div id="table-totals" cellspacing="0"></div>
</div> </div>
<div id="footer"></div> <div id="footer"></div>