diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php
index 748727942408..1153285ecc4e 100644
--- a/app/DataMapper/CompanySettings.php
+++ b/app/DataMapper/CompanySettings.php
@@ -220,8 +220,8 @@ class CompanySettings extends BaseSettings {
public $secondary_font = 'Roboto';
public $hide_paid_to_date = false;
public $embed_documents = false;
- public $all_pages_header = true;
- public $all_pages_footer = true;
+ public $all_pages_header = false;
+ public $all_pages_footer = false;
public $pdf_variables = [];
public static $casts = [
diff --git a/app/Designs/AbstractDesign.php b/app/Designs/AbstractDesign.php
index 591a4ba757d9..25fd82218593 100644
--- a/app/Designs/AbstractDesign.php
+++ b/app/Designs/AbstractDesign.php
@@ -19,7 +19,9 @@ abstract class AbstractDesign
abstract public function body();
- abstract public function table();
+ abstract public function product_table();
+
+ abstract public function task_table();
abstract public function footer();
diff --git a/app/Designs/Bold.php b/app/Designs/Bold.php
index 431995e52461..c49facd2a520 100644
--- a/app/Designs/Bold.php
+++ b/app/Designs/Bold.php
@@ -39,7 +39,11 @@ class Bold extends AbstractDesign
{
size: auto;
margin-top: 5mm;
- }
+ }
+
+ .text-left .table_header_thead_class {}
+ .px-12 .text-2xl .px-4 .py-2 .table_header_td_class {}
+ .bg-gray-200 .py-5 .pl-12 .table_body_td_class {}
';
}
@@ -95,8 +99,10 @@ class Bold extends AbstractDesign
'table_body_td_class' => "bg-gray-200 py-5 pl-12",
];
}
+ public function task_table() {
+ }
- public function table() {
+ public function product_table() {
return '
diff --git a/app/Designs/Business.php b/app/Designs/Business.php
index 3e244d8abc16..9406342c085a 100644
--- a/app/Designs/Business.php
+++ b/app/Designs/Business.php
@@ -106,7 +106,10 @@ class Business extends AbstractDesign
];
}
- public function table() {
+ public function task_table() {
+ }
+
+ public function product_table() {
return '
diff --git a/app/Designs/Clean.php b/app/Designs/Clean.php
index fe410d490b74..4b4342338004 100644
--- a/app/Designs/Clean.php
+++ b/app/Designs/Clean.php
@@ -106,8 +106,10 @@ class Clean extends AbstractDesign
];
}
- public function table() {
+ public function task_table() {
+ }
+ public function product_table() {
return '
diff --git a/app/Designs/Creative.php b/app/Designs/Creative.php
index 5b3ddd18f7eb..de8f4ba7c165 100644
--- a/app/Designs/Creative.php
+++ b/app/Designs/Creative.php
@@ -102,8 +102,11 @@ class Creative extends AbstractDesign
];
}
- public function table() {
+ public function task_table() {
+ }
+ public function product_table() {
+
return '
diff --git a/app/Designs/Custom.php b/app/Designs/Custom.php
index 30ba401a9e50..72de8f97a636 100644
--- a/app/Designs/Custom.php
+++ b/app/Designs/Custom.php
@@ -19,8 +19,10 @@ class Custom extends AbstractDesign
private $body;
- private $table;
+ private $product_table;
+ private $task_table;
+
private $footer;
private $table_styles;
@@ -33,8 +35,10 @@ class Custom extends AbstractDesign
$this->body = $design->body;
- $this->table = $design->table;
+ $this->product_table = $design->product_table;
+ $this->task_table = $design->task_table;
+
$this->footer = $design->footer;
$this->table_styles = $design->table_styles;
@@ -67,18 +71,23 @@ class Custom extends AbstractDesign
}
- public function table()
+ public function product_table()
{
- return $this->table;
+ return $this->product_table;
}
+ public function task_table()
+ {
+ return $this->task_table;
+ }
+
public function footer()
{
return $this->footer;
-
+
}
}
\ No newline at end of file
diff --git a/app/Designs/Designer.php b/app/Designs/Designer.php
index 3d1d002134bc..63b395ecb4de 100644
--- a/app/Designs/Designer.php
+++ b/app/Designs/Designer.php
@@ -26,6 +26,8 @@ class Designer {
protected $entity_string;
+ protected $entity;
+
private static $custom_fields = [
'invoice1',
'invoice2',
@@ -49,8 +51,9 @@ class Designer {
'company4',
];
- public function __construct($design, $input_variables, $entity_string)
+ public function __construct($entity, $design, $input_variables, $entity_string)
{
+ $this->entity = $entity;
$this->design = $design;
@@ -65,27 +68,63 @@ class Designer {
* formatted HTML
* @return string The HTML design built
*/
- public function build($entity):Designer
+ public function build():Designer
{
- $this->exportVariables($entity)
+ $this->setHtml()
+ ->exportVariables()
->setDesign($this->getSection('include'))
->setDesign($this->getSection('header'))
->setDesign($this->getSection('body'))
- ->setDesign($this->getTable($entity))
+ ->setDesign($this->getProductTable($this->entity))
->setDesign($this->getSection('footer'));
return $this;
}
- public function getTable($entity):string
+ public function init()
+ {
+ $this->setHtml()
+ ->exportVariables();
+
+ return $this;
+ }
+
+ public function getHeader()
{
- $table_header = $entity->table_header($this->input_variables['product_columns'], $this->design->table_styles());
- $table_body = $entity->table_body($this->input_variables['product_columns'], $this->design->table_styles());
+ $this->setDesign($this->getSection('include'))
+ ->setDesign($this->getSection('header'));
- $data = str_replace('$table_header', $table_header, $this->getSection('table'));
+ return $this;
+ }
+
+ public function getFooter()
+ {
+
+ $this->setDesign($this->getSection('footer'));
+
+ return $this;
+ }
+
+ public function getBody()
+ {
+
+ $this->setDesign($this->getSection('include'))
+ ->setDesign($this->getSection('body'))
+ ->setDesign($this->getProductTable());
+
+ return $this;
+ }
+
+ public function getProductTable():string
+ {
+
+ $table_header = $this->entity->table_header($this->input_variables['product_columns'], $this->design->table_styles());
+ $table_body = $this->entity->table_body($this->input_variables['product_columns'], $this->design->table_styles());
+
+ $data = str_replace('$table_header', $table_header, $this->getSection('product_table'));
$data = str_replace('$table_body', $table_body, $data);
return $data;
@@ -97,6 +136,13 @@ class Designer {
return $this->html;
}
+ public function setHtml()
+ {
+ $this->html = '';
+
+ return $this;
+ }
+
private function setDesign($section)
{
@@ -117,10 +163,10 @@ class Designer {
return str_replace(array_keys($this->exported_variables), array_values($this->exported_variables), $this->design->{$section}());
}
- private function exportVariables($entity)
+ private function exportVariables()
{
- $company = $entity->company;
+ $company = $this->entity->company;
$this->exported_variables['$client_details'] = $this->processVariables($this->processInputVariables($company, $this->input_variables['client_details']), $this->clientDetails($company));
$this->exported_variables['$company_details'] = $this->processVariables($this->processInputVariables($company, $this->input_variables['company_details']), $this->companyDetails($company));
@@ -170,35 +216,6 @@ class Designer {
return $output;
}
- // private function exportVariables()
- // {
- // /*
- // * $entity_labels
- // * $entity_details
- // */
- // $header = $this->design->header();
-
- // /*
- // * $company_logo - full URL
- // * $client_details
- // */
- // $body = $this->design->body();
-
- // /*
- // * $table_header
- // * $table_body
- // * $total_labels
- // * $total_values
- // */
- // $table = $this->design->table();
-
- // /*
- // * $company_details
- // * $company_address
- // */
- // $footer = $this->design->footer();
- // }
-
private function clientDetails(Company $company)
{
diff --git a/app/Designs/Elegant.php b/app/Designs/Elegant.php
index 78020a3837b1..1523055e4d58 100644
--- a/app/Designs/Elegant.php
+++ b/app/Designs/Elegant.php
@@ -95,8 +95,10 @@ class Elegant extends AbstractDesign
];
}
- public function table() {
+ public function task_table() {
+ }
+ public function product_table() {
return '
diff --git a/app/Designs/Hipster.php b/app/Designs/Hipster.php
index 89b67ea4f344..926f0b15491a 100644
--- a/app/Designs/Hipster.php
+++ b/app/Designs/Hipster.php
@@ -110,8 +110,10 @@ class Hipster extends AbstractDesign
];
}
- public function table() {
+ public function task_table() {
+ }
+ public function product_table() {
return '
diff --git a/app/Designs/Modern.php b/app/Designs/Modern.php
index ccbc98c99f86..df84ccb1c31c 100644
--- a/app/Designs/Modern.php
+++ b/app/Designs/Modern.php
@@ -31,6 +31,35 @@ class Modern extends AbstractDesign
@@ -42,8 +71,7 @@ class Modern extends AbstractDesign
public function header() {
return '
-
-
+