mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Merge pull request #14347 from snipe/feature/sc-24856_requestable_page
Dynamically show models/assets on requestable page
This commit is contained in:
commit
b1cd44341b
|
@ -111,6 +111,7 @@ class AssetsController extends Controller
|
||||||
'requests_counter',
|
'requests_counter',
|
||||||
'byod',
|
'byod',
|
||||||
'asset_eol_date',
|
'asset_eol_date',
|
||||||
|
'requestable',
|
||||||
];
|
];
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
|
|
|
@ -37,6 +37,7 @@ class AssetsTransformer
|
||||||
'name'=> e($asset->model->name),
|
'name'=> e($asset->model->name),
|
||||||
] : null,
|
] : null,
|
||||||
'byod' => ($asset->byod ? true : false),
|
'byod' => ($asset->byod ? true : false),
|
||||||
|
'requestable' => ($asset->requestable ? true : false),
|
||||||
|
|
||||||
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
||||||
'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date).' months' : null,
|
'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date).' months' : null,
|
||||||
|
|
|
@ -195,6 +195,14 @@ class AssetPresenter extends Presenter
|
||||||
'visible' => false,
|
'visible' => false,
|
||||||
'title' => trans('admin/hardware/form.warranty_expires'),
|
'title' => trans('admin/hardware/form.warranty_expires'),
|
||||||
'formatter' => 'dateDisplayFormatter',
|
'formatter' => 'dateDisplayFormatter',
|
||||||
|
], [
|
||||||
|
'field' => 'requestable',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => true,
|
||||||
|
'visible' => false,
|
||||||
|
'title' => trans('admin/hardware/general.requestable'),
|
||||||
|
'formatter' => 'trueFalseFormatter',
|
||||||
|
|
||||||
], [
|
], [
|
||||||
'field' => 'notes',
|
'field' => 'notes',
|
||||||
'searchable' => true,
|
'searchable' => true,
|
||||||
|
|
|
@ -516,5 +516,6 @@ return [
|
||||||
'partial' => 'Deleted :success_count :object_type, but :error_count :object_type could not be deleted',
|
'partial' => 'Deleted :success_count :object_type, but :error_count :object_type could not be deleted',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'no_requestable' => 'There are no requestable assets or asset models.',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -16,20 +16,37 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
|
||||||
|
@if (($assets->count() < 1) && ($models->count() < 1))
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="alert alert-info fade in">
|
||||||
|
<i class="fas fa-info-circle faa-pulse animated"></i>
|
||||||
|
<strong>{{ trans('general.notification_info') }}: </strong>
|
||||||
|
{{ trans('general.no_requestable') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@else
|
||||||
<div class="nav-tabs-custom">
|
<div class="nav-tabs-custom">
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
|
@if ($assets->count() > 0)
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#assets" data-toggle="tab" title="{{ trans('general.assets') }}">{{ trans('general.assets') }}
|
<a href="#assets" data-toggle="tab" title="{{ trans('general.assets') }}">{{ trans('general.assets') }}
|
||||||
<badge class="badge badge-secondary"> {{ $assets->count()}}</badge>
|
<badge class="badge badge-secondary"> {{ $assets->count()}}</badge>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@endif
|
||||||
|
@if ($models->count() > 0)
|
||||||
<li>
|
<li>
|
||||||
<a href="#models" data-toggle="tab" title="{{ trans('general.asset_models') }}">{{ trans('general.asset_models') }}
|
<a href="#models" data-toggle="tab" title="{{ trans('general.asset_models') }}">{{ trans('general.asset_models') }}
|
||||||
<badge class="badge badge-secondary"> {{ $models->count()}}</badge>
|
<badge class="badge badge-secondary"> {{ $models->count()}}</badge>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@endif
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
@if ($assets->count() > 0)
|
||||||
<div class="tab-pane fade in active" id="assets">
|
<div class="tab-pane fade in active" id="assets">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
@ -79,13 +96,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
<div class="tab-pane fade" id="models">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
|
|
||||||
@if ($models->count() > 0)
|
@if ($models->count() > 0)
|
||||||
<h2>{{ trans('general.requestable_models') }}</h2>
|
<div class="tab-pane fade in {{ ($assets->count() == 0) ? 'active' : '' }}" id="models">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
<table
|
<table
|
||||||
name="requested-assets"
|
name="requested-assets"
|
||||||
data-toolbar="#toolbar"
|
data-toolbar="#toolbar"
|
||||||
|
@ -145,18 +161,15 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@else
|
</div>
|
||||||
<div class="alert alert-info alert-block">
|
</div>
|
||||||
<i class="fas fa-info-circle"></i>
|
|
||||||
{{ trans('general.no_results') }}
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div> <!-- .tab-content-->
|
</div> <!-- .tab-content-->
|
||||||
</div> <!-- .nav-tabs-custom -->
|
</div> <!-- .nav-tabs-custom -->
|
||||||
|
|
||||||
|
@endif
|
||||||
</div> <!-- .col-md-12> -->
|
</div> <!-- .col-md-12> -->
|
||||||
</div> <!-- .row -->
|
</div> <!-- .row -->
|
||||||
@stop
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue