* #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:
18
resources/js/admin/airport_lookup.js
Normal file
18
resources/js/admin/airport_lookup.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Lookup an airport from the server
|
||||
* @param icao
|
||||
* @param callback
|
||||
*/
|
||||
export default (icao, callback) => {
|
||||
let params = {
|
||||
method: 'GET',
|
||||
url: '/api/airports/' + icao + '/lookup',
|
||||
};
|
||||
|
||||
console.log('Looking airport up');
|
||||
axios(params)
|
||||
.then(response => {
|
||||
console.log(response);
|
||||
callback(response.data);
|
||||
});
|
||||
};
|
||||
@@ -2,7 +2,14 @@
|
||||
* Admin stuff needed
|
||||
*/
|
||||
|
||||
|
||||
require('./../bootstrap');
|
||||
|
||||
import airport_lookup from "./airport_lookup";
|
||||
import calculate_distance from "./calculate_distance";
|
||||
|
||||
window.phpvms.airport_lookup = airport_lookup;
|
||||
window.phpvms.calculate_distance = calculate_distance;
|
||||
|
||||
// Import the mapping function
|
||||
window.phpvms.map = require('../maps/index');
|
||||
|
||||
19
resources/js/admin/calculate_distance.js
Normal file
19
resources/js/admin/calculate_distance.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Lookup an airport from the server
|
||||
* @param fromICAO
|
||||
* @param toICAO
|
||||
* @param callback
|
||||
*/
|
||||
export default (fromICAO, toICAO, callback) => {
|
||||
let params = {
|
||||
method: 'GET',
|
||||
url: '/api/airports/' + fromICAO + '/distance/' + toICAO,
|
||||
};
|
||||
|
||||
console.log('Calcuating airport distance');
|
||||
axios(params)
|
||||
.then(response => {
|
||||
console.log(response);
|
||||
callback(response.data);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user