diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 4768c31616..2cb64047dc 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -1353,8 +1353,6 @@ class PdfBuilder if (is_null($this->service->config->entity->{$_variable}) || empty($this->service->config->entity->{$_variable})) { return true; } - - // nlog("{$_variable} - {$this->service->config->entity->{$_variable}}"); return false; } @@ -1377,11 +1375,11 @@ class PdfBuilder $elements = [ ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [ ['element' => 'div', 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;'], 'elements' => [ - ['element' => 'span', 'content' => strtr(str_replace(["labels", "values"], ["",""], $_variables['values']['$entity.public_notes']), $_variables)] + ['element' => 'div', 'content' => strtr(str_replace(["labels", "values"], ["",""], $_variables['values']['$entity.public_notes']), $_variables)] ]], ['element' => 'div', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column; page-break-inside: auto;'], 'elements' => [ - ['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['data-ref' => 'total_table-terms-label', 'style' => "font-weight:bold; text-align: left; margin-top: 1rem; {$show_terms_label}"]], - ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']], + ['element' => 'div', 'content' => '$entity.terms_label: ', 'properties' => ['data-ref' => 'total_table-terms-label', 'style' => "font-weight:bold; text-align: left; margin-top: 1rem; {$show_terms_label}"]], + ['element' => 'div', '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' => 'display: flex; align-items: flex-start; page-break-inside: auto;'], 'elements' => [ @@ -1440,8 +1438,8 @@ class PdfBuilder foreach ($taxes as $i => $tax) { $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']], - ['element' => 'span', 'content', 'content' => $this->service->config->formatMoney($tax['total']), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]], + ['element' => 'p', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']], + ['element' => 'p', 'content', 'content' => $this->service->config->formatMoney($tax['total']), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]], ]]; } } elseif ($variable == '$line_taxes') { @@ -1453,8 +1451,8 @@ class PdfBuilder foreach ($taxes as $i => $tax) { $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']], - ['element' => 'span', 'content', 'content' => $this->service->config->formatMoney($tax['total']), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]], + ['element' => 'p', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']], + ['element' => 'p', 'content', 'content' => $this->service->config->formatMoney($tax['total']), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]], ]]; } } elseif (Str::startsWith($variable, '$custom_surcharge')) { @@ -1463,28 +1461,28 @@ class PdfBuilder $visible = intval(str_replace(['0','.'], '', ($this->service->config->entity->{$_variable} ?? ''))) != 0; $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], - ['element' => 'span', 'content' => $variable, 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1)]], + ['element' => 'p', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], + ['element' => 'p', 'content' => $variable, 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1)]], ]]; } elseif (Str::startsWith($variable, '$custom')) { $field = explode('_', $variable); $visible = is_object($this->service->company->custom_fields) && property_exists($this->service->company->custom_fields, $field[1]) && !empty($this->service->company->custom_fields->{$field[1]}); $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], - ['element' => 'span', 'content' => $variable, 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1)]], + ['element' => 'p', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], + ['element' => 'p', 'content' => $variable, 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1)]], ]]; } else { $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], - ['element' => 'span', 'content' => $variable, 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1)]], - ]]; + ['element' => 'p', 'content' => $variable . '_label', 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], + ['element' => 'p', 'content' => $variable, 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1)]], + ], 'properties' => ['class' => 'totals_table-' . substr($variable, 1)]]; } } $elements[1]['elements'][] = ['element' => 'div', 'elements' => [ - ['element' => 'span', 'content' => '',], - ['element' => 'span', 'content' => ''], + ['element' => 'p', 'content' => '',], + ['element' => 'p', 'content' => ''], ]]; @@ -1991,7 +1989,8 @@ class PdfBuilder '/\*\*.*?\*\*/', // Bold '/\*.*?\*/', // Italic '/__.*?__/', // Bold - '/_.*?_/', // Italic + // '/_.*?_/', // Italic + '/(?/m', // Blockquotes '/^\s*```/m', // Code blocks @@ -2027,7 +2026,6 @@ class PdfBuilder $contains_html = str_contains($child['content'], '<') && str_contains($child['content'], '>'); if ($contains_html) { - // Encode any HTML elements now so that DOMDocument doesn't throw any errors, // Later we can decode specific elements. diff --git a/app/Services/Pdf/PdfService.php b/app/Services/Pdf/PdfService.php index 68ea3ad316..b37c47559c 100644 --- a/app/Services/Pdf/PdfService.php +++ b/app/Services/Pdf/PdfService.php @@ -92,7 +92,7 @@ class PdfService try { $html = $this->getHtml(); - + nlog($html); $pdf = $this->resolvePdfEngine($html); $numbered_pdf = $this->pageNumbering($pdf, $this->company); diff --git a/resources/views/pdf-designs/bold.html b/resources/views/pdf-designs/bold.html index be0475c7b9..846da450b4 100644 --- a/resources/views/pdf-designs/bold.html +++ b/resources/views/pdf-designs/bold.html @@ -227,22 +227,6 @@ text-align: right; } - #table-totals - > * - [data-element='product-table-balance-due-label'], - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - font-size: 1.4rem; - } - - #table-totals - > * - [data-element='product-table-balance-due'] { - color: var(--primary-color); - } - #table-totals > * > :last-child { text-align: right; padding-right: 1.5rem; @@ -438,47 +422,43 @@ - - -
-
-
-

$entity_label

-
-
+ + +
+
+
+

$entity_label

+
+
+
+
+

&

+
+
-
-

&

-
+ +
+

$entity_label

+
+
+
-
-

$entity_label

-
-
-
-
-
- -
- -
- -
- -
-
- -
-
-
-
-
-
-
$status_logo
- - +
+
+
+
+
+
+
+
+
+
+
+
$status_logo
+ + diff --git a/resources/views/pdf-designs/business.html b/resources/views/pdf-designs/business.html index d3a43f2c5f..ed0d574b76 100644 --- a/resources/views/pdf-designs/business.html +++ b/resources/views/pdf-designs/business.html @@ -41,11 +41,18 @@ .header-container { display: grid; - grid-template-columns: 1.8fr 1fr 1fr; - grid-gap: 20px; + grid-template-columns: 1fr auto 1fr; + align-items: start; + gap: 1rem; + width:100%; margin-bottom: 2rem; } + .company-logo-container { + justify-self: start; + align-self: start; + } + .company-logo { max-width: $company_logo_size; } @@ -55,6 +62,8 @@ } #company-details { + justify-self: center; + align-self: start; display: flex; flex-direction: column; color: #AAA9A9; @@ -62,6 +71,8 @@ } #company-address { + justify-self: end; + align-self: start; display: flex; flex-direction: column; color: #b1b1b1; @@ -173,14 +184,6 @@ background: #f7f7f7; } - [data-element='product-table-balance-due-label'], - [data-element='product-table-balance-due'], - [data-element='task-table-balance-due-label'], - [data-element='task-table-balance-due'] { - color: var(--secondary-color) !important; - font-weight: bold !important; - } - #table-totals > *:last-child { border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem; @@ -220,22 +223,6 @@ padding-right: 17px; } - #table-totals - > * - [data-element='product-table-balance-due-label'], - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - font-size: 1.2rem; - } - - #table-totals - > * - [data-element='product-table-balance-due'] { - color: red; - } - #table-totals > * > :last-child { text-align: right; padding-right: 1rem; @@ -263,6 +250,7 @@ padding: 1rem; border-top-left-radius: 7px; border-bottom-left-radius: 7px; + white-space: nowrap; } [data-ref="totals_table-outstanding"] { background-color: var(--secondary-color); @@ -272,6 +260,7 @@ padding: 1rem; border-top-right-radius: 7px; border-bottom-right-radius: 7px; + white-space: nowrap; } [data-ref="statement-totals"] { @@ -399,13 +388,11 @@
- -
-
+
+ +
+
+

$entity_issued_to_label

diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 1784284038..a9ad0d6f01 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -62,7 +62,7 @@ } #company-details { - justify-self: center; + justify-self: center; align-self: start; display: flex; flex-direction: column; @@ -185,7 +185,7 @@ padding-right: 1rem; padding-left: 1rem; gap: 80px; - page-break-inside: avoid; + page-break-inside: auto; overflow: visible !important; } @@ -209,15 +209,6 @@ margin-bottom: calc(.75rem * var(--tw-space-y-reverse)); } - #table-totals>* [data-element='product-table-balance-due-label'], - #table-totals>* [data-element='product-table-balance-due'] { - font-weight: bold; - } - - #table-totals>* [data-element='product-table-balance-due'] { - color: var(--primary-color); - } - #table-totals>*> :last-child { text-align: right; padding-right: 0.5rem; @@ -388,10 +379,15 @@
-
$status_logo
+
+ + +
$status_logo
+ + diff --git a/resources/views/pdf-designs/creative.html b/resources/views/pdf-designs/creative.html index 342dde036d..d4373e9b11 100644 --- a/resources/views/pdf-designs/creative.html +++ b/resources/views/pdf-designs/creative.html @@ -233,13 +233,6 @@ text-align: right; } - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - color: var(--primary-color); - } - #table-totals > * > * { padding-left: 0.5rem; } diff --git a/resources/views/pdf-designs/elegant.html b/resources/views/pdf-designs/elegant.html index 6bacfb22a8..933499ece1 100644 --- a/resources/views/pdf-designs/elegant.html +++ b/resources/views/pdf-designs/elegant.html @@ -214,21 +214,6 @@ text-align: right; } - #table-totals - > * - [data-element='product-table-balance-due-label'], - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - } - - #table-totals - > * - [data-element='product-table-balance-due'] { - color: var(--primary-color); - } - #table-totals > * > :last-child { text-align: right; padding-right: 0.5rem; diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index 36c9c01946..623b2a9845 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -243,21 +243,6 @@ text-align: right; } - #table-totals - > * - [data-element='product-table-balance-due-label'], - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - } - - #table-totals - > * - [data-element='product-table-balance-due'] { - color: var(--primary-color); - } - #table-totals > * > :last-child { text-align: right; padding-right: 0rem; diff --git a/resources/views/pdf-designs/modern.html b/resources/views/pdf-designs/modern.html index 510217348c..b2fc774524 100644 --- a/resources/views/pdf-designs/modern.html +++ b/resources/views/pdf-designs/modern.html @@ -257,12 +257,6 @@ text-align: right; } - #table-totals > * [data-element="product-table-balance-due-label"], - #table-totals > * [data-element="product-table-balance-due"] { - font-weight: bold; - font-size: 1.3rem; - } - [data-ref="total_table-footer"] { margin-top: 1rem; margin-bottom: 1rem; diff --git a/resources/views/pdf-designs/playful.html b/resources/views/pdf-designs/playful.html index bb21ae1eea..d81874365d 100644 --- a/resources/views/pdf-designs/playful.html +++ b/resources/views/pdf-designs/playful.html @@ -231,21 +231,6 @@ text-align: right; } - #table-totals - > * - [data-element='product-table-balance-due-label'], - #table-totals - > * - [data-element='product-table-balance-due'] { - font-weight: bold; - } - - #table-totals - > * - [data-element='product-table-balance-due'] { - color: var(--primary-color); - } - #table-totals > * > :last-child { text-align: right; padding-right: 1rem;