Fixed remove-asset-tag javascript on asset edit, added server side validation support

This commit is contained in:
snipe 2018-10-05 02:51:14 -07:00
parent 4920dced6e
commit 81d8c1cc52
2 changed files with 4 additions and 4 deletions

View file

@ -28,7 +28,7 @@
@else
<!-- we are creating a new asset - let people use more than one asset tag -->
<div class="col-md-7 col-sm-12{{ (\App\Helpers\Helper::checkIfRequired($item, 'asset_tag')) ? ' required' : '' }}">
<input class="form-control" type="text" name="asset_tag" id="asset_tag" value="{{ Input::old('asset_tag', \App\Models\Asset::autoincrement_asset()) }}" data-validation="required">
<input class="form-control" type="text" name="asset_tag" id="asset_tag" value="{{ Input::old('asset_tag', \App\Models\Asset::autoincrement_asset()) }}" data-validation="required server" data-validation-url="{{url('/') }}/api/v1/hardware/checktag">
</div>
<div class="col-md-2 col-sm-12">
<button class="add_field_button btn btn-default btn-sm"><i class="fa fa-plus"></i></button>
@ -232,7 +232,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 : '' }}'+ incremented_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 : '' }}'+ incremented_tag +'" data-validation="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="fa fa-minus"></i></a>';
@ -260,7 +260,7 @@
e.preventDefault();
console.log(x);
$('.fields_wrapper').parent('div').remove();
$(this).parent('div').parent('div').parent('span').remove();
x--;
})
});

View file

@ -801,7 +801,7 @@
$.validate({
form : '#create-form',
modules : 'date,toggleDisabled',
modules : 'date,toggleDisabled,security',
disabledFormFilter : '#create-form',
showErrorDialogs : true
});