fixed cancel button path for document form refs #1729
This commit is contained in:
parent
00ed7bcd49
commit
7b001d039c
@ -49,6 +49,9 @@ abstract class DocumentForm extends Base
|
||||
/** @var string */
|
||||
public $routeUpdate;
|
||||
|
||||
/** @var string */
|
||||
public $routeCancel;
|
||||
|
||||
/** @var string */
|
||||
public $formId;
|
||||
|
||||
@ -195,7 +198,7 @@ abstract class DocumentForm extends Base
|
||||
bool $hideLogo = false, bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, bool $hideCompanyEdit = false,
|
||||
/** Company Component End */
|
||||
/** Content Component Start */
|
||||
string $routeStore = '', string $routeUpdate = '', string $formId = 'document', string $formSubmit = 'onSubmit',
|
||||
string $routeStore = '', string $routeUpdate = '', string $formId = 'document', string $formSubmit = 'onSubmit', string $routeCancel = '',
|
||||
bool $hideCompany = false, bool $hideAdvanced = false, bool $hideFooter = false, bool $hideButtons = false,
|
||||
/** Content Component End */
|
||||
/** Metadata Component Start */
|
||||
@ -232,6 +235,7 @@ abstract class DocumentForm extends Base
|
||||
/** Content Component Start */
|
||||
$this->routeStore = $this->getRouteStore($type, $routeStore);
|
||||
$this->routeUpdate = $this->getRouteUpdate($type, $routeUpdate, $document);
|
||||
$this->routeCancel = $this->getRouteCancel($type, $routeCancel);
|
||||
$this->formId = $formId;
|
||||
$this->formSubmit = $formSubmit;
|
||||
|
||||
@ -322,6 +326,21 @@ abstract class DocumentForm extends Base
|
||||
return 'invoices.update';
|
||||
}
|
||||
|
||||
protected function getRouteCancel($type, $routeCancel)
|
||||
{
|
||||
if (!empty($routeCancel)) {
|
||||
return $routeCancel;
|
||||
}
|
||||
|
||||
$route = $this->getRouteFromConfig($type, 'index');
|
||||
|
||||
if (!empty($route)) {
|
||||
return $route;
|
||||
}
|
||||
|
||||
return 'invoices.index';
|
||||
}
|
||||
|
||||
protected function getContacts($type, $contacts)
|
||||
{
|
||||
if (!empty($contacts)) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="card">
|
||||
<div class="card-footer">
|
||||
<div class="row save-buttons">
|
||||
{{ Form::saveButtons('invoices.index') }}
|
||||
{{ Form::saveButtons($routeCancel) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -88,6 +88,7 @@
|
||||
<x-documents.form.buttons
|
||||
type="{{ $type }}"
|
||||
:document="$document"
|
||||
route-cancel="{{ $routeCancel }}"
|
||||
/>
|
||||
@endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user