From 0c6fad2bbae7e93043f0ab06862573f104dae930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 28 Jun 2022 15:09:11 +0300 Subject: [PATCH] closed #2492 Fixed: Transaction index and show page action button.. ( #33224ej ) --- app/Models/Banking/Transaction.php | 94 ++++++++++--------- .../transactions/show/buttons.blade.php | 2 +- .../transactions/show/more-buttons.blade.php | 12 +-- 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php index 0d97bf0d7..e0f15b75b 100644 --- a/app/Models/Banking/Transaction.php +++ b/app/Models/Banking/Transaction.php @@ -444,7 +444,7 @@ class Transaction extends Model } catch (\Exception $e) {} try { - if (! $this->reconciled) { + if (! $this->reconciled && ! $this->hasTransferRelation) { $actions[] = [ 'title' => trans('general.edit'), 'icon' => 'edit', @@ -458,7 +458,7 @@ class Transaction extends Model } catch (\Exception $e) {} try { - if (empty($this->document_id)) { + if (empty($this->document_id) && ! $this->hasTransferRelation) { $actions[] = [ 'title' => trans('general.duplicate'), 'icon' => 'file_copy', @@ -472,7 +472,7 @@ class Transaction extends Model } catch (\Exception $e) {} try { - if ($this->is_splittable && empty($this->document_id) && empty($this->recurring)) { + if ($this->is_splittable && empty($this->document_id) && empty($this->recurring) && ! $this->hasTransferRelation) { $connect = [ 'type' => 'button', 'title' => trans('general.connect'), @@ -519,54 +519,56 @@ class Transaction extends Model } catch (\Exception $e) {} if ($prefix != 'recurring-transactions') { - $actions[] = [ - 'type' => 'divider', - ]; - - try { + if (! $this->hasTransferRelation) { $actions[] = [ - 'type' => 'button', - 'title' => trans('general.share_link'), - 'icon' => 'share', - 'url' => route('modals.transactions.share.create', $this->id), - 'permission' => 'read-banking-transactions', - 'attributes' => [ - 'id' => 'index-more-actions-share-' . $this->id, - '@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")', - ], + 'type' => 'divider', ]; - } catch (\Exception $e) {} - try { - $actions[] = [ - 'type' => 'button', - 'title' => trans('invoices.send_mail'), - 'icon' => 'email', - 'url' => route('modals.transactions.emails.create', $this->id), - 'permission' => 'read-banking-transactions', - 'attributes' => [ - 'id' => 'index-more-actions-send-email-' . $this->id, - '@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")', - ], - ]; - } catch (\Exception $e) {} - - $actions[] = [ - 'type' => 'divider', - ]; - - try { - if (! $this->reconciled) { + try { $actions[] = [ - 'type' => 'delete', - 'icon' => 'delete', - 'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template', - 'route' => $prefix. '.destroy', - 'permission' => 'delete-banking-transactions', - 'model' => $this, + 'type' => 'button', + 'title' => trans('general.share_link'), + 'icon' => 'share', + 'url' => route('modals.transactions.share.create', $this->id), + 'permission' => 'read-banking-transactions', + 'attributes' => [ + 'id' => 'index-more-actions-share-' . $this->id, + '@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")', + ], ]; - } - } catch (\Exception $e) {} + } catch (\Exception $e) {} + + try { + $actions[] = [ + 'type' => 'button', + 'title' => trans('invoices.send_mail'), + 'icon' => 'email', + 'url' => route('modals.transactions.emails.create', $this->id), + 'permission' => 'read-banking-transactions', + 'attributes' => [ + 'id' => 'index-more-actions-send-email-' . $this->id, + '@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")', + ], + ]; + } catch (\Exception $e) {} + + $actions[] = [ + 'type' => 'divider', + ]; + + try { + if (! $this->reconciled) { + $actions[] = [ + 'type' => 'delete', + 'icon' => 'delete', + 'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template', + 'route' => $prefix. '.destroy', + 'permission' => 'delete-banking-transactions', + 'model' => $this, + ]; + } + } catch (\Exception $e) {} + } } else { try { $actions[] = [ diff --git a/resources/views/components/transactions/show/buttons.blade.php b/resources/views/components/transactions/show/buttons.blade.php index 2b60820cc..d9f389ea2 100644 --- a/resources/views/components/transactions/show/buttons.blade.php +++ b/resources/views/components/transactions/show/buttons.blade.php @@ -10,7 +10,7 @@ @stack('edit_button_start') -@if (! $transaction->hasTransferRelation) +@if (! $transaction->reconciled && ! $transaction->hasTransferRelation) @if (! $hideButtonEdit) @can($permissionUpdate) diff --git a/resources/views/components/transactions/show/more-buttons.blade.php b/resources/views/components/transactions/show/more-buttons.blade.php index a44332004..93529b01c 100644 --- a/resources/views/components/transactions/show/more-buttons.blade.php +++ b/resources/views/components/transactions/show/more-buttons.blade.php @@ -8,7 +8,7 @@ @stack('duplicate_button_start') - @if (! $transaction->hasTransferRelation) + @if (empty($transaction->document_id) && ! $transaction->hasTransferRelation) @if (! $hideButtonDuplicate) @can($permissionCreate) @@ -22,7 +22,7 @@ @stack('connect_button_start') - @if ($transaction->is_splittable && empty($transaction->document_id) && empty($transaction->recurring)) + @if ($transaction->is_splittable && empty($transaction->document_id) && empty($transaction->recurring) && ! $transaction->hasTransferRelation) @if (! $hideButtonConnect) @can($permissionCreate)