Fixed document canceled button issue..

This commit is contained in:
Cüneyt Şentürk 2022-06-03 09:39:09 +03:00
parent 80b6b19b52
commit 889640c1bd
2 changed files with 62 additions and 56 deletions

View File

@ -521,18 +521,20 @@ class Document extends Model
]; ];
} catch (\Exception $e) {} } catch (\Exception $e) {}
try { if ($this->status != 'cancelled') {
$actions[] = [ try {
'title' => trans('general.print'), $actions[] = [
'icon' => 'print', 'title' => trans('general.print'),
'url' => route($prefix . '.print', $this->id), 'icon' => 'print',
'permission' => 'read-' . $group . '-' . $permission_prefix, 'url' => route($prefix . '.print', $this->id),
'attributes' => [ 'permission' => 'read-' . $group . '-' . $permission_prefix,
'id' => 'index-more-actions-print-' . $this->id, 'attributes' => [
'target' => '_blank', 'id' => 'index-more-actions-print-' . $this->id,
], 'target' => '_blank',
]; ],
} catch (\Exception $e) {} ];
} catch (\Exception $e) {}
}
try { try {
$actions[] = [ $actions[] = [
@ -547,60 +549,64 @@ class Document extends Model
]; ];
} catch (\Exception $e) {} } catch (\Exception $e) {}
if (!str_contains($this->type, 'recurring')) { if (! str_contains($this->type, 'recurring')) {
$actions[] = [ if ($this->status != 'cancelled') {
'type' => 'divider',
];
try {
$actions[] = [ $actions[] = [
'type' => 'button', 'type' => 'divider',
'title' => trans('general.share_link'),
'icon' => 'share',
'url' => route('modals.'. $prefix . '.share.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-share-link-' . $this->id,
'@click' => 'onShareLink("' . route('modals.'. $prefix . '.share.create', $this->id) . '")',
],
]; ];
} catch (\Exception $e) {}
try { try {
if ($this->type == 'invoice') {
$actions[] = [ $actions[] = [
'type' => 'button', 'type' => 'button',
'title' => trans('invoices.send_mail'), 'title' => trans('general.share_link'),
'icon' => 'email', 'icon' => 'share',
'url' => route('modals.'. $prefix . '.emails.create', $this->id), 'url' => route('modals.'. $prefix . '.share.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix, 'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [ 'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id, 'id' => 'index-more-actions-share-link-' . $this->id,
'@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")', '@click' => 'onShareLink("' . route('modals.'. $prefix . '.share.create', $this->id) . '")',
], ],
]; ];
} } catch (\Exception $e) {}
} catch (\Exception $e) {}
try {
if ($this->type == 'invoice') {
$actions[] = [
'type' => 'button',
'title' => trans('invoices.send_mail'),
'icon' => 'email',
'url' => route('modals.'. $prefix . '.emails.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id,
'@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")',
],
];
}
} catch (\Exception $e) {}
}
$actions[] = [ $actions[] = [
'type' => 'divider', 'type' => 'divider',
]; ];
try { if ($this->status != 'cancelled') {
try {
$actions[] = [
'title' => trans('general.cancel'),
'icon' => 'cancel',
'url' => route($prefix . '.cancelled', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-cancel-' . $this->id,
],
];
} catch (\Exception $e) {}
$actions[] = [ $actions[] = [
'title' => trans('general.cancel'), 'type' => 'divider',
'icon' => 'cancel',
'url' => route($prefix . '.cancelled', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-cancel-' . $this->id,
],
]; ];
} catch (\Exception $e) {} }
$actions[] = [
'type' => 'divider',
];
try { try {
$actions[] = [ $actions[] = [

View File

@ -52,13 +52,13 @@
@stack('button_pdf_end') @stack('button_pdf_end')
@if (! $hideDivider2)
<x-dropdown.divider />
@endif
@stack('share_button_start')
@if (! in_array($document->status, $hideButtonStatuses)) @if (! in_array($document->status, $hideButtonStatuses))
@if (! $hideDivider2)
<x-dropdown.divider />
@endif
@stack('share_button_start')
@if (! $hideShare) @if (! $hideShare)
@if ($document->status != 'cancelled') @if ($document->status != 'cancelled')
<x-dropdown.button @click="onShareLink('{{ route($shareRoute, $document->id) }}')"> <x-dropdown.button @click="onShareLink('{{ route($shareRoute, $document->id) }}')">