mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Initial rework of locations display
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
711c713ab8
commit
7c77e03c5a
|
@ -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')
|
||||
|
|
|
@ -15,17 +15,77 @@
|
|||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs hidden-print">
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<li class="active">
|
||||
<a href="#users" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-info-circle fa-2x"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.users') }}
|
||||
{!! (($location->users) && ($location->users->count() > 0 )) ? '<badge class="badge badge-secondary">'.$location->users->count().'</badge>' : '' !!}
|
||||
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#assets" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.assets') }}
|
||||
{!! (($location->assets) && ($location->assets->count() > 0 )) ? '<badge class="badge badge-secondary">'.$location->assets->count().'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#accessories" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.accessories') }}
|
||||
{!! (($location->accessories) && ($location->accessories->count() > 0 )) ? '<badge class="badge badge-secondary">'.$location->accessories->count().'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#consumables" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.consumables') }}
|
||||
{!! (($location->consumables) && ($location->consumables->count() > 0 )) ? '<badge class="badge badge-secondary">'.$location->consumables->count().'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#components" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
<i class="fas fa-barcode fa-2x" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ trans('general.components') }}
|
||||
{!! (($location->components) && ($location->components->count() > 0 )) ? '<badge class="badge badge-secondary">'.$location->components->count().'</badge>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="users">
|
||||
<h2 class="box-title">{{ trans('general.users') }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<div class="table table-responsive">
|
||||
|
||||
@include('partials.users-bulk-actions')
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\UserPresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="usersTable"
|
||||
|
@ -37,6 +97,7 @@
|
|||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
data-toolbar="#toolbar"
|
||||
id="usersTable"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{route('api.users.index', ['location_id' => $location->id])}}"
|
||||
|
@ -47,22 +108,13 @@
|
|||
|
||||
</table>
|
||||
</div><!-- /.table-responsive -->
|
||||
</div><!-- /.box-body -->
|
||||
</div> <!--/.box-->
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<div class="tab-pane" id="assets">
|
||||
<h2 class="box-title">{{ trans('general.assets') }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
@include('partials.asset-bulk-actions')
|
||||
|
||||
<div class="table table-responsive">
|
||||
|
||||
@include('partials.asset-bulk-actions')
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\AssetPresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="assetsListingTable"
|
||||
|
@ -74,6 +126,7 @@
|
|||
data-show-export="true"
|
||||
data-show-refresh="true"
|
||||
data-sort-order="asc"
|
||||
data-toolbar="#toolbar"
|
||||
id="assetsListingTable"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{route('api.assets.index', ['location_id' => $location->id]) }}"
|
||||
|
@ -84,18 +137,13 @@
|
|||
</table>
|
||||
|
||||
</div><!-- /.table-responsive -->
|
||||
</div><!-- /.box-body -->
|
||||
</div> <!--/.box-->
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
|
||||
|
||||
<div class="tab-pane" id="accessories">
|
||||
<h2 class="box-title">{{ trans('general.accessories') }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="table table-responsive">
|
||||
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\AccessoryPresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="accessoriesListingTable"
|
||||
|
@ -115,20 +163,12 @@
|
|||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
}'>
|
||||
</table>
|
||||
|
||||
</div><!-- /.table-responsive -->
|
||||
</div><!-- /.box-body -->
|
||||
</div> <!--/.box-->
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h2 class="box-title">{{ trans('general.consumables') }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<div class="tab-pane" id="consumables">
|
||||
<div class="table table-responsive">
|
||||
|
||||
<table
|
||||
data-columns="{{ \App\Presenters\ConsumablePresenter::dataTableLayout() }}"
|
||||
data-cookie-id-table="consumablesListingTable"
|
||||
|
@ -150,16 +190,10 @@
|
|||
</table>
|
||||
|
||||
</div><!-- /.table-responsive -->
|
||||
</div><!-- /.box-body -->
|
||||
</div> <!--/.box-->
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<div class="tab-pane" id="components">
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h2 class="box-title">{{ trans('general.components') }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="table table-responsive">
|
||||
|
||||
<table
|
||||
|
@ -183,11 +217,11 @@
|
|||
|
||||
</table>
|
||||
</div><!-- /.table-responsive -->
|
||||
</div><!-- /.box-body -->
|
||||
</div> <!--/.box-->
|
||||
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
</div><!--/.col-md-9-->
|
||||
</div><!--/.col-md-9-->
|
||||
</div><!--/.col-md-9-->
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="toolbar">
|
||||
<div id="assets-toolbar">
|
||||
{{ Form::open([
|
||||
'method' => 'POST',
|
||||
'route' => ['hardware/bulkedit'],
|
||||
|
|
19
resources/views/partials/users-bulk-actions.blade.php
Normal file
19
resources/views/partials/users-bulk-actions.blade.php
Normal file
|
@ -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)
|
||||
<div id="users-toolbar">
|
||||
<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">
|
||||
<option value="delete">{!! trans('general.bulk_checkin_delete') !!}</option>
|
||||
<option value="edit">{{ trans('general.bulk_edit') }}</option>
|
||||
<option value="bulkpasswordreset">{{ trans('button.send_password_link') }}</option>
|
||||
</select>
|
||||
<button class="btn btn-default" id="bulkEdit" disabled>{{ trans('button.go') }}</button>
|
||||
</div>
|
||||
@endcan
|
||||
@endif
|
|
@ -38,26 +38,8 @@
|
|||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
{{ Form::open([
|
||||
'method' => 'POST',
|
||||
'route' => ['users/bulkedit'],
|
||||
'class' => 'form-inline',
|
||||
'id' => 'bulkForm']) }}
|
||||
|
||||
@if (request('status')!='deleted')
|
||||
@can('delete', \App\Models\User::class)
|
||||
<div id="toolbar">
|
||||
<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">
|
||||
<option value="delete">{!! trans('general.bulk_checkin_delete') !!}</option>
|
||||
<option value="edit">{{ trans('general.bulk_edit') }}</option>
|
||||
<option value="bulkpasswordreset">{{ trans('button.send_password_link') }}</option>
|
||||
</select>
|
||||
<button class="btn btn-default" id="bulkEdit" disabled>{{ trans('button.go') }}</button>
|
||||
</div>
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
@include('partials.users-bulk-actions')
|
||||
|
||||
<table
|
||||
data-click-to-select="true"
|
||||
|
|
Loading…
Reference in a new issue