From 72f09542cec030e176c9751ca0727ce0af85e370 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 11:55:07 +1100 Subject: [PATCH 1/2] Fixes for designs - white label --- app/Services/PdfMaker/Design.php | 22 +++++++++++++++++++--- resources/views/pdf-designs/bold.html | 1 - resources/views/pdf-designs/business.html | 1 - resources/views/pdf-designs/clean.html | 3 +-- resources/views/pdf-designs/creative.html | 1 - resources/views/pdf-designs/elegant.html | 1 - resources/views/pdf-designs/hipster.html | 1 - resources/views/pdf-designs/modern.html | 1 - resources/views/pdf-designs/plain.html | 11 ++++++++--- resources/views/pdf-designs/playful.html | 1 - resources/views/pdf-designs/tech.html | 3 +-- 11 files changed, 29 insertions(+), 17 deletions(-) diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index a30facb499..7abc5e4900 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -659,21 +659,37 @@ class Design extends BaseDesign $variables = $this->context['pdf_variables']['total_columns']; /* 'labels' is a protected value - if the user enters labels it attempts to replace this string again - we need to set labels are a protected text label and remove it from the string */ + // $elements = [ + // ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [ + // ['element' => 'p', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']], + // ['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column;'], 'elements' => [ + // ['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['hidden' => $this->entityVariableCheck('$entity.terms'), 'data-ref' => 'total_table-terms-label', 'style' => 'font-weight: bold; text-align: left; margin-top: 1rem;']], + // ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']], + // ]], + // ['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']], + // ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [ + // ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']], + // ]], + // ]], + // ['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []], + // ]; + $elements = [ ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [ ['element' => 'p', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']], - ['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column;'], 'elements' => [ + ['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column; page-break-inside: auto;'], 'elements' => [ ['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['hidden' => $this->entityVariableCheck('$entity.terms'), 'data-ref' => 'total_table-terms-label', 'style' => 'font-weight: bold; text-align: left; margin-top: 1rem;']], ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']], ]], ['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']], - ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [ - ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']], + ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start; page-break-inside: auto;'], 'elements' => [ + ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']], ]], ]], ['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []], ]; + if ($this->type == self::DELIVERY_NOTE) { return $elements; } diff --git a/resources/views/pdf-designs/bold.html b/resources/views/pdf-designs/bold.html index d38b6e4d0e..ddbf71e194 100644 --- a/resources/views/pdf-designs/bold.html +++ b/resources/views/pdf-designs/bold.html @@ -22,7 +22,6 @@ @page { margin: 0 !important; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/business.html b/resources/views/pdf-designs/business.html index d38fda65e7..dcc3206e82 100644 --- a/resources/views/pdf-designs/business.html +++ b/resources/views/pdf-designs/business.html @@ -20,7 +20,6 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 7f8a63d511..0dc623d880 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -18,9 +18,8 @@ @page { margin-left: $global_margin; margin-right: $global_margin; - margin-bottom: 0; margin-top: 0; - size: $page_size $page_layout; + margin-bottom: 0; } p { diff --git a/resources/views/pdf-designs/creative.html b/resources/views/pdf-designs/creative.html index 1553c9980c..dc017018bd 100644 --- a/resources/views/pdf-designs/creative.html +++ b/resources/views/pdf-designs/creative.html @@ -20,7 +20,6 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/elegant.html b/resources/views/pdf-designs/elegant.html index 1b2ba47f1a..fc14396d24 100644 --- a/resources/views/pdf-designs/elegant.html +++ b/resources/views/pdf-designs/elegant.html @@ -17,7 +17,6 @@ @page { margin: $global_margin; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index 57ba54d098..df4101e703 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -17,7 +17,6 @@ @page { margin: $global_margin; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/modern.html b/resources/views/pdf-designs/modern.html index 826dd88a76..0f31218c90 100644 --- a/resources/views/pdf-designs/modern.html +++ b/resources/views/pdf-designs/modern.html @@ -21,7 +21,6 @@ @page { margin: 0 !important; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/plain.html b/resources/views/pdf-designs/plain.html index 4a2f5e61cd..6fad8938d5 100644 --- a/resources/views/pdf-designs/plain.html +++ b/resources/views/pdf-designs/plain.html @@ -16,8 +16,13 @@ } @page { - margin: 5px $global_margin $global_margin $global_margin; - size: $page_size $page_layout; + position: absolute; + top: 0; + margin-left: $global_margin; + margin-right: $global_margin; + margin-top: 0; + margin-bottom: 0; + } p { @@ -71,10 +76,10 @@ } [data-ref="table"] { + margin-top: 1rem; min-width: 100%; table-layout: fixed; overflow-wrap: break-word; - margin-top: 1rem; /* margin-bottom: 200px; */ } diff --git a/resources/views/pdf-designs/playful.html b/resources/views/pdf-designs/playful.html index c8fe01f1e3..d8712983e3 100644 --- a/resources/views/pdf-designs/playful.html +++ b/resources/views/pdf-designs/playful.html @@ -17,7 +17,6 @@ @page { margin: -0.25cm !important; - size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/tech.html b/resources/views/pdf-designs/tech.html index ca132d31bb..74c1df1adb 100644 --- a/resources/views/pdf-designs/tech.html +++ b/resources/views/pdf-designs/tech.html @@ -17,7 +17,6 @@ @page { margin: 0; - size: $page_size $page_layout; } @media print { @@ -355,7 +354,7 @@ $entity_images -