diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index d5d29f5f11..fe407f5e48 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -1114,14 +1114,14 @@ class PdfBuilder if (!isset($elements[$first_visible]['properties']['class'])) {//@phpstan-ignore-line $elements[$first_visible]['properties']['class'] = 'left-radius'; } else { - $elements[$first_visible]['properties']['class'] .= 'left-radius'; + $elements[$first_visible]['properties']['class'] .= ' left-radius'; } // Add class to last visible element if (!isset($elements[$last_visible]['properties']['class'])) { $elements[$last_visible]['properties']['class'] = 'right-radius'; } else { - $elements[$last_visible]['properties']['class'] .= 'right-radius'; + $elements[$last_visible]['properties']['class'] .= ' right-radius'; } } diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index 3e05054ed5..c2a2bdac8e 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -858,7 +858,7 @@ class Design extends BaseDesign if (!isset($elements[$last_visible]['properties']['class'])) { $elements[$last_visible]['properties']['class'] = 'right-radius'; } else { - $elements[$last_visible]['properties']['class'] .= 'right-radius'; + $elements[$last_visible]['properties']['class'] .= ' right-radius'; } } @@ -1055,7 +1055,68 @@ class Design extends BaseDesign return $el; }, $element['elements']); - $elements[] = $element; + + +$visible_elements = array_filter($element['elements'], function ($el) { + if (isset($el['properties']['visi']) && $el['properties']['visi']) { + return true; + } + return false; +}); + +if (!empty($visible_elements)) { + $first_visible = array_key_first($visible_elements); + $last_visible = array_key_last($visible_elements); + + // Add class to first visible cell + if (!isset($element['elements'][$first_visible]['properties']['class'])) { //@phpstan-ignore-line + $element['elements'][$first_visible]['properties']['class'] = 'left-radius'; + } else { + $element['elements'][$first_visible]['properties']['class'] .= ' left-radius'; + } + + // Add class to last visible cell + if (!isset($element['elements'][$last_visible]['properties']['class'])) { + $element['elements'][$last_visible]['properties']['class'] = 'right-radius'; + } else { + $element['elements'][$last_visible]['properties']['class'] .= ' right-radius'; + } +} + +// Then, filter the elements array +$element['elements'] = array_map(function ($el) { + if (isset($el['properties']['visi'])) { + if ($el['properties']['visi'] === false) { + $el['properties']['style'] = 'display: none;'; + } + unset($el['properties']['visi']); + } + return $el; +}, $element['elements']); + +$elements[] = $element; + + + + + + + + + + + + + + + + + + + + + + // $elements[] = $element; } diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index ccaf0a10aa..4a7692357c 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -84,9 +84,9 @@ trait PdfMaker ]; // if (config('ninja.snappdf_chromium_arguments')) { - $pdf->clearChromiumArguments(); + // $pdf->clearChromiumArguments(); // $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments')); - $pdf->addChromiumArguments(implode(' ', $chrome_flags)); + // $pdf->addChromiumArguments(implode(' ', $chrome_flags)); // } if (config('ninja.snappdf_chromium_path')) { diff --git a/resources/views/pdf-designs/bold.html b/resources/views/pdf-designs/bold.html index e83bc9d3c9..13eab3e009 100644 --- a/resources/views/pdf-designs/bold.html +++ b/resources/views/pdf-designs/bold.html @@ -299,11 +299,6 @@ margin-top: 1rem; } - [data-ref='product_table-product.description-th'] { - min-width: 100px !important; - overflow-wrap: break-word; - } - [data-ref='product_table-product.item-td']{ font-weight: bold; } @@ -312,34 +307,32 @@ width: 10%; } - [data-ref='product_table-product.unit_cost-th']{ - width: 10%; + [data-ref='product_table-product.unit_cost-th'], + [data-ref='product_table-product.quantity-th']{ + width: 12%; } - [data-ref='product_table-product.quantity-th'], [data-ref='product_table-product.product1-th'], [data-ref='product_table-product.product2-th'], [data-ref='product_table-product.product3-th'], - [data-ref='product_table-product.product4-th'] { - width: 8%; - } - + [data-ref='product_table-product.product4-th'], [data-ref='product_table-product.tax1-th'] { - width: 6%; + width: 10%; } [data-ref='product_table-product.line_total-th'], [data-ref='product_table-product.line_total-td'], [data-ref='task_table-task.line_total-th'], [data-ref='task_table-task.line_total-td'] { - width: 10%; + width: 12%; text-align: right !important; padding-right: 1rem !important; } + [data-ref='product_table-product.description-th'], [data-ref='task_table-task.description-th'] { overflow-wrap: break-word; - min-width: 100px !important; + min-width: 150px !important; } [data-ref='task_table-task.hours-th'], @@ -350,7 +343,7 @@ [data-ref='task_table-task.task2-th'], [data-ref='task_table-task.task3-th'], [data-ref='task_table-task.task4-th'] { - width: 8%; + width: 12%; } [data-ref='task_table-task.service-th']{ @@ -358,7 +351,7 @@ } [data-ref='task_table-task.tax1-th'] { - width: 6%; + width: 10%; } diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index f819f4ffd8..640537011c 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -254,6 +254,8 @@ bottom: 0; } + [data-ref='task_table-task.description-th'], + [data-ref='task_table-task.description-td'], [data-ref='product_table-product.description-th'], [data-ref='product_table-product.description-td'] { min-width: 150px !important; @@ -266,37 +268,25 @@ [data-ref='product_table-product.item-th'], [data-ref='product_table-product.unit_cost-th'], - [data-ref='product_table-product.quantity-th'] { + [data-ref='product_table-product.quantity-th'], + [data-ref='product_table-product.line_total-th'] { width: 12%; } [data-ref='product_table-product.tax1-th'] { - width: 6%; - } - - [data-ref='product_table-product.line_total-th'] { width: 10%; } - [data-ref='task_table-task.description-th'], - [data-ref='task_table-task.description-td'] { - min-width: 100px !important; - overflow-wrap: break-word; - } - [data-ref='task_table-task.hours-th'], [data-ref='task_table-task.service-th'], [data-ref='task_table-task.discount-th'], [data-ref='task_table-task.cost-th'], - [data-ref='task_table-task.quantity-th'] { + [data-ref='task_table-task.quantity-th'], + [data-ref='task_table-task.line_total-th'] { width: 12%; } [data-ref='task_table-task.tax1-th'] { - width: 6%; - } - - [data-ref='task_table-task.line_total-th'] { width: 10%; } diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index b5e051a49f..e49b73fb28 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -292,10 +292,12 @@ padding-right:0 !important; } + [data-ref="task_table-task.tax1-th"], + [data-ref="task_table-task.tax1-td"], [data-ref="product_table-product.tax1-th"], [data-ref="product_table-product.tax1-td"] { text-align: center; - width: 6%; + width: 9%; padding-left:0 !important; padding-right:0 !important; } diff --git a/resources/views/pdf-designs/modern.html b/resources/views/pdf-designs/modern.html index 56306ded28..dec2b45186 100644 --- a/resources/views/pdf-designs/modern.html +++ b/resources/views/pdf-designs/modern.html @@ -319,8 +319,9 @@ width: 10%; } - [data-ref='product_table-product.tax1-th'] { - width: 6%; + [data-ref='product_table-product.tax1-th'], + [data-ref='task_table-task.tax1-th'] { + width: 10%; } [data-ref='product_table-product.line_total-th'], @@ -340,10 +341,7 @@ width: 10%; } - [data-ref='task_table-task.tax1-th'] { - width: 6%; - } - + .stamp { transform: rotate(12deg); color: #555;