Airlines, Parking
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
},
|
||||
setIcao (icao) {
|
||||
this.icao = icao
|
||||
this.$store.dispatch('setCurrentAirport', icao)
|
||||
},
|
||||
visible (feature) {
|
||||
let bounds = this.$store.state.Settings.bounds
|
||||
|
||||
@@ -75,6 +75,21 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<span class="demo-input-label">Airline :</span>
|
||||
</el-col>
|
||||
<el-col :span="15">
|
||||
<el-select v-model="airlineCodes" multiple placeholder="Select">
|
||||
<el-option
|
||||
v-for="item in airlines"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<span class="demo-input-label">Pushback Route End :</span>
|
||||
@@ -85,11 +100,42 @@
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
computed: {
|
||||
parking: function () {
|
||||
return this.$store.state.Editable.type === 'parking'
|
||||
},
|
||||
airlines: function () {
|
||||
var airlineCodes = [];
|
||||
var storedairlineCodes = this.$store.state.Airports.currentAirport.airlines;
|
||||
// return [{value: 'bi-directional', label: 'bi-directional'},
|
||||
// {value: 'forward', label: 'forward'},
|
||||
// {value: 'backward', label: 'backward'}
|
||||
// ]
|
||||
storedairlineCodes.forEach(element => {
|
||||
airlineCodes.push({value: element, label: element});
|
||||
});
|
||||
return airlineCodes
|
||||
},
|
||||
airlineCodes: {
|
||||
// getter
|
||||
get: function () {
|
||||
var codes = this.$store.state.Editable.data.parking.airlineCodes
|
||||
if (Array.isArray(codes)) {
|
||||
return codes
|
||||
} else if (codes !== undefined) {
|
||||
return codes.split(',')
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
return
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
this.$store.commit('SET_EDIT_PARKING_AIRLINES', newValue)
|
||||
}
|
||||
},
|
||||
name: {
|
||||
// getter
|
||||
get: function () {
|
||||
|
||||
@@ -175,7 +175,13 @@ var mapParkings = function (o) {
|
||||
var lat = convertLat(o.getLatLng());
|
||||
var lon = convertLon(o.getLatLng());
|
||||
// <Parking index="0" type="gate" name="GA_Parking" lat="S9 25.739923" lon="E160 2.927602" heading="67" radius="44" airlineCodes="" />
|
||||
return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading%360).toFixed(1), '@radius': String(o.options.attributes.radius) };
|
||||
var parking = { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading%360).toFixed(1), '@radius': String(o.options.attributes.radius) };
|
||||
if( o.options.attributes.airlineCodes) {
|
||||
console.log(o.options.attributes.airlineCodes);
|
||||
parking['@airlineCodes'] = o.options.attributes.airlineCodes;
|
||||
}
|
||||
|
||||
return parking;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ const ADD_AIRPORT = 'ADD_AIRPORT';
|
||||
const SET_AIRPORTS = 'SET_AIRPORTS';
|
||||
const SET_UNFILTERED_AIRPORTS = 'SET_UNFILTERED_AIRPORTS';
|
||||
const RESET_AIRPORTS = 'RESET_AIRPORTS';
|
||||
const SET_CURRENT_AIRPORT = 'SET_CURRENT_AIRPORT';
|
||||
|
||||
const state = {
|
||||
airports: [], unfilteredairports:[]
|
||||
airports: [], unfilteredairports:[], currentAirport: {}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
@@ -23,6 +24,9 @@ const mutations = {
|
||||
SET_AIRPORTS (state, airports) {
|
||||
Vue.set(state, 'airports', airports);
|
||||
},
|
||||
SET_CURRENT_AIRPORT (state, airport) {
|
||||
Vue.set(state, 'currentAirport', airport);
|
||||
},
|
||||
SET_UNFILTERED_AIRPORTS (state, airports) {
|
||||
state.unfilteredairports = airports;
|
||||
},
|
||||
@@ -47,6 +51,18 @@ const actions = {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
async setCurrentAirport(context, icao) {
|
||||
try {
|
||||
let airports = await idb.getAirports();
|
||||
let searchRegex = new RegExp(icao, 'i');
|
||||
let airport = airports
|
||||
.filter(point => typeof point.geometry.coordinates !== "undefined" )
|
||||
.filter(a => searchRegex.test(a.properties.icao));
|
||||
context.commit(SET_CURRENT_AIRPORT, airport[0].properties);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
async getAirport(context, icao) {
|
||||
try {
|
||||
let airports = await idb.getAirports();
|
||||
|
||||
@@ -51,6 +51,9 @@ const mutations = {
|
||||
'SET_EDIT_PARKING_NAME' (state, parkingName) {
|
||||
Vue.set(state.data.parking, 'name', parkingName)
|
||||
},
|
||||
'SET_EDIT_PARKING_AIRLINES' (state, airlineCodes) {
|
||||
Vue.set(state.data.parking, 'airlineCodes', airlineCodes)
|
||||
},
|
||||
'SET_EDIT_PARKING_TYPE' (state, type) {
|
||||
Vue.set(state.data.parking, 'type', type)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user