diff --git a/app/Http/Livewire/PdfSlot.php b/app/Http/Livewire/PdfSlot.php index 8eda7b1c4ded..b28379338550 100644 --- a/app/Http/Livewire/PdfSlot.php +++ b/app/Http/Livewire/PdfSlot.php @@ -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(), - ]); } diff --git a/resources/views/portal/ninja2020/components/html-viewer.blade.php b/resources/views/portal/ninja2020/components/html-viewer.blade.php index 8b27738e3a54..b459ca03e435 100644 --- a/resources/views/portal/ninja2020/components/html-viewer.blade.php +++ b/resources/views/portal/ninja2020/components/html-viewer.blade.php @@ -77,7 +77,15 @@ span {
{{ $product['quantity'] }} × {{ $product['cost'] }}
++ @if($show_quantity) + {{ $product['quantity'] }} x + @endif + + @if($show_cost) + {{ $product['cost'] }} + @endif +
{{ $product['notes'] }}