From 9c1cfd2e86647d455f4d679969730c4f64607506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 11 Aug 2020 17:53:11 +0200 Subject: [PATCH] Shared footer elements --- app/Services/PdfMaker/Designs/Playful.php | 8 +++++++- app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php | 8 ++++++++ app/Services/PdfMaker/PdfMakerUtilities.php | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Services/PdfMaker/Designs/Playful.php b/app/Services/PdfMaker/Designs/Playful.php index 7b7372abdf67..adb87ed290ac 100644 --- a/app/Services/PdfMaker/Designs/Playful.php +++ b/app/Services/PdfMaker/Designs/Playful.php @@ -45,7 +45,7 @@ class Playful extends BaseDesign public function elements(array $context, string $type = 'product'): array { $this->context = $context; - + $this->type = $type; $this->setup(); @@ -71,6 +71,12 @@ class Playful extends BaseDesign 'id' => 'product-table', 'elements' => $this->productTable(), ], + 'footer-elements' => [ + 'id' => 'footer', + 'elements' => [ + $this->sharedFooterElements(), + ], + ], ]; } diff --git a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php index d7f82cb2357d..ff9f89087115 100644 --- a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php +++ b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php @@ -156,4 +156,12 @@ trait DesignHelpers return 'true'; } + + public function sharedFooterElements() + { + return ['element' => 'div', 'properties' => ['class' => 'flex items-center justify-between mt-10'], 'content' => '', 'elements' => [ + ['element' => 'img', 'content' => '', 'properties' => ['src' => '$contact.signature', 'class' => 'h-40']], + ['element' => 'img', 'content' => '', 'properties' => ['src' => '$app_url/images/created-by-invoiceninja-new.png', 'class' => 'h-32', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false']], + ]]; + } } diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index bf0c74c1fa20..6a20c3fe66a5 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -128,7 +128,7 @@ trait PdfMakerUtilities $html = strtr($html, $variables['values']); - $this->document->loadHTML($html); + @$this->document->loadHTML($html); $this->document->saveHTML(); }