A","fullname":null,"country":"Japan","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":636,"airbourne":46,"location":"Japan","phone":"+1-800-235-9262","url":"http:\/\/www.ana.co.jp\/","wiki_url":"http:\/\/en.wikipedia.org\/wiki\/All_Nippon_Airways","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":0,"active":1,"is_oneworld":0,"is_staralliance":1,"is_skyteam":0,"is_allianceaffiliate":0,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:32:25.000000Z","updated_at":"2023-06-28T11:05:47.000000Z"}},{"id":53072,"route_id":33886,"carrier":"MU","carrier_name":"China Eastern","lcc":0,"iata_from":"OKJ","iata_to":"PVG","day1":"no","day2":"yes","day3":"no","day4":"yes","day5":"yes","day6":"yes","day7":"yes","aircraft_codes":"32S","first_flight":null,"last_flight":"2026-10-15","class_first":1,"class_business":0,"class_economy":1,"common_duration":160,"min_duration":155,"max_duration":165,"is_new":0,"is_active":1,"is_layover":0,"passengers_per_day":0,"created_at":"2017-12-20T10:14:28.000000Z","updated_at":"2025-10-27T11:48:32.000000Z","deleted_at":null,"last_found":"2025-10-27 12:48:32","flights_per_week":5,"flights_per_day":"0-1 flights","airline":{"id":947,"callsign":"CHINA EASTERN","ICAO":"CES","IATA":"MU","name":"China Eastern Airlines","fs_id":"MU","shortname":"China Eastern","fullname":null,"country":"China","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":1826,"airbourne":207,"location":"China","phone":"+1-800-200-5118","url":"https:\/\/www.ceair.com\/","wiki_url":"","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":0,"active":1,"is_oneworld":0,"is_staralliance":0,"is_skyteam":1,"is_allianceaffiliate":0,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:32:12.000000Z","updated_at":"2023-06-28T11:05:47.000000Z"}},{"id":53068,"route_id":33883,"carrier":"JL","carrier_name":"JAL","lcc":0,"iata_from":"OKJ","iata_to":"HND","day1":"yes","day2":"yes","day3":"yes","day4":"yes","day5":"yes","day6":"yes","day7":"yes","aircraft_codes":"737","first_flight":null,"last_flight":"2026-10-15","class_first":0,"class_business":1,"class_economy":1,"common_duration":75,"min_duration":70,"max_duration":90,"is_new":0,"is_active":1,"is_layover":0,"passengers_per_day":0,"created_at":"2017-12-20T10:14:28.000000Z","updated_at":"2025-10-27T11:48:32.000000Z","deleted_at":null,"last_found":"2025-10-27 12:48:32","flights_per_week":35,"flights_per_day":"5 flights","airline":{"id":779,"callsign":"JAPANAIR","ICAO":"JAL","IATA":"JL","name":"JAL","fs_id":"JL","shortname":"JAL","fullname":null,"country":"Japan","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":569,"airbourne":33,"location":"Japan","phone":"+1-800-525-3663","url":"http:\/\/www.jal.com\/en\/","wiki_url":"","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":0,"active":1,"is_oneworld":1,"is_staralliance":0,"is_skyteam":0,"is_allianceaffiliate":0,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:31:01.000000Z","updated_at":"2023-06-28T11:05:45.000000Z"}},{"id":53071,"route_id":33885,"carrier":"NU","carrier_name":"JTA","lcc":0,"iata_from":"OKJ","iata_to":"OKA","day1":"yes","day2":"yes","day3":"yes","day4":"yes","day5":"yes","day6":"yes","day7":"yes","aircraft_codes":"737","first_flight":null,"last_flight":"2026-10-15","class_first":0,"class_business":1,"class_economy":1,"common_duration":125,"min_duration":120,"max_duration":145,"is_new":0,"is_active":1,"is_layover":0,"passengers_per_day":0,"created_at":"2017-12-20T10:14:28.000000Z","updated_at":"2025-10-27T11:48:32.000000Z","deleted_at":null,"last_found":"2025-10-27 12:48:32","flights_per_week":7,"flights_per_day":"1 flight","airline":{"id":991,"callsign":"JAI OCEAN","ICAO":"JTA","IATA":"NU","name":"Japan Transocean Air","fs_id":"NU","shortname":"JTA","fullname":null,"country":"Japan","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":70,"airbourne":0,"location":"","phone":"","url":"http:\/\/www.jal.co.jp\/jta\/","wiki_url":"","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":0,"active":1,"is_oneworld":1,"is_staralliance":0,"is_skyteam":0,"is_allianceaffiliate":1,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:32:32.000000Z","updated_at":"2023-06-28T11:05:47.000000Z"}},{"id":53070,"route_id":33884,"carrier":"KE","carrier_name":"Korean Air","lcc":0,"iata_from":"OKJ","iata_to":"ICN","day1":"upcoming","day2":"no","day3":"yes","day4":"no","day5":"yes","day6":"no","day7":"yes","aircraft_codes":"737","first_flight":null,"last_flight":"2026-10-15","class_first":0,"class_business":1,"class_economy":1,"common_duration":90,"min_duration":90,"max_duration":120,"is_new":0,"is_active":1,"is_layover":0,"passengers_per_day":0,"created_at":"2017-12-20T10:14:28.000000Z","updated_at":"2025-10-27T11:48:32.000000Z","deleted_at":null,"last_found":"2025-10-27 12:48:32","flights_per_week":3,"flights_per_day":"0-1 flights","airline":{"id":809,"callsign":"KOREANAIR","ICAO":"KAL","IATA":"KE","name":"Korean Air","fs_id":"KE","shortname":"Korean Air","fullname":null,"country":"South Korea","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":425,"airbourne":64,"location":"Republic Of Korea","phone":"+1-800-438-5000","url":"http:\/\/www.koreanair.com\/","wiki_url":"","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":0,"active":1,"is_oneworld":0,"is_staralliance":0,"is_skyteam":1,"is_allianceaffiliate":0,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:31:16.000000Z","updated_at":"2023-06-28T11:05:46.000000Z"}},{"id":182264,"route_id":91088,"carrier":"IT","carrier_name":"Tigerair Taiwan","lcc":0,"iata_from":"OKJ","iata_to":"KHH","day1":"yes","day2":"no","day3":"yes","day4":"no","day5":"yes","day6":"no","day7":"no","aircraft_codes":"32S","first_flight":null,"last_flight":"2026-10-15","class_first":0,"class_business":0,"class_economy":1,"common_duration":203,"min_duration":200,"max_duration":205,"is_new":0,"is_active":1,"is_layover":0,"passengers_per_day":0,"created_at":"2024-09-17T09:16:09.000000Z","updated_at":"2025-10-27T11:48:32.000000Z","deleted_at":null,"last_found":"2025-10-27 12:48:32","flights_per_week":3,"flights_per_day":"0-1 flights","airline":{"id":736,"callsign":"SMART CAT","ICAO":"TTW","IATA":"IT","name":"Tigerair Taiwan","fs_id":"TTW","shortname":"Tigerair Taiwan","fullname":null,"country":"Taiwan","flag_carrier":null,"languages_primary":null,"languages_secondary":null,"flights_last_24_hours":49,"airbourne":9,"location":"Taiwan","phone":"","url":"http:\/\/www.tigerairtw.com\/en\/","wiki_url":"","is_scheduled_passenger":1,"is_nonscheduled_passenger":0,"is_cargo":0,"is_railway":null,"is_lowcost":1,"active":1,"is_oneworld":0,"is_staralliance":0,"is_skyteam":0,"is_allianceaffiliate":0,"rating_iosapp":null,"rating_androidapp":null,"rating_skytrax_reviews":null,"rating_skytrax_stars":null,"rating_tripadvisor":null,"rating_trustpilot":null,"rating_flightradar24":null,"color1":null,"color2":null,"textcolor":null,"kayak_api_lastseen":null,"kayak_api_isactive":0,"created_at":"2018-01-03T06:30:44.000000Z","updated_at":"2023-06-28T11:05:50.000000Z"}}],
airlinesToShow: 0,
airlinesToShowCount: 5,
countriesToShowCount: 5,
days: {},
countries: [{"country":"China","country_code":"CN"},{"country":"Japan","country_code":"JP"},{"country":"Republic of Korea","country_code":"KR"},{"country":"Taiwan","country_code":"TW"}],
countriesToShow: 0,
sortBy: "Popularity",
classes: {},
destinationCountrySorting: 'asc',
priceSorting: '',
mostFlightsSorting: 'desc',
airportNameSorting: '',
airportSorting: '',
destinationTo: '',
calendar: null,
selectedDate: '',
airportRequest: null,
selectedFlight: null,
showInfoBox: false,
iframeUrl: '/content/cCompare?from=OKJ&to=' + this.destinationTo + '}&width=300&height=600&preview=1',
}
},
mounted() {
//console.log(this.$refs);
/*
this.$nextTick(() => {
this.frameHeight = this.$refs.iframe.contentWindow.document.body.scrollHeight + 'px';
});
*/
},
watch: {
durationFrom() {
this.updateFilter()
},
lowcost() {
if (this.lowcost === true) {
delete this.classes['business']
this.businessOnly = 0
}
this.configureLowcost()
this.updateFilter()
},
businessOnly() {
if (this.businessOnly === true) {
this.lowcost = 0
this.classes['business'] = true
} else delete this.classes['business']
this.updateFilter()
},
durationTo() {
this.updateFilter()
},
departureFrom() {
this.updateFilter()
},
departureTo() {
this.updateFilter()
},
arrivalFrom() {
this.updateFilter()
},
arrivalTo() {
this.updateFilter()
},
distanceFrom() {
this.updateFilter()
},
distanceTo() {
this.updateFilter()
},
priceFrom() {
this.updateFilter()
},
priceTo() {
this.updateFilter()
}
},
methods: {
setEntityType(entityType) {
this.entityType = entityType;
this.schedulesOffset = 50;
if(entityType === 'destinations') {
this.sortingType = 'most-flights';
this.mostFlightsSorting = 'desc'
this.changeSorting('most-flights');
} else if( entityType === 'arrivals') {
this.sortingType = 'arrival-time';
} else if( entityType === 'departures') {
this.sortingType = 'departure-time';
}
if(this.calendar) this.calendar.close();
this.calendar = null
this.updateFilter();
},
showAllDestinations() {
if (this.showAll) {
this.isLoading = true;
this.$nextTick(() => {
this.destinations = this.allDestinations;
this.isLoading = false;
this.showAll = false;
});
}
},
openInfoBox(selectedFlight) {
this.selectedFlight = selectedFlight;
this.showInfoBox = true
},
mapExplorerUrl() {
const carrierString = Object.keys(this.carrier)
.map(key => `${this.carrier[key]}`)
.join(',')
const aircraftsString = Object.keys(this.selectedaircrafts)
.map(key => `${key}`)
.join(',')
const countryString = Object.keys(this.selectedCountries)
.map(key => `${this.selectedCountries[key]}`)
.join(',')
let alliance = []
if (this.staralliance) alliance.push('SA')
if (this.skyteam) alliance.push('ST')
if (this.oneworld) alliance.push('OW')
let url = 'explorer/' + this.from + '?mapview';
if (!!this.durationFrom) url += '&durationFrom=' + this.durationFrom
if (!!this.durationTo) url += '&durationTo=' + this.durationTo
if (!!this.departureFrom) url += '&timeFrom=' + this.timeToMinutes(this.departureFrom)
if (!!this.departureTo) url += '&timeTo=' + this.timeToMinutes(this.departureTo)
if(alliance.length > 0) url += '&alliance=' + alliance.join(',')
if (!!this.lowcost) url += '&lowcost=1'
if (!!carrierString) url += '&airlines=' + carrierString
if (!!aircraftsString) url += '&aircrafts=' + this.selectedaircrafts
if (!!countryString) url += '&countries=' + countryString
//url += '&mapview';
return url
},
closeAirlinePopup() {
let popup = document.getElementById('ff-list-info');
popup.style.display = 'none';
let parent = document.getElementById('ff-li-active');
parent.style.backgroundColor = 'white';
},
initDatePlugin(from, to, label, firstFlight, lastFlight, days) {
initDatePlugin(from, to, '', label, firstFlight, lastFlight, days);
},
openAirlinePopup(event, from, to) {
let popup = document.getElementById('ff-list-info');
let $target = event.currentTarget;
var infoplace = document.getElementById('ff-list-info-inner');
let parent = $target.closest('.ff-li-list');
let parents = document.getElementsByClassName('ff-li-list');
popup.style.display = 'none';
for (var i = 0; i < parents.length; i++) {
if (typeof parents[i].id != 'undefined') {
parents[i].removeAttribute('id');
}
}
parent.setAttribute('id', 'ff-li-active');
that = this;
// this.destinationTo = to;
let boxheight = 140;
infoplace.innerHTML = '
';
// Hämtar in data
const xhttp = new XMLHttpRequest();
xhttp.onload = function () {
if (this.responseText == 'Error') {
infoplace.innerHTML = 'An error accored. Please try again';
} else {
infoplace.innerHTML = this.responseText;
}
that.setPopupPosition(popup, $target, parent);
}
xhttp.open("GET", "/api/routepop/" + from + '/' + to + '', true);
xhttp.send();
},
setPopupPosition(popup, target, parent) {
popup.style.display = 'block';
popup.style.left = 'auto';
popup.style.right = '0px';
popup.style.width = '70%';
popup.style.top = target.offsetTop - 20 + "px";
popup.style.height = 'auto';
let boxsize = popup.getBoundingClientRect();
popup.style.top = (parent.offsetTop - boxsize.height) - 50 + "px";
let screenwidth = screen.width;
if (screenwidth < 641) {
//if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
popup.style.width = 'calc(100% - 40px)';
popup.style.left = '0px';
popup.style.right = '0px';
popup.style.top = '0px';
popup.style.bottom = '0px';
popup.style.position = 'fixed';
popup.style.overflowY = 'auto';
popup.style.zIndex = '999';
popup.style.paddingTop = '40px';
// Mobile, sätt fullbredd.
} else {
// Istället för att scrolla, lägger vi boxen under istället om den inte får plats uppåt
if (!isInViewport(popup)) {
popup.style.top = parent.offsetTop + 60 + 'px';
//popup.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
}
}
},
/* Aircrafts filtering */
deleteAircrafts() {
this.selectedaircrafts = [];
this.updateFilter()
},
moreAircrafts() {
this.aircraftsToShow = this.activeaircrafts;
},
changeAircraftCode(code) {
name = '';
this.aircrafts.forEach(aircraft => {
if (code == aircraft.IATA) {
name = aircraft.name;
}
});
return name;
},
setAircraft(code) {
if (!this.selectedaircrafts.includes(code)) {
this.selectedaircrafts.push(code);
} else {
this.selectedaircrafts.splice(this.selectedaircrafts.indexOf(code), 1);
}
this.updateFilter();
},
/* /Aircrafts filtering */
isInViewport(element) {
const rect = element.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
},
getframeheightFirst(iframe, thisframe) {
this.$nextTick(() => {
var frame = document.getElementById('ad-compare-header');
var adcontainer = document.getElementById('container-ad-compare-1');
adcontainer.style.display = 'block';
var ad = document.getElementById('ad-compare-1');
var iheight = this.$refs.rightiframe.contentWindow.document.body.scrollHeight;
ad.style.height = iheight + "px";
frame.style.height = iheight + "px";
adcontainer.style.height = iheight + "px";
});
/*
if( iframe.contentWindow !== null ) {
var ad = document.getElementById('container-ad-compare-1');
ad.style.display = 'block';
}
*/
},
getframeheight(iframe) {
this.$nextTick(() => {
var frame = document.getElementById('ad-compare-header-2');
var adcontainer = document.getElementById('container-ad-compare-2');
adcontainer.style.display = 'block';
var ad = document.getElementById('ad-compare-2');
var iheight = this.$refs.rightiframe.contentWindow.document.body.scrollHeight;
adcontainer.style.height = iheight + "px";
ad.style.height = iheight + "px";
frame.style.height = iheight + "px";
});
/*
if( iframe.contentWindow !== null ) {
var ad = document.getElementById('container-ad-compare-2');
ad.style.display = 'block';
}
*/
},
dayName(number) {
if (number === 'day1') return 'Monday '
if (number === 'day2') return 'Tuesday'
if (number === 'day3') return 'Wednesday'
if (number === 'day4') return 'Thursday'
if (number === 'day5') return 'Friday'
if (number === 'day6') return 'Saturday'
if (number === 'day7') return 'Sunday'
},
clearDeparture() {
this.departureTo = 0
this.departureFrom = 0
departure.noUiSlider.updateOptions({
range: {
min: this.filters.timeofday.min_time,
max: this.filters.timeofday.max_time
},
start: [this.filters.timeofday.min_time, this.filters.timeofday.max_time]
})
mobdeparture.noUiSlider.updateOptions({
range: {
min: this.filters.timeofday.min_time,
max: this.filters.timeofday.max_time
},
start: [this.filters.timeofday.min_time, this.filters.timeofday.max_time]
})
},
clearArrival() {
this.arrivalTo = 0
this.arrivalFrom = 0
arrival.noUiSlider.updateOptions({
range: {
min: this.filters.arrival.min_time,
max: this.filters.arrival.max_time
},
start: [this.filters.arrival.min_time, this.filters.arrival.max_time]
})
mobarrival.noUiSlider.updateOptions({
range: {
min: this.filters.arrival.min_time,
max: this.filters.arrival.max_time
},
start: [this.filters.arrival.min_time, this.filters.arrival.max_time]
})
},
clearPrice() {
this.priceTo = 0
this.priceFrom = 0
mobpriceslider.noUiSlider.updateOptions({
range: {
min: 0,
max: 280
},
start: [0, 280]
})
},
clearDistance() {
this.distanceFrom = 0
this.distanceTo = 0
mobdistance.noUiSlider.updateOptions({
range: {
min: 0,
max: 1178
},
start: [0, 1178]
})
},
clearDuration() {
this.durationFrom = 0
this.durationTo = 0
timeslider.noUiSlider.updateOptions({
range: {
min: this.filters.duration.min_duration,
max: this.filters.duration.max_duration
},
start: [this.filters.duration.min_duration, this.filters.duration.max_duration]
})
mobtimeslider.noUiSlider.updateOptions({
range: {
min: this.filters.duration.min_duration,
max: this.filters.duration.max_duration
},
start: [this.filters.duration.min_duration, this.filters.duration.max_duration]
})
},
resetAll() {
location.href = '/' + this.from + '?entityType=' + this.entityType + 'state=1';
},
clearDays() {
this.days = {}
this.updateFilter()
},
clearCountries() {
this.selectedCountries = {}
this.updateFilter()
},
clearAirlines() {
this.carrier = {}
this.lowcost = 0
this.updateFilter()
},
minutesToTime(time, withoutLetters = false) {
let hours = Math.floor(time / 60)
let minutes = time % 60
if (withoutLetters) {
if (minutes < 10) minutes = '0' + minutes;
return hours + ':' + minutes
}
return hours + "h " + minutes + "m"
},
moment: function (date) {
return moment(date);
},
changeDurationSorting() {
this.showAllDestinations();
if (this.durationSorting === 'asc') {
this.durationSorting = 'desc'
this.destinations.sort((a, b) => (parseInt(a.common_duration) < parseInt(b.common_duration)) ? 1 : -1)
if(this.entityType === 'departures' || this.entityType === 'arrivals') this.schedules.sort((a, b) => (parseInt(a.elapsed_time) < parseInt(b.elapsed_time) ? 1 : -1));
} else {
this.durationSorting = 'asc'
this.destinations.sort((a, b) => (parseInt(a.common_duration) > parseInt(b.common_duration)) ? 1 : -1)
if(this.entityType === 'departures' || this.entityType === 'arrivals') this.schedules.sort((a, b) => (parseInt(a.elapsed_time) > parseInt(b.elapsed_time) ? 1 : -1));
}
this.sortBy = 'Duration'
},
changePriceSorting() {
this.showAllDestinations();
if (this.priceSorting === 'asc') {
this.priceSorting = 'desc'
this.destinations.sort((a, b) => (parseInt(a.price) < parseInt(b.price)) ? 1 : -1)
} else {
this.priceSorting = 'asc'
this.destinations.sort((a, b) => (parseInt(a.price) > parseInt(b.price)) ? 1 : -1)
}
this.sortBy = 'Price'
},
changeDestinationSorting() {
this.showAllDestinations();
if (this.destinationSorting === 'asc') {
this.destinationSorting = 'desc'
this.destinations.sort((a, b) => (a.airport.city_name_en < b.airport.city_name_en) ? 1 : -1)
if(this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.city_name_en < b.airport.city_name_en ? 1 : -1));
} else if(this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.city_name_en < b.departure_airport.city_name_en) ? 1 : -1);
}
} else {
this.destinationSorting = 'asc'
this.destinations.sort((a, b) => (a.airport.city_name_en > b.airport.city_name_en) ? 1 : -1)
if(this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.city_name_en > b.airport.city_name_en ? 1 : -1));
} else if(this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.city_name_en > b.departure_airport.city_name_en ? 1 : -1));
}
}
this.sortBy = 'City name'
},
changeAirportNameSorting() {
this.showAllDestinations();
if (this.airportNameSorting === 'asc') {
this.airportNameSorting = 'desc'
this.sortingDirection = 'desc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (a.airport.name < b.airport.name) ? 1 : -1)
if(this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.name < b.airport.name ? 1 : -1));
} else if(this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.name < b.departure_airport.name) ? 1 : -1);
}
}
} else {
this.airportNameSorting = 'asc'
this.sortingDirection = 'asc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (a.airport.name > b.airport.name) ? 1 : -1)
if(this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.name > b.airport.name ? 1 : -1));
} else if(this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.name > b.departure_airport.name) ? 1 : -1);
}
}
}
this.sortBy = 'Airport name'
},
changeDestinationCountrySorting() {
this.showAllDestinations();
if (this.destinationCountrySorting === 'asc') {
this.destinationCountrySorting = 'desc'
this.sortingDirection = 'desc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (a.airport.country < b.airport.country) ? 1 : -1)
if(this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.country < b.airport.country ? 1 : -1));
} else if(this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.country < b.departure_airport.country) ? 1 : -1);
}
}
} else {
this.destinationCountrySorting = 'asc'
this.sortingDirection = 'asc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (a.airport.country > b.airport.country) ? 1 : -1)
if (this.entityType === 'departures') {
this.schedules.sort((a, b) => (a.airport.country > b.airport.country ? 1 : -1));
} else if (this.entityType === 'arrivals') {
this.schedules.sort((a, b) => (a.departure_airport.country > b.departure_airport.country) ? 1 : -1);
}
}
}
this.sortBy = 'Country'
},
changeArrivalTimeSorting() {
this.schedules.sort((a, b) => (a.arrival_time > b.arrival_time ? 1 : -1));
},
changeDepartureTimeSorting() {
this.schedules.sort((a, b) => (a.departure_time > b.departure_time ? 1 : -1));
},
changeSorting(type) {
this.showAllDestinations();
this.sortingType = type
if (type === 'most-flights') {
if (this.mostFlightsSorting !== 'asc') {
this.mostFlightsSorting = 'asc'
this.sortingDirection = 'asc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (a.flights_per_wek < b.flights_per_wek) ? 1 : -1)
}
} else {
this.mostFlightsSorting = 'desc'
this.sortingDirection = 'desc'
this.destinations.sort((a, b) => (a.flights_per_wek > b.flights_per_wek) ? 1 : -1)
}
this.sortBy = 'Popularity'
}
if(type === 'departure-time') {
this.sortingDirection = 'asc'
this.sortBy = 'Departure time'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else this.changeDepartureTimeSorting();
}
if(type === 'arrival-time') {
this.sortingDirection = 'asc'
this.sortBy = 'Arrival time'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else this.changeArrivalTimeSorting();
}
if (type === 'name') {
this.changeAirportNameSorting()
}
if (type === 'country') {
this.changeDestinationCountrySorting()
}
if (type === 'price') {
this.changePriceSorting()
}
if (type === 'flight-low') {
if (this.sortBy !== 'Flight time (Low-High)') {
this.sortingDirection = 'asc'
this.sortBy = 'Flight time (Low-High)'
this.sortingDirection = 'desc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (parseInt(a.common_duration) > parseInt(b.common_duration)) ? 1 : -1)
}
// if(this.entityType === 'departures' || this.entityType === 'arrivals') this.schedules.sort((a, b) => (parseInt(a.elapsed_time) > parseInt(b.elapsed_time) ? 1 : -1));
}
}
if (type === 'flight-high') {
if (this.sortBy !== 'Flight time (High-Low)') {
this.sortingDirection = 'desc'
this.sortBy = 'Flight time (High-Low)'
this.sortingDirection = 'asc'
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (parseInt(a.common_duration) < parseInt(b.common_duration)) ? 1 : -1)
}
// if(this.entityType === 'departures' || this.entityType === 'arrivals') this.schedules.sort((a, b) => (parseInt(a.elapsed_time) < parseInt(b.elapsed_time) ? 1 : -1));
}
}
if (type === 'biggest') {
this.changeBiggestSorting()
}
if (type === 'recent') {
this.changeRecentSorting()
}
},
changeRecentSorting() {
// Temporarily set to something different to force reactivity
this.sortBy = '';
// Use Vue's nextTick to ensure the DOM has updated before changing back
this.$nextTick(() => {
this.sortBy = 'Recently added';
this.sortDirection = 'desc';
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
// Create a stable sort by first making a copy of the array with indexes
const indexedArray = this.destinations.map((item, index) => ({item, index}));
// Sort the indexed array
indexedArray.sort((a, b) => {
const itemA = a.item;
const itemB = b.item;
const getHighestId = (dest) => {
if (!dest.airlineroutes || dest.airlineroutes.length === 0) {
return 0;
}
return dest.airlineroutes.reduce((highestId, route) => {
const routeId = parseInt(route.id) || 0;
return routeId > highestId ? routeId : highestId;
}, 0);
};
const aHighestId = getHighestId(itemA);
const bHighestId = getHighestId(itemB);
if (aHighestId !== bHighestId) {
return bHighestId - aHighestId; // Descending order (higher ID first)
}
return a.index - b.index;
});
// Assign the sorted array back to destinations to trigger reactivity
this.destinations = [...indexedArray.map(indexed => indexed.item)];
this.schedules.sort((a, b) => (a.id < b.id) ? 1 : -1)
}
});
},
changeBiggestSorting() {
if (this.airportSorting === 'asc') {
this.airportSorting = 'desc'
this.sortingDirection = 'asc';
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (parseInt(a.airport.no_routes) > parseInt(b.airport.no_routes)) ? 1 : -1)
}
} else {
this.airportSorting = 'asc'
this.sortingDirection = 'desc';
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.updateFilter(false);
} else {
this.destinations.sort((a, b) => (parseInt(a.airport.no_routes) < parseInt(b.airport.no_routes)) ? 1 : -1)
}
}
this.sortBy = 'Airport size'
},
updateDurationFrom(value) {
this.durationFrom = value.target.value
},
updateDurationTo(value) {
this.durationTo = value.target.value
},
updatePriceFrom(value) {
this.priceFrom = value.target.value
},
updatePriceTo(value) {
this.priceTo = value.target.value
},
updateDepartureFrom(value) {
this.departureFrom = value.target.value
},
updateDepartureTo(value) {
this.departureTo = value.target.value
},
updateArrivalFrom(value) {
this.arrivalFrom = value.target.value
},
updateArrivalTo(value) {
this.arrivalTo = value.target.value
},
updateDistanceFrom(value) {
this.distanceFrom = value.target.value
},
updateDistanceTo(value) {
this.distanceTo = value.target.value
},
moreAirlines() {
this.airlinesToShowCount += 10
this.airlinesToShow = this.airlines.slice(0, this.airlinesToShowCount)
},
moreCountries() {
this.countriesToShowCount += 10
this.countriesToShow = this.countries.slice(0, this.countriesToShowCount)
},
setDays(day) {
if (this.days['day' + day]) delete this.days['day' + day]
else this.days['day' + day] = true
this.updateFilter()
},
clearFilters() {
location.reload()
},
setClass(className) {
if (this.classes[className]) delete this.classes[className]
else this.classes[className] = true
this.updateFilter()
},
isAllianceSet(alliance) {
let is = true
let isAlliance = false
if (alliance === 'staralliance') {
this.airlines.forEach(airline => {
if (parseInt(airline.SA) === 1 || (airline.airline && parseInt(airline.airline.is_staralliance) == 1)) {
if (!this.carrier[airline.carrier]) {
is = false
return false
}
isAlliance = true
}
})
if (is) this.staralliance = 1
}
if (alliance === 'oneworld') {
this.airlines.forEach(airline => {
if (parseInt(airline.OW) === 1 || (airline.airline && parseInt(airline.airline.is_oneworld) == 1)) {
if (!this.carrier[airline.carrier]) {
is = false
return false
}
isAlliance = true
}
})
if (is) this.oneworld = 1
}
if (alliance === 'skyteam') {
this.airlines.forEach(airline => {
if (parseInt(airline.ST) === 1 || (airline.airline && parseInt(airline.airline.is_skyteam) == 1)) {
if (!this.carrier[airline.carrier]) {
is = false
return false
}
isAlliance = true
}
})
if (is) this.skyteam = 1
}
if (is && isAlliance) return true
},
configureLowcost() {
if (!!this.lowcost) {
this.airlines.forEach(airline => {
if ((airline.airline && parseInt(airline.airline.is_lowcost) === 1) || parseInt(airline.LOWCOST) === 1) {
if (!this.carrier[airline.carrier]) {
this.carrier[airline.carrier] = airline.carrier
}
}
})
} else {
this.airlines.forEach(airline => {
if (this.carrier[airline.carrier]) {
delete this.carrier[airline.carrier]
}
})
}
},
checkAlliance(alliance) {
if (alliance === 'staralliance') {
this.staralliance = !this.staralliance ? 1 : 0
if (this.staralliance === 1) {
//console.log(this.airlines)
this.airlines.forEach(airline => {
if (parseInt(airline.SA) === 1 || (!!airline.airline && parseInt(airline.airline.is_staralliance) === 1)) {
if (!this.carrier[airline.carrier]) {
this.carrier[airline.carrier] = airline.carrier
}
}
})
} else {
this.airlines.forEach(airline => {
if (parseInt(airline.SA) === 1 || (!!airline.airline && parseInt(airline.airline.is_staralliance) === 1)) {
if (this.carrier[airline.carrier]) {
delete this.carrier[airline.carrier]
}
}
})
}
}
if (alliance === 'oneworld') {
this.oneworld = !this.oneworld ? 1 : 0
if (this.oneworld === 1) {
this.airlines.forEach(airline => {
if (parseInt(airline.OW) === 1 || (!!airline.airline && parseInt(airline.airline.is_oneworld) === 1)) {
if (!this.carrier[airline.carrier]) {
this.carrier[airline.carrier] = airline.carrier
}
}
})
} else {
this.airlines.forEach(airline => {
if (parseInt(airline.OW) === 1 || (!!airline.airline && parseInt(airline.airline.is_oneworld) === 1)) {
if (this.carrier[airline.carrier]) {
delete this.carrier[airline.carrier]
}
}
})
}
}
if (alliance === 'skyteam') {
this.skyteam = !this.skyteam ? 1 : 0
if (this.skyteam === 1) {
this.airlines.forEach(airline => {
if (parseInt(airline.ST) === 1 || (!!airline.airline && parseInt(airline.airline.is_skyteam) === 1)) {
if (!this.carrier[airline.carrier]) {
this.carrier[airline.carrier] = airline.carrier
}
}
})
} else {
this.airlines.forEach(airline => {
if (parseInt(airline.ST) === 1 || (!!airline.airline && parseInt(airline.airline.is_skyteam) === 1)) {
if (this.carrier[airline.carrier]) {
delete this.carrier[airline.carrier]
}
}
})
}
}
this.updateFilter()
},
setAirlines(index, iata) {
if (!!this.carrier[index]) delete this.carrier[index]
else {
this.carrier[index] = iata
}
this.updateFilter()
},
setCountries(countryCode) {
if (!!this.selectedCountries[countryCode]) delete this.selectedCountries[countryCode]
else {
this.selectedCountries[countryCode] = countryCode
}
this.updateFilter()
},
timeToMinutes(time) {
if (time) {
const timeArr = time.split(':'); // split it at the colons
return (+timeArr[0]) * 60 + (+timeArr[1]);
} else return ''
},
convertMin(minutes) {
var num = minutes;
var hours = (num / 60);
var rhours = Math.floor(hours);
var minutes = (hours - rhours) * 60;
var rminutes = Math.round(minutes);
if (rminutes == '0' || rminutes == 0) {
return rhours + ":0" + rminutes;
} else {
return rhours + ":" + rminutes;
}
},
reloadAds() {
if (this.refreshAds) {
if (window.googletag && googletag.pubadsReady) {
setTimeout(() => {
googletag.pubads().refresh()
}, "50");
}
this.refreshAds = false
setTimeout(() => {
this.refreshAds = true
}, "250");
}
},
computeGridRangeForMonth(targetMonth, todayStr) {
// 1) Если targetMonth пустой — берём текущий год/месяц из todayStr
let year, monthIndex;
const [y, m, d] = todayStr.split('-').map(Number);
const today = new Date(y, m - 1, d, 0,0,0,0);
if (targetMonth) {
[year, monthIndex] = targetMonth.split('-').map((v,i) => i===0 ? Number(v) : Number(v)-1);
} else {
year = today.getFullYear();
monthIndex = today.getMonth();
}
// 2) Начало 6-недельной сетки
const firstOfMonth = new Date(year, monthIndex, 1);
const startGrid = new Date(year, monthIndex, 1 - firstOfMonth.getDay());
// 3) Конец 6-недельной сетки: +41 день
const endGrid = new Date(startGrid);
endGrid.setDate(startGrid.getDate() + 41);
// 4) dateFrom: если current month — от today, иначе от startGrid
const isCurrent = !targetMonth || (
today.getFullYear() === year &&
today.getMonth() === monthIndex
);
const fromDate = isCurrent ? today : startGrid;
// 5) Локальное форматирование
const fmt = D => {
const Y = D.getFullYear();
const M = String(D.getMonth()+1).padStart(2,'0');
const DD = String(D.getDate()).padStart(2,'0');
return `${Y}-${M}-${DD}`;
};
return {
dateFrom: fmt(fromDate),
dateTo: fmt(endGrid)
};
},
handleMonthChange(selectedDates, dateStr, instance) {
const year = instance.currentYear;
const month = instance.currentMonth + 1; // 1–12
this.selectedMonth = `${year}-${String(month).padStart(2,'0')}`;
const data = this.collectFilters();
let queryString = Object.keys(data).map(key => key + '=' + data[key]).join('&');
document.querySelector('.flatpickr-innerContainer').style.opacity = '0.3';
document.getElementById('calendar-loading').style.display = 'block';
axios.get('api/schedulelist/' + this.from + '?' + queryString)
.then((res) => {
this.updateDatepicker(res);
document.getElementById('calendar-loading').style.display = 'none';
document.querySelector('.flatpickr-innerContainer').style.opacity = '1';
})
},
updateDatepicker(res, type) {
let _this = this;
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
// this.$nextTick(() => {
let scheduleDays;
if(type === 'updateFilter') {
scheduleDays = res.data.response.schedule.sheduledays;
} else {
scheduleDays = res.data.response.sheduledays;
}
const allowed = scheduleDays.filter(d => d.count > 0).map(d => {
const year = '20' + d.year;
const month = d.monthnum.padStart(2, '0');
const day = String(d.date).padStart(2, '0');
return `${year}-${month}-${day}`;
});
console.log("Test")
if(!this.calendar) {
this.calendar = flatpickr(document.getElementById('calendar-date'), {
dateFormat: "Y-m-d",
enable: allowed,
clickOpens: true,
closeOnSelect: true,
onMonthChange: _this.handleMonthChange,
defaultDate: this.selectedDate || (new Date()).toISOString().slice(0,10),
onYearChange: _this.handleMonthChange,
onChange(selectedDates, dateStr) {
_this.selectedDate = dateStr;
_this.updateFilter();
}
});
document.addEventListener('click', function (e) {
const calendarContainer = document.querySelector('.flatpickr-calendar');
const calendarInput = document.getElementById('calendar-date');
if (
_this.calendar &&
calendarContainer &&
!calendarContainer.contains(e.target) &&
!calendarInput.contains(e.target)
) {
_this.calendar.close();
}
});
let calendarLoading = document.createElement('div');
calendarLoading.id = 'calendar-loading';
calendarLoading.style.position = 'absolute';
calendarLoading.style.top = '50%';
calendarLoading.style.display = 'none';
calendarLoading.style.left = '50%';
calendarLoading.style.transform = 'translate(-50%, -50%)';
calendarLoading.innerHTML = `
`;
document.querySelector('.flatpickr-calendar').append(calendarLoading);
} else {
this.calendar.set('enable', allowed);
this.calendar.redraw();
}
// })
}
},
collectFilters() {
let alliance = []
if (this.staralliance) alliance.push('SA')
if (this.skyteam) alliance.push('ST')
if (this.oneworld) alliance.push('OW')
const carrierString = Object.keys(this.carrier)
.map(key => `${this.carrier[key]}`)
.join(',')
const countryString = Object.keys(this.selectedCountries)
.map(key => `${this.selectedCountries[key]}`)
.join(',')
const daysString = Object.keys(this.days)
.map(key => `${key}`)
.join(',')
const classesString = Object.keys(this.classes)
.map(key => `${key}`)
.join(',')
const aircraftsString = Object.keys(this.selectedaircrafts)
.map(key => `${key}`)
.join(',')
let data = {}
if (!!this.durationFrom) data.durationFrom = this.durationFrom
if (!!this.durationTo) data.durationTo = this.durationTo
if (!!this.priceFrom) data.priceFrom = this.priceFrom
if (!!this.priceTo) data.priceTo = this.priceTo
if (!!this.departureFrom) data.timeFrom = this.timeToMinutes(this.departureFrom)
if (!!this.departureTo) data.timeTo = this.timeToMinutes(this.departureTo)
if (!!this.arrivalFrom) data.arrivalFrom = this.timeToMinutes(this.arrivalFrom)
if (!!this.arrivalTo) data.arrivalTo = this.timeToMinutes(this.arrivalTo)
if (!!this.lowcost) data.lowcost = 1
if (!!this.businessOnly) data.business_only = 1
if (!!this.from) data.from = this.from
if (!!carrierString) data.airlines = carrierString
if (!!daysString) data.days = daysString
if (!!classesString) data.classes = classesString
if (!!countryString) data.countries = countryString
if (!!this.distanceFrom) data.distanceFrom = this.distanceFrom
if (!!this.distanceTo) data.distanceTo = this.distanceTo
// Aircrafts
if (!!aircraftsString) data.aircrafts = this.selectedaircrafts
data.entityType = this.entityType
data.take = this.schedulesOffset;
data.selectedDate = this.selectedDate ?? null
data.dateMethod = 'month';
data.sorting = this.sortingType
console.log(this.sortingDirection)
data.sortingDirection = this.sortingDirection
if(!this.selectedMonth) {
const todayStr = (new Date()).toISOString().slice(0,10);
const { dateFrom, dateTo } = this.computeGridRangeForMonth(null, todayStr);
data.dateFrom = dateFrom;
data.dateTo = dateTo;
} else {
const todayStr = (new Date()).toISOString().slice(0,10);
const { dateFrom, dateTo } = this.computeGridRangeForMonth(this.selectedMonth, todayStr);
data.dateFrom = dateFrom;
data.dateTo = dateTo;
}
return data
},
showMoreSchedules() {
this.schedulesOffset += 50;
this.updateFilter();
},
updateFilter(sortAfter = true) {
if (!this.isInit) return false
const data = this.collectFilters();
let queryString = Object.keys(data).map(key => key + '=' + data[key]).join('&');
this.isLoading = true
if (queryString === 'from=' + this.from) this.showAll = true
else this.showAll = false
if (this.airportRequest) {
this.airportRequest.cancel('canceled by new request')
}
// создаём новый источник отмены
this.airportRequest = axios.CancelToken.source()
axios.get('/api/airport/' + this.from + '?' + queryString + '&rand=' + Math.random(), { cancelToken: this.airportRequest.token }).then((res) => {
this.isLoading = false
if (res.data.response) {
console.log('updated filter');
this.destinations = Object.values(res.data.response.routes)
if(this.entityType === 'departures' || this.entityType === 'arrivals') {
this.schedules = res.data.response.schedule.result
this.schedulesCount = res.data.response.schedule.total
this.updateDatepicker(res, 'updateFilter');
this.date = res.data.response.schedule.firstdate
}
this.airlines = res.data.response.filters.airlines.result
this.countries = res.data.response.filters.countries.result
this.airlines.sort((a, b) => (Object.values(this.carrier).includes(a.carrier)) ? -1 : 1)
this.countries.sort((a, b) => (Object.values(this.selectedCountries).includes(a.country_code)) ? -1 : 1)
this.airlinesToShow = this.airlines.slice(0, this.airlinesToShowCount)
this.countriesToShow = this.countries.slice(0, this.countriesToShowCount)
this.destCount = Object.values(this.destinations).length
window.history.pushState({}, "", this.from + '?' + queryString + '&state=1')
this.filters = res.data.response.filters
if (parseInt(this.durationFrom) > 0 || parseInt(this.durationTo) > 0) {
timeslider.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.duration.min_duration,
max: res.data.response.filters.duration.max_duration
},
start: [this.durationFrom, this.durationTo]
})
mobtimeslider.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.duration.min_duration,
max: res.data.response.filters.duration.max_duration
},
start: [this.durationFrom, this.durationTo]
})
}
if (parseInt(this.distanceFrom) > 0 || parseInt(this.distanceTo) > 0) {
mobdistance.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.distance.min_distance,
max: res.data.response.filters.distance.max_distance
},
start: [this.distanceFrom, this.distanceTo]
})
}
if (parseInt(this.departureFrom) > 0 || parseInt(this.departureTo) > 0) {
departure.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.timeofday.min_time,
max: res.data.response.filters.timeofday.max_time
},
start: [this.timeToMinutes(this.departureFrom), this.timeToMinutes(this.departureTo)]
})
mobdeparture.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.timeofday.min_time,
max: res.data.response.filters.timeofday.max_time
},
start: [this.timeToMinutes(this.departureFrom), this.timeToMinutes(this.departureTo)]
})
}
if (parseInt(this.arrivalFrom) > 0 || parseInt(this.arrivalTo) > 0) {
mobarrival.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.arrival.min_time,
max: res.data.response.filters.arrival.max_time
},
start: [this.timeToMinutes(this.arrivalFrom), this.timeToMinutes(this.arrivalTo)]
})
mobarrival.noUiSlider.updateOptions({
range: {
min: res.data.response.filters.arrival.min_time,
max: res.data.response.filters.arrival.max_time
},
start: [this.timeToMinutes(this.arrivalFrom), this.timeToMinutes(this.arrivalTo)]
})
}
if (parseInt(this.priceFrom) > 0 || parseInt(this.priceTo) > 0) {
mobpriceslider.noUiSlider.updateOptions({
range: {
min: 0,
max: 280
},
start: [this.priceFrom, this.priceTo]
})
}
// Aircrafts
let ac = res.data.response.filters.aircrafts.result;
let acs = [];
for (let i = 0; i < ac.length; i++) {
acs.push(ac[i].filterValue);
}
this.activeaircrafts = acs;
this.aircraftsToShow = acs;
if(sortAfter) this.changeSorting(this.sortingType)
// console.log(Object.keys(this.carrier).length)
if (Object.keys(this.carrier).length == 0 && this.lowcost) this.destinations = []
}
}).catch((error) => {
if (axios.isCancel(error)) {
console.log('Request canceled', error.message);
} else {
console.error('Error fetching data:', error);
}
});
}
}
}).mount('#vue-app')