Revert attempting to use divs as tables

This commit is contained in:
David Bomba 2023-01-31 09:25:40 +11:00
parent 5ca0bf3b23
commit c7701b71d6
3 changed files with 68 additions and 24 deletions

View File

@ -306,7 +306,7 @@ class Design extends BaseDesign
return $elements; return $elements;
} }
public function entityDetails(): array public function entityDetailsx(): array
{ {
@ -379,7 +379,7 @@ class Design extends BaseDesign
} }
public function entityDetailsx(): array public function entityDetails(): array
{ {
@ -457,6 +457,7 @@ class Design extends BaseDesign
return $elements; return $elements;
} }
public function deliveryNoteTable(): array public function deliveryNoteTable(): array
{ {
if ($this->type !== self::DELIVERY_NOTE) { if ($this->type !== self::DELIVERY_NOTE) {

View File

@ -246,7 +246,44 @@ trait DesignHelpers
]]; ]];
} }
public function entityVariableCheck(string $variable): string
public function entityVariableCheck(string $variable): bool
{
// Extract $invoice.date => date
// so we can append date as $entity->date and not $entity->$invoice.date;
// When it comes to invoice balance, we'll always show it.
if ($variable == '$invoice.total') {
return false;
}
// Some variables don't map 1:1 to table columns. This gives us support for such cases.
$aliases = [
'$quote.balance_due' => 'partial',
];
try {
$_variable = explode('.', $variable)[1];
} catch (Exception $e) {
throw new Exception('Company settings seems to be broken. Missing $entity.variable type.');
}
if (\in_array($variable, \array_keys($aliases))) {
$_variable = $aliases[$variable];
}
if (is_null($this->entity->{$_variable})) {
return true;
}
if (empty($this->entity->{$_variable})) {
return true;
}
return false;
}
public function entityVariableCheckx(string $variable): string
{ {
// Extract $invoice.date => date // Extract $invoice.date => date
// so we can append date as $entity->date and not $entity->$invoice.date; // so we can append date as $entity->date and not $entity->$invoice.date;

View File

@ -34,11 +34,6 @@
padding: 0; padding: 0;
} }
span {
border-right:10px;
}
#qr-bill { #qr-bill {
width:100% !important; width:100% !important;
box-sizing: border-box; box-sizing: border-box;
@ -57,7 +52,8 @@
} }
.company-logo { .company-logo {
max-width: $company_logo_size; max-width: 65%;
/* max-width: $company_logo_size;*/
} }
#company-details { #company-details {
@ -86,32 +82,34 @@
} }
.client-and-entity-wrapper { .client-and-entity-wrapper {
display: flex; /* display: flex;*/
padding: 0.2rem; padding: 1rem;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
border-top: 1px solid #d8d8d8; border-top: 1px solid #d8d8d8;
border-bottom: 1px solid #d8d8d8; border-bottom: 1px solid #d8d8d8;
} }
#entity-details { #entity-details {
display: table; display:flex;
padding-right: 30px; text-align: left;
flex-direction: column; margin-right: 20px;
overflow: hidden;
height: 12px;
white-space: nowrap;
line-height: var(--line-height);
} }
.entity-details-cell { #entity-details > tr,
display: table-cell; #entity-details th {
border-right: 10px solid transparent; font-weight: normal;
padding-right: 15px;
padding-top: 2.5px;
padding-bottom: 2.5px;
} }
#client-details { #client-details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-right: 30px;
line-height: var(--line-height); line-height: var(--line-height);
padding-right:30px;
} }
#shipping-details { #shipping-details {
@ -120,6 +118,12 @@
line-height: var(--line-height); line-height: var(--line-height);
} }
#client-details {
display: flex;
flex-direction: column;
line-height: var(--line-height);
}
#client-details > :first-child { #client-details > :first-child {
font-weight: bold; font-weight: bold;
} }
@ -367,7 +371,9 @@
</div> </div>
<p class="entity-label">$entity_label</p> <p class="entity-label">$entity_label</p>
<div class="client-and-entity-wrapper"> <div class="client-and-entity-wrapper">
<div id="entity-details"></div> <div>
<table id="entity-details" cellspacing="0" dir="$dir"></table>
</div>
<div id="client-details"></div> <div id="client-details"></div>
<div id="vendor-details"></div> <div id="vendor-details"></div>
<div id="shipping-details"></div> <div id="shipping-details"></div>