changed bulk actions show based on permissions
This commit is contained in:
parent
311139df10
commit
259a771bbf
@ -2,8 +2,9 @@
|
||||
|
||||
return [
|
||||
|
||||
'bulk_actions' => 'Bulk Action|Bulk Actions',
|
||||
'selected' => 'selected',
|
||||
'bulk_actions' => 'Bulk Action|Bulk Actions',
|
||||
'selected' => 'selected',
|
||||
'no_action' => 'No action available',
|
||||
|
||||
'message' => [
|
||||
'duplicate' => 'Are you sure you want to <b>duplicate</b> selected record?',
|
||||
|
@ -45,7 +45,7 @@
|
||||
@foreach($users as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 d-none d-sm-block">
|
||||
@if ((user()->id != $item->id) && user()->can('update-auth-users'))
|
||||
@if (user()->id != $item->id)
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
|
@ -45,11 +45,7 @@
|
||||
@foreach($accounts as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if (user()->can('update-banking-accounts'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-3 col-xl-2"><a class="col-aka" href="{{ route('accounts.edit', $item->id) }}">{{ $item->name }}</a></td>
|
||||
<td class="col-md-2 col-lg-2 col-xl-3 d-none d-md-block text-left">{{ $item->number }}</td>
|
||||
|
@ -46,7 +46,7 @@
|
||||
@foreach($companies as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if ((session('company_id') != $item->id) && user()->can('update-common-companies'))
|
||||
@if ((session('company_id') != $item->id))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
|
@ -43,11 +43,7 @@
|
||||
@foreach($dashboards as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-3 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if (user()->can('update-common-dashboards'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-6 col-lg-7 col-xl-7 long-texts"><a href="{{ route('dashboards.edit', $item->id) }}">{{ $item->name }}</a></td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-2 col-xl-2">
|
||||
|
@ -49,18 +49,14 @@
|
||||
@foreach($items as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if (user()->can('update-common-items'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-4 col-md-4 col-lg-3 col-xl-3 py-2">
|
||||
<img src="{{ $item->picture ? Storage::url($item->picture->id) : asset('public/img/akaunting-logo-green.svg') }}" class="avatar image-style p-1 mr-3 item-img hidden-md col-aka" alt="{{ $item->name }}">
|
||||
<a href="{{ route('items.edit', $item->id) }}">{{ $item->name }}</a>
|
||||
</td>
|
||||
<td class="col-lg-1 col-xl-2 d-none d-lg-block">
|
||||
{{ $item->category ? $item->category->name : trans('general.na') }}
|
||||
{{ $item->category->name }}
|
||||
</td>
|
||||
<td class="col-md-3 col-lg-3 col-xl-2 text-right d-none d-md-block">
|
||||
{{ money($item->sale_price, setting('default.currency'), true) }}
|
||||
|
@ -1,12 +1,23 @@
|
||||
@stack('bulk_action_row_input_start')
|
||||
|
||||
@php
|
||||
if (is_array($path)) {
|
||||
$path = route('bulk-actions.action', $path);
|
||||
} else {
|
||||
$path = url('common/bulk-actions/' . $path);
|
||||
}
|
||||
|
||||
$actions_to_show = [];
|
||||
foreach ($actions as $key => $action) {
|
||||
if ((isset($action['permission']) && !user()->can($action['permission']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$actions_to_show[$key] = true;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(!empty($actions_to_show))
|
||||
<div class="align-items-center d-none"
|
||||
v-if="bulk_action.show"
|
||||
:class="[{'show': bulk_action.show}]">
|
||||
@ -31,7 +42,7 @@
|
||||
@change="onChange">
|
||||
<option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option>
|
||||
@foreach($actions as $key => $action)
|
||||
@if((!isset($action['permission'])) || (isset($action['permission']) && user()->can($action['permission'])))
|
||||
@if(isset($actions_to_show[$key]))
|
||||
<option
|
||||
value="{{ $key }}"
|
||||
@if(!empty($action['message']))
|
||||
@ -86,5 +97,8 @@
|
||||
</div>
|
||||
</template>
|
||||
</akaunting-modal>
|
||||
@else
|
||||
<div class="text-white" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
|
||||
@endif
|
||||
|
||||
@stack('bulk_action_row_input_end')
|
||||
|
@ -49,11 +49,7 @@
|
||||
@foreach($vendors as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if (user()->can('update-purchases-vendors'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-3 col-lg-3 col-xl-2">
|
||||
<a class="col-aka" href="{{ route('vendors.show', $item->id) }}">{{ $item->name }}</a>
|
||||
|
@ -49,11 +49,7 @@
|
||||
@foreach($customers as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
|
||||
@if (user()->can('update-sales-customers'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-3 col-lg-3 col-xl-2">
|
||||
<a class="col-aka" href="{{ route('customers.show', $item->id) }}">{{ $item->name }}</a>
|
||||
|
@ -45,11 +45,7 @@
|
||||
@foreach($categories as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 d-none d-sm-block">
|
||||
@if (user()->can('update-settings-categories'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-4"><a class="col-aka" href="{{ route('categories.edit', $item->id) }}">{{ $item->name }}</a></td>
|
||||
<td class="col-sm-2 col-md-2 col-lg-2 d-none d-sm-block">{{ $types[$item->type] }}</td>
|
||||
|
@ -45,11 +45,7 @@
|
||||
@foreach($currencies as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 d-none d-sm-block">
|
||||
@if (user()->can('update-settings-currencies'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-4"><a class="col-aka" href="{{ route('currencies.edit', $item->id) }}">{{ $item->name }}</a></td>
|
||||
<td class="col-md-2 col-lg-2 d-none d-md-block">{{ $item->code }}</td>
|
||||
|
@ -46,11 +46,7 @@
|
||||
@foreach($taxes as $item)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 d-none d-sm-block">
|
||||
@if (user()->can('update-settings-taxes'))
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
@else
|
||||
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
|
||||
@endif
|
||||
{{ Form::bulkActionGroup($item->id, $item->name) }}
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-4"><a class="col-aka" href="{{ route('taxes.edit', $item->id) }}">{{ $item->name }}</a></td>
|
||||
<td class="col-md-2 col-lg-2 d-none d-md-block">{{ $item->rate }}</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user