From a303026b1423dbfaaf1f3e6e1dd98a19a9434c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 31 Mar 2020 23:04:42 +0200 Subject: [PATCH] Migrate invoice desings from flex to grid (#3571) * Refactor Plain - Change company logo sizing from weight% to height% * Fix invoice designs --- app/Designs/Bold.php | 92 +++++++++++++------------ app/Designs/Business.php | 45 +++++------- app/Designs/Creative.php | 86 +++++++++-------------- app/Designs/Designer.php | 30 ++++---- app/Designs/Elegant.php | 27 +++----- app/Designs/Modern.php | 60 ++++++++-------- app/Designs/Photo.php | 11 ++- app/Designs/Plain.php | 80 +++++++++++---------- app/Designs/Playful.php | 84 ++++++++++------------ app/Utils/Traits/MakesInvoiceValues.php | 2 +- 10 files changed, 232 insertions(+), 285 deletions(-) diff --git a/app/Designs/Bold.php b/app/Designs/Bold.php index 8d78ff6c9c49..fdb2410b5c93 100644 --- a/app/Designs/Bold.php +++ b/app/Designs/Bold.php @@ -28,60 +28,66 @@ class Bold extends AbstractDesign body {font-size:90%} @page: not(:first-of-type) { size: auto; margin-top: 5mm; } .table_header_thead_class {text-align:left;} - .table_header_td_class {padding-left:3rem; padding-right:3rem; font-size:1.5rem; padding-left:1rem;padding-right:1rem; padding-top:.5rem;padding-bottom:.5rem} + .table_header_td_class {padding-left:3rem; padding-right:3rem; font-size:1rem; padding-left:1rem;padding-right:1rem; padding-top:.5rem;padding-bottom:.5rem} .table_body_td_class {background-color:#edf2f7; adding-top:1.25rem;padding-bottom:1.25rem; padding-left:3rem;} '; } public function header() { - return '
-
-
- $company_logo + return '
+
+
+
+ $company_logo +
+
+
+ $company_details +
+
+ $company_address +
-
-
-
- $company_details -
-
- $company_address -
-
'; } public function body() { - return '
-
-

$entity_label

$client_details -
-
-
-
- $entity_details + return '
+
+
+

$entity_label

+
$client_details
+
+
+
+
+ $entity_details +
- - - $product_table_header - - - $product_table_body - -
- - - $task_table_header - - - $task_table_body - -
'; + +
+ + + $product_table_header + + + $product_table_body + +
+ + + $task_table_header + + + $task_table_body + +
+
'; } public function task() @@ -111,16 +117,16 @@ class Bold extends AbstractDesign
-
+

$terms_label

$terms
-
- $balance_due_label +
+ $balance_due_label
-
- $balance_due +
+ $balance_due
'; diff --git a/app/Designs/Business.php b/app/Designs/Business.php index c6f9cbd95e91..e7e970955f0f 100644 --- a/app/Designs/Business.php +++ b/app/Designs/Business.php @@ -40,54 +40,45 @@ class Business extends AbstractDesign } .table_header_thead_class { border-top-left-radius: .5rem; text-align: left } .table_header_td_class { color: white; padding: .5rem 1rem; font-weight: 800; background-color: #2a4365; } -.table_body_td_class { color: #c05621; padding: 1rem; border-width: 4px; border-color: white; background-color: #edf2f7; } +.table_body_td_class { color: #c05621; padding: 1rem; border-width: 4px; border-color: white; background-color: white; } '; } public function header() { - return '
-
-
+ return '
+
+
$company_logo
-
-
- $company_details -
-
- $company_address -
+
+ $company_details +
+
+ $company_address
'; } public function body() { - return '
-
- $entity_label -
- $client_details -
+ return '
+
+ $client_details
-
-
-
- $entity_labels -
-
- $entity_details -
+
+
+ $entity_details
+ $product_table_header - + $product_table_body
@@ -95,7 +86,7 @@ class Business extends AbstractDesign $task_table_header - + $task_table_body '; diff --git a/app/Designs/Creative.php b/app/Designs/Creative.php index 2dbd0a2bcb0d..4dd13ac6295c 100644 --- a/app/Designs/Creative.php +++ b/app/Designs/Creative.php @@ -36,7 +36,7 @@ size: auto; margin-top: 6mm; } .table_header_thead_class { text-align: left; border-radius: .5rem; } -.table_header_td_class { text-transform: uppercase; font-size: 1.25rem; color: #b83280; padding: 1.25rem 1rem; font-weight: 500 } +.table_header_td_class { text-transform: uppercase; font-size: 1.25rem; color: #b83280; font-weight: 500 } .table_body_td_class { padding: 1rem;} '; } @@ -44,55 +44,41 @@ margin-top: 6mm; public function header() { - return '
-
-
-
- $client_details -
-
- $company_details -
-
- $company_address -
-
- $company_logo + return '
+
+
$client_details
+
$company_details
+
$company_address
+
$company_logo
'; } public function body() { - return '
-
-

$entity_label

- $entity_number -
-
-
- $entity_labels -
-
- $entity_details + return '
+
+

#$entity_number

+
$entity_details
-
- - - $product_table_header - - - $product_table_body - + +
+ + $product_table_header + + + $product_table_body +
- +
$task_table_header $task_table_body -
'; + +'; } public function task() @@ -108,25 +94,17 @@ margin-top: 6mm; public function footer() { - return '
-
-
-
-

$entity.public_notes

-
+ return '
+
+
+

$entity.public_notes

-
-
-
- $subtotal_label - $discount_label - $paid_to_date_label -
-
- $subtotal - $discount - $paid_to_date -
+
+
+ $subtotal_label $discount_label $total_tax_labels $line_tax_labels +
+
+ $subtotal $discount $total_tax_values $line_tax_values
diff --git a/app/Designs/Designer.php b/app/Designs/Designer.php index e2d28d660630..76b288257925 100644 --- a/app/Designs/Designer.php +++ b/app/Designs/Designer.php @@ -294,21 +294,21 @@ class Designer private function quoteDetails(Company $company) { $data = [ - '$quote.quote_number' => '$quote.number_label: $quote.number', - '$quote.po_number' => '$quote.po_number_label: $quote.po_number', - '$quote.quote_date' => '$quote.date_label: $quote.date', - '$quote.valid_until' => '$quote.valid_until_label: $quote.valid_until', - '$quote.balance_due' => '$quote.balance_due_label: $quote.balance_due', - '$quote.quote_total' => '$quote.total_label: $quote.total', - '$quote.partial_due' => '$quote.partial_due_label: $quote.partial_due', - '$quote.custom1' => '$quote.custom1_label: $quote.custom1', - '$quote.custom2' => '$quote.custom2_label: $quote.custom2', - '$quote.custom3' => '$quote.custom3_label: $quote.custom3', - '$quote.custom4' => '$quote.custom4_label: $quote.custom4', - '$quote.surcharge1' => '$surcharge1_label: $surcharge1', - '$quote.surcharge2' => '$surcharge2_label: $surcharge2', - '$quote.surcharge3' => '$surcharge3_label: $surcharge3', - '$quote.surcharge4' => '$surcharge4_label: $surcharge4', + '$quote.quote_number' => '$quote.number_label: $quote.number', + '$quote.po_number' => '$quote.po_number_label: $quote.po_number', + '$quote.quote_date' => '$quote.date_label: $quote.date', + '$quote.valid_until' => '$quote.valid_until_label: $quote.valid_until', + '$quote.balance_due' => '$quote.balance_due_label: $quote.balance_due', + '$quote.quote_total' => '$quote.total_label: $quote.total', + '$quote.partial_due' => '$quote.partial_due_label: $quote.partial_due', + '$quote.custom1' => '$quote.custom1_label: $quote.custom1', + '$quote.custom2' => '$quote.custom2_label: $quote.custom2', + '$quote.custom3' => '$quote.custom3_label: $quote.custom3', + '$quote.custom4' => '$quote.custom4_label: $quote.custom4', + '$quote.surcharge1' => '$surcharge1_label: $surcharge1', + '$quote.surcharge2' => '$surcharge2_label: $surcharge2', + '$quote.surcharge3' => '$surcharge3_label: $surcharge3', + '$quote.surcharge4' => '$surcharge4_label: $surcharge4', ]; diff --git a/app/Designs/Elegant.php b/app/Designs/Elegant.php index 41b502603244..c6ce44a4f02d 100644 --- a/app/Designs/Elegant.php +++ b/app/Designs/Elegant.php @@ -41,18 +41,13 @@ class Elegant extends AbstractDesign public function header() { - return '
-
-
+ return '
+
+
$company_logo
-
-
- $entity_labels -
-
- $entity_details -
+
+ $entity_details
'; @@ -60,14 +55,14 @@ class Elegant extends AbstractDesign public function body() { - return '
-
+ return '
+
$client_details
-
+
$company_details
-
+
$company_address
@@ -81,10 +76,10 @@ class Elegant extends AbstractDesign - $product_table_header + $task_table_header - $product_table_body + $task_table_body
'; } diff --git a/app/Designs/Modern.php b/app/Designs/Modern.php index a2b333b87602..759d1f616430 100644 --- a/app/Designs/Modern.php +++ b/app/Designs/Modern.php @@ -64,36 +64,33 @@ class Modern extends AbstractDesign public function header() { return '
-
-

$company.name

-
-
-
- $entity_labels -
-
- $entity_details -
+
+
+

$company.name

+
+
+ $company_details +
+
+ $entity_details +
+
'; } public function body() { - return '
-
-
- $company_logo -
-
-
- $client_details -
-
- -
+ return ' +
+
+ $company_logo +
+
+ $client_details
+
@@ -165,17 +162,14 @@ class Modern extends AbstractDesign
diff --git a/app/Designs/Photo.php b/app/Designs/Photo.php index 4a0ae7baff73..445a72092982 100644 --- a/app/Designs/Photo.php +++ b/app/Designs/Photo.php @@ -47,15 +47,12 @@ body {font-size:90%} public function header() { return '
-
-
+
+
$company_logo
-
-
- $entity_labels -
-
+
+
$entity_details
diff --git a/app/Designs/Plain.php b/app/Designs/Plain.php index fd46495e870c..240bed9be84c 100644 --- a/app/Designs/Plain.php +++ b/app/Designs/Plain.php @@ -37,25 +37,18 @@ body {font-size:90%} '; } - public function header() { - return '
-
- $company_logo -
+ return '
+
+
+ $company_logo +
+
$company_details
-
-
-
- $entity_details -
-
-
-

$balance_due_label

-

$0.00

-
+
+ $entity_details
'; } @@ -81,35 +74,40 @@ body {font-size:90%} $task_table_body
-
-
-
-

$entity.public_notes

-
-

$terms_label

-

$terms

+ +
+
+
+

$entity.public_notes

+
+

$terms_label

+

$terms

+
-
-
-
-
- $discount_label - $total_tax_labels - $line_tax_labels -
-
- $discount - $total_tax_values - $line_tax_values -
+
+
+
+ $discount_label + $total_tax_labels + $line_tax_labels +
+
+ $discount + $total_tax_values + $line_tax_values +
+
+
+
+ $balance_due_label +
+
+ $balance_due +
+
-
-

$balance_due_label

-

$balance_due

-
-
-
'; +'; } @@ -42,18 +42,13 @@ body {font-size:90%} public function header() { return '
-
-
+
+
$company_logo
-
-
-
- $entity_labels -
-
- $entity_details -
+
+
+ $entity_details
'; @@ -64,7 +59,7 @@ body {font-size:90%} return '
-

$entity_label

+

$to_label:

$client_details @@ -98,40 +93,7 @@ body {font-size:90%} $task_table_body - -
-
-
-

$entity.public_notes

-
-
-
-
-
- $discount_label - $total_tax_labels - $line_tax_labels -
-
- $discount - $total_tax_values - $line_tax_values -
-
-
-
-
-
-

$terms_label

-

$terms

-
-
-
-
-

$balance_due_label

-

$balance_due

-
-
'; +'; } public function task() @@ -146,6 +108,32 @@ body {font-size:90%} public function footer() { - return ''; + return '
+
+ $entity.public_notes +
+
+
+ $discount_label + $total_tax_labels + $line_tax_labels +
+
+ $discount + $total_tax_values + $line_tax_values +
+
+
+

$terms_label

+

$terms

+
+
+
+

$balance_due_label

+

$balance_due

+
+
+
'; } } diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index af8371f6a27a..0e1c63e61639 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -296,7 +296,7 @@ trait MakesInvoiceValues $logo = $this->company->present()->logo($settings); - $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; $data['$company_logo'] = &$data['$company.logo']; $data['$company1'] = ['value' => $settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; $data['$company2'] = ['value' => $settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')];