Update create asset page to use new validation library

This commit is contained in:
Marcus Moore 2023-11-13 18:17:39 -08:00
parent f02ff62a08
commit 0d3589ca24
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View file

@ -26,14 +26,14 @@
<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">
<input class="form-control" type="text" name="asset_tags[1]" id="asset_tag" value="{{ old('asset_tag', $item->asset_tag) }}" 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>
@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_tags.1', \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()) }}" 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>
@ -295,7 +295,7 @@
box_html += '<span class="fields_wrapper">';
box_html += '<div class="form-group"><label for="asset_tag" class="col-md-3 control-label">{{ trans('admin/hardware/form.tag') }} ' + x + '</label>';
box_html += '<div class="col-md-7 col-sm-12 required">';
box_html += '<input type="text" class="form-control" name="asset_tags[' + x + ']" value="{{ (($snipeSettings->auto_increment_prefix!='') && ($snipeSettings->auto_increment_assets=='1')) ? $snipeSettings->auto_increment_prefix : '' }}'+ auto_tag +'" data-validation="required">';
box_html += '<input type="text" class="form-control" name="asset_tags[' + x + ']" value="{{ (($snipeSettings->auto_increment_prefix!='') && ($snipeSettings->auto_increment_assets=='1')) ? $snipeSettings->auto_increment_prefix : '' }}'+ auto_tag +'" required>';
box_html += '</div>';
box_html += '<div class="col-md-2 col-sm-12">';
box_html += '<a href="#" class="remove_field btn btn-default btn-sm"><i class="fas fa-minus"></i></a>';
@ -379,4 +379,4 @@
</script>
@stop
@stop

View file

@ -2,7 +2,7 @@
<div class="form-group {{ $errors->has('status_id') ? ' has-error' : '' }}">
<label for="status_id" class="col-md-3 control-label">{{ trans('admin/hardware/form.status') }}</label>
<div class="col-md-7 col-sm-11{{ (Helper::checkIfRequired($item, 'status_id')) ? ' required' : '' }}">
{{ Form::select('status_id', $statuslabel_list , old('status_id', $item->status_id), array('class'=>'select2 status_id', 'style'=>'width:100%','id'=>'status_select_id', 'aria-label'=>'status_id', 'data-validation' => "required")) }}
{{ Form::select('status_id', $statuslabel_list , old('status_id', $item->status_id), array('class'=>'select2 status_id', 'style'=>'width:100%','id'=>'status_select_id', 'aria-label'=>'status_id', 'data-validation' => "required", 'required' => 'required')) }}
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
<div class="col-md-2 col-sm-2 text-left">