Merge pull request #2874 from novag/hide-cancel

hide cancel button for drafts
This commit is contained in:
EnesSacid-Buker 2023-02-15 16:50:01 +03:00 committed by GitHub
commit 9c1ebc9287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -67,7 +67,7 @@ class Bills extends BulkAction
$bills = $this->getSelectedRecords($request);
foreach ($bills as $bill) {
if ($bill->status == 'cancelled') {
if (in_array($bill->status, ['cancelled', 'draft'])) {
continue;
}

View File

@ -67,7 +67,7 @@ class Invoices extends BulkAction
$invoices = $this->getSelectedRecords($request);
foreach ($invoices as $invoice) {
if ($invoice->status == 'cancelled') {
if (in_array($invoice->status, ['cancelled', 'draft'])) {
continue;
}

View File

@ -611,7 +611,7 @@ class Document extends Model
'type' => 'divider',
];
if ($this->status != 'cancelled') {
if (! in_array($this->status, ['cancelled', 'draft'])) {
try {
$actions[] = [
'title' => trans('general.cancel'),

View File

@ -108,15 +108,13 @@
@stack('button_cancelled_start')
@if (! $hideCancel)
@if (! $hideCancel && ! in_array($document->status, ['cancelled', 'draft']))
@can($permissionUpdate)
<x-dropdown.divider />
@if ($document->status != 'cancelled')
<x-dropdown.link href="{{ route($cancelledRoute, $document->id) }}" id="show-more-actions-cancel-{{ $document->type }}">
{{ trans('general.cancel') }}
</x-dropdown.link>
@endif
<x-dropdown.link href="{{ route($cancelledRoute, $document->id) }}" id="show-more-actions-cancel-{{ $document->type }}">
{{ trans('general.cancel') }}
</x-dropdown.link>
@endcan
@endif