From 4fe77ea76c8423b9f4569ec3b5234442ad049df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 13 Feb 2020 16:37:27 +0300 Subject: [PATCH] Bulk action permission fixed and badge style. --- app/Providers/Form.php | 4 ++-- public/css/custom.css | 6 ++++++ resources/views/auth/users/index.blade.php | 14 ++++++++++---- resources/views/banking/accounts/index.blade.php | 10 +++++++--- resources/views/common/companies/index.blade.php | 14 ++++++++++---- resources/views/common/dashboards/index.blade.php | 12 +++++++++--- resources/views/common/items/index.blade.php | 10 +++++++--- .../partials/form/bulk_action_group.blade.php | 7 ++++++- resources/views/purchases/vendors/index.blade.php | 10 +++++++--- resources/views/sales/customers/index.blade.php | 14 +++++++++----- .../views/settings/categories/index.blade.php | 12 +++++++++--- .../views/settings/currencies/index.blade.php | 12 +++++++++--- resources/views/settings/taxes/index.blade.php | 12 +++++++++--- resources/views/wizard/currencies/index.blade.php | 4 ++-- resources/views/wizard/taxes/index.blade.php | 4 ++-- 15 files changed, 104 insertions(+), 41 deletions(-) diff --git a/app/Providers/Form.php b/app/Providers/Form.php index 635582cbb..245d23c0f 100644 --- a/app/Providers/Form.php +++ b/app/Providers/Form.php @@ -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', [ diff --git a/public/css/custom.css b/public/css/custom.css index 729435bb6..5feb89a8e 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -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--------*/ diff --git a/resources/views/auth/users/index.blade.php b/resources/views/auth/users/index.blade.php index 64c35d25a..3c4198c24 100644 --- a/resources/views/auth/users/index.blade.php +++ b/resources/views/auth/users/index.blade.php @@ -44,7 +44,13 @@ @foreach($users as $item) - {{ Form::bulkActionGroup($item->id, $item->name) }} + + @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 + @if (setting('default.use_gravatar', '0') == '1') @@ -64,13 +70,13 @@ @endforeach - @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) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/banking/accounts/index.blade.php b/resources/views/banking/accounts/index.blade.php index ec3337cb6..dc5973a88 100644 --- a/resources/views/banking/accounts/index.blade.php +++ b/resources/views/banking/accounts/index.blade.php @@ -45,7 +45,11 @@ @foreach($accounts as $item) - {{ 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 {{ $item->name }} {{ $item->number }} @@ -55,9 +59,9 @@ {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} @else @if ($item->enabled) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/common/companies/index.blade.php b/resources/views/common/companies/index.blade.php index b11035723..befd40551 100644 --- a/resources/views/common/companies/index.blade.php +++ b/resources/views/common/companies/index.blade.php @@ -45,19 +45,25 @@ @foreach($companies as $item) - {{ Form::bulkActionGroup($item->id, $item->name) }} + + @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 + {{ $item->id }} {{ $item->name }} {{ $item->email }} @date($item->created_at) - @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) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/common/dashboards/index.blade.php b/resources/views/common/dashboards/index.blade.php index c963d0788..ad184d75e 100644 --- a/resources/views/common/dashboards/index.blade.php +++ b/resources/views/common/dashboards/index.blade.php @@ -42,16 +42,22 @@ @foreach($dashboards as $item) - {{ Form::bulkActionGroup($item->id, $item->name) }} + + @if (user()->can('update-common-dashboards')) + {{ Form::bulkActionGroup($item->id, $item->name) }} + @else + {{ Form::bulkActionGroup($item->id, $item->name, ['disabled' => 'disabled']) }} + @endif + {{ $item->name }} @if (user()->can('update-common-dashboards')) {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} @else @if ($item->enabled) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/common/items/index.blade.php b/resources/views/common/items/index.blade.php index 84c843a2e..766f08255 100644 --- a/resources/views/common/items/index.blade.php +++ b/resources/views/common/items/index.blade.php @@ -49,7 +49,11 @@ @foreach($items as $item) - {{ 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 {{ $item->name }} @@ -69,9 +73,9 @@ {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} @else @if ($item->enabled) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/partials/form/bulk_action_group.blade.php b/resources/views/partials/form/bulk_action_group.blade.php index 601b7482f..96301e3ca 100644 --- a/resources/views/partials/form/bulk_action_group.blade.php +++ b/resources/views/partials/form/bulk_action_group.blade.php @@ -1,7 +1,12 @@ @stack($name . '_input_start')
- diff --git a/resources/views/purchases/vendors/index.blade.php b/resources/views/purchases/vendors/index.blade.php index 51fefe3ac..83d06f5ec 100644 --- a/resources/views/purchases/vendors/index.blade.php +++ b/resources/views/purchases/vendors/index.blade.php @@ -49,7 +49,11 @@ @foreach($vendors as $item) - {{ 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 {{ $item->name }} @@ -68,9 +72,9 @@ {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} @else @if ($item->enabled) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif diff --git a/resources/views/sales/customers/index.blade.php b/resources/views/sales/customers/index.blade.php index eb2c90523..4f820e076 100644 --- a/resources/views/sales/customers/index.blade.php +++ b/resources/views/sales/customers/index.blade.php @@ -49,7 +49,11 @@ @foreach($customers as $item) - {{ 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 {{ $item->name }} @@ -68,9 +72,9 @@ {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }} @else @if ($item->enabled) - {{ trans('general.enabled') }} + {{ trans('general.yes') }} @else - {{ trans('general.disabled') }} + {{ trans('general.no') }} @endif @endif @@ -81,9 +85,9 @@