Combobox, POI
This commit is contained in:
@@ -36,7 +36,6 @@ export const useFlightsStore = defineStore('Flights', {
|
||||
return apolloWrapper.query(FLIGHT_DETAIL, {id}).then(result => result.data.flight);
|
||||
},
|
||||
fetch() {
|
||||
console.log("flights fetch");
|
||||
return apolloWrapper
|
||||
.query(FLIGHTS_LIST)
|
||||
.then((result) => {
|
||||
@@ -44,17 +43,6 @@ export const useFlightsStore = defineStore('Flights', {
|
||||
|
||||
return result.data.flights;
|
||||
});
|
||||
// if (this.items.length > 0) return;
|
||||
//
|
||||
// this.$patch({
|
||||
// items: [
|
||||
// {id: 1, takeOffLocation: "LKLT", titlePhotoUrl: null, landingLocation: "LKLC", date: "2023-03-03", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 63},
|
||||
// {id: 2, takeOffLocation: "LKLT", titlePhotoUrl: "https://cdn.quasar.dev/img/mountains.jpg", landingLocation: "LKLT", date: "2023-02-01", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 76},
|
||||
// {id: 3, takeOffLocation: "LKLT", titlePhotoUrl: null, landingLocation: "LKLC", date: "2023-04-03", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 53},
|
||||
// {id: 4, takeOffLocation: "LKLT", titlePhotoUrl: null, landingLocation: "LKMB", date: "2023-03-04", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 75},
|
||||
// {id: 5, takeOffLocation: "LKLT", titlePhotoUrl: null, landingLocation: "LKMH", date: "2023-01-46", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 23},
|
||||
// ]
|
||||
// });
|
||||
},
|
||||
deleteItem(id) {
|
||||
const idx = this.items.indexOf(this.items.find(f => f.id === id));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import {defineStore} from 'pinia'
|
||||
import {apolloWrapper} from "src/graphql/apollo";
|
||||
import {POI_LIST} from "src/graphql/queries/poi";
|
||||
|
||||
export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
||||
state: () => ({
|
||||
@@ -16,23 +18,23 @@ export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
||||
console.log('item', item);
|
||||
return item;
|
||||
},
|
||||
pointTypeName() {
|
||||
return (typeName) => {
|
||||
const typeToNameMap = {
|
||||
poi: "General POI",
|
||||
airport: "Airport",
|
||||
}
|
||||
return typeToNameMap[typeName] || "Unknown";
|
||||
}
|
||||
},
|
||||
groupByTypes() {
|
||||
const groupedByType = {};
|
||||
for (const item of this.items) {
|
||||
if (!groupedByType[item.type]) groupedByType[item.type] = [];
|
||||
groupedByType[item.type].push(item);
|
||||
}
|
||||
return groupedByType;
|
||||
}
|
||||
// pointTypeName() {
|
||||
// return (typeName) => {
|
||||
// const typeToNameMap = {
|
||||
// poi: "General POI",
|
||||
// airport: "Airport",
|
||||
// }
|
||||
// return typeToNameMap[typeName] || "Unknown";
|
||||
// }
|
||||
// },
|
||||
// groupByTypes() {
|
||||
// const groupedByType = {};
|
||||
// for (const item of this.items) {
|
||||
// if (!groupedByType[item.type]) groupedByType[item.type] = [];
|
||||
// groupedByType[item.type].push(item);
|
||||
// }
|
||||
// return groupedByType;
|
||||
// }
|
||||
},
|
||||
|
||||
actions: {
|
||||
@@ -41,12 +43,17 @@ export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
||||
this.items.push({id: poiId, "name": "Zamek " + poiId, "type": "poi", "location": {"lat": 50, "lng": 10}});
|
||||
},
|
||||
fetch() {
|
||||
console.log("fetch poi");
|
||||
this.items = [
|
||||
{id: 1, "name": "LKLT", private: false, "type": "airport", "location": {"lat": 50, "lng": 10}},
|
||||
{id: 2, "name": "Hrad", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
||||
{id: 3, "name": "Zamek", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
||||
]
|
||||
return apolloWrapper.query(POI_LIST).then(result => {
|
||||
this.items = result.data.pointsOfInterest;
|
||||
return result.data.pointsOfInterest;
|
||||
});
|
||||
|
||||
// console.log("fetch poi");
|
||||
// this.items = [
|
||||
// {id: 1, "name": "LKLT", private: false, "type": "airport", "location": {"lat": 50, "lng": 10}},
|
||||
// {id: 2, "name": "Hrad", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
||||
// {id: 3, "name": "Zamek", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
||||
// ]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user