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', [ 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', [ 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', [ Facade::component('bulkActionGroup', 'partials.form.bulk_action_group', [
'id', 'name' 'id', 'name', 'attributes' => []
]); ]);
Facade::component('enabledGroup', 'partials.form.enabled_group', [ Facade::component('enabledGroup', 'partials.form.enabled_group', [

View File

@ -882,3 +882,9 @@ table .align-items-center td span.badge {
} }
/*--Lg Breakpoint Finish--*/ /*--Lg Breakpoint Finish--*/
/*--------Responsive 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> <tbody>
@foreach($users as $item) @foreach($users as $item)
<tr class="row align-items-center border-top-1"> <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"> <td class="col-xs-4 col-sm-3 col-md-2 col-lg-3">
<a class="col-aka" href="{{ route('users.edit', $item->id) }}"> <a class="col-aka" href="{{ route('users.edit', $item->id) }}">
@if (setting('default.use_gravatar', '0') == '1') @if (setting('default.use_gravatar', '0') == '1')
@ -64,13 +70,13 @@
@endforeach @endforeach
</td> </td>
<td class="col-xs-4 col-sm-3 col-md-2 col-lg-2"> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -45,7 +45,11 @@
@foreach($accounts as $item) @foreach($accounts as $item)
<tr class="row align-items-center border-top-1"> <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"> <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) }} {{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td> </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-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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -45,19 +45,25 @@
<tbody> <tbody>
@foreach($companies as $item) @foreach($companies as $item)
<tr class="row align-items-center border-top-1"> <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-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-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-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-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"> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -42,16 +42,22 @@
<tbody> <tbody>
@foreach($dashboards as $item) @foreach($dashboards as $item)
<tr class="row align-items-center border-top-1"> <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-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"> <td class="col-xs-4 col-sm-3 col-md-2 col-lg-2 col-xl-2">
@if (user()->can('update-common-dashboards')) @if (user()->can('update-common-dashboards'))
{{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -49,7 +49,11 @@
@foreach($items as $item) @foreach($items as $item)
<tr class="row align-items-center border-top-1"> <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"> <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) }} {{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td> </td>
<td class="col-xs-4 col-sm-4 col-md-4 col-lg-3 col-xl-3 py-2"> <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 }}"> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -1,7 +1,12 @@
@stack($name . '_input_start') @stack($name . '_input_start')
<div class="custom-control custom-checkbox"> <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 }}" :value="{{ $id }}"
v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.selected' }}" v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.selected' }}"
v-on:change="onSelect"> v-on:change="onSelect">

View File

@ -49,7 +49,11 @@
@foreach($vendors as $item) @foreach($vendors as $item)
<tr class="row align-items-center border-top-1"> <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"> <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) }} {{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td> </td>
<td class="col-xs-4 col-sm-3 col-md-3 col-lg-3 col-xl-2"> <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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -49,7 +49,11 @@
@foreach($customers as $item) @foreach($customers as $item)
<tr class="row align-items-center border-top-1"> <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"> <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) }} {{ Form::bulkActionGroup($item->id, $item->name) }}
@else
{{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }}
@endif
</td> </td>
<td class="col-xs-4 col-sm-3 col-md-3 col-lg-3 col-xl-2"> <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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -44,7 +44,13 @@
<tbody> <tbody>
@foreach($categories as $item) @foreach($categories as $item)
<tr class="row align-items-center border-top-1"> <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-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-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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -44,7 +44,13 @@
<tbody> <tbody>
@foreach($currencies as $item) @foreach($currencies as $item)
<tr class="row align-items-center border-top-1"> <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-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-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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

@ -45,7 +45,13 @@
<tbody> <tbody>
@foreach($taxes as $item) @foreach($taxes as $item)
<tr class="row align-items-center border-top-1"> <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-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-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> <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) }} {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
@else @else
@if ($item->enabled) @if ($item->enabled)
<badge rounded type="success">{{ trans('general.enabled') }}</badge> <badge rounded type="success" class="mw-60">{{ trans('general.yes') }}</badge>
@else @else
<badge rounded type="danger">{{ trans('general.disabled') }}</badge> <badge rounded type="danger" class="mw-60">{{ trans('general.no') }}</badge>
@endif @endif
@endif @endif
</td> </td>

View File

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

View File

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