From f42c76d8a854941de53c557357a6c5a3b613f665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 14 Aug 2020 14:54:06 +0200 Subject: [PATCH] Update templates with new check for entity variables --- app/Services/PdfMaker/Designs/Bold.php | 4 +- app/Services/PdfMaker/Designs/Business.php | 2 +- app/Services/PdfMaker/Designs/Clean.php | 2 +- app/Services/PdfMaker/Designs/Creative.php | 2 +- app/Services/PdfMaker/Designs/Elegant.php | 2 +- app/Services/PdfMaker/Designs/Hipster.php | 2 +- app/Services/PdfMaker/Designs/Modern.php | 2 +- app/Services/PdfMaker/Designs/Photo.php | 45 ---------------------- app/Services/PdfMaker/Designs/Plain.php | 4 +- app/Services/PdfMaker/Designs/Playful.php | 2 +- 10 files changed, 12 insertions(+), 55 deletions(-) delete mode 100644 app/Services/PdfMaker/Designs/Photo.php diff --git a/app/Services/PdfMaker/Designs/Bold.php b/app/Services/PdfMaker/Designs/Bold.php index d1fa02f3bee2..ffa73edf9598 100644 --- a/app/Services/PdfMaker/Designs/Bold.php +++ b/app/Services/PdfMaker/Designs/Bold.php @@ -45,7 +45,7 @@ class Bold extends BaseDesign public function elements(array $context, string $type = 'product'): array { $this->context = $context; - + $this->type = $type; $this->setup(); @@ -130,7 +130,7 @@ class Bold extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Business.php b/app/Services/PdfMaker/Designs/Business.php index a04a3c0c8508..2aa6a816afc8 100644 --- a/app/Services/PdfMaker/Designs/Business.php +++ b/app/Services/PdfMaker/Designs/Business.php @@ -130,7 +130,7 @@ class Business extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Clean.php b/app/Services/PdfMaker/Designs/Clean.php index 1fd3848da6a1..9c233f007bbd 100644 --- a/app/Services/PdfMaker/Designs/Clean.php +++ b/app/Services/PdfMaker/Designs/Clean.php @@ -117,7 +117,7 @@ class Clean extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Creative.php b/app/Services/PdfMaker/Designs/Creative.php index 82cb3e833a32..a3043a89e8c5 100644 --- a/app/Services/PdfMaker/Designs/Creative.php +++ b/app/Services/PdfMaker/Designs/Creative.php @@ -130,7 +130,7 @@ class Creative extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Elegant.php b/app/Services/PdfMaker/Designs/Elegant.php index f9eea9fc16af..3cc20cbe2cc2 100644 --- a/app/Services/PdfMaker/Designs/Elegant.php +++ b/app/Services/PdfMaker/Designs/Elegant.php @@ -91,7 +91,7 @@ class Elegant extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Hipster.php b/app/Services/PdfMaker/Designs/Hipster.php index a3ee624d7452..7c217ebb77fe 100644 --- a/app/Services/PdfMaker/Designs/Hipster.php +++ b/app/Services/PdfMaker/Designs/Hipster.php @@ -130,7 +130,7 @@ class Hipster extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'div', 'properties' => ['class' => 'space-x-4'], 'content' => '', 'elements' => [ + $elements[] = ['element' => 'div', 'properties' => ['hidden' => $this->entityVariableCheck($variable), 'class' => 'space-x-4'], 'content' => '', 'elements' => [ ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['class' => 'font-semibold uppercase text-yellow-600']], ['element' => 'span', 'content' => $variable, 'properties' => ['class' => 'uppercase']], ]]; diff --git a/app/Services/PdfMaker/Designs/Modern.php b/app/Services/PdfMaker/Designs/Modern.php index 1259d14e363f..4ede0c3c9e0e 100644 --- a/app/Services/PdfMaker/Designs/Modern.php +++ b/app/Services/PdfMaker/Designs/Modern.php @@ -91,7 +91,7 @@ class Modern extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-16 lg:pr-24 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-16 lg:pr-24 font-normal']], ]]; diff --git a/app/Services/PdfMaker/Designs/Photo.php b/app/Services/PdfMaker/Designs/Photo.php deleted file mode 100644 index 68c9d799dec7..000000000000 --- a/app/Services/PdfMaker/Designs/Photo.php +++ /dev/null @@ -1,45 +0,0 @@ - product||task */ - public $type; - - public function html() - { - return file_get_contents( - base_path('resources/views/pdf-designs/bold.html') - ); - } -} diff --git a/app/Services/PdfMaker/Designs/Plain.php b/app/Services/PdfMaker/Designs/Plain.php index c119b308a560..d08a91357ba4 100644 --- a/app/Services/PdfMaker/Designs/Plain.php +++ b/app/Services/PdfMaker/Designs/Plain.php @@ -100,10 +100,12 @@ class Plain extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $element = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-medium']], ]]; + + $elements[] = $element; } return $elements; diff --git a/app/Services/PdfMaker/Designs/Playful.php b/app/Services/PdfMaker/Designs/Playful.php index b8c2077d849a..bc9b9c6c1881 100644 --- a/app/Services/PdfMaker/Designs/Playful.php +++ b/app/Services/PdfMaker/Designs/Playful.php @@ -91,7 +91,7 @@ class Playful extends BaseDesign $elements = []; foreach ($variables as $variable) { - $elements[] = ['element' => 'tr', 'content' => '', 'elements' => [ + $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'content' => '', 'elements' => [ ['element' => 'th', 'content' => $variable . '_label', 'properties' => ['class' => 'text-left pr-4 font-normal']], ['element' => 'th', 'content' => $variable, 'properties' => ['class' => 'text-left pr-4 font-medium']], ]];