wip
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
soraefir
2025-02-28 01:43:32 +01:00
parent 1960036980
commit 7af6d04dd1
6 changed files with 128 additions and 114 deletions

View File

@@ -12,7 +12,7 @@ Vue.component("l-popup", window.Vue2Leaflet.LPopup);
Vue.component("l-tooltip", window.Vue2Leaflet.LTooltip);
Vue.component("l-polyline", window.Vue2Leaflet.LPolyline);
Vue.component("l-control-scale", window.Vue2Leaflet.LControlScale);
Vue.component("multiselect", window.VueMultiselect.default);
// Vue.component("multiselect", window.VueMultiselect.default);
Vue.use(window.VueTextareaAutosize);
const app = new Vue({
@@ -23,7 +23,7 @@ const app = new Vue({
map_override: { active: false, center: [0, 0] },
query: {
type: "", res: [],
type: "", res: [], load: false,
},
impexp: "",
lang: {
@@ -113,32 +113,28 @@ const app = new Vue({
},
search_nominatim: function (f) {
return (q) => {
this.query.type = f;
return api.query_nominatim(q, this.compute_bb(), this.get_filter(f)).catch((_err) => []).then((r) => {
r.forEach((rr) => {
rr.latlon = [parseFloat(rr.lat), parseFloat(rr.lon)];
rr.sname = rr.display_name.split(",")[0];
});
this.query.res = r;
return r
return (q) => api.query_nominatim(q, this.compute_bb(), this.get_filter(f)).catch((_err) => []).then((r) => {
r.forEach((rr) => {
rr.latlon = [parseFloat(rr.lat), parseFloat(rr.lon)];
rr.sname = rr.display_name.split(",")[0];
});
}
this.query.load = false;
this.query.res = r;
return r
});
},
search_travel: function (f) {
return (q) => {
this.query.type = f;
return api.query_flight(q).then((r) => {
r.forEach(el => {
el.path = getGeoLine(
{ lat: el.from_geo.lat, lng: el.from_geo.lon },
{ lat: el.to_geo.lat, lng: el.to_geo.lon }, { dist: 5_000_000 }).map(v => [v.lat, v.lng])
el.type = "flight";
});
this.query.res = r;
return r;
return (q) => api.query_flight(q).then((r) => {
r.forEach(el => {
el.path = getGeoLine(
{ lat: el.from_geo.lat, lng: el.from_geo.lon },
{ lat: el.to_geo.lat, lng: el.to_geo.lon }, { dist: 5_000_000 }).map(v => [v.lat, v.lng])
el.type = "flight";
});
}
this.query.load = false;
this.query.res = r;
return r;
});
},
drawer_hover_item: function (item) {
@@ -166,6 +162,7 @@ const app = new Vue({
search_active: function (q) {
const txt = q.target.value
this.query.load = true;
switch (this.query.type) {
case 'hotel': return this.search_hotel(txt);
case 'restaurant': return this.search_restaurant(txt);