mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #12807 from snipe/fixes/handle_arrays_on_validation_failure
Echo out the array values in withInput()
This commit is contained in:
commit
b886f57d92
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue