Fixed #8753 - create-asset-from-model did not preselect the model

This commit is contained in:
snipe 2020-11-18 13:59:02 -08:00
parent 551e28eec9
commit 57d6a7d35e

View file

@ -5,7 +5,7 @@
<div class="col-md-7{{ ((isset($field_req)) || ((isset($required) && ($required =='true')))) ? ' required' : '' }}">
<select class="js-data-ajax" data-endpoint="models" data-placeholder="{{ trans('general.select_model') }}" name="{{ $fieldname }}" style="width: 100%" id="model_select_id" aria-label="{{ $fieldname }}"{!! (isset($field_req) ? ' data-validation="required" required' : '') !!}>
@if ($model_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
@if ($model_id = old($fieldname, ($item->{$fieldname} ?? request($fieldname) ?? '')))
<option value="{{ $model_id }}" selected="selected">
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}
</option>