diff --git a/app/Abstracts/View/Components/Documents/Template.php b/app/Abstracts/View/Components/Documents/Template.php index 4e03e1108..c1ab0650f 100644 --- a/app/Abstracts/View/Components/Documents/Template.php +++ b/app/Abstracts/View/Components/Documents/Template.php @@ -95,6 +95,9 @@ abstract class Template extends Component /** @var string */ public $textOrderNumber; + /** @var string */ + public $showContactRoute; + public $hideItems; public $hideName; @@ -138,7 +141,7 @@ abstract class Template extends Component bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false, bool $hideContactPhone = false, bool $hideContactEmail = false, bool $hideOrderNumber = false, bool $hideDocumentNumber = false, bool $hideIssuedAt = false, bool $hideDueAt = false, string $textDocumentTitle = '', string $textDocumentSubheading = '', - string $textContactInfo = '', string $textDocumentNumber = '', string $textOrderNumber = '', string $textIssuedAt = '', string $textDueAt = '', + string $textContactInfo = '', string $textDocumentNumber = '', string $textOrderNumber = '', string $textIssuedAt = '', string $textDueAt = '', string $showContactRoute = '', bool $hideItems = false, bool $hideName = false, bool $hideDescription = false, bool $hideQuantity = false, bool $hidePrice = false, bool $hideDiscount = false, bool $hideAmount = false, bool $hideNote = false, string $textItems = '', string $textQuantity = '', string $textPrice = '', string $textAmount = '', bool $print = false ) { @@ -171,6 +174,7 @@ abstract class Template extends Component $this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle); $this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading); $this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo); + $this->showContactRoute = $this->getShowContactRoute($type, $showContactRoute); $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt); $this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber); $this->textDueAt = $this->getTextDueAt($type, $textDueAt); @@ -540,6 +544,28 @@ abstract class Template extends Component return 'general.amount'; } + protected function getShowContactRoute($type, $showContactRoute) + { + if (! empty($showContactRoute)) { + return $showContactRoute; + } + + + if (! empty($showRoute)) { + return $showRoute; + } + + $route = $this->getRouteFromConfig($type, 'contact.show', 1); + + if (!empty($route)) { + return $route; + } + + $default_key = Str::plural(config('type.' . static::OBJECT_TYPE . '.' . $type . '.contact_type'), 2); + + return $default_key . '.show'; + } + protected function getHideItems($type, $hideItems, $hideName, $hideDescription) { if (! empty($hideItems)) { diff --git a/resources/views/components/documents/template/classic.blade.php b/resources/views/components/documents/template/classic.blade.php index 1035f623e..f3e595417 100644 --- a/resources/views/components/documents/template/classic.blade.php +++ b/resources/views/components/documents/template/classic.blade.php @@ -127,7 +127,7 @@ {{ $document->contact_name }}

@else - diff --git a/resources/views/components/documents/template/default.blade.php b/resources/views/components/documents/template/default.blade.php index fa7f5ac0c..a4946f908 100644 --- a/resources/views/components/documents/template/default.blade.php +++ b/resources/views/components/documents/template/default.blade.php @@ -90,7 +90,7 @@ {{ $document->contact_name }}

@else - diff --git a/resources/views/components/documents/template/modern.blade.php b/resources/views/components/documents/template/modern.blade.php index e77ee8204..f4cadd165 100644 --- a/resources/views/components/documents/template/modern.blade.php +++ b/resources/views/components/documents/template/modern.blade.php @@ -96,7 +96,7 @@ {{ $document->contact_name }}

@else -