close #2061 Enhancement: Added permission check invoice/bill transaction delete buton
This commit is contained in:
parent
40bd54fe1c
commit
6a0de2c672
@ -104,6 +104,9 @@ abstract class DocumentShow extends Base
|
||||
/** @var string */
|
||||
public $permissionDelete;
|
||||
|
||||
/** @var string */
|
||||
public $permissionTransactionDelete;
|
||||
|
||||
/** @var string */
|
||||
public $permissionButtonCustomize;
|
||||
|
||||
@ -366,7 +369,7 @@ abstract class DocumentShow extends Base
|
||||
string $routeButtonAddNew = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonPrint = '', string $routeButtonPdf = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', string $routeButtonCustomize = '', string $routeButtonSent = '',
|
||||
string $routeButtonReceived = '', string $routeButtonEmail = '', string $routeButtonPaid = '',
|
||||
bool $checkButtonReconciled = true, bool $checkButtonCancelled = true,
|
||||
string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '', string $permissionButtonCustomize = '',
|
||||
string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '', string $permissionTransactionDelete = '', string $permissionButtonCustomize = '',
|
||||
bool $hideButtonGroupDivider1 = false, bool $hideButtonGroupDivider2 = false, bool $hideButtonGroupDivider3 = false,
|
||||
bool $hideButtonMoreActions = false, bool $hideButtonAddNew = false, bool $hideButtonEdit = false, bool $hideButtonDuplicate = false, bool $hideButtonPrint = false, bool $hideButtonPdf = false, bool $hideButtonCancel = false, bool $hideButtonCustomize = false, bool $hideButtonDelete = false,
|
||||
bool $hideHeader = false,bool $hideRecurringMessage = false, bool $hideStatusMessage = false, bool $hideTimeline = false, bool $hideFooter = false, bool $hideFooterHistories = false, bool $hideFooterTransactions = false,
|
||||
@ -418,6 +421,7 @@ abstract class DocumentShow extends Base
|
||||
$this->permissionCreate = $this->getPermissionCreate($type, $permissionCreate);
|
||||
$this->permissionUpdate = $this->getPermissionUpdate($type, $permissionUpdate);
|
||||
$this->permissionDelete = $this->getPermissionDelete($type, $permissionDelete);
|
||||
$this->permissionTransactionDelete = $this->getPermissionTransactionDelete($type, $permissionTransactionDelete);
|
||||
$this->permissionButtonCustomize = $this->getPermissionButtonCustomize($type, $permissionButtonCustomize);
|
||||
|
||||
$this->hideButtonGroupDivider1 = $hideButtonGroupDivider1;
|
||||
@ -958,6 +962,17 @@ abstract class DocumentShow extends Base
|
||||
return $permissionDelete;
|
||||
}
|
||||
|
||||
protected function getPermissionTransactionDelete($type, $permissionTransactionDelete)
|
||||
{
|
||||
if (!empty($permissionTransactionDelete)) {
|
||||
return $permissionTransactionDelete;
|
||||
}
|
||||
|
||||
$permissionTransactionDelete = 'delete-banking-transactions';
|
||||
|
||||
return $permissionTransactionDelete;
|
||||
}
|
||||
|
||||
protected function getPermissionButtonCustomize($type, $permissionButtonCustomize)
|
||||
{
|
||||
if (!empty($permissionButtonCustomize)) {
|
||||
|
@ -11,37 +11,52 @@
|
||||
@stack('row_footer_transactions_head_tr_start')
|
||||
<tr class="row table-head-line">
|
||||
@stack('row_footer_transactions_head_td_start')
|
||||
<th class="col-xs-4 col-sm-3">
|
||||
@php $class = 'col-sm-3'; @endphp
|
||||
@cannot($permissionTransactionDelete)
|
||||
@php $class = 'col-sm-4'; @endphp
|
||||
@endcan
|
||||
|
||||
<th class="col-xs-4 {{ $class }}">
|
||||
{{ trans('general.date') }}
|
||||
</th>
|
||||
<th class="col-xs-4 col-sm-3">
|
||||
|
||||
<th class="col-xs-4 {{ $class }}">
|
||||
{{ trans('general.amount') }}
|
||||
</th>
|
||||
<th class="col-sm-3 d-none d-sm-block">
|
||||
|
||||
<th class="{{ $class }} d-none d-sm-block">
|
||||
{{ trans_choice('general.accounts', 1) }}
|
||||
</th>
|
||||
|
||||
@can($permissionTransactionDelete)
|
||||
<th class="col-xs-4 col-sm-3">
|
||||
{{ trans('general.actions') }}
|
||||
</th>
|
||||
@endcan
|
||||
@stack('row_footer_transactions_head_td_end')
|
||||
</tr>
|
||||
@stack('row_footer_transactions_head_tr_end')
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@stack('row_footer_transactions_body_tr_start')
|
||||
@if ($transactions->count())
|
||||
@foreach($transactions as $transaction)
|
||||
<tr class="row align-items-center border-top-1 tr-py">
|
||||
@stack('row_footer_transactions_body_td_start')
|
||||
<td class="col-xs-4 col-sm-3">
|
||||
<td class="col-xs-4 {{ $class }}">
|
||||
@date($transaction->paid_at)
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3">
|
||||
|
||||
<td class="col-xs-4 {{ $class }}">
|
||||
@money($transaction->amount, $transaction->currency_code, true)
|
||||
</td>
|
||||
<td class="col-sm-3 d-none d-sm-block">
|
||||
|
||||
<td class="{{ $class }} d-none d-sm-block">
|
||||
{{ $transaction->account->name }}
|
||||
</td>
|
||||
|
||||
@can($permissionTransactionDelete)
|
||||
<td class="col-xs-4 col-sm-3 py-0">
|
||||
@if ($transaction->reconciled)
|
||||
<button type="button" class="btn btn-default btn-sm">
|
||||
@ -62,6 +77,7 @@
|
||||
)) !!}
|
||||
@endif
|
||||
</td>
|
||||
@endcan
|
||||
@stack('row_footer_transactions_body_td_end')
|
||||
</tr>
|
||||
@endforeach
|
||||
|
Loading…
x
Reference in New Issue
Block a user