Transaction not edit, duplicate, delete etc button for Transferred

This commit is contained in:
Cüneyt Şentürk 2021-08-18 15:15:14 +03:00
parent de9a0603a7
commit ef00815557
2 changed files with 24 additions and 0 deletions

View File

@ -349,6 +349,16 @@ class Transaction extends Model
} }
} }
/**
* 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. * Get the title of type.
* *

View File

@ -8,6 +8,7 @@
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
@stack('button_dropdown_start') @stack('button_dropdown_start')
@stack('edit_button_start') @stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEdit) @if (!$hideButtonEdit)
@can($permissionUpdate) @can($permissionUpdate)
<a class="dropdown-item" href="{{ route($routeButtonEdit, $transaction->id) }}"> <a class="dropdown-item" href="{{ route($routeButtonEdit, $transaction->id) }}">
@ -15,9 +16,11 @@
</a> </a>
@endcan @endcan
@endif @endif
@endif
@stack('edit_button_end') @stack('edit_button_end')
@stack('duplicate_button_start') @stack('duplicate_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDuplicate) @if (!$hideButtonDuplicate)
@can($permissionCreate) @can($permissionCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $transaction->id) }}"> <a class="dropdown-item" href="{{ route($routeButtonDuplicate, $transaction->id) }}">
@ -25,12 +28,15 @@
</a> </a>
@endcan @endcan
@endif @endif
@endif
@stack('duplicate_button_end') @stack('duplicate_button_end')
@stack('button_dropdown_divider_1_start') @stack('button_dropdown_divider_1_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider1) @if (!$hideButtonGroupDivider1)
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
@endif
@stack('button_dropdown_divider_1_end') @stack('button_dropdown_divider_1_end')
@if (!$hideButtonPrint) @if (!$hideButtonPrint)
@ -42,14 +48,17 @@
@endif @endif
@stack('share_button_start') @stack('share_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonShare) @if (!$hideButtonShare)
<a class="dropdown-item" href="{{ $signedUrl }}" target="_blank"> <a class="dropdown-item" href="{{ $signedUrl }}" target="_blank">
{{ trans('general.share') }} {{ trans('general.share') }}
</a> </a>
@endif @endif
@endif
@stack('share_button_end') @stack('share_button_end')
@stack('edit_button_start') @stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEmail) @if (!$hideButtonEmail)
@if($transaction->contact->email) @if($transaction->contact->email)
<a class="dropdown-item" href="{{ route($routeButtonEmail, $transaction->id) }}"> <a class="dropdown-item" href="{{ route($routeButtonEmail, $transaction->id) }}">
@ -63,6 +72,7 @@
</el-tooltip> </el-tooltip>
@endif @endif
@endif @endif
@endif
@stack('edit_button_end') @stack('edit_button_end')
@stack('button_pdf_start') @stack('button_pdf_start')
@ -74,12 +84,15 @@
@stack('button_pdf_end') @stack('button_pdf_end')
@stack('button_dropdown_divider_3_start') @stack('button_dropdown_divider_3_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider3) @if (!$hideButtonGroupDivider3)
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
@endif
@stack('button_dropdown_divider_3_end') @stack('button_dropdown_divider_3_end')
@stack('delete_button_start') @stack('delete_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDelete) @if (!$hideButtonDelete)
@can($permissionDelete) @can($permissionDelete)
@if ($checkButtonReconciled) @if ($checkButtonReconciled)
@ -91,6 +104,7 @@
@endif @endif
@endcan @endcan
@endif @endif
@endif
@stack('delete_button_end') @stack('delete_button_end')
@stack('button_dropdown_end') @stack('button_dropdown_end')
</div> </div>