Fixes for designs

This commit is contained in:
David Bomba 2025-01-19 17:53:19 +11:00
parent 3d80032d69
commit 4cc61ffb7c
7 changed files with 90 additions and 46 deletions

View File

@ -1114,14 +1114,14 @@ class PdfBuilder
if (!isset($elements[$first_visible]['properties']['class'])) {//@phpstan-ignore-line if (!isset($elements[$first_visible]['properties']['class'])) {//@phpstan-ignore-line
$elements[$first_visible]['properties']['class'] = 'left-radius'; $elements[$first_visible]['properties']['class'] = 'left-radius';
} else { } else {
$elements[$first_visible]['properties']['class'] .= 'left-radius'; $elements[$first_visible]['properties']['class'] .= ' left-radius';
} }
// Add class to last visible element // Add class to last visible element
if (!isset($elements[$last_visible]['properties']['class'])) { if (!isset($elements[$last_visible]['properties']['class'])) {
$elements[$last_visible]['properties']['class'] = 'right-radius'; $elements[$last_visible]['properties']['class'] = 'right-radius';
} else { } else {
$elements[$last_visible]['properties']['class'] .= 'right-radius'; $elements[$last_visible]['properties']['class'] .= ' right-radius';
} }
} }

View File

@ -858,7 +858,7 @@ class Design extends BaseDesign
if (!isset($elements[$last_visible]['properties']['class'])) { if (!isset($elements[$last_visible]['properties']['class'])) {
$elements[$last_visible]['properties']['class'] = 'right-radius'; $elements[$last_visible]['properties']['class'] = 'right-radius';
} else { } 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; return $el;
}, $element['elements']); }, $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;
} }

View File

@ -84,9 +84,9 @@ trait PdfMaker
]; ];
// if (config('ninja.snappdf_chromium_arguments')) { // if (config('ninja.snappdf_chromium_arguments')) {
$pdf->clearChromiumArguments(); // $pdf->clearChromiumArguments();
// $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments')); // $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments'));
$pdf->addChromiumArguments(implode(' ', $chrome_flags)); // $pdf->addChromiumArguments(implode(' ', $chrome_flags));
// } // }
if (config('ninja.snappdf_chromium_path')) { if (config('ninja.snappdf_chromium_path')) {

View File

@ -299,11 +299,6 @@
margin-top: 1rem; 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']{ [data-ref='product_table-product.item-td']{
font-weight: bold; font-weight: bold;
} }
@ -312,34 +307,32 @@
width: 10%; width: 10%;
} }
[data-ref='product_table-product.unit_cost-th']{ [data-ref='product_table-product.unit_cost-th'],
width: 10%; [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.product1-th'],
[data-ref='product_table-product.product2-th'], [data-ref='product_table-product.product2-th'],
[data-ref='product_table-product.product3-th'], [data-ref='product_table-product.product3-th'],
[data-ref='product_table-product.product4-th'] { [data-ref='product_table-product.product4-th'],
width: 8%;
}
[data-ref='product_table-product.tax1-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-th'],
[data-ref='product_table-product.line_total-td'], [data-ref='product_table-product.line_total-td'],
[data-ref='task_table-task.line_total-th'], [data-ref='task_table-task.line_total-th'],
[data-ref='task_table-task.line_total-td'] { [data-ref='task_table-task.line_total-td'] {
width: 10%; width: 12%;
text-align: right !important; text-align: right !important;
padding-right: 1rem !important; padding-right: 1rem !important;
} }
[data-ref='product_table-product.description-th'],
[data-ref='task_table-task.description-th'] { [data-ref='task_table-task.description-th'] {
overflow-wrap: break-word; overflow-wrap: break-word;
min-width: 100px !important; min-width: 150px !important;
} }
[data-ref='task_table-task.hours-th'], [data-ref='task_table-task.hours-th'],
@ -350,7 +343,7 @@
[data-ref='task_table-task.task2-th'], [data-ref='task_table-task.task2-th'],
[data-ref='task_table-task.task3-th'], [data-ref='task_table-task.task3-th'],
[data-ref='task_table-task.task4-th'] { [data-ref='task_table-task.task4-th'] {
width: 8%; width: 12%;
} }
[data-ref='task_table-task.service-th']{ [data-ref='task_table-task.service-th']{
@ -358,7 +351,7 @@
} }
[data-ref='task_table-task.tax1-th'] { [data-ref='task_table-task.tax1-th'] {
width: 6%; width: 10%;
} }

View File

@ -254,6 +254,8 @@
bottom: 0; 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-th'],
[data-ref='product_table-product.description-td'] { [data-ref='product_table-product.description-td'] {
min-width: 150px !important; min-width: 150px !important;
@ -266,37 +268,25 @@
[data-ref='product_table-product.item-th'], [data-ref='product_table-product.item-th'],
[data-ref='product_table-product.unit_cost-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%; width: 12%;
} }
[data-ref='product_table-product.tax1-th'] { [data-ref='product_table-product.tax1-th'] {
width: 6%;
}
[data-ref='product_table-product.line_total-th'] {
width: 10%; 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.hours-th'],
[data-ref='task_table-task.service-th'], [data-ref='task_table-task.service-th'],
[data-ref='task_table-task.discount-th'], [data-ref='task_table-task.discount-th'],
[data-ref='task_table-task.cost-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%; width: 12%;
} }
[data-ref='task_table-task.tax1-th'] { [data-ref='task_table-task.tax1-th'] {
width: 6%;
}
[data-ref='task_table-task.line_total-th'] {
width: 10%; width: 10%;
} }

View File

@ -292,10 +292,12 @@
padding-right:0 !important; 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-th"],
[data-ref="product_table-product.tax1-td"] { [data-ref="product_table-product.tax1-td"] {
text-align: center; text-align: center;
width: 6%; width: 9%;
padding-left:0 !important; padding-left:0 !important;
padding-right:0 !important; padding-right:0 !important;
} }

View File

@ -319,8 +319,9 @@
width: 10%; width: 10%;
} }
[data-ref='product_table-product.tax1-th'] { [data-ref='product_table-product.tax1-th'],
width: 6%; [data-ref='task_table-task.tax1-th'] {
width: 10%;
} }
[data-ref='product_table-product.line_total-th'], [data-ref='product_table-product.line_total-th'],
@ -340,10 +341,7 @@
width: 10%; width: 10%;
} }
[data-ref='task_table-task.tax1-th'] {
width: 6%;
}
.stamp { .stamp {
transform: rotate(12deg); transform: rotate(12deg);
color: #555; color: #555;