diff --git a/src/components/flights/FlightTrackMap.vue b/src/components/flights/FlightTrackMap.vue
index 120c8ef..a9d93d8 100644
--- a/src/components/flights/FlightTrackMap.vue
+++ b/src/components/flights/FlightTrackMap.vue
@@ -110,6 +110,7 @@ const chartOptions = {
:markers="pointsOfInterests"
:highlight-position="currentPositionMarker"
:photos="mapPhotos"
+ v-bind="$attrs"
/>
diff --git a/src/components/inputs/MapGPSInput.vue b/src/components/inputs/MapGPSInput.vue
index 7b56603..9531e16 100644
--- a/src/components/inputs/MapGPSInput.vue
+++ b/src/components/inputs/MapGPSInput.vue
@@ -1,14 +1,9 @@
-
+
diff --git a/src/components/map/MapWithMarkers.vue b/src/components/map/MapWithMarkers.vue
index 30dbcfc..ecf3f96 100644
--- a/src/components/map/MapWithMarkers.vue
+++ b/src/components/map/MapWithMarkers.vue
@@ -85,16 +85,15 @@ const getColor = (i) => {
-
+
-
+
-
diff --git a/src/components/map/MapWrapper.vue b/src/components/map/MapWrapper.vue
index 126cac8..8088c54 100644
--- a/src/components/map/MapWrapper.vue
+++ b/src/components/map/MapWrapper.vue
@@ -1,37 +1,132 @@
-
+
+
+
+
+
+
+
diff --git a/src/composables/geocoding.js b/src/composables/geocoding.js
new file mode 100644
index 0000000..46639f9
--- /dev/null
+++ b/src/composables/geocoding.js
@@ -0,0 +1,41 @@
+import {ref} from "vue";
+import axios from "axios";
+
+export const useGeocode = (emits) => {
+
+ const center = ref({
+ lat: 50.1314,
+ lng: 14.5256
+ });
+ const zoom = ref(10);
+
+ const emitModels = (lat, lng) => {
+ emits("update:gpsLatitude", lat);
+ emits("update:gpsLongitude", lng);
+ }
+
+ const searchGeocode = (address) => {
+ return axios.get(`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURI(address)}&key=${process.env.GOOGLE_MAPS_API_KEY}`).then(response => {
+ if (response.data.status !== 'OK') {
+ return null;
+ }
+
+ return response.data.results;
+ });
+ }
+
+ const setCoordinatesFromGeocode = (address) => {
+ // TODO: odstranit a nahradit za searchGeocode! Vlastne cela tato composable by sla nahradit
+ axios.get(`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURI(address)}&key=${process.env.GOOGLE_MAPS_API_KEY}`).then(response => {
+ if (response.data.status !== 'OK') {
+ emits("notFound", address);
+ return null;
+ }
+ center.value = response.data.results[0].geometry.location;
+ emitModels(center.value.lat, center.value.lng);
+ zoom.value = 13;
+ });
+ }
+
+ return {emitModels, setCoordinatesFromGeocode, zoom, center, searchGeocode}
+}
diff --git a/src/graphql/fragments/flightPlan.js b/src/graphql/fragments/flightPlan.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/graphql/fragments/poi.js b/src/graphql/fragments/poi.js
index 94b4537..596e4da 100644
--- a/src/graphql/fragments/poi.js
+++ b/src/graphql/fragments/poi.js
@@ -8,6 +8,8 @@ fragment pointOfInterestListInfo on PointOfInterest {
name
urlSlug
isPublic
+ gpsLatitude
+ gpsLongitude
titlePhoto {
thumbnailUrl
}
diff --git a/src/graphql/mutations/flightPlan.js b/src/graphql/mutations/flightPlan.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/graphql/queries/airports.js b/src/graphql/queries/airports.js
index 9cc4631..29812d7 100644
--- a/src/graphql/queries/airports.js
+++ b/src/graphql/queries/airports.js
@@ -6,6 +6,8 @@ export const AIRPORTS_LIST = gql`
id
name
icaoCode
+ gpsLatitude
+ gpsLongitude
}
}
`;
diff --git a/src/graphql/queries/airspace.js b/src/graphql/queries/airspace.js
new file mode 100644
index 0000000..a56ca84
--- /dev/null
+++ b/src/graphql/queries/airspace.js
@@ -0,0 +1,20 @@
+import gql from "graphql-tag";
+
+// TODO: dodelat filtrovani podle typu a zobrazene zeme?
+export const AIRSPACE_LIST = gql`
+ query AirspaceList {
+ airspaces {
+ name
+ type
+ mapCenter {
+ lat
+ lng
+ }
+ radius
+ mapBounds {
+ lat
+ lng
+ }
+ }
+ }
+`;
diff --git a/src/graphql/queries/flightPlan.js b/src/graphql/queries/flightPlan.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/profile/flight/FlightDetailPage.vue b/src/pages/profile/flight/FlightDetailPage.vue
index f885e34..aebbac0 100644
--- a/src/pages/profile/flight/FlightDetailPage.vue
+++ b/src/pages/profile/flight/FlightDetailPage.vue
@@ -3,14 +3,14 @@ import {useFlightsStore} from "stores/Flights";
export default {
preFetch({currentRoute}) {
- useFlightsStore().fetchDetail(currentRoute.params.id);
+ return useFlightsStore().fetchDetail(currentRoute.params.id);
}
}
+
+
+
+
+
+
+
+
+ {{ i + 1 }}. {{ marker.label }}
+
+
+ {{ marker.type }}
+
+
+
+
+
-
- Najit
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ poi.name }}
+
+ Přidat do trasy
+
+
+
+
+ Najít {{ place }} na mapě
+
+
+
+
+
+
diff --git a/src/stores/Airspaces.js b/src/stores/Airspaces.js
new file mode 100644
index 0000000..8ac6c18
--- /dev/null
+++ b/src/stores/Airspaces.js
@@ -0,0 +1,18 @@
+import {defineStore} from 'pinia'
+import {AIRSPACE_LIST} from "src/graphql/queries/airspace";
+import {ref} from "vue";
+import {query} from "stores/helpers";
+
+export const useAirspacesStore = defineStore('Airspaces', () => {
+ const airspaces = ref([])
+ const isQueryRunning = ref(false);
+
+ const fetch = () => {
+ return query({
+ isQueryRunning,
+ query: AIRSPACE_LIST,
+ }).then(items => airspaces.value = items);
+ }
+
+ return {airspaces, isQueryRunning, fetch};
+})
diff --git a/src/stores/FlightPlans.js b/src/stores/FlightPlans.js
new file mode 100644
index 0000000..0fad587
--- /dev/null
+++ b/src/stores/FlightPlans.js
@@ -0,0 +1,66 @@
+import {defineStore} from 'pinia'
+import {FLIGHT_PLAN_DETAIL, FLIGHT_PLAN_PUBLIC_DETAIL, FLIGHT_PLAN_LIST} from "src/graphql/queries/flightPlans";
+import {CREATE_FLIGHT_PLAN, EDIT_FLIGHT_PLAN} from "src/graphql/mutations/flightPlan";
+import {mutate, query, updateInItems} from "stores/helpers";
+import {ref} from "vue";
+
+export const useFlightPlansStore = defineStore('FlightPlans', () => {
+ const flightPlan = ref(null);
+ const flightPlans = ref([]);
+ const isMutationRunning = ref(false);
+ const isQueryRunning = ref(false);
+
+ const fetchDetail = (id) => {
+ return query({
+ isQueryRunning,
+ query: FLIGHT_PLAN_DETAIL,
+ variables: {id},
+ }).then(item => flightPlan.value = item);
+ };
+
+ const fetchPublicDetail = ({urlSlug, username, uploadToken, uploadFlightSlug}) => {
+ return query({
+ isQueryRunning,
+ query: FLIGHT_PLAN_PUBLIC_DETAIL,
+ variables: {urlSlug, pilotUsername: username, uploadToken, uploadFlightSlug},
+ }).then(item => {
+ flightPlan.value = item;
+ return item;
+ });
+ };
+
+ const fetch = () => {
+ return query({
+ isQueryRunning,
+ query: FLIGHT_PLANS_LIST,
+ }).then(items => flightPlans.value = items);
+ }
+
+ const create = (input) => {
+ return mutate({
+ isMutationRunning,
+ mutation: CREATE_FLIGHT_PLAN,
+ variables: {input},
+ }).then(item => {
+ flightPlans.value.push(item);
+ return item;
+ })
+ }
+
+ const update = (id, input) => {
+ return mutate({
+ isMutationRunning,
+ mutation: EDIT_FLIGHT_PLAN,
+ variables: {id, input}
+ }).then(item => {
+ updateInItems(flightPlans.value, 'id', item);
+ flightPlan.value = item;
+ return item;
+ })
+ }
+
+ return {
+ flightPlan, flightPlans, isMutationRunning, isQueryRunning,
+ fetch, fetchDetail, create, update, fetchPublicDetail
+ }
+})