From 7c77e03c5ac280c7cfab23614835c94d57b1ce68 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 5 Jun 2022 18:08:15 -0700 Subject: [PATCH] Initial rework of locations display Signed-off-by: snipe --- app/Models/Location.php | 18 + resources/views/locations/view.blade.php | 316 ++++++++++-------- .../partials/asset-bulk-actions.blade.php | 2 +- .../partials/users-bulk-actions.blade.php | 19 ++ resources/views/users/index.blade.php | 20 +- 5 files changed, 214 insertions(+), 161 deletions(-) create mode 100644 resources/views/partials/users-bulk-actions.blade.php diff --git a/app/Models/Location.php b/app/Models/Location.php index a85c8905e0..07ca6c8a18 100755 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -103,6 +103,7 @@ class Location extends SnipeModel return $this->hasMany(\App\Models\User::class, 'location_id'); } + public function assets() { return $this->hasMany(\App\Models\Asset::class, 'location_id') @@ -129,6 +130,23 @@ class Location extends SnipeModel return $this->hasMany(\App\Models\Asset::class, 'rtd_location_id'); } + public function consumables() + { + return $this->hasMany(\App\Models\Consumable::class, 'location_id'); + } + + public function components() + { + return $this->hasMany(\App\Models\Component::class, 'location_id'); + } + + public function accessories() + { + return $this->hasMany(\App\Models\Accessory::class, 'location_id'); + } + + + public function parent() { return $this->belongsTo(self::class, 'parent_id', 'id') diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.php index 771538df5e..cd9bafc733 100644 --- a/resources/views/locations/view.blade.php +++ b/resources/views/locations/view.blade.php @@ -15,178 +15,212 @@ -
-
-
-

{{ trans('general.assets') }}

-
-
-
+
+

{{ trans('general.assets') }}

- - @include('partials.asset-bulk-actions') - -
- - -
+ -
-
-
+
+ -
-
-
-

{{ trans('general.accessories') }}

-
-
-
-
- +
+
-
+ +
+
-
- - -
-
-
-

{{ trans('general.consumables') }}

-
-
-
-
- - $location->id]) }}" + data-export-options='{ "fileName": "export-locations-{{ str_slug($location->name) }}-consumables-{{ date('Y-m-d') }}", "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"] }'> -
+ -
-
-
+ + -
-
-
-

{{ trans('general.components') }}

-
-
-
-
+
- $location->id])}}" + data-export-options='{ "fileName": "export-locations-{{ str_slug($location->name) }}-components-{{ date('Y-m-d') }}", "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"] }'> -
-
-
-
- + +
+ + +
diff --git a/resources/views/partials/asset-bulk-actions.blade.php b/resources/views/partials/asset-bulk-actions.blade.php index 4a24a34ced..62b185a7b4 100644 --- a/resources/views/partials/asset-bulk-actions.blade.php +++ b/resources/views/partials/asset-bulk-actions.blade.php @@ -1,4 +1,4 @@ -
+
{{ Form::open([ 'method' => 'POST', 'route' => ['hardware/bulkedit'], diff --git a/resources/views/partials/users-bulk-actions.blade.php b/resources/views/partials/users-bulk-actions.blade.php new file mode 100644 index 0000000000..ab66462159 --- /dev/null +++ b/resources/views/partials/users-bulk-actions.blade.php @@ -0,0 +1,19 @@ +{{ Form::open([ + 'method' => 'POST', + 'route' => ['users/bulkedit'], + 'class' => 'form-inline', + 'id' => 'bulkForm']) }} + +@if (request('status')!='deleted') + @can('delete', \App\Models\User::class) +
+ + + +
+ @endcan +@endif \ No newline at end of file diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php index 82d3d81a87..f3a51a6a5d 100755 --- a/resources/views/users/index.blade.php +++ b/resources/views/users/index.blade.php @@ -38,26 +38,8 @@
- {{ Form::open([ - 'method' => 'POST', - 'route' => ['users/bulkedit'], - 'class' => 'form-inline', - 'id' => 'bulkForm']) }} - - @if (request('status')!='deleted') - @can('delete', \App\Models\User::class) -
- - - -
- @endcan - @endif + @include('partials.users-bulk-actions')