Airport lookup from vaCentral API; changes to Airports tables
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#airports-table a.inline').editable({
|
||||
type: 'text',
|
||||
mode: 'inline',
|
||||
@@ -16,6 +18,29 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('a.airport_data_lookup').click(function(e) {
|
||||
e.preventDefault();
|
||||
var icao = $("input#airport_icao").val();
|
||||
if(icao === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
phpvms_vacentral_airport_lookup(icao, function(data) {
|
||||
console.log('lookup data', data);
|
||||
_.forEach(data, function(value, key) {
|
||||
if(key === 'city') {
|
||||
key = 'location';
|
||||
}
|
||||
|
||||
$("#" + key).val(value);
|
||||
|
||||
if(key === 'tz') {
|
||||
$("#tz").trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user