Skip to content

Commit

Permalink
Transaction not edit, duplicate, delete etc button for Transferred
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Aug 18, 2021
1 parent de9a060 commit ef00815
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/Models/Banking/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ public function delete_attachment()
}
}

/**
* Check if the record is attached to a transfer.
*
* @return bool
*/
public function getHasTransferRelationAttribute()
{
return (bool) (optional($this->category)->id == optional($this->category)->transfer());
}

/**
* Get the title of type.
*
Expand Down
14 changes: 14 additions & 0 deletions resources/views/components/transactions/show/top-buttons.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,35 @@
<div class="dropdown-menu" role="menu">
@stack('button_dropdown_start')
@stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEdit)
@can($permissionUpdate)
<a class="dropdown-item" href="{{ route($routeButtonEdit, $transaction->id) }}">
{{ trans('general.edit') }}
</a>
@endcan
@endif
@endif
@stack('edit_button_end')

@stack('duplicate_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDuplicate)
@can($permissionCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $transaction->id) }}">
{{ trans('general.duplicate') }}
</a>
@endcan
@endif
@endif
@stack('duplicate_button_end')

@stack('button_dropdown_divider_1_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider1)
<div class="dropdown-divider"></div>
@endif
@endif
@stack('button_dropdown_divider_1_end')

@if (!$hideButtonPrint)
Expand All @@ -42,14 +48,17 @@
@endif

@stack('share_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonShare)
<a class="dropdown-item" href="{{ $signedUrl }}" target="_blank">
{{ trans('general.share') }}
</a>
@endif
@endif
@stack('share_button_end')

@stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEmail)
@if($transaction->contact->email)
<a class="dropdown-item" href="{{ route($routeButtonEmail, $transaction->id) }}">
Expand All @@ -63,6 +72,7 @@
</el-tooltip>
@endif
@endif
@endif
@stack('edit_button_end')

@stack('button_pdf_start')
Expand All @@ -74,12 +84,15 @@
@stack('button_pdf_end')

@stack('button_dropdown_divider_3_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider3)
<div class="dropdown-divider"></div>
@endif
@endif
@stack('button_dropdown_divider_3_end')

@stack('delete_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDelete)
@can($permissionDelete)
@if ($checkButtonReconciled)
Expand All @@ -91,6 +104,7 @@
@endif
@endcan
@endif
@endif
@stack('delete_button_end')
@stack('button_dropdown_end')
</div>
Expand Down

0 comments on commit ef00815

Please sign in to comment.