Skip to content

A free open source IT asset/license management system

component finally working

spencerrlongga091baf5a681
diff --git a/resources/views/categories/index.blade.php b/resources/views/categories/index.blade.php
index 4680d58201..27a7d036d2 100755
--- a/resources/views/categories/index.blade.php
+++ b/resources/views/categories/index.blade.php
@@ -13,9 +13,20 @@
<div class="col-md-12">
<div class="box box-default">
<div class="box-body">
- @include('partials.category-bulk-actions')
- <table
- data-columns="{{ \App\Presenters\CategoryPresenter::dataTableLayout() }}"
+
+ <x-tables.bulk-actions
+ id_divname='categoriesBulkEditToolbar'
+ action_route="{{route('categories.bulk.delete')}}"
+ id_formname="categoriesBulkForm"
+ id_button="bulkCategoryEditButton"
+ >
+ @can('delete', App\Models\Category::class)
+ <option>Delete</option>
+ @endcan
+ </x-tables.bulk-actions>
+
+ <table
+ data-columns="{{ \App\Presenters\CategoryPresenter::dataTableLayout() }}"
data-cookie-id-table="categoryTable"
data-id-table="categoryTable"
data-side-pagination="server"
diff --git a/resources/views/components/tables/bulk-actions.blade.php b/resources/views/components/tables/bulk-actions.blade.php
index 09db7284fb..6963ba73c0 100644
--- a/resources/views/components/tables/bulk-actions.blade.php
+++ b/resources/views/components/tables/bulk-actions.blade.php
@@ -1,30 +1,35 @@
-@php
- @endphp
-<div id="{{ (isset($id_divname)) ? $id_divname : 'assetsBulkEditToolbar' }}" style="min-width:400px">
+@use (App\Models\Manufacturer)
+@props([
+ 'id_divname',
+ 'id_formname',
+ 'id_button',
+ 'action_route',
+ 'action_method',
+ ])
+
+<div id="{{ $id_divname }}" style="min-width:400px">
<form
method="POST"
- action="{{ route('hardware/bulkedit') }}"
+ action="{{ $action_route }}"
accept-charset="UTF-8"
class="form-inline"
- id="{{ (isset($id_formname)) ? $id_formname : 'assetsBulkForm' }}"
+ id="{{ $id_formname }}"
>
@csrf
- {{-- The sort and order will only be used if the cookie is actually empty (like on first-use) --}}
+ {{-- The sort and order will only be used if the cookie is actually empty (like on first-use)--}}
<input name="sort" type="hidden" value="assets.id">
<input name="order" type="hidden" value="asc">
<label for="bulk_actions">
- <span class="sr-only">
- {{ trans('button.bulk_actions') }}
- </span>
+ <span class="sr-only">
+ {{ trans('button.bulk_actions') }}
+ </span>
</label>
<select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="min-width: 350px;">
- @can('delete', \App\Models\Asset::class)
- <option value="delete">{{ trans('button.delete') }}</option>
- @endcan
+ {{ $slot }}
</select>
- <button class="btn btn-primary" id="{{ (isset($id_button)) ? $id_button : 'bulkAssetEditButton' }}"
+ <button class="btn btn-primary" id="{{ $id_button }}"
disabled>{{ trans('button.go') }}</button>
</form>
-</div>
+</div>
\ No newline at end of file
diff --git a/resources/views/manufacturers/index.blade.php b/resources/views/manufacturers/index.blade.php
index 7ec3e9a8aa..e623309659 100755
--- a/resources/views/manufacturers/index.blade.php
+++ b/resources/views/manufacturers/index.blade.php
@@ -5,6 +5,11 @@
{{ trans('admin/manufacturers/table.asset_manufacturers') }}
@parent
@stop
+@php
+
+ $canDelete = \Illuminate\Support\Facades\Auth::user()->can('delete', Manufacturer::class)
+
+@endphp
{{-- Page content --}}
@section('content')
@@ -30,8 +35,16 @@
</form>
@else
- @include ('partials.manufacturer-bulk-actions')
-
+ <x-tables.bulk-actions
+ id_divname='manufacturersBulkEditToolbar'
+ action_route="{{route('manufacturers.bulk.delete')}}"
+ id_formname="manufacturersBulkForm"
+ id_button="bulkManufacturerEditButton"
+ >
+ @can('delete', App\Models\Manufacturer::class)
+ <option>Delete</option>
+ @endcan
+ </x-tables.bulk-actions>
<table
data-columns="{{ \App\Presenters\ManufacturerPresenter::dataTableLayout() }}"
@@ -54,8 +67,7 @@
}'>
</table>
-
- @endif
+ @endif
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
diff --git a/resources/views/notifications.blade.php b/resources/views/notifications.blade.php
index eca587770f..216f2c3f14 100755
--- a/resources/views/notifications.blade.php
+++ b/resources/views/notifications.blade.php
@@ -153,11 +153,13 @@
<button type="button" class="close" data-dismiss="alert">&times;</button>
<i class="fas fa-exclamation-triangle faa-pulse animated"></i>
<strong>{{ trans('general.notification_error') }}: </strong>
+ <div class="accordion">
@foreach($messages as $key => $message)
<ul>
<li>{{ $message }}</li>
</ul>
@endforeach
+ </div>
</div>
</div>
@endif
diff --git a/resources/views/partials/category-bulk-actions.blade.php b/resources/views/partials/category-bulk-actions.blade.php
deleted file mode 100644
index e273dfb21e..0000000000
--- a/resources/views/partials/category-bulk-actions.blade.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<div id="{{ (isset($id_divname)) ? $id_divname : 'categoriesBulkEditToolbar' }}" style="min-width:400px">
- <form
- method="POST"
- action="{{ route('categories.bulk.delete') }}"
- accept-charset="UTF-8"
- class="form-inline"
- id="{{ (isset($id_formname)) ? $id_formname : 'categoriesBulkForm' }}"
- >
- @csrf
-
- {{-- The sort and order will only be used if the cookie is actually empty (like on first-use) --}}
- <input name="sort" type="hidden" value="assets.id">
- <input name="order" type="hidden" value="asc">
- <label for="bulk_actions">
- <span class="sr-only">
- {{ trans('button.bulk_actions') }}
- </span>
- </label>
- <select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="min-width: 350px;">
- @can('delete', \App\Models\Category::class)
- <option value="delete">{{ trans('button.delete') }}</option>
- @endcan
- </select>
-
- <button class="btn btn-primary" id="{{ (isset($id_button)) ? $id_button : 'bulkCategoryEditButton' }}"
- disabled>{{ trans('button.go') }}</button>
- </form>
-</div>
diff --git a/resources/views/partials/manufacturer-bulk-actions.blade.php b/resources/views/partials/manufacturer-bulk-actions.blade.php
deleted file mode 100644
index a0f63fe63c..0000000000
--- a/resources/views/partials/manufacturer-bulk-actions.blade.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<div id="{{ (isset($id_divname)) ? $id_divname : 'manufacturersBulkEditToolbar' }}" style="min-width:400px">
- <form
- method="POST"
- {{-- if we end up adding more than a single action we'll want to rethink this --}}
- {{-- ...basically should end up being a big component, but felt too big an undertaking for this PR --}}
- action="{{ route('manufacturers.bulk.delete') }}"
- accept-charset="UTF-8"
- class="form-inline"
- id="{{ (isset($id_formname)) ? $id_formname : 'manufacturersBulkForm' }}"
- >
- @csrf
-
- {{-- The sort and order will only be used if the cookie is actually empty (like on first-use) --}}
- <input name="sort" type="hidden" value="assets.id">
- <input name="order" type="hidden" value="asc">
- <label for="bulk_actions">
- <span class="sr-only">
- {{ trans('button.bulk_actions') }}
- </span>
- </label>
- <select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="min-width: 350px;">
- @can('delete', \App\Models\Manufacturer::class)
- <option value="delete">{{ trans('button.delete') }}</option>
- @endcan
- </select>
-
- <button class="btn btn-primary" id="{{ (isset($id_button)) ? $id_button : 'bulkManufacturerEditButton' }}"
- disabled>{{ trans('button.go') }}</button>
- </form>
-</div>
diff --git a/resources/views/partials/supplier-bulk-actions.blade.php b/resources/views/partials/supplier-bulk-actions.blade.php
deleted file mode 100644
index e7747e71ff..0000000000
--- a/resources/views/partials/supplier-bulk-actions.blade.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<div id="{{ (isset($id_divname)) ? $id_divname : 'suppliersBulkEditToolbar' }}" style="min-width:400px">
- <form
- method="POST"
- action="{{ route('suppliers.bulk.delete') }}"
- accept-charset="UTF-8"
- class="form-inline"
- id="{{ (isset($id_formname)) ? $id_formname : 'supplierBulkForm' }}"
- >
- @csrf
-
- {{-- The sort and order will only be used if the cookie is actually empty (like on first-use) --}}
- <input name="sort" type="hidden" value="suppliers.id">
- <input name="order" type="hidden" value="asc">
- <label for="bulk_actions">
- <span class="sr-only">
- {{ trans('button.bulk_actions') }}
- </span>
- </label>
- <select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="min-width: 350px;">
- @can('delete', \App\Models\Supplier::class)
- <option value="delete">{{ trans('button.delete') }}</option>
- @endcan
- </select>
-
- <button class="btn btn-primary" id="{{ (isset($id_button)) ? $id_button : 'bulkSupplierEditButton' }}"
- disabled>{{ trans('button.go') }}</button>
- </form>
-</div>
diff --git a/resources/views/suppliers/index.blade.php b/resources/views/suppliers/index.blade.php
index 2b448a29d5..022203937e 100755
--- a/resources/views/suppliers/index.blade.php
+++ b/resources/views/suppliers/index.blade.php
@@ -17,8 +17,17 @@
<div class="row">
<div class="col-md-12">
- @include('partials.supplier-bulk-actions')
+ <x-tables.bulk-actions
+ id_divname='suppliersBulkEditToolbar'
+ action_route="{{route('suppliers.bulk.delete')}}"
+ id_formname="suppliersBulkForm"
+ id_button="bulkSupplierEditButton"
+ >
+ @can('delete', App\Models\Supplier::class)
+ <option>Delete</option>
+ @endcan
+ </x-tables.bulk-actions>
<table
data-columns="{{ \App\Presenters\SupplierPresenter::dataTableLayout() }}"
data-cookie-id-table="suppliersTable"