route prefix fixed #1v0ueh7

This commit is contained in:
Sevan Nerse 2021-11-25 14:13:14 +03:00
parent 916d2a15e3
commit a83c8eee3c
4 changed files with 26 additions and 2 deletions

View File

@ -41,6 +41,9 @@ abstract class DocumentShow extends Base
public $date_format; public $date_format;
/** @var string */
public $routePrefix;
/** @var string */ /** @var string */
public $textRecurringType; public $textRecurringType;
@ -404,6 +407,7 @@ abstract class DocumentShow extends Base
$this->logo = $this->getLogo($logo); $this->logo = $this->getLogo($logo);
$this->backgroundColor = $backgroundColor; $this->backgroundColor = $backgroundColor;
$this->signedUrl = $this->getSignedUrl($type, $signedUrl); $this->signedUrl = $this->getSignedUrl($type, $signedUrl);
$this->routePrefix = $this->getRoutePrefix($type);
$this->histories = ($histories) ? $histories : $document->histories; $this->histories = ($histories) ? $histories : $document->histories;
$this->transactions = ($transactions) ? $transactions : $document->transactions; $this->transactions = ($transactions) ? $transactions : $document->transactions;
@ -1602,4 +1606,12 @@ abstract class DocumentShow extends Base
// @todo what return value invoice or always false?? // @todo what return value invoice or always false??
return setting('invoice.hide_amount', $hideAmount); return setting('invoice.hide_amount', $hideAmount);
} }
protected function getRoutePrefix($type) {
if ($prefix = config('type.' . $type . '.route.prefix', false)){
return 'invoices';
}
return $prefix;
}
} }

View File

@ -34,6 +34,9 @@ abstract class TransactionShow extends Base
public $date_format; public $date_format;
/** @var string */
public $routePrefix;
/** @var bool */ /** @var bool */
public $hideButtonAddNew; public $hideButtonAddNew;
@ -362,6 +365,7 @@ abstract class TransactionShow extends Base
$this->date_format = $this->getCompanyDateFormat(); $this->date_format = $this->getCompanyDateFormat();
$this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType); $this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType);
$this->hideRecurringMessage = $hideRecurringMessage; $this->hideRecurringMessage = $hideRecurringMessage;
$this->routePrefix = $this->getRoutePrefix($type);
// Navbar Hide // Navbar Hide
$this->hideButtonAddNew = $hideButtonAddNew; $this->hideButtonAddNew = $hideButtonAddNew;
@ -1297,4 +1301,12 @@ abstract class TransactionShow extends Base
return 'general.revenues'; return 'general.revenues';
} }
protected function getRoutePrefix($type) {
if ($prefix = config('type.' . $type . '.route.prefix', false)){
return 'revenues';
}
return $prefix;
}
} }

View File

@ -33,7 +33,7 @@
@stack('recurring_parent_message_body_start') @stack('recurring_parent_message_body_start')
<p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [ <p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [
'type' => mb_strtolower(trans_choice($textRecurringType, 1)), 'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
'link' => '<a href="' . route(mb_strtolower(trans_choice($textRecurringType, 2)) . '.show', $document->parent->id) . '"><u>' . $document->parent->document_number . '</u></a>' 'link' => '<a href="' . route($routePrefix . '.show', $document->parent->id) . '"><u>' . $document->parent->document_number . '</u></a>'
]) !!} ]) !!}
</p> </p>
@stack('recurring_parent_message_body_end') @stack('recurring_parent_message_body_end')

View File

@ -33,7 +33,7 @@
@stack('recurring_parent_message_body_start') @stack('recurring_parent_message_body_start')
<p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [ <p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [
'type' => mb_strtolower(trans_choice($textRecurringType, 1)), 'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
'link' => '<a href="' . route(mb_strtolower(trans_choice($textRecurringType, 2)) . '.show', $transaction->parent->id) . '"><u>' . trans_choice($textRecurringType, 1) . '#' . $transaction->parent->id . '</u></a>' 'link' => '<a href="' . route($routePrefix . '.show', $transaction->parent->id) . '"><u>' . trans_choice($textRecurringType, 1) . '#' . $transaction->parent->id . '</u></a>'
]) !!} ]) !!}
</p> </p>
@stack('recurring_parent_message_body_end') @stack('recurring_parent_message_body_end')