mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-28 23:19:42 -08:00
Merge branch 'develop'
This commit is contained in:
commit
eb24eb1fff
|
@ -154,16 +154,21 @@ class AssetMaintenancesController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
$asset = null;
|
||||
|
||||
if ($asset = Asset::find(request('asset_id'))) {
|
||||
// We have to set this so that the correct property is set in the select2 ajax dropdown
|
||||
$asset->asset_id = $asset->id;
|
||||
}
|
||||
|
||||
// Prepare Asset Maintenance Type List
|
||||
$assetMaintenanceType = [
|
||||
'' => 'Select an asset maintenance type',
|
||||
] + AssetMaintenance::getImprovementOptions();
|
||||
// Mark the selected asset, if it came in
|
||||
// Render the view
|
||||
|
||||
return view('asset_maintenances/edit')
|
||||
->with('asset_list', Helper::detailedAssetList())
|
||||
->with('selectedAsset', request('asset_id'))
|
||||
->with('supplier_list', Helper::suppliersList())
|
||||
->with('asset', $asset)
|
||||
->with('assetMaintenanceType', $assetMaintenanceType)
|
||||
->with('item', new AssetMaintenance);
|
||||
}
|
||||
|
|
|
@ -963,7 +963,7 @@ class Asset extends Depreciable
|
|||
*/
|
||||
public function scopeOrderModels($query, $order)
|
||||
{
|
||||
return $query->join('models', 'assets.model_id', '=', 'models.id')->orderBy('models.name', $order);
|
||||
return $query->join('models as asset_models', 'assets.model_id', '=', 'models.id')->orderBy('models.name', $order);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,22 +41,8 @@
|
|||
</div><!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
<!-- Asset -->
|
||||
<div class="form-group {{ $errors->has('asset_id') ? ' has-error' : '' }}">
|
||||
<label for="asset_id" class="col-md-3 control-label">
|
||||
{{ trans('admin/asset_maintenances/table.asset_name') }}
|
||||
</label>
|
||||
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'asset_id')) ? ' required' : '' }}">
|
||||
@if ($selectedAsset == null)
|
||||
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $item->asset_id), ['class'=>'select2', 'style'=>'min-width:350px']) }}
|
||||
@else
|
||||
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $selectedAsset), ['class'=>'select2', 'style'=>'min-width:350px', 'enabled' => 'false']) }}
|
||||
@endif
|
||||
{!! $errors->first('asset_id', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div> <!-- .form-group -->
|
||||
|
||||
@include ('partials.forms.edit.supplier')
|
||||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/asset_maintenances/table.asset_name'), 'fieldname' => 'asset_id'])
|
||||
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
|
||||
@include ('partials.forms.edit.maintenance_type')
|
||||
|
||||
<!-- Title -->
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
|
||||
<div class="col-md-7 required">
|
||||
<select class="js-data-ajax select2" data-endpoint="hardware" name="{{ $fieldname }}" style="width: 100%" id="assigned_asset_select"{{ (isset($multiple)) ? ' multiple="multiple"' : '' }}>
|
||||
@if ($asset_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
|
||||
|
||||
@if ($asset_id = Input::old($fieldname, (isset($asset) ? $asset->id : (isset($item) ? $item->{$fieldname} : ''))))
|
||||
<option value="{{ $asset_id }}" selected="selected">
|
||||
{{ (\App\Models\Asset::find($asset_id)) ? \App\Models\Asset::find($asset_id)->present()->fullName : '' }}
|
||||
</option>
|
||||
|
|
Loading…
Reference in a new issue