From 50bbd6ddfdfbba861eebfce4dc8696df5b1e1b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 27 Sep 2021 17:59:14 +0200 Subject: [PATCH 1/2] Fixes for table header not showing --- app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php index d268457d2b63..dd04ead2ed3a 100644 --- a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php +++ b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php @@ -217,6 +217,13 @@ trait DesignHelpers public function sharedFooterElements() { + // We want to show headers for statements, no exceptions. + $statements = " + document.querySelectorAll('#statement-invoice-table > thead > tr > th, #statement-payment-table > thead > tr > th, #statement-aging-table > thead > tr > th').forEach(t => { + t.hidden = false; + }); + "; + // Unminified version, just for the reference. // By default all table headers are hidden with HTML `hidden` property. // This will check for table data values & if they're not empty it will remove hidden from the column itself. @@ -259,6 +266,7 @@ document.addEventListener('DOMContentLoaded', function() { $html_decode = 'document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(`[data-state="encoded-html"]`).forEach(e=>e.innerHTML=e.innerText)},!1);'; return ['element' => 'div', 'elements' => [ + ['element' => 'script', 'content' => $statements], ['element' => 'script', 'content' => $javascript], ['element' => 'script', 'content' => $html_decode], ]]; From 5065f57c7a750d79abfe9176d4b50c7e4087cb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 27 Sep 2021 18:01:52 +0200 Subject: [PATCH 2/2] Show Invoice Ninja logo only for footer --- app/Services/PdfMaker/Design.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index 1ecab6b3ce22..bb9e3f809269 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -605,6 +605,16 @@ class Design extends BaseDesign public function tableTotals(): array { + if ($this->type === self::STATEMENT) { + return [ + ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [ + ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [ + ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']], + ]], + ]], + ]; + } + $_variables = array_key_exists('variables', $this->context) ? $this->context['variables'] : ['values' => ['$entity.public_notes' => $this->entity->public_notes, '$entity.terms' => $this->entity->terms, '$entity_footer' => $this->entity->footer], 'labels' => []]; @@ -626,7 +636,7 @@ class Design extends BaseDesign ['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []], ]; - if ($this->type == self::DELIVERY_NOTE || $this->type == self::STATEMENT) { + if ($this->type == self::DELIVERY_NOTE) { return $elements; }