A free open source IT asset/license management system
Echo out the array values in withInput()
snipe19d5d34ffbd9
diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.phpindex fdcde40c51..aff215ae26 100755--- a/resources/views/hardware/edit.blade.php+++ b/resources/views/hardware/edit.blade.php@@ -18,10 +18,14 @@<!-- Asset Tag --><div class="form-group {{ $errors->has('asset_tag') ? ' has-error' : '' }}"><label for="asset_tag" class="col-md-3 control-label">{{ trans('admin/hardware/form.tag') }}</label>-- <!-- we are editing an existing asset -->+++@if ($item->id)+ <!-- we are editing an existing asset, there will be only one asset tag --><div class="col-md-7 col-sm-12{{ (Helper::checkIfRequired($item, 'asset_tag')) ? ' required' : '' }}">++<input class="form-control" type="text" name="asset_tags[1]" id="asset_tag" value="{{ old('asset_tag', $item->asset_tag) }}" data-validation="required">{!! $errors->first('asset_tags', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}{!! $errors->first('asset_tag', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}@@ -29,7 +33,7 @@@else<!-- we are creating a new asset - let people use more than one asset tag --><div class="col-md-7 col-sm-12{{ (Helper::checkIfRequired($item, 'asset_tag')) ? ' required' : '' }}">- <input class="form-control" type="text" name="asset_tags[1]" id="asset_tag" value="{{ old('asset_tag', \App\Models\Asset::autoincrement_asset()) }}" data-validation="required">+ <input class="form-control" type="text" name="asset_tags[1]" id="asset_tag" value="{{ old('asset_tags.1', \App\Models\Asset::autoincrement_asset()) }}" data-validation="required">{!! $errors->first('asset_tags', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}{!! $errors->first('asset_tag', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}</div>@@ -40,11 +44,8 @@</div>@endif</div>---- @include ('partials.forms.edit.serial', ['fieldname'=> 'serials[1]', 'translated_serial' => trans('admin/hardware/form.serial')])+ @include ('partials.forms.edit.serial', ['fieldname'=> 'serials[1]', 'old_val_name' => 'serials.1', 'translated_serial' => trans('admin/hardware/form.serial')])<div class="input_fields_wrap"></div>diff --git a/resources/views/partials/forms/edit/serial.blade.php b/resources/views/partials/forms/edit/serial.blade.phpindex 7a7bb8b8e2..483b425846 100644--- a/resources/views/partials/forms/edit/serial.blade.php+++ b/resources/views/partials/forms/edit/serial.blade.php@@ -2,7 +2,7 @@<div class="form-group {{ $errors->has('serial') ? ' has-error' : '' }}"><label for="{{ $fieldname }}" class="col-md-3 control-label">{{ trans('admin/hardware/form.serial') }} </label><div class="col-md-7 col-sm-12{{ (Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}">- <input class="form-control" type="text" name="{{ $fieldname }}" id="{{ $fieldname }}" value="{{ old('serial', $item->serial) }}" />+ <input class="form-control" type="text" name="{{ $fieldname }}" id="{{ $fieldname }}" value="{{ old((isset($old_val_name) ? $old_val_name : $fieldname), $item->serial) }}" />{!! $errors->first('serial', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}</div></div>