1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Tune show/hide parameters for html invoices

This commit is contained in:
David Bomba 2023-07-13 12:43:54 +10:00
parent 484d090fae
commit 08c66fc545
2 changed files with 21 additions and 2 deletions

View File

@ -48,6 +48,10 @@ class PdfSlot extends Component
protected $listeners = ['viewportChanged' => 'getPdf'];
public $show_cost = true;
public $show_quantity = true;
public function mount()
{
MultiDB::setDb($this->db);
@ -82,6 +86,14 @@ class PdfSlot extends Component
$this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings;
$this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_columns);
$this->show_quantity = in_array('$product.quantity', $this->settings->pdf_variables->product_columns);
if($this->entity_type == 'quote' && !$this->settings->sync_invoice_quote_columns ){
$this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_quote_columns);
$this->show_quantity = in_array('$product.quantity', $this->settings->pdf_variables->product_quote_columns);
}
$this->html_variables = $this->entity->client ?
(new HtmlEngine($this->invitation))->generateLabelsAndValues() :
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues();
@ -100,7 +112,6 @@ class PdfSlot extends Component
'entity_details' => $this->getEntityDetails(),
'user_details' => $this->getUserDetails(),
'user_name' => $this->getUserName(),
]);
}

View File

@ -77,7 +77,15 @@ span {
<td>
<div class="product-information">
<div class="item-details">
<p class="mt-2">{{ $product['quantity'] }} × {{ $product['cost'] }}</p>
<p class="mt-2">
@if($show_quantity)
{{ $product['quantity'] }} x
@endif
@if($show_cost)
{{ $product['cost'] }}
@endif
</p>
<p class="overflow-ellipsis overflow-hidden px-1 mb-2">{{ $product['notes'] }}</p>
</div>
</div>