fixed show contact route

This commit is contained in:
Cihan Şentürk 2023-01-03 10:47:34 +03:00 committed by GitHub
parent fa7d6a92a6
commit dc0752d0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 4 deletions

View File

@ -95,6 +95,9 @@ abstract class Template extends Component
/** @var string */ /** @var string */
public $textOrderNumber; public $textOrderNumber;
/** @var string */
public $showContactRoute;
public $hideItems; public $hideItems;
public $hideName; 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 $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, bool $hideOrderNumber = false, bool $hideDocumentNumber = false, bool $hideIssuedAt = false, bool $hideDueAt = false,
string $textDocumentTitle = '', string $textDocumentSubheading = '', 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, 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 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->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
$this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading); $this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading);
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo); $this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
$this->showContactRoute = $this->getShowContactRoute($type, $showContactRoute);
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt); $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
$this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber); $this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber);
$this->textDueAt = $this->getTextDueAt($type, $textDueAt); $this->textDueAt = $this->getTextDueAt($type, $textDueAt);
@ -540,6 +544,28 @@ abstract class Template extends Component
return 'general.amount'; 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) protected function getHideItems($type, $hideItems, $hideName, $hideDescription)
{ {
if (! empty($hideItems)) { if (! empty($hideItems)) {

View File

@ -127,7 +127,7 @@
{{ $document->contact_name }} {{ $document->contact_name }}
</p> </p>
@else @else
<x-link href="{{ route('customers.show', $document->contact_id) }}" <x-link href="{{ route($showContactRoute, $document->contact_id) }}"
override="class" override="class"
class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6" class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6"
> >

View File

@ -90,7 +90,7 @@
{{ $document->contact_name }} {{ $document->contact_name }}
</p> </p>
@else @else
<x-link href="{{ route('customers.show', $document->contact_id) }}" <x-link href="{{ route($showContactRoute, $document->contact_id) }}"
override="class" override="class"
class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6" class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6"
> >

View File

@ -96,7 +96,7 @@
{{ $document->contact_name }} {{ $document->contact_name }}
</p> </p>
@else @else
<x-link href="{{ route('customers.show', $document->contact_id) }}" <x-link href="{{ route($showContactRoute, $document->contact_id) }}"
override="class" override="class"
class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6" class="py-1.5 mb-3 sm:mb-0 text-xs bg-transparent hover:bg-transparent font-medium leading-6"
> >