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 */
|
/** @var string */
|
||||||
public $permissionDelete;
|
public $permissionDelete;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $permissionTransactionDelete;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $permissionButtonCustomize;
|
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 $routeButtonAddNew = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonPrint = '', string $routeButtonPdf = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', string $routeButtonCustomize = '', string $routeButtonSent = '',
|
||||||
string $routeButtonReceived = '', string $routeButtonEmail = '', string $routeButtonPaid = '',
|
string $routeButtonReceived = '', string $routeButtonEmail = '', string $routeButtonPaid = '',
|
||||||
bool $checkButtonReconciled = true, bool $checkButtonCancelled = true,
|
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 $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 $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,
|
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->permissionCreate = $this->getPermissionCreate($type, $permissionCreate);
|
||||||
$this->permissionUpdate = $this->getPermissionUpdate($type, $permissionUpdate);
|
$this->permissionUpdate = $this->getPermissionUpdate($type, $permissionUpdate);
|
||||||
$this->permissionDelete = $this->getPermissionDelete($type, $permissionDelete);
|
$this->permissionDelete = $this->getPermissionDelete($type, $permissionDelete);
|
||||||
|
$this->permissionTransactionDelete = $this->getPermissionTransactionDelete($type, $permissionTransactionDelete);
|
||||||
$this->permissionButtonCustomize = $this->getPermissionButtonCustomize($type, $permissionButtonCustomize);
|
$this->permissionButtonCustomize = $this->getPermissionButtonCustomize($type, $permissionButtonCustomize);
|
||||||
|
|
||||||
$this->hideButtonGroupDivider1 = $hideButtonGroupDivider1;
|
$this->hideButtonGroupDivider1 = $hideButtonGroupDivider1;
|
||||||
@ -958,6 +962,17 @@ abstract class DocumentShow extends Base
|
|||||||
return $permissionDelete;
|
return $permissionDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPermissionTransactionDelete($type, $permissionTransactionDelete)
|
||||||
|
{
|
||||||
|
if (!empty($permissionTransactionDelete)) {
|
||||||
|
return $permissionTransactionDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
$permissionTransactionDelete = 'delete-banking-transactions';
|
||||||
|
|
||||||
|
return $permissionTransactionDelete;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getPermissionButtonCustomize($type, $permissionButtonCustomize)
|
protected function getPermissionButtonCustomize($type, $permissionButtonCustomize)
|
||||||
{
|
{
|
||||||
if (!empty($permissionButtonCustomize)) {
|
if (!empty($permissionButtonCustomize)) {
|
||||||
|
@ -11,37 +11,52 @@
|
|||||||
@stack('row_footer_transactions_head_tr_start')
|
@stack('row_footer_transactions_head_tr_start')
|
||||||
<tr class="row table-head-line">
|
<tr class="row table-head-line">
|
||||||
@stack('row_footer_transactions_head_td_start')
|
@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') }}
|
{{ trans('general.date') }}
|
||||||
</th>
|
</th>
|
||||||
<th class="col-xs-4 col-sm-3">
|
|
||||||
|
<th class="col-xs-4 {{ $class }}">
|
||||||
{{ trans('general.amount') }}
|
{{ trans('general.amount') }}
|
||||||
</th>
|
</th>
|
||||||
<th class="col-sm-3 d-none d-sm-block">
|
|
||||||
|
<th class="{{ $class }} d-none d-sm-block">
|
||||||
{{ trans_choice('general.accounts', 1) }}
|
{{ trans_choice('general.accounts', 1) }}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
|
@can($permissionTransactionDelete)
|
||||||
<th class="col-xs-4 col-sm-3">
|
<th class="col-xs-4 col-sm-3">
|
||||||
{{ trans('general.actions') }}
|
{{ trans('general.actions') }}
|
||||||
</th>
|
</th>
|
||||||
|
@endcan
|
||||||
@stack('row_footer_transactions_head_td_end')
|
@stack('row_footer_transactions_head_td_end')
|
||||||
</tr>
|
</tr>
|
||||||
@stack('row_footer_transactions_head_tr_end')
|
@stack('row_footer_transactions_head_tr_end')
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@stack('row_footer_transactions_body_tr_start')
|
@stack('row_footer_transactions_body_tr_start')
|
||||||
@if ($transactions->count())
|
@if ($transactions->count())
|
||||||
@foreach($transactions as $transaction)
|
@foreach($transactions as $transaction)
|
||||||
<tr class="row align-items-center border-top-1 tr-py">
|
<tr class="row align-items-center border-top-1 tr-py">
|
||||||
@stack('row_footer_transactions_body_td_start')
|
@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)
|
@date($transaction->paid_at)
|
||||||
</td>
|
</td>
|
||||||
<td class="col-xs-4 col-sm-3">
|
|
||||||
|
<td class="col-xs-4 {{ $class }}">
|
||||||
@money($transaction->amount, $transaction->currency_code, true)
|
@money($transaction->amount, $transaction->currency_code, true)
|
||||||
</td>
|
</td>
|
||||||
<td class="col-sm-3 d-none d-sm-block">
|
|
||||||
|
<td class="{{ $class }} d-none d-sm-block">
|
||||||
{{ $transaction->account->name }}
|
{{ $transaction->account->name }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
@can($permissionTransactionDelete)
|
||||||
<td class="col-xs-4 col-sm-3 py-0">
|
<td class="col-xs-4 col-sm-3 py-0">
|
||||||
@if ($transaction->reconciled)
|
@if ($transaction->reconciled)
|
||||||
<button type="button" class="btn btn-default btn-sm">
|
<button type="button" class="btn btn-default btn-sm">
|
||||||
@ -62,6 +77,7 @@
|
|||||||
)) !!}
|
)) !!}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
@endcan
|
||||||
@stack('row_footer_transactions_body_td_end')
|
@stack('row_footer_transactions_body_td_end')
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
Loading…
x
Reference in New Issue
Block a user