Check that the models are valid being trying to return a value in the ajax partials

This commit is contained in:
snipe 2017-11-08 17:07:57 -08:00
parent 5ce7882bf5
commit ffae537400
7 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@
<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} : ''))
<option value="{{ $asset_id }}" selected="selected">
{{ \App\Models\Asset::find($asset_id)->present()->fullName }}
{{ (\App\Models\Asset::find($asset_id)) ? \App\Models\Asset::find($asset_id)->present()->fullName : '' }}
</option>
@else
<option value="">{{ trans('general.select_asset') }}</option>

View file

@ -7,7 +7,7 @@
<select class="js-data-ajax" data-endpoint="categories/{{ (isset($category_type)) ? $category_type : 'assets' }}" name="{{ $fieldname }}" style="width: 100%" id="category_select_id">
@if ($category_id = Input::old($fieldname, $item->{$fieldname}))
<option value="{{ $category_id }}" selected="selected">
{{ \App\Models\Category::find($category_id)->name }}
{{ (\App\Models\Category::find($category_id)) ? \App\Models\Category::find($category_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_category') }}</option>

View file

@ -6,7 +6,7 @@
<select class="js-data-ajax" data-endpoint="departments" name="{{ $fieldname }}" style="width: 100%" id="department_select">
@if ($department_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $department_id }}" selected="selected">
{{ \App\Models\Department::find($department_id)->name }}
{{ (\App\Models\Department::find($department_id)) ? \App\Models\Department::find($department_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_department') }}</option>

View file

@ -7,7 +7,7 @@
<select class="js-data-ajax" data-endpoint="manufacturers" name="{{ $fieldname }}" style="width: 100%" id="category_select_id">
@if ($manufacturer_id = Input::old($fieldname, $item->{$fieldname}))
<option value="{{ $manufacturer_id }}" selected="selected">
{{ \App\Models\Manufacturer::find($manufacturer_id)->name }}
{{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_manufacturer') }}</option>

View file

@ -7,7 +7,7 @@
<select class="js-data-ajax" data-endpoint="models" name="{{ $fieldname }}" style="width: 100%" id="model_select_id">
@if ($model_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $model_id }}" selected="selected">
{{ \App\Models\AssetModel::find($model_id)->name }}
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_model') }}</option>

View file

@ -6,7 +6,7 @@
<select class="js-data-ajax" data-endpoint="suppliers" name="{{ $fieldname }}" style="width: 100%" id="supplier_select">
@if ($supplier_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $supplier_id }}" selected="selected">
{{ \App\Models\Supplier::find($supplier_id)->name }}
{{ (\App\Models\Supplier::find($supplier_id)) ? \App\Models\Supplier::find($supplier_id)->name : '' }}
</option>
@else
<option value="">{{ trans('general.select_supplier') }}</option>

View file

@ -6,7 +6,7 @@
<select class="js-data-ajax" data-endpoint="users" name="{{ $fieldname }}" style="width: 100%" id="assigned_user_select">
@if ($user_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $user_id }}" selected="selected">
{{ \App\Models\User::find($user_id)->present()->fullName }}
{{ (\App\Models\User::find($user_id)) ? \App\Models\User::find($user_id)->present()->fullName : '' }}
</option>
@else
<option value="">{{ trans('general.select_user') }}</option>