Skip to content

Commit

Permalink
Code refactoring after commit 510c38a
Browse files Browse the repository at this point in the history
  • Loading branch information
EnesSacid-Buker committed Feb 15, 2023
1 parent 510c38a commit fb00b31
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/BulkActions/Purchases/Bills.php
Expand Up @@ -67,7 +67,7 @@ public function cancelled($request)
$bills = $this->getSelectedRecords($request);

foreach ($bills as $bill) {
if ($bill->status == 'cancelled') {
if (! in_array($bill->status, ['cancelled', 'draft'])) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion app/BulkActions/Sales/Invoices.php
Expand Up @@ -67,7 +67,7 @@ public function cancelled($request)
$invoices = $this->getSelectedRecords($request);

foreach ($invoices as $invoice) {
if ($invoice->status == 'cancelled' || $invoice->status == 'draft') {
if (! in_array($invoice->status, ['cancelled', 'draft'])) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Models/Document/Document.php
Expand Up @@ -611,7 +611,7 @@ public function getLineActionsAttribute()
'type' => 'divider',
];

if ($this->status != 'cancelled' && $this->status != 'draft') {
if (! in_array($this->status, ['cancelled', 'draft'])) {
try {
$actions[] = [
'title' => trans('general.cancel'),
Expand Down
10 changes: 4 additions & 6 deletions resources/views/components/documents/show/more-buttons.blade.php
Expand Up @@ -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' && $document->status != 'draft')
<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

Expand Down

0 comments on commit fb00b31

Please sign in to comment.