diff --git a/src/components/flights/form/FlightFormBasic.vue b/src/components/flights/form/FlightFormBasic.vue index 44acf55..2ba5b82 100644 --- a/src/components/flights/form/FlightFormBasic.vue +++ b/src/components/flights/form/FlightFormBasic.vue @@ -1,10 +1,8 @@ diff --git a/src/components/flights/form/FlightFormTrack.vue b/src/components/flights/form/FlightFormTrack.vue new file mode 100644 index 0000000..43d5b78 --- /dev/null +++ b/src/components/flights/form/FlightFormTrack.vue @@ -0,0 +1,68 @@ + + + diff --git a/src/components/inputs/AnotherDatetimePicker.vue b/src/components/inputs/AnotherDatetimePicker.vue deleted file mode 100644 index cc3ff64..0000000 --- a/src/components/inputs/AnotherDatetimePicker.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - diff --git a/src/components/inputs/ComboboxInput.vue b/src/components/inputs/ComboboxInput.vue new file mode 100644 index 0000000..fa9435a --- /dev/null +++ b/src/components/inputs/ComboboxInput.vue @@ -0,0 +1,89 @@ + + + diff --git a/src/components/inputs/DatetimePicker.vue b/src/components/inputs/DatetimePicker.vue index 9aa600b..cc3ff64 100644 --- a/src/components/inputs/DatetimePicker.vue +++ b/src/components/inputs/DatetimePicker.vue @@ -1,31 +1,25 @@ + + + diff --git a/src/components/inputs/LocationInput.vue b/src/components/inputs/LocationInput.vue deleted file mode 100644 index 4f2c544..0000000 --- a/src/components/inputs/LocationInput.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - diff --git a/src/graphql/fragments/flight.js b/src/graphql/fragments/flight.js index a3cdbfb..118b464 100644 --- a/src/graphql/fragments/flight.js +++ b/src/graphql/fragments/flight.js @@ -18,6 +18,13 @@ fragment flightFullInfo on Flight { ...airportInfo } + track { + pointOfInterest { + id + name + } + } + landingAirport { ...airportInfo } @@ -71,6 +78,10 @@ fragment flightEditIds on Flight { takeoffAirportId aircraftId copilotId + copilot { + id + name + } } `; diff --git a/src/graphql/fragments/poi.js b/src/graphql/fragments/poi.js new file mode 100644 index 0000000..35d04fd --- /dev/null +++ b/src/graphql/fragments/poi.js @@ -0,0 +1,8 @@ +import gql from "graphql-tag"; + +export const FRAGMENT_POI_LIST_INFO = gql` +fragment pointOfInterestListInfo on PointOfInterest { + id + name +} +`; diff --git a/src/graphql/mutations/poi.js b/src/graphql/mutations/poi.js new file mode 100644 index 0000000..f294570 --- /dev/null +++ b/src/graphql/mutations/poi.js @@ -0,0 +1,12 @@ +import gql from "graphql-tag"; +import {FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi"; + +export const CREATE_POI = gql` + mutation createPointOfInterest($input: CreatePointOfInterestInput!) { + createPointOfInterest(input: $input) { + ...pointOfInterestListInfo + } + } + + ${FRAGMENT_POI_LIST_INFO} +`; diff --git a/src/graphql/queries/poi.js b/src/graphql/queries/poi.js new file mode 100644 index 0000000..a4e22c4 --- /dev/null +++ b/src/graphql/queries/poi.js @@ -0,0 +1,12 @@ +import gql from "graphql-tag"; +import {FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi"; + +export const POI_LIST = gql` +query poiList { + pointsOfInterest { + ...pointOfInterestListInfo + } +} + +${FRAGMENT_POI_LIST_INFO} +`; diff --git a/src/pages/profile/forms/FlightEditPage.vue b/src/pages/profile/forms/FlightEditPage.vue index c0e0717..33028d3 100644 --- a/src/pages/profile/forms/FlightEditPage.vue +++ b/src/pages/profile/forms/FlightEditPage.vue @@ -18,6 +18,7 @@ import {usePhotosStore} from "stores/Photo"; import PhotosList from "components/photos/PhotosList.vue"; import {confirmObject, successObject} from "src/composables/dialog"; import PhotoForm from "components/flights/PhotoForm.vue"; +import FlightFormTrack from "components/flights/form/FlightFormTrack.vue"; useMeta({title: "Editace letu"}); @@ -56,6 +57,7 @@ onMounted(() => { }); const handleFlightEdit = (data) => { + console.log(data); useFlightsStore().update(flightId, data).then(() => { $q.notify(successObject("Úspěšně upraveno")); fetchFlight(flightId); @@ -129,6 +131,15 @@ const openPhotoEdit = (photo) => { + + + + 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)); diff --git a/src/stores/PointsOfInterest.js b/src/stores/PointsOfInterest.js index d6ce473..39bfb9d 100644 --- a/src/stores/PointsOfInterest.js +++ b/src/stores/PointsOfInterest.js @@ -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}}, + // ] } } })