* #355 Calculate distance button in add/edit Flight page * Styling * Move add/edit flight logic out of controller and into service layer * Styling * Formatting * Run styleci against modules dir * Styleci config * Style fixes in /modules
This commit is contained in:
@@ -95,6 +95,21 @@ $(document).ready(function () {
|
||||
setEditable();
|
||||
setFieldsEditable();
|
||||
});
|
||||
|
||||
$('a.airport_distance_lookup').click(function (e) {
|
||||
e.preventDefault();
|
||||
const fromIcao = $("select#dpt_airport_id option:selected").val();
|
||||
const toIcao = $("select#arr_airport_id option:selected").val();
|
||||
if (fromIcao === '' || toIcao === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Calculating from ${fromIcao} to ${toIcao}`);
|
||||
phpvms.calculate_distance(fromIcao, toIcao, function (response) {
|
||||
console.log('Calculate distance:', response);
|
||||
$("#distance").val(response.data.distance.nmi);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user