diff --git a/app/Http/Livewire/PdfSlot.php b/app/Http/Livewire/PdfSlot.php index ce951f497223..9be66121824a 100644 --- a/app/Http/Livewire/PdfSlot.php +++ b/app/Http/Livewire/PdfSlot.php @@ -78,6 +78,7 @@ class PdfSlot extends Component 'company_address' => $this->getCompanyAddress(), 'entity_details' => $this->getEntityDetails(), 'user_details' => $this->getUserDetails(), + 'user_name' => $this->getUserName(), ]); } @@ -120,43 +121,54 @@ class PdfSlot extends Component private function getEntityDetails() { - $entity_details = "
"; + $entity_details = ""; 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}

"; } - $entity_details .= "
"; - return $this->convertVariables($entity_details); } + private function getUserName() + { + if($this->entity_type == 'purchase_order') { + $name = $this->settings->pdf_variables->vendor_details[0]; + + } else { + $name = $this->settings->pdf_variables->client_details[0]; + } + + return $this->convertVariables($name); + + } + private function getUserDetails() { $user_details = ""; if($this->entity_type == 'purchase_order') { - foreach($this->settings->pdf_variables->vendor_details as $variable) { + foreach(array_slice($this->settings->pdf_variables->vendor_details,1) as $variable) { $user_details .= "

{$variable}

"; } } else{ - foreach($this->settings->pdf_variables->client_details as $variable) { + foreach(array_slice($this->settings->pdf_variables->client_details,1) as $variable) { $user_details .= "

{$variable}

"; } } diff --git a/resources/views/portal/ninja2020/components/html-viewer.blade.php b/resources/views/portal/ninja2020/components/html-viewer.blade.php index 1be4224c2ba9..58fbdc575226 100644 --- a/resources/views/portal/ninja2020/components/html-viewer.blade.php +++ b/resources/views/portal/ninja2020/components/html-viewer.blade.php @@ -2,7 +2,7 @@ -
-
+
+ +
+
{!! $company_details !!}
-
+ + +
+ +
+ +
{!! $entity_details !!}
+ +
+ + +
+ +
+ + + +
+ {!! $user_details !!} +
+ +
-
- -
- -
{!! $entity_details !!}
- -
- {!! $user_details !!} -
+
@if($products->count() > 0) -
+
- + @foreach($products as $product) - +
Item Amount
@@ -74,7 +93,7 @@ span {
@endif @if($services->count() > 0) -
+
+
@@ -109,21 +128,21 @@ span { - + - +
-

{{ ctrans('texts.total') }}

+

{{ ctrans('texts.total') }}

{{ $amount }}{{ $amount }}
-

{{ ctrans('texts.balance') }}

+

{{ ctrans('texts.balance') }}

{{ $balance }}{{ $balance }}
@@ -131,9 +150,9 @@ span {
@if(strlen($entity->public_notes) > 3) -
+
- @@ -146,7 +165,7 @@ span { @endif @if(strlen($entity->terms) > 3) -
+
- @endif - + @endif \ No newline at end of file