diff --git a/app/Abstracts/View/Components/DocumentShow.php b/app/Abstracts/View/Components/DocumentShow.php
index 904b88bee..d059cfe97 100644
--- a/app/Abstracts/View/Components/DocumentShow.php
+++ b/app/Abstracts/View/Components/DocumentShow.php
@@ -95,6 +95,9 @@ abstract class DocumentShow extends Base
/** @var string */
public $routeButtonPaid;
+ /** @var string */
+ public $routeContactShow;
+
/** @var string */
public $permissionCreate;
@@ -373,7 +376,7 @@ abstract class DocumentShow extends Base
$type, $document, $documentTemplate = '', $logo = '', $backgroundColor = '', string $signedUrl = '', $histories = [], $transactions = [],
string $textRecurringType = '', string $textStatusMessage = '', string $textHistories = '', string $textHistoryStatus = '',
string $routeButtonAddNew = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonPrint = '', string $routeButtonPdf = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', string $routeButtonCustomize = '', string $routeButtonSent = '',
- string $routeButtonReceived = '', string $routeButtonEmail = '', string $routeButtonPaid = '',
+ string $routeButtonReceived = '', string $routeButtonEmail = '', string $routeButtonPaid = '', string $routeContactShow = '',
bool $checkButtonReconciled = true, bool $checkButtonCancelled = true,
string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '', string $permissionTransactionDelete = '', string $permissionButtonCustomize = '',
bool $hideButtonGroupDivider1 = false, bool $hideButtonGroupDivider2 = false, bool $hideButtonGroupDivider3 = false,
@@ -424,6 +427,7 @@ abstract class DocumentShow extends Base
$this->routeButtonCustomize = $this->getRouteButtonCustomize($type, $routeButtonCustomize);
$this->routeButtonDelete = $this->getRouteButtonDelete($type, $routeButtonDelete);
$this->routeButtonPaid = $this->getRouteButtonPaid($type, $routeButtonPaid);
+ $this->routeContactShow = $this->getRouteContactShow($type, $routeContactShow);
$this->permissionCreate = $this->getPermissionCreate($type, $permissionCreate);
$this->permissionUpdate = $this->getPermissionUpdate($type, $permissionUpdate);
@@ -886,6 +890,36 @@ abstract class DocumentShow extends Base
return 'invoices.paid';
}
+ protected function getRouteContactShow($type, $routeContactShow)
+ {
+ if (!empty($routeContactShow)) {
+ return $routeContactShow;
+ }
+
+ //example route parameter.
+ $parameter = 1;
+
+ $route = Str::plural(config('type.' . $type . '.contact_type'), 2) . '.show';
+
+ try {
+ route($route, $config_parameters);
+ } catch (\Exception $e) {
+ try {
+ $route = Str::plural($type, 2) . '.' . $config_key;
+
+ route($route, $config_parameters);
+ } catch (\Exception $e) {
+ $route = '';
+ }
+ }
+
+ if (!empty($route)) {
+ return $route;
+ }
+
+ return 'customers.show';
+ }
+
protected function getRouteButtonSent($type, $routeButtonSent)
{
if (!empty($routeButtonSent)) {
diff --git a/resources/views/components/documents/show/content.blade.php b/resources/views/components/documents/show/content.blade.php
index 41abf848d..36c1614aa 100644
--- a/resources/views/components/documents/show/content.blade.php
+++ b/resources/views/components/documents/show/content.blade.php
@@ -9,6 +9,7 @@
hide-header-contact="{{ $hideHeaderContact }}"
text-header-contact="{{ $textHeaderContact }}"
class-header-contact="{{ $classHeaderContact }}"
+ route-contact-show="{{ $routeContactShow }}"
hide-header-amount="{{ $hideHeaderAmount }}"
text-header-amount="{{ $textHeaderAmount }}"
class-header-amount="{{ $classHeaderAmount }}"
diff --git a/resources/views/components/documents/show/header.blade.php b/resources/views/components/documents/show/header.blade.php
index 214eda433..2f0660171 100644
--- a/resources/views/components/documents/show/header.blade.php
+++ b/resources/views/components/documents/show/header.blade.php
@@ -25,7 +25,9 @@
- {{ $document->contact_name }}
+
+ {{ $document->contact_name }}
+