A free open source IT asset/license management system
Converted smaller bulk actions menus
snipeba86827b447e
diff --git a/app/Http/Controllers/Licenses/LicensesController.php b/app/Http/Controllers/Licenses/LicensesController.phpindex c91909d9f9..b33fb017dc 100755--- a/app/Http/Controllers/Licenses/LicensesController.php+++ b/app/Http/Controllers/Licenses/LicensesController.php@@ -41,12 +41,7 @@ class LicensesController extends Controller{$this->authorize('view', License::class);- $bulkActions = [- 'delete' => ['label' => trans('general.delete')],- 'delete_with_checkin' => ['label' => trans('admin/licenses/general.bulk.delete_with_checkin.label')],- ];-- return view('licenses/index', ['bulkActions' => $bulkActions]);+ return view('licenses/index');}/**diff --git a/app/Http/Transformers/AssetModelsTransformer.php b/app/Http/Transformers/AssetModelsTransformer.phpindex f900bca709..8b34119ba0 100644--- a/app/Http/Transformers/AssetModelsTransformer.php+++ b/app/Http/Transformers/AssetModelsTransformer.php@@ -91,6 +91,10 @@ class AssetModelsTransformer'delete' => $assetmodel->isDeletable(),'clone' => (Gate::allows('create', AssetModel::class) && ($assetmodel->deleted_at == '')),'restore' => (Gate::allows('create', AssetModel::class) && ($assetmodel->deleted_at != '')),+ 'bulk_selectable' => [+ 'edit' => (Gate::allows('update', AssetModel::class) && ($assetmodel->deleted_at == '')),+ 'delete' => (Gate::allows('delete', AssetModel::class) && $assetmodel->isDeletable()),+ ],];$array += $permissions_array;diff --git a/resources/views/blade/table/accessories.blade.php b/resources/views/blade/table/accessories.blade.phpindex 255ea0302c..8df1a55518 100644--- a/resources/views/blade/table/accessories.blade.php+++ b/resources/views/blade/table/accessories.blade.php@@ -17,14 +17,7 @@</x-slot:table_header><x-slot:bulkactions>- <x-table.bulk-actions- name='accessory'- action_route="{{ route('accessories.bulk.delete') }}"- model_name="accessory">- @can('delete', App\Models\Accessory::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-accessories /></x-slot:bulkactions><x-tablediff --git a/resources/views/blade/table/bulk-accessories.blade.php b/resources/views/blade/table/bulk-accessories.blade.phpnew file mode 100644index 0000000000..0b2d3fe4c9--- /dev/null+++ b/resources/views/blade/table/bulk-accessories.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Accessory::class)+ <x-table.bulk-actions+ name="accessory"+ :action_route="route('accessories.bulk.delete')"+ model_name="accessory"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-actions.blade.php b/resources/views/blade/table/bulk-actions.blade.phpindex 24d81c523d..327d89a361 100644--- a/resources/views/blade/table/bulk-actions.blade.php+++ b/resources/views/blade/table/bulk-actions.blade.php@@ -50,3 +50,16 @@<button class="btn btn-theme" id="{{ $buttonId }}" disabled>{{ trans('button.go') }}</button></form></div>++{{-- snipeit.js auto-initializes every .select2 with no config, which leaves+ the search box on. Bulk-action menus never carry more than a handful of+ options, so the search input just looks awkward. Reinitialize with+ minimumResultsForSearch: Infinity to suppress the search box for this+ select regardless of what snipeit.js did first. --}}+@push('js')+<script nonce="{{ csrf_token() }}">+ $(function () {+ $('#{{ $selectId }}').select2({ minimumResultsForSearch: Infinity });+ });+</script>+@endpushdiff --git a/resources/views/blade/table/bulk-categories.blade.php b/resources/views/blade/table/bulk-categories.blade.phpnew file mode 100644index 0000000000..7f573f6576--- /dev/null+++ b/resources/views/blade/table/bulk-categories.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Category::class)+ <x-table.bulk-actions+ name="category"+ :action_route="route('categories.bulk.delete')"+ model_name="category"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-companies.blade.php b/resources/views/blade/table/bulk-companies.blade.phpnew file mode 100644index 0000000000..b9d137c93a--- /dev/null+++ b/resources/views/blade/table/bulk-companies.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Company::class)+ <x-table.bulk-actions+ name="company"+ :action_route="route('companies.bulk.delete')"+ model_name="company"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-departments.blade.php b/resources/views/blade/table/bulk-departments.blade.phpnew file mode 100644index 0000000000..0f33cce5b7--- /dev/null+++ b/resources/views/blade/table/bulk-departments.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Department::class)+ <x-table.bulk-actions+ name="department"+ :action_route="route('departments.bulk.delete')"+ model_name="department"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-depreciations.blade.php b/resources/views/blade/table/bulk-depreciations.blade.phpnew file mode 100644index 0000000000..c471efd2cb--- /dev/null+++ b/resources/views/blade/table/bulk-depreciations.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Depreciation::class)+ <x-table.bulk-actions+ name="depreciation"+ :action_route="route('depreciations.bulk.delete')"+ model_name="depreciation"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-licenses.blade.php b/resources/views/blade/table/bulk-licenses.blade.phpnew file mode 100644index 0000000000..e729c27e95--- /dev/null+++ b/resources/views/blade/table/bulk-licenses.blade.php@@ -0,0 +1,11 @@+@can('delete', \App\Models\License::class)+ <x-table.bulk-actions+ name="licenses"+ :action_route="route('licenses.bulk.delete')"+ model_name="license"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ 'delete_with_checkin' => ['label' => trans('admin/licenses/general.bulk.delete_with_checkin.label')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-locations.blade.php b/resources/views/blade/table/bulk-locations.blade.phpnew file mode 100644index 0000000000..4aa36808cc--- /dev/null+++ b/resources/views/blade/table/bulk-locations.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Location::class)+ <x-table.bulk-actions+ name="location"+ :action_route="route('locations.bulkdelete.show')"+ model_name="location"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-manufacturers.blade.php b/resources/views/blade/table/bulk-manufacturers.blade.phpnew file mode 100644index 0000000000..e7de92dc2f--- /dev/null+++ b/resources/views/blade/table/bulk-manufacturers.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Manufacturer::class)+ <x-table.bulk-actions+ name="manufacturer"+ :action_route="route('manufacturers.bulk.delete')"+ model_name="manufacturer"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-models.blade.php b/resources/views/blade/table/bulk-models.blade.phpindex bbdcb782f0..6493ae1ecd 100644--- a/resources/views/blade/table/bulk-models.blade.php+++ b/resources/views/blade/table/bulk-models.blade.php@@ -1,31 +1,15 @@@aware(['name'])-- <form- method="POST"- action="{{route('models.bulkedit.index')}}"- accept-charset="UTF-8"- class="form-inline"- id="{{ Illuminate\Support\Str::camel($name) }}Form"- >- @csrf- @if (request('status')!='deleted')- @can('view', \App\Models\AssetModel::class)- <div style="width:100% !important;" class="hidden-print">- <label for="bulk_actions" class="sr-only">{{ trans('general.bulk_actions') }}</label>- <select name="bulk_actions" class="form-control select2" style="width: 200px;" aria-label="bulk_actions">- @can('delete', \App\Models\AssetModel::class)- <option value="edit">{{ trans('general.bulk_edit') }}</option>- @endcan- @can('delete', \App\Models\AssetModel::class)- <option value="delete">{{ trans('general.bulk_delete') }}</option>- @endcan- </select>- <button class="btn btn-theme" id="{{ Illuminate\Support\Str::camel($name) }}Button" disabled>{{ trans('button.go') }}</button>- </div>- @endcan- @endif- </form>---+@if (request('status') !== 'deleted')+ @canany(['update', 'delete'], \App\Models\AssetModel::class)+ <x-table.bulk-actions+ :name="$name"+ :action_route="route('models.bulkedit.index')"+ model_name="assetmodel"+ :actions="[+ 'edit' => ['label' => trans('general.bulk_edit')],+ 'delete' => ['label' => trans('general.bulk_delete')],+ ]"+ />+ @endcanany+@endifdiff --git a/resources/views/blade/table/bulk-statuslabels.blade.php b/resources/views/blade/table/bulk-statuslabels.blade.phpnew file mode 100644index 0000000000..3b504b111e--- /dev/null+++ b/resources/views/blade/table/bulk-statuslabels.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Statuslabel::class)+ <x-table.bulk-actions+ name="statuslabel"+ :action_route="route('statuslabels.bulk.delete')"+ model_name="statuslabel"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/bulk-suppliers.blade.php b/resources/views/blade/table/bulk-suppliers.blade.phpnew file mode 100644index 0000000000..ba36346d17--- /dev/null+++ b/resources/views/blade/table/bulk-suppliers.blade.php@@ -0,0 +1,10 @@+@can('delete', \App\Models\Supplier::class)+ <x-table.bulk-actions+ name="supplier"+ :action_route="route('suppliers.bulk.delete')"+ model_name="supplier"+ :actions="[+ 'delete' => ['label' => trans('general.delete')],+ ]"+ />+@endcandiff --git a/resources/views/blade/table/licenses.blade.php b/resources/views/blade/table/licenses.blade.phpindex c83e302b85..22219abe11 100644--- a/resources/views/blade/table/licenses.blade.php+++ b/resources/views/blade/table/licenses.blade.php@@ -1,6 +1,7 @@@props(['route' => route('api.licenses.index'),'name' => 'default',+ 'export_name' => null,'presenter' => \App\Presenters\LicensePresenter::dataTableLayout(),'fixed_right_number' => 2,'fixed_number' => 1,@@ -28,7 +29,7 @@:$show_advanced_searchbuttons="licenseButtons"api_url="{{ $route }}"- export_filename="export-{{ str_slug($name) }}-licenses-{{ date('Y-m-d') }}"+ export_filename="export-{{ str_slug($export_name ?? $name) }}-licenses-{{ date('Y-m-d') }}"/>diff --git a/resources/views/blade/table/locations.blade.php b/resources/views/blade/table/locations.blade.phpindex 6360d83cc6..77cc81fe63 100644--- a/resources/views/blade/table/locations.blade.php+++ b/resources/views/blade/table/locations.blade.php@@ -11,14 +11,7 @@<x-slot:bulkactions>- <x-table.bulk-actions- name='location'- action_route="{{ route('locations.bulkdelete.show') }}"- model_name="location">- @can('delete', App\Models\Location::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-locations /></x-slot:bulkactions><x-tablediff --git a/resources/views/categories/index.blade.php b/resources/views/categories/index.blade.phpindex ee802342fa..c85dbfd6ee 100755--- a/resources/views/categories/index.blade.php+++ b/resources/views/categories/index.blade.php@@ -13,15 +13,7 @@<x-box><x-slot:bulkactions>- <x-table.bulk-actions- name='category'- action_route="{{route('categories.bulk.delete')}}"- model_name="category"- >- @can('delete', App\Models\Category::class)- <option>Delete</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-categories /></x-slot:bulkactions><x-tablediff --git a/resources/views/categories/view.blade.php b/resources/views/categories/view.blade.phpindex 49624d003b..7af4926e69 100644--- a/resources/views/categories/view.blade.php+++ b/resources/views/categories/view.blade.php@@ -57,9 +57,13 @@@elseif ($category->category_type=='license')@can('view', \App\Models\License::class)<x-tabs.pane name="licenses">+ <x-slot:bulkactions>+ <x-table.bulk-licenses />+ </x-slot:bulkactions><x-table.licensesshow_footer="true"name="licenses"+ :export_name="$category->name":route="route('api.licenses.index', ['category_id' => $category->id])"/></x-tabs.pane>@endcandiff --git a/resources/views/companies/index.blade.php b/resources/views/companies/index.blade.phpindex b981227c81..c42ffeb24b 100644--- a/resources/views/companies/index.blade.php+++ b/resources/views/companies/index.blade.php@@ -12,15 +12,7 @@<x-box><x-slot:bulkactions>- <x-table.bulk-actions- name='company'- action_route="{{ route('companies.bulk.delete') }}"- model_name="company"- >- @can('delete', App\Models\Company::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-companies /></x-slot:bulkactions><x-tablediff --git a/resources/views/companies/view.blade.php b/resources/views/companies/view.blade.phpindex 634cbc9e04..9451e57aec 100644--- a/resources/views/companies/view.blade.php+++ b/resources/views/companies/view.blade.php@@ -44,7 +44,10 @@<!-- start licenses tab pane --><x-tabs.pane name="licenses">- <x-table.licenses name="licenses" :route="route('api.licenses.index', ['company_id' => $company->id, 'expand_company_hierarchy' => 1])"/>+ <x-slot:bulkactions>+ <x-table.bulk-licenses />+ </x-slot:bulkactions>+ <x-table.licenses name="licenses" :export_name="$company->name" :route="route('api.licenses.index', ['company_id' => $company->id, 'expand_company_hierarchy' => 1])"/></x-tabs.pane><!-- end licenses tab pane -->diff --git a/resources/views/departments/index.blade.php b/resources/views/departments/index.blade.phpindex d67beb3ae4..0d65fd5777 100644--- a/resources/views/departments/index.blade.php+++ b/resources/views/departments/index.blade.php@@ -12,15 +12,7 @@<x-box name="department"><x-slot:bulkactions>- <x-table.bulk-actions- name='department'- action_route="{{ route('departments.bulk.delete') }}"- model_name="department"- >- @can('delete', App\Models\Department::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-departments /></x-slot:bulkactions><x-tablediff --git a/resources/views/depreciations/index.blade.php b/resources/views/depreciations/index.blade.phpindex 2ce5129f9d..e57e284d65 100755--- a/resources/views/depreciations/index.blade.php+++ b/resources/views/depreciations/index.blade.php@@ -13,15 +13,7 @@<x-box name="depreciation"><x-slot:bulkactions>- <x-table.bulk-actions- name='depreciation'- action_route="{{ route('depreciations.bulk.delete') }}"- model_name="depreciation"- >- @can('delete', App\Models\Depreciation::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-depreciations /></x-slot:bulkactions><x-tablediff --git a/resources/views/depreciations/view.blade.php b/resources/views/depreciations/view.blade.phpindex de9ef465cd..d41f5540dd 100644--- a/resources/views/depreciations/view.blade.php+++ b/resources/views/depreciations/view.blade.php@@ -34,7 +34,10 @@<!-- start licenses tab pane --><x-tabs.pane name="licenses">- <x-table.licenses name="licenses" :route="route('api.licenses.index', ['depreciation_id' => $depreciation->id])"/>+ <x-slot:bulkactions>+ <x-table.bulk-licenses />+ </x-slot:bulkactions>+ <x-table.licenses name="licenses" :export_name="$depreciation->name" :route="route('api.licenses.index', ['depreciation_id' => $depreciation->id])"/></x-tabs.pane><!-- end licenses tab pane -->diff --git a/resources/views/licenses/index.blade.php b/resources/views/licenses/index.blade.phpindex 310f5fa3ce..4308b4d63c 100755--- a/resources/views/licenses/index.blade.php+++ b/resources/views/licenses/index.blade.php@@ -13,14 +13,7 @@<x-box><x-slot:bulkactions>- @can('delete', App\Models\License::class)- <x-table.bulk-actions- name='licenses'- action_route="{{ route('licenses.bulk.delete') }}"- model_name="license"- :actions="$bulkActions"- />- @endcan+ <x-table.bulk-licenses /></x-slot:bulkactions><x-table.licensesdiff --git a/resources/views/manufacturers/index.blade.php b/resources/views/manufacturers/index.blade.phpindex 7dccde3f23..2deca7c0c1 100755--- a/resources/views/manufacturers/index.blade.php+++ b/resources/views/manufacturers/index.blade.php@@ -25,15 +25,7 @@@else<x-slot:bulkactions>- <x-table.bulk-actions- name='manufacturer'- action_route="{{route('manufacturers.bulk.delete')}}"- model_name="manufacturer"- >- @can('delete', App\Models\Manufacturer::class)- <option>Delete</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-manufacturers /></x-slot:bulkactions>diff --git a/resources/views/manufacturers/view.blade.php b/resources/views/manufacturers/view.blade.phpindex b28c7750d2..92ac7cfaab 100644--- a/resources/views/manufacturers/view.blade.php+++ b/resources/views/manufacturers/view.blade.php@@ -31,7 +31,10 @@</x-tabs.pane><x-tabs.pane name="licenses">- <x-table.licenses :name="$manufacturer->name" :route="route('api.licenses.index', ['manufacturer_id' => $manufacturer->id])" />+ <x-slot:bulkactions>+ <x-table.bulk-licenses />+ </x-slot:bulkactions>+ <x-table.licenses name="licenses" :export_name="$manufacturer->name" :route="route('api.licenses.index', ['manufacturer_id' => $manufacturer->id])" /></x-tabs.pane><x-tabs.pane name="accessories">diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex 924150488c..0b9d4fc29e 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -1965,7 +1965,7 @@}}- $select.select2();+ $select.select2({ minimumResultsForSearch: Infinity });}// These methods dynamically add/remove hidden input values in the bulk actions formdiff --git a/resources/views/statuslabels/index.blade.php b/resources/views/statuslabels/index.blade.phpindex 1a58e1c605..eb813577c6 100755--- a/resources/views/statuslabels/index.blade.php+++ b/resources/views/statuslabels/index.blade.php@@ -14,15 +14,7 @@<x-box><x-slot:bulkactions>- <x-table.bulk-actions- name='statuslabel'- action_route="{{ route('statuslabels.bulk.delete') }}"- model_name="statuslabel"- >- @can('delete', App\Models\Statuslabel::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-statuslabels /></x-slot:bulkactions><x-tablediff --git a/resources/views/suppliers/index.blade.php b/resources/views/suppliers/index.blade.phpindex 01023c8a39..91bf3aba84 100755--- a/resources/views/suppliers/index.blade.php+++ b/resources/views/suppliers/index.blade.php@@ -12,15 +12,7 @@<x-box><x-slot:bulkactions>- <x-table.bulk-actions- name='supplier'- action_route="{{route('suppliers.bulk.delete')}}"- model_name="supplier"- >- @can('delete', App\Models\Supplier::class)- <option>{{ trans('general.delete') }}</option>- @endcan- </x-table.bulk-actions>+ <x-table.bulk-suppliers /></x-slot:bulkactions>diff --git a/resources/views/suppliers/view.blade.php b/resources/views/suppliers/view.blade.phpindex cb4ad1f57d..fd1663ad9b 100755--- a/resources/views/suppliers/view.blade.php+++ b/resources/views/suppliers/view.blade.php@@ -44,7 +44,10 @@<!-- start licenses tab pane --><x-tabs.pane name="licenses">- <x-table.licenses :name="$supplier->name" :route="route('api.licenses.index', ['supplier_id' => $supplier->id])"/>+ <x-slot:bulkactions>+ <x-table.bulk-licenses />+ </x-slot:bulkactions>+ <x-table.licenses name="licenses" :export_name="$supplier->name" :route="route('api.licenses.index', ['supplier_id' => $supplier->id])"/></x-tabs.pane><!-- end licenses tab pane -->