A free open source IT asset/license management system
Set default API routes in table components
snipe7d226a6dca10
diff --git a/resources/views/blade/table/accessories.blade.php b/resources/views/blade/table/accessories.blade.phpindex 990c0ad526..463fe426b1 100644--- a/resources/views/blade/table/accessories.blade.php+++ b/resources/views/blade/table/accessories.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.accessories.index'),'name' => 'default','presenter' => \App\Presenters\AccessoryPresenter::dataTableLayout(),'fixed_right_number' => 2,diff --git a/resources/views/blade/table/assets.blade.php b/resources/views/blade/table/assets.blade.phpindex c0d2da0228..f85cd88755 100644--- a/resources/views/blade/table/assets.blade.php+++ b/resources/views/blade/table/assets.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.assets.index'),'name' => 'default','presenter' => \App\Presenters\AssetPresenter::dataTableLayout(),'fixed_right_number' => 2,diff --git a/resources/views/blade/table/components.blade.php b/resources/views/blade/table/components.blade.phpindex 7a2a8334e7..ad60ef9317 100644--- a/resources/views/blade/table/components.blade.php+++ b/resources/views/blade/table/components.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.components.index'),'name' => 'default','presenter' => \App\Presenters\ComponentPresenter::dataTableLayout(),'fixed_right_number' => 2,diff --git a/resources/views/blade/table/consumables.blade.php b/resources/views/blade/table/consumables.blade.phpindex 93bd9b62da..2b775f288f 100644--- a/resources/views/blade/table/consumables.blade.php+++ b/resources/views/blade/table/consumables.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.consumables.index'),'name' => 'default','presenter' => \App\Presenters\ConsumablePresenter::dataTableLayout(),'fixed_right_number' => 2,diff --git a/resources/views/blade/table/licenses.blade.php b/resources/views/blade/table/licenses.blade.phpindex d436c74bc2..ad4c343d77 100644--- a/resources/views/blade/table/licenses.blade.php+++ b/resources/views/blade/table/licenses.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.licenses.index'),'name' => 'default','presenter' => \App\Presenters\LicensePresenter::dataTableLayout(),'fixed_right_number' => 2,diff --git a/resources/views/blade/table/locations.blade.php b/resources/views/blade/table/locations.blade.phpindex 1468851c66..948d1c8ba7 100644--- a/resources/views/blade/table/locations.blade.php+++ b/resources/views/blade/table/locations.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.locations.index'),'name' => 'default','presenter' => \App\Presenters\LocationPresenter::dataTableLayout(),'fixed_right_number' => 1,@@ -9,9 +9,9 @@<!-- start locations tab pane -->@can('view', \App\Models\Location::class)- <x-slot:header>+ <x-slot:table_header>{{ $table_header }}- </x-slot:header>+ </x-slot:table_header><x-slot:bulkactions>@include('partials.locations-bulk-actions')diff --git a/resources/views/blade/table/models.blade.php b/resources/views/blade/table/models.blade.phpnew file mode 100644index 0000000000..b3dae52e62--- /dev/null+++ b/resources/views/blade/table/models.blade.php@@ -0,0 +1,32 @@+@props([+ 'route' => route('api.models.index'),+ 'name' => 'default',+ 'presenter' => \App\Presenters\AssetModelPresenter::dataTableLayout(),+ 'fixed_right_number' => 1,+ 'fixed_number' => 2,+ 'table_header' => trans('general.asset_models'),+])++<!-- start assets tab pane -->+@can('view', \App\Models\AssetModel::class)+ <x-slot:table_header>+ {{ $table_header }}+ </x-slot:table_header>++ <x-slot:bulkactions>+ <x-table.bulk-users/>+ </x-slot:bulkactions>++ <x-slot:content>+ <x-table+ :$presenter+ :$fixed_right_number+ :$fixed_number+ buttons="modelButtons"+ api_url="{{ $route }}"+ export_filename="export-models-{{ date('Y-m-d') }}"+ />+ </x-slot:content>++@endcan+<!-- end assets tab pane -->\ No newline at end of filediff --git a/resources/views/blade/table/users.blade.php b/resources/views/blade/table/users.blade.phpindex 85d90ec3fc..bd4b840191 100644--- a/resources/views/blade/table/users.blade.php+++ b/resources/views/blade/table/users.blade.php@@ -1,5 +1,5 @@@props([- 'route' => null,+ 'route' => route('api.users.index'),'name' => 'default','presenter' => \App\Presenters\UserPresenter::dataTableLayout(),'fixed_right_number' => 1,diff --git a/resources/views/blade/tabs/pane.blade.php b/resources/views/blade/tabs/pane.blade.phpindex d0db95b792..3b1a976939 100644--- a/resources/views/blade/tabs/pane.blade.php+++ b/resources/views/blade/tabs/pane.blade.php@@ -5,9 +5,9 @@<!-- tab-pane --><div id="{{ $name }}" {{ $attributes->merge(['class' => 'snipetab-pane tab-pane fade']) }}>- @if (isset($header))+ @if (isset($table_header))<h2 class="box-title{{ (!isset($bulkactions)) ? ' pull-left' : '' }}">- {{ $header }}+ {{ $table_header }}</h2>@endifdiff --git a/resources/views/categories/view.blade.php b/resources/views/categories/view.blade.phpindex fdbd1d7cc3..9a24e4b404 100644--- a/resources/views/categories/view.blade.php+++ b/resources/views/categories/view.blade.php@@ -23,11 +23,13 @@<x-tabs.nav-itemname="assets"- class="active"icon_type="asset"label="{{ trans('general.assets') }}"count="{{ $category->showableAssets()->count() }}"/>+ @endcan++ @can('view', \App\Models\AssetModel::class)<x-tabs.nav-itemname="models"@@ -42,7 +44,6 @@@can('view', \App\Models\Accessory::class)<x-tabs.nav-itemname="accessories"- class="active"icon_type="accessory"label="{{ trans('general.accessories') }}"count="{{ $category->accessories()->count() }}"@@ -54,7 +55,6 @@<x-tabs.nav-itemname="licenses"- class="active"icon_type="license"label="{{ trans('general.licenses') }}"/>@@ -65,7 +65,6 @@@can('view', \App\Models\Consumable::class)<x-tabs.nav-itemname="consumables"- class="active"icon_type="consumable"label="{{ trans('general.consumables') }}"count="{{ $category->consumables()->count() }}"@@ -77,7 +76,6 @@@can('view', \App\Models\Component::class)<x-tabs.nav-itemname="components"- class="active"icon_type="component"label="{{ trans('general.components') }}"count="{{ $category->components()->count() }}"@@ -98,25 +96,10 @@<x-tabs.pane name="assets"><x-table.assets :route="route('api.assets.index', ['category_id' => $category->id, 'itemtype' => 'assets'])"/></x-tabs.pane>-+ @endcan+ @can('view', \App\Models\AssetModel::class)<x-tabs.pane name="models">- <x-slot:header>- {{ trans('general.asset_models') }}- </x-slot:header>-- <x-slot:bulkactions>- @include('partials.models-bulk-actions')- </x-slot:bulkactions>-- <x-slot:content>- <x-table- buttons="modelButtons"- api_url="{{ route('api.models.index', ['status' => e(request('status')), 'category_id' => $category->id]) }}"- :presenter="\App\Presenters\AssetModelPresenter::dataTableLayout()"- export_filename="export-{{ str_slug($category->name) }}-models-{{ date('Y-m-d') }}"- />- </x-slot:content>-+ <x-table.models :route="route('api.models.index', ['status' => e(request('status')), 'category_id' => $category->id])"/></x-tabs.pane>@endcandiff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.phpindex e7350425ad..e2bcb13ef4 100644--- a/resources/views/locations/view.blade.php+++ b/resources/views/locations/view.blade.php@@ -32,16 +32,7 @@<x-tabs><x-slot:tabnav>- @can('view', \App\Models\User::class)- <x-tabs.nav-item- class="active"- name="users"- icon="fa-solid fa-house-user fa-fw"- label="{{ trans('general.users') }}"- count="{{ $location->users()->count() }}"- tooltip="{{ trans('general.users') }}"- />- @endcan+ <x-tabs.asset-tab count="{{ $location->assets()->AssetsForShow()->count() }}"/>@can('view', \App\Models\Asset::class)@@ -92,29 +83,8 @@@endcan- @can('view', \App\Models\Consumable::class)-- <x-tabs.nav-item- name="consumables"- icon="fas fa-tint fa-fw"- label="{{ trans('general.consumables') }}"- count="{{ $location->consumables()->count() }}"- tooltip="{{ trans('general.consumables') }}"- />-- @endcan-- @can('view', \App\Models\Component::class)-- <x-tabs.nav-item- name="components"- icon="fas fa-hdd fa-fw"- label="{{ trans('general.components') }}"- count="{{ $location->components->count() }}"- tooltip="{{ trans('general.components') }}"- />-- @endcan+ <x-tabs.consumable-tab count="{{ $location->consumables->count() }}"/>+ <x-tabs.component-tab count="{{ $location->components->count() }}"/><x-tabs.nav-itemname="child_locations"@@ -124,14 +94,8 @@tooltip="{{ trans('general.child_locations') }}"/>- <x-tabs.nav-item- name="files"- icon="fa-solid fa-file-contract fa-fw"- label="{{ trans('general.files') }}"- count="{{ $location->uploads()->count() }}"- tooltip="{{ trans('general.files') }}"- />-+ <x-tabs.files-tab count="{{ $location->uploads->count() }}"/>+<x-tabs.nav-itemname="history"icon="fa-solid fa-clock-rotate-left fa-fw"@@ -149,7 +113,7 @@<!-- start users tab pane -->@can('view', \App\Models\User::class)- <x-tabs.pane name="users" class="in active">+ <x-tabs.pane name="users"><x-table.users :route="route('api.users.index',['status' => e(request('status')),@@ -168,19 +132,19 @@<!-- start assets tab pane -->@can('view', \App\Models\Asset::class)<x-tabs.pane name="assets">- <x-table.assets :header="trans('admin/locations/message.current_location')" :route="route('api.assets.index', ['location_id' => $location->id])"/>+ <x-table.assets :table_header="trans('admin/locations/message.current_location')" :route="route('api.assets.index', ['location_id' => $location->id])"/></x-tabs.pane><!-- end assets tab pane --><!-- start assigned assets tab pane --><x-tabs.pane name="assets_assigned">- <x-table.assets :header="trans('admin/locations/message.assigned_assets')" :route="route('api.assets.index', ['assigned_to' => $location->id, 'assigned_type' => 'App\Models\Location'])"/>+ <x-table.assets :table_header="trans('admin/locations/message.assigned_assets')" :route="route('api.assets.index', ['assigned_to' => $location->id, 'assigned_type' => 'App\Models\Location'])"/></x-tabs.pane><!-- end assigned assets tab pane --><!-- start rtd assets tab pane --><x-tabs.pane name="rtd_assets">- <x-table.assets :header="trans('admin/hardware/form.default_location')" :route="route('api.assets.index', ['rtd_location_id' => $location->id]) "/>+ <x-table.assets :table_header="trans('admin/hardware/form.default_location')" :route="route('api.assets.index', ['rtd_location_id' => $location->id]) "/></x-tabs.pane>@endcan<!-- end rtd assets tab pane -->@@ -195,7 +159,7 @@<!-- start assigned accessories tab pane --><x-tabs.pane name="accessories_assigned">- <x-table.accessories :header="trans('general.accessories_assigned')" :route="route('api.locations.assigned_accessories', ['location' => $location]) "/>+ <x-table.accessories :table_header="trans('general.accessories_assigned')" :route="route('api.locations.assigned_accessories', ['location' => $location]) "/></x-tabs.pane>@endcan<!-- end assigned accessories tab pane -->@@ -204,7 +168,7 @@<!-- start consumables tab pane -->@can('view', \App\Models\Consumable::class)<x-tabs.pane name="consumables">- <x-table.consumables :header="trans('general.accessories_assigned')" :route="route('api.consumables.index', ['location_id' => $location->id]) "/>+ <x-table.consumables :route="route('api.consumables.index', ['location_id' => $location->id]) "/></x-tabs.pane>@endcan<!-- end consumables tab pane -->@@ -219,16 +183,16 @@<!-- start child locations tab pane --><x-tabs.pane name="child_locations">- <x-table.locations :header="trans('general.child_locations')" :route="route('api.locations.index', ['parent_id' => $location->id]) "/>+ <x-table.locations :table_header="trans('general.child_locations')" :route="route('api.locations.index', ['parent_id' => $location->id]) "/></x-tabs.pane><!-- end components tab pane --><!-- start files tab pane --><x-tabs.pane name="files">- <x-slot:header>+ <x-slot:table_header>{{ trans('general.files') }}- </x-slot:header>+ </x-slot:table_header><x-slot:content><x-table.files object_type="locations" :object="$location" /></x-slot:content>@@ -237,9 +201,9 @@<!-- start history tab pane --><x-tabs.pane name="history">- <x-slot:header>+ <x-slot:table_header>{{ trans('general.history') }}- </x-slot:header>+ </x-slot:table_header><x-slot:content><x-tablename="locationHistory"