Bulk action permission fixed and badge style.

This commit is contained in:
Cüneyt Şentürk 2020-02-13 16:37:27 +03:00
parent 0db2bffd03
commit 4fe77ea76c
15 changed files with 104 additions and 41 deletions

View File

@ -120,7 +120,7 @@ class Form extends Provider
]);
Facade::component('bulkActionRowGroup', 'partials.form.bulk_action_row_group', [
'text', 'actions', 'path'
'text', 'actions', 'path', 'attributes' => []
]);
Facade::component('bulkActionAllGroup', 'partials.form.bulk_action_all_group', [
@ -128,7 +128,7 @@ class Form extends Provider
]);
Facade::component('bulkActionGroup', 'partials.form.bulk_action_group', [
'id', 'name'
'id', 'name', 'attributes' => []
]);
Facade::component('enabledGroup', 'partials.form.enabled_group', [

View File

@ -882,3 +882,9 @@ table .align-items-center td span.badge {
}
/*--Lg Breakpoint Finish--*/
/*--------Responsive Finish--------*/
/*--------Index Pages Badge Min Width--------*/
.mw-60 {
min-width: 60px;
}
/*--------Index Pages Badge Min Finish--------*/

View File

@ -44,7 +44,13 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td>
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-3">
<a class="col-aka" href="{{ route('users.edit', $item->id) }}">
@if (setting('default.use_gravatar', '0') == '1')
@ -64,13 +70,13 @@
@endforeach
</td>
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-2">
@if (user()->can('update-auth-users'))
@if ((user()->id != $item->id) && user()->can('update-auth-users'))
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -45,7 +45,11 @@
@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">
{{ Form::bulkActionGroup($item->id, $item->name) }}
@if (user()->can('update-banking-accounts'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</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>
@ -55,9 +59,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -45,19 +45,25 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td>
<td class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block"><a class="col-aka">{{ $item->id }}</a></td>
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-3 col-xl-3 long-texts"><a href="{{ route('companies.edit', $item->id) }}">{{ $item->name }}</a></td>
<td class="col-md-2 col-lg-2 col-xl-2 d-none d-md-block long-texts">{{ $item->email }}</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block">@date($item->created_at)</td>
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-2 col-xl-2">
@if (user()->can('update-common-companies'))
@if ((session('company_id') != $item->id) && user()->can('update-common-companies'))
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -42,16 +42,22 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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
</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">
@if (user()->can('update-common-dashboards'))
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -49,7 +49,11 @@
@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">
{{ Form::bulkActionGroup($item->id, $item->name) }}
@if (user()->can('update-common-items'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</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 }}">
@ -69,9 +73,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -1,7 +1,12 @@
@stack($name . '_input_start')
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="bulk-action-{{ $id }}" data-bulk-action="{{ $id }}"
<input type="checkbox" class="custom-control-input" id="bulk-action-{{ $id }}"
@if (isset($attributes['disabled']))
:disabled="{{ ($attributes['disabled']) ? true : false }}"
@else
data-bulk-action="{{ $id }}"
@endif
:value="{{ $id }}"
v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.selected' }}"
v-on:change="onSelect">

View File

@ -49,7 +49,11 @@
@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">
{{ Form::bulkActionGroup($item->id, $item->name) }}
@if (user()->can('update-purchases-vendors'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</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>
@ -68,9 +72,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -49,7 +49,11 @@
@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">
{{ Form::bulkActionGroup($item->id, $item->name) }}
@if (user()->can('update-sales-customers'))
{{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</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>
@ -68,9 +72,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>
@ -81,9 +85,9 @@
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('customers.show', $item->id) }}">{{ trans('general.show') }}</a>
<a class="dropdown-item" href="{{ route('customers.edit', $item->id) }}">{{ trans('general.edit') }}</a>
<a class="dropdown-item" href="{{ route('customers.edit', $item->id) }}">{{ trans('general.edit') }}</a>
<div class="dropdown-divider"></div>
<div class="dropdown-divider"></div>
@permission('create-sales-customers')
<a class="dropdown-item" href="{{ route('customers.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>

View File

@ -44,7 +44,13 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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
</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>
<td class="col-md-2 col-lg-2 d-none d-md-block"><i class="fa fa-2x fa-circle" style="color:{{ $item->color }};"></i></td>
@ -53,9 +59,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -44,7 +44,13 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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
</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>
<td class="col-sm-2 col-md-2 col-lg-2 d-none d-sm-block">{{ $item->rate }}</td>
@ -53,9 +59,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -45,7 +45,13 @@
<tbody>
@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">{{ Form::bulkActionGroup($item->id, $item->name) }}</td>
<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
</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>
<td class="col-sm-2 col-md-2 col-lg-2 d-none d-sm-block">{{ $types[$item->type] }}</td>
@ -54,9 +60,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -54,9 +54,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>

View File

@ -52,9 +52,9 @@
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else
@if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge>
<badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge>
<badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif
@endif
</td>