mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Rip out jquery for location parent
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
b8231f420b
commit
778787db3c
|
@ -65,50 +65,3 @@
|
||||||
@include ('partials.forms.edit.image-upload')
|
@include ('partials.forms.edit.image-upload')
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@if (!$item->id)
|
|
||||||
@section('moar_scripts')
|
|
||||||
<script nonce="{{ csrf_token() }}">
|
|
||||||
|
|
||||||
var $eventSelect = $(".parent");
|
|
||||||
$eventSelect.on("change", function () { parent_details($eventSelect.val()); });
|
|
||||||
$(function() {
|
|
||||||
var parent_loc = $(".parent option:selected").val();
|
|
||||||
if(parent_loc!=''){
|
|
||||||
parent_details(parent_loc);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function parent_details(id) {
|
|
||||||
|
|
||||||
if (id) {
|
|
||||||
//start ajax request
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: "{{url('/') }}/api/locations/"+id+"/check",
|
|
||||||
//force to handle it as text
|
|
||||||
dataType: "text",
|
|
||||||
success: function(data) {
|
|
||||||
var json = $.parseJSON(data);
|
|
||||||
$("#city").val(json.city);
|
|
||||||
$("#address").val(json.address);
|
|
||||||
$("#address2").val(json.address2);
|
|
||||||
$("#state").val(json.state);
|
|
||||||
$("#zip").val(json.zip);
|
|
||||||
$(".country").select2("val",json.country);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$("#city").val('');
|
|
||||||
$("#address").val('');
|
|
||||||
$("#address2").val('');
|
|
||||||
$("#state").val('');
|
|
||||||
$("#zip").val('');
|
|
||||||
$(".country").select2("val",'');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@stop
|
|
||||||
@endif
|
|
||||||
|
|
Loading…
Reference in a new issue