mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34: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',
|
||||
'byod',
|
||||
'asset_eol_date',
|
||||
'requestable',
|
||||
];
|
||||
|
||||
$filter = [];
|
||||
|
|
|
@ -37,6 +37,7 @@ class AssetsTransformer
|
|||
'name'=> e($asset->model->name),
|
||||
] : null,
|
||||
'byod' => ($asset->byod ? true : false),
|
||||
'requestable' => ($asset->requestable ? true : false),
|
||||
|
||||
'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,
|
||||
|
|
|
@ -195,6 +195,14 @@ class AssetPresenter extends Presenter
|
|||
'visible' => false,
|
||||
'title' => trans('admin/hardware/form.warranty_expires'),
|
||||
'formatter' => 'dateDisplayFormatter',
|
||||
], [
|
||||
'field' => 'requestable',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'visible' => false,
|
||||
'title' => trans('admin/hardware/general.requestable'),
|
||||
'formatter' => 'trueFalseFormatter',
|
||||
|
||||
], [
|
||||
'field' => 'notes',
|
||||
'searchable' => true,
|
||||
|
|
|
@ -516,5 +516,6 @@ return [
|
|||
'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="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">
|
||||
<ul class="nav nav-tabs">
|
||||
@if ($assets->count() > 0)
|
||||
<li class="active">
|
||||
<a href="#assets" data-toggle="tab" title="{{ trans('general.assets') }}">{{ trans('general.assets') }}
|
||||
<badge class="badge badge-secondary"> {{ $assets->count()}}</badge>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@if ($models->count() > 0)
|
||||
<li>
|
||||
<a href="#models" data-toggle="tab" title="{{ trans('general.asset_models') }}">{{ trans('general.asset_models') }}
|
||||
<badge class="badge badge-secondary"> {{ $models->count()}}</badge>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
@if ($assets->count() > 0)
|
||||
<div class="tab-pane fade in active" id="assets">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
@ -79,13 +96,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="models">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@endif
|
||||
|
||||
@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
|
||||
name="requested-assets"
|
||||
data-toolbar="#toolbar"
|
||||
|
@ -145,18 +161,15 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<div class="alert alert-info alert-block">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
{{ trans('general.no_results') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- .tab-content-->
|
||||
</div> <!-- .nav-tabs-custom -->
|
||||
|
||||
@endif
|
||||
</div> <!-- .col-md-12> -->
|
||||
</div> <!-- .row -->
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue