From 1c9450a6e4eac9b90aacc70ec6ef1f010681e904 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 20 Jul 2023 21:17:01 +1000 Subject: [PATCH] Improve readability for html view in Client Portal --- app/Http/Livewire/PdfSlot.php | 16 ++++++++++------ .../ninja2020/components/html-viewer.blade.php | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/Http/Livewire/PdfSlot.php b/app/Http/Livewire/PdfSlot.php index dc4372f12340..dccaf802c03d 100644 --- a/app/Http/Livewire/PdfSlot.php +++ b/app/Http/Livewire/PdfSlot.php @@ -25,6 +25,7 @@ use Illuminate\Support\Facades\Cache; use App\Models\PurchaseOrderInvitation; use App\Models\RecurringInvoiceInvitation; use App\Jobs\Vendor\CreatePurchaseOrderPdf; +use App\Services\PdfMaker\Designs\Utilities\DesignHelpers; class PdfSlot extends Component { @@ -172,20 +173,20 @@ class PdfSlot extends Component if($this->entity_type == 'invoice' || $this->entity_type == 'recurring_invoice') { foreach($this->settings->pdf_variables->invoice_details as $variable) - $entity_details .= "

{$variable}_label

{$variable}

"; + $entity_details .= "

{$variable}_label

{$variable}

"; } elseif($this->entity_type == 'quote'){ foreach($this->settings->pdf_variables->quote_details as $variable) - $entity_details .= "

{$variable}_label

{$variable}

"; + $entity_details .= "

{$variable}_label

{$variable}

"; } elseif($this->entity_type == 'credit') { foreach($this->settings->pdf_variables->credit_details as $variable) - $entity_details .= "

{$variable}_label

{$variable}

"; + $entity_details .= "

{$variable}_label

{$variable}

"; } elseif($this->entity_type == 'purchase_order'){ foreach($this->settings->pdf_variables->purchase_order_details as $variable) - $entity_details .= "

{$variable}_label

{$variable}

"; + $entity_details .= "

{$variable}_label

{$variable}

"; } return $this->convertVariables($entity_details); @@ -228,13 +229,16 @@ class PdfSlot extends Component private function getProducts() { + + + $product_items = collect($this->entity->line_items)->filter(function ($item) { return $item->type_id == 1 || $item->type_id == 6 || $item->type_id == 5; })->map(function ($item){ return [ 'quantity' => $item->quantity, 'cost' => Number::formatMoney($item->cost, $this->entity->client ?: $this->entity->vendor), - 'notes' => $item->notes, + 'notes' => $this->invitation->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($item->notes) : $item->notes, 'line_total' => Number::formatMoney($item->line_total, $this->entity->client ?: $this->entity->vendor), ]; }); @@ -250,7 +254,7 @@ class PdfSlot extends Component return [ 'quantity' => $item->quantity, 'cost' => Number::formatMoney($item->cost, $this->entity->client ?: $this->entity->vendor), - 'notes' => $item->notes, + 'notes' => $this->invitation->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($item->notes) : $item->notes, 'line_total' => Number::formatMoney($item->line_total, $this->entity->client ?: $this->entity->vendor), ]; }); diff --git a/resources/views/portal/ninja2020/components/html-viewer.blade.php b/resources/views/portal/ninja2020/components/html-viewer.blade.php index d630d3240959..0b1ccdafed00 100644 --- a/resources/views/portal/ninja2020/components/html-viewer.blade.php +++ b/resources/views/portal/ninja2020/components/html-viewer.blade.php @@ -86,7 +86,7 @@ span { {{ $product['cost'] }} @endif

-

{{ $product['notes'] }}

+

{!! $product['notes'] !!}

@@ -106,19 +106,19 @@ span {
- + @foreach($services as $service) - +
Service Amount

{{ $service['quantity'] }} × {{ $service['cost'] }}

-

{{ $service['notes'] }}

+

{!! $service['notes'] !!}