+
+
Vzlet
+
+
+
-
-
-
-
-
-
-
+
Přistání
+
+
+
-
+
diff --git a/src/components/flights/form/FlightFormCopilot.vue b/src/components/flights/form/FlightFormCopilot.vue
index cc41a30..2420fdd 100644
--- a/src/components/flights/form/FlightFormCopilot.vue
+++ b/src/components/flights/form/FlightFormCopilot.vue
@@ -1,5 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/inputs/ComboboxInput.vue b/src/components/inputs/ComboboxInput.vue
index b44c1a4..d9c14e4 100644
--- a/src/components/inputs/ComboboxInput.vue
+++ b/src/components/inputs/ComboboxInput.vue
@@ -10,6 +10,11 @@ const props = defineProps({
required: false,
default: () => []
},
+ enableNewValues: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
options: {
type: Array,
required: true,
@@ -17,9 +22,9 @@ const props = defineProps({
})
const model = ref({});
-onMounted(() => {
- model.value = props.modelValue;
-})
+watch(() => props.modelValue, (newVal) => {
+ model.value = newVal;
+}, {immediate: true});
const emit = defineEmits(['update:modelValue', 'clear']);
watch(model, (val) => {
@@ -84,7 +89,7 @@ const filterFn = (val, update, abort) => {
:options="availableOptions"
option-label="name"
option-value="id"
- new-value-mode="add"
+ :new-value-mode="enableNewValues ? 'add' : 'toggle'"
clear-icon="clear"
:v-bind="$attrs"
>
diff --git a/src/components/inputs/DatetimePicker.vue b/src/components/inputs/DatetimePicker.vue
index 0db6f94..05d40ec 100644
--- a/src/components/inputs/DatetimePicker.vue
+++ b/src/components/inputs/DatetimePicker.vue
@@ -10,8 +10,11 @@ const props = defineProps({
type: [String, Boolean],
required: false,
default: FORMAT_DATETIME_LONG
+ },
+ minDate: {
+ type: [String, Date],
+ required: false
}
-
})
let dateModel = ref("");
@@ -36,6 +39,7 @@ onMounted(() => {
emitModelUpdate();
}
});
+// TODO: ^^ by asi slo prepsat do watchera, viz ComboboxInput
const publicModel = computed(() => {
@@ -92,7 +96,12 @@ const myLocale = {
pluralDay: 'dny'
}
-// https://quasar.dev/vue-composables/use-form-child - mozna resi ohack s onMounted()?
+const isDateValid = (date) => {
+ if (!props.minDate) return true;
+
+ const minDate = formatDatetime(props.minDate, "YYYY/MM/DD");
+ return date >= minDate;
+}
@@ -107,10 +116,10 @@ const myLocale = {
diff --git a/src/components/inputs/MapGPSInput.vue b/src/components/inputs/MapGPSInput.vue
index 7727e76..7b56603 100644
--- a/src/components/inputs/MapGPSInput.vue
+++ b/src/components/inputs/MapGPSInput.vue
@@ -2,7 +2,7 @@
import {Marker} from "vue3-google-map";
import {onMounted, ref} from "vue";
import axios from "axios";
-import MapWrapper from "components/MapWrapper.vue";
+import MapWrapper from "components/map/MapWrapper.vue";
const center = ref({
lat: 50.1314,
diff --git a/src/components/map/EmbeddedMap.vue b/src/components/map/EmbeddedMap.vue
new file mode 100644
index 0000000..3e4978a
--- /dev/null
+++ b/src/components/map/EmbeddedMap.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
diff --git a/src/components/map/MapWithMarkers.vue b/src/components/map/MapWithMarkers.vue
new file mode 100644
index 0000000..da4f72f
--- /dev/null
+++ b/src/components/map/MapWithMarkers.vue
@@ -0,0 +1,71 @@
+
+
+
+ Loading
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/map/MapWrapper.vue b/src/components/map/MapWrapper.vue
new file mode 100644
index 0000000..d01c399
--- /dev/null
+++ b/src/components/map/MapWrapper.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
diff --git a/src/components/photos/PhotoDetail.vue b/src/components/photos/PhotoDetail.vue
new file mode 100644
index 0000000..0450d28
--- /dev/null
+++ b/src/components/photos/PhotoDetail.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
{{ photo.name }}
+
+
{{ photo.description }}
+
+
+ Předchozí
+ Další
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatDatetime(photo.exposedAt) }}
+
+
+
+
+
+
+
+ {{ formatDatetime(photo.exposedAt) }}
+
+
+
+
+
+
+
+
+ {{ photo.gpsAltitude }} m
+
+
+
+
+
+
+
+
+
diff --git a/src/components/flights/PhotoForm.vue b/src/components/photos/PhotoForm.vue
similarity index 96%
rename from src/components/flights/PhotoForm.vue
rename to src/components/photos/PhotoForm.vue
index adc8831..9f1fe93 100644
--- a/src/components/flights/PhotoForm.vue
+++ b/src/components/photos/PhotoForm.vue
@@ -1,5 +1,5 @@
-
+
-
+
{{ photo.name }}
@@ -40,8 +40,14 @@ const openDetail = (photo) => {
-
- {{ photo.isFlightCover ? 'ano' : 'ne' }}
+
+
+
+
+
+
+
+
diff --git a/src/components/poi/POIEditForm.vue b/src/components/poi/POIEditForm.vue
index 54cc916..cf598fa 100644
--- a/src/components/poi/POIEditForm.vue
+++ b/src/components/poi/POIEditForm.vue
@@ -22,7 +22,6 @@ const formData = reactive({
});
const poiNameForMap = ref("");
-
onMounted(() => {
setDefaultData(formData, props.poi);
poiNameForMap.value = props.poi.name;
@@ -46,7 +45,6 @@ const handlePositionNotFound = () => {
-
{
/>
-
-
diff --git a/src/components/weather/CloudCoverIcon.vue b/src/components/weather/CloudCoverIcon.vue
new file mode 100644
index 0000000..ac15fb0
--- /dev/null
+++ b/src/components/weather/CloudCoverIcon.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/components/weather/WeatherInfo.vue b/src/components/weather/WeatherInfo.vue
new file mode 100644
index 0000000..dbf17cd
--- /dev/null
+++ b/src/components/weather/WeatherInfo.vue
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pokrytí oblačností (celkové): {{ weather.cloudcoverTotal }} %
+
+ Nízké mraky: {{ weather.cloudcoverLow }} %
+
+
+
+
+
+ QNH
+
+
+ {{ weather.qnh }} hPa
+
+
+
+
+
+
+
+
+
+ {{ kmhToKnots(weather.windSpeedSurface) }} kt, {{ weather.windDirectionSurface }} °
+
+
+
+
+
+
+
+
+
+ Teplota: {{ weather.temperatureSurface }} ° C
+
+ Rosný bod: {{ weather.dewpointSurface }} ° C
+
+
+
+
+
+
diff --git a/src/composables/inputs.js b/src/composables/inputs.js
new file mode 100644
index 0000000..25490a5
--- /dev/null
+++ b/src/composables/inputs.js
@@ -0,0 +1,5 @@
+export const commonProps = {
+ class: "q-my-lg",
+ outlined: true,
+ standout: true
+}
diff --git a/src/composables/objects/aircraft.js b/src/composables/objects/aircraft.js
index c81979a..435a11d 100644
--- a/src/composables/objects/aircraft.js
+++ b/src/composables/objects/aircraft.js
@@ -8,7 +8,7 @@ export const aircraft = ref(null);
export const fetchAircraft = (aircraftId) => {
loading.value = true;
- useAircraftsStore().fetchDetail(aircraftId).then((data) => {
+ return useAircraftsStore().fetchDetail(aircraftId).then((data) => {
aircraft.value = data;
}).catch(err => {
console.error(err);
diff --git a/src/composables/objects/flight.js b/src/composables/objects/flight.js
index 92492fc..a7094f6 100644
--- a/src/composables/objects/flight.js
+++ b/src/composables/objects/flight.js
@@ -17,8 +17,11 @@ export const loading = ref(true);
export const flight = ref(null);
export const fetchFlight = (flightId) => {
loading.value = true;
- useFlightsStore().fetchDetail(parseInt(flightId))
- .then(respFlight => flight.value = respFlight)
+ return useFlightsStore().fetchDetail(parseInt(flightId))
+ .then(respFlight => {
+ flight.value = respFlight;
+ return respFlight;
+ })
.finally(() => loading.value = false);
};
@@ -32,7 +35,8 @@ export const fetchFlights = () => {
};
-export const handleDeleteFlight = ($q, flightId, onOkCallback = () => {}) => {
+export const handleDeleteFlight = ($q, flightId, onOkCallback = () => {
+}) => {
$q.dialog(confirmObject(`Opravdu chceš smazat tento let?`))
.onOk(() => {
useFlightsStore().delete(flightId).then(onOkCallback);
diff --git a/src/graphql/fragments/copilot.js b/src/graphql/fragments/copilot.js
new file mode 100644
index 0000000..4d454b1
--- /dev/null
+++ b/src/graphql/fragments/copilot.js
@@ -0,0 +1,15 @@
+import gql from "graphql-tag";
+
+export const FRAGMENT_COPILOT_LIST_INFO = gql`
+fragment copilotListInfo on Copilot {
+ id
+ name
+}
+`;
+
+export const FRAGMENT_COPILOT_FULL_INFO = gql`
+fragment copilotFullInfo on Copilot {
+ id
+ name
+}
+`;
diff --git a/src/graphql/fragments/flight.js b/src/graphql/fragments/flight.js
index 4353306..3812491 100644
--- a/src/graphql/fragments/flight.js
+++ b/src/graphql/fragments/flight.js
@@ -2,6 +2,20 @@ import gql from "graphql-tag";
import {FRAGMENT_AIRCRAFT_BASIC_INFO, FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
+import {FRAGMENT_POI_FULL_INFO} from "src/graphql/fragments/poi";
+
+export const FRAGMENT_WEATHER_FULL_INFO = gql`
+fragment weatherFullInfo on WeatherInfo {
+ datetime
+ qnh
+ temperatureSurface
+ dewpointSurface
+ windSpeedSurface
+ windDirectionSurface
+ cloudcoverTotal
+ cloudcoverLow
+ rain
+}`;
export const FRAGMENT_FLIGHT_FULL_INFO = gql`
fragment flightFullInfo on Flight {
@@ -12,8 +26,6 @@ fragment flightFullInfo on Flight {
landingDatetime
landings
durationMinCalculated
- solo
- withInstructor
coverPhoto {
thumbnailUrl
@@ -24,12 +36,10 @@ fragment flightFullInfo on Flight {
...airportInfo
}
+ gpxTrackUrl
track {
pointOfInterest {
- id
- name
- gpsLatitude
- gpsLongitude
+ ...pointOfInterestFullInfo
}
}
@@ -37,6 +47,15 @@ fragment flightFullInfo on Flight {
...airportInfo
}
+ landingWeatherInfo {
+ ...weatherFullInfo
+ }
+
+ takeoffWeatherInfo {
+ ...weatherFullInfo
+ }
+
+
aircraft {
...aircraftFullInfo
}
@@ -49,6 +68,8 @@ fragment flightFullInfo on Flight {
${FRAGMENT_PHOTO_FULL_INFO}
${FRAGMENT_AIRCRAFT_FULL_INFO}
${FRAGMENT_AIRPORT_INFO}
+${FRAGMENT_POI_FULL_INFO}
+${FRAGMENT_WEATHER_FULL_INFO}
`;
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
@@ -92,10 +113,3 @@ fragment flightEditIds on Flight {
}
}
`;
-
-// export const FRAGMENT_LOCATION = gql`
-// fragment airportInfo on Airport {
-// id
-// name
-// }
-// `;
diff --git a/src/graphql/fragments/photo.js b/src/graphql/fragments/photo.js
index 7e79259..2904b9a 100644
--- a/src/graphql/fragments/photo.js
+++ b/src/graphql/fragments/photo.js
@@ -11,4 +11,8 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
flightId
pointOfInterestId
isFlightCover
+ gpsLatitude
+ gpsLongitude
+ gpsAltitude
+ exposedAt
}`;
diff --git a/src/graphql/mutations/copilot.js b/src/graphql/mutations/copilot.js
new file mode 100644
index 0000000..f6e651a
--- /dev/null
+++ b/src/graphql/mutations/copilot.js
@@ -0,0 +1,29 @@
+import gql from "graphql-tag";
+import {FRAGMENT_COPILOT_FULL_INFO} from "src/graphql/fragments/copilot";
+
+export const CREATE_COPILOT = gql`
+ mutation createCopilot($input: CreateCopilotInput!) {
+ createCopilot(input: $input) {
+ ...copilotFullInfo
+ }
+ }
+
+ ${FRAGMENT_COPILOT_FULL_INFO}
+`;
+
+export const EDIT_COPILOT = gql`
+mutation editCopilot($id: Int!, $input: EditCopilotInput!) {
+ editCopilot(id: $id, input: $input) {
+ ...copilotFullInfo
+ }
+}
+
+ ${FRAGMENT_COPILOT_FULL_INFO}
+`;
+export const DELETE_COPILOT = gql`
+mutation deleteCopilot($id: Int!) {
+ deleteCopilot(id: $id) {
+ id
+ }
+}
+`;
diff --git a/src/graphql/queries/aircrafts.js b/src/graphql/queries/aircrafts.js
index 9101b59..0f4b219 100644
--- a/src/graphql/queries/aircrafts.js
+++ b/src/graphql/queries/aircrafts.js
@@ -1,5 +1,6 @@
import gql from "graphql-tag";
import {FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
+import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight";
export const AIRCRAFTS_LIST = gql`
query AircraftsList {
@@ -16,8 +17,13 @@ export const AIRCRAFT_DETAIL = gql`
query AircraftDetail($id: Int!) {
aircraft(id: $id) {
...aircraftFullInfo
+
+ flights {
+ ...flightListInfo
+ }
+
}
}
${FRAGMENT_AIRCRAFT_FULL_INFO}
-
+${FRAGMENT_FLIGHT_LIST_INFO}
`;
diff --git a/src/graphql/queries/copilots.js b/src/graphql/queries/copilots.js
index 4c88b4e..2e68e32 100644
--- a/src/graphql/queries/copilots.js
+++ b/src/graphql/queries/copilots.js
@@ -1,20 +1,21 @@
import gql from "graphql-tag";
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight";
+import {FRAGMENT_COPILOT_FULL_INFO, FRAGMENT_COPILOT_LIST_INFO} from "src/graphql/fragments/copilot";
export const COPILOTS_LIST = gql`
query copilotsList {
copilots {
- id
- name
+ ...copilotListInfo
}
}
+
+${FRAGMENT_COPILOT_LIST_INFO}
`;
-export const COPILOTS_DETAIL = gql`
+export const COPILOT_DETAIL = gql`
query copilot($id: Int!) {
copilot(id: $id) {
- id
- name
+ ...copilotFullInfo
flights {
...flightListInfo
@@ -22,5 +23,6 @@ query copilot($id: Int!) {
}
}
+${FRAGMENT_COPILOT_FULL_INFO}
${FRAGMENT_FLIGHT_LIST_INFO}
`;
diff --git a/src/layouts/ProfileLayout.vue b/src/layouts/ProfileLayout.vue
index 2863742..481fc07 100644
--- a/src/layouts/ProfileLayout.vue
+++ b/src/layouts/ProfileLayout.vue
@@ -26,11 +26,19 @@
-
-
-
+
+
+
+
+
+
-
{{ loggedUser.name }}
+
+ {{ loggedUser.name }}
+
@@ -47,7 +55,7 @@
-
+
@@ -94,7 +102,7 @@ const linksList = [
{
title: 'Spolucestující',
icon: "people",
- to: {name: "pilots"}
+ to: {name: "copilots"}
},
]
@@ -103,9 +111,8 @@ const toggleLeftDrawer = () => {
leftDrawerOpen.value = !leftDrawerOpen.value
};
-const loggedUserStore = useUserStore();
onMounted(() => {
- loggedUserStore.setupCredentials();
+ useUserStore().setupCredentials();
})
-const loggedUser = storeToRefs(loggedUserStore).user;
+const loggedUser = storeToRefs(useUserStore()).user;
diff --git a/src/pages/profile/ProfilePage.vue b/src/pages/profile/ProfilePage.vue
index 732fbea..9dfcb9c 100644
--- a/src/pages/profile/ProfilePage.vue
+++ b/src/pages/profile/ProfilePage.vue
@@ -4,14 +4,6 @@ import {onMounted} from "vue";
import {useFlightsStore} from "stores/Flights";
const loggedUser = useUserStore().user
-
-onMounted(() => {
- useUserStore().setupCredentials();
- setInterval(() => {
- useFlightsStore().fetch();
- }, 1000);
-})
-
diff --git a/src/pages/profile/details/AircraftDetailPage.vue b/src/pages/profile/details/AircraftDetailPage.vue
index 3716bc5..3524f90 100644
--- a/src/pages/profile/details/AircraftDetailPage.vue
+++ b/src/pages/profile/details/AircraftDetailPage.vue
@@ -8,6 +8,8 @@ import {confirmObject, successObject} from "src/composables/dialog";
import {loading, aircraft, fetchAircraft} from "src/composables/objects/aircraft";
import FAB from "components/FAB.vue";
import {useAppStore} from "stores/App";
+import FlightsList from "components/flights/FlightsList.vue";
+import {copilot} from "src/composables/objects/copilot";
const aircraftId = parseInt(useRoute().params.id);
onMounted(() => {
@@ -40,30 +42,31 @@ watch(aircraft, (newVal) => {
-
+
-
- Výrobce: {{ aircraft.manufacturer }}
-
+
+ Výrobce: {{ aircraft.manufacturer }}
+
+
+ Model: {{ aircraft.model }}
+
+
-
- Model: {{ aircraft.model }}
-
-
-
+ Lety
+
+ Zatím žádné lety.
+
+
-
-
+
-
-
diff --git a/src/pages/profile/details/CopilotDetailPage.vue b/src/pages/profile/details/CopilotDetailPage.vue
index 1981d55..fcdbda9 100644
--- a/src/pages/profile/details/CopilotDetailPage.vue
+++ b/src/pages/profile/details/CopilotDetailPage.vue
@@ -12,7 +12,7 @@ onMounted(() => {
fetchCopilot(copilotId).then(() => {
useAppStore().setPageTitle(copilot.value.name);
useAppStore().setBreadcrumbs([
- {to: {name: "pilots"}, label: "Kopiloti"},
+ {to: {name: "copilots"}, label: "Kopiloti"},
{label: copilot.value.name}
])
});
@@ -29,6 +29,6 @@ onMounted(() => {
-
+
diff --git a/src/pages/profile/details/FlightDetailPage.vue b/src/pages/profile/details/FlightDetailPage.vue
index c9287ed..4e28b69 100644
--- a/src/pages/profile/details/FlightDetailPage.vue
+++ b/src/pages/profile/details/FlightDetailPage.vue
@@ -1,21 +1,26 @@
+
-
-
+
+
+
+
+
+
@@ -72,12 +119,12 @@ const flightPath = computed(() => {
-
-
@@ -85,6 +132,8 @@ const flightPath = computed(() => {
+
+
diff --git a/src/pages/profile/details/PointOfInterestDetailPage.vue b/src/pages/profile/details/PointOfInterestDetailPage.vue
index 1615709..df059fe 100644
--- a/src/pages/profile/details/PointOfInterestDetailPage.vue
+++ b/src/pages/profile/details/PointOfInterestDetailPage.vue
@@ -6,7 +6,7 @@ import FAB from "components/FAB.vue";
import {fetchPoi, loading, poi} from "src/composables/objects/poi";
import PhotosList from "components/photos/PhotosList.vue";
import {useAppStore} from "stores/App";
-import MapWithMarker from "components/MapWithMarkers.vue";
+import EmbeddedMap from "components/map/EmbeddedMap.vue";
onMounted(() => {
fetchPoi(useRoute().params.id).then(() => {
@@ -25,11 +25,11 @@ onMounted(() => {
-
{
isRequestPending.value = true;
useAircraftsStore().update(aircraftId, formData).then(() => {
- $q.notify(successObject("Letadlo uspesne upraveno"));
-
+ $q.notify(successObject("Letadlo úspěšně upraveno"));
useRouter().push({name: "aircrafts"});
}).finally(() => {
- isRequestPending.value = true;
+ isRequestPending.value = false;
})
}
onMounted(() => {
- fetchAircraft(aircraftId)
+ fetchAircraft(aircraftId).then(() => {
+ useAppStore().setPageTitle(`${aircraft.value.callSign} - editace`);
+ useAppStore().setBreadcrumbs([
+ {to: {name: "aircraft"}, label: "Letadla"},
+ {to: {name: "aircraftDetail", params: {id: aircraftId}}, label: aircraft.value.callSign},
+ {label: "Editace"}
+ ])
+ })
});
-
- Editace letadla {{ aircraft.callSign }}
-
-
-
+
diff --git a/src/pages/profile/forms/EditCopilotPage.vue b/src/pages/profile/forms/EditCopilotPage.vue
index 5c04194..4893f3e 100644
--- a/src/pages/profile/forms/EditCopilotPage.vue
+++ b/src/pages/profile/forms/EditCopilotPage.vue
@@ -3,8 +3,11 @@ import {onMounted} from "vue";
import {loading, copilot, fetchCopilot} from "src/composables/objects/copilot";
import {useAppStore} from "stores/App";
import CopilotEditSkeleton from "components/copilots/CopilotEditSkeleton.vue";
-import CopilotEditForm from "components/copilots/CopilotEditForm.vue";
+import CopilotEditForm from "components/copilots/CopilotForm.vue";
import {useRoute} from "vue-router";
+import {useCopilotsStore} from "stores/Copilots";
+import {successObject} from "src/composables/dialog";
+import {useQuasar} from "quasar";
const copilotId = parseInt(useRoute().params.id);
@@ -12,19 +15,27 @@ onMounted(() => {
fetchCopilot(copilotId).then(() => {
useAppStore().setPageTitle(`${copilot.value.name} - editace`);
useAppStore().setBreadcrumbs([
- {to: {name: "pilots"}, label: "Kopiloti"},
- {to: {name: "pilotDetail", params: {id: copilotId}}, label: copilot.value.name},
+ {to: {name: "copilots"}, label: "Kopiloti"},
+ {to: {name: "copilotDetail", params: {id: copilotId}}, label: copilot.value.name},
{label: "Editace"}
])
})
});
+const $q = useQuasar();
+
+const handleSave = (formData) => {
+ useCopilotsStore().update(copilotId, formData).then(() => {
+ $q.notify(successObject("Kopilot úspěšně upraven"));
+
+ // useRouter().push({name: "copilots"});
+ // TODO: ^^ hazi error
+ })
+}
-
-
-
-
+
+
diff --git a/src/pages/profile/forms/EditFlightPage.vue b/src/pages/profile/forms/EditFlightPage.vue
index 61335ca..f905bfe 100644
--- a/src/pages/profile/forms/EditFlightPage.vue
+++ b/src/pages/profile/forms/EditFlightPage.vue
@@ -17,7 +17,7 @@ import FlightFormPhotos from "components/flights/form/FlightFormPhotos.vue";
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 PhotoForm from "components/photos/PhotoForm.vue";
import FlightFormTrack from "components/flights/form/FlightFormTrack.vue";
import {fetchFlight, flight, loading} from "src/composables/objects/flight";
import FlightEditSkeleton from "components/flights/FlightEditSkeleton.vue";
diff --git a/src/pages/profile/forms/NewAircraftsPage.vue b/src/pages/profile/forms/NewAircraftsPage.vue
index 3b7ca4b..1debaf1 100644
--- a/src/pages/profile/forms/NewAircraftsPage.vue
+++ b/src/pages/profile/forms/NewAircraftsPage.vue
@@ -3,7 +3,8 @@ import AircraftForm from "components/aircrafts/AircraftForm.vue";
import {useAircraftsStore} from "stores/Aircrafts";
import {useRouter} from "vue-router";
import {useQuasar} from "quasar";
-import {ref} from "vue";
+import {onMounted, ref} from "vue";
+import {useAppStore} from "stores/App";
let isRequestPending = ref(false);
const $q = useQuasar();
@@ -18,6 +19,15 @@ const handleSave = (formData) => {
isRequestPending.value = true;
})
}
+
+
+onMounted(() => {
+ useAppStore().setPageTitle("Nové letadlo");
+ useAppStore().setBreadcrumbs([
+ {to: {name: "aircrafts"}, label: "Letadla"},
+ {label: "Nové"}
+ ]);
+});
diff --git a/src/pages/profile/forms/NewCopilotPage.vue b/src/pages/profile/forms/NewCopilotPage.vue
index 3b7ca4b..f769538 100644
--- a/src/pages/profile/forms/NewCopilotPage.vue
+++ b/src/pages/profile/forms/NewCopilotPage.vue
@@ -1,25 +1,34 @@
-
+
diff --git a/src/pages/profile/forms/NewFlightPage.vue b/src/pages/profile/forms/NewFlightPage.vue
index f74616e..4722171 100644
--- a/src/pages/profile/forms/NewFlightPage.vue
+++ b/src/pages/profile/forms/NewFlightPage.vue
@@ -5,49 +5,39 @@ import {useFlightsStore} from "stores/Flights";
import {useRouter} from "vue-router";
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
import {storeToRefs} from "pinia";
-import {useMeta} from "quasar";
import {useAirportsStore} from "stores/Airports";
import FlightFormSteps from "components/flights/form/FlightFormSteps.vue";
import FlightFormBasic from "components/flights/form/FlightFormBasic.vue";
+import {useAppStore} from "stores/App";
-const aircraftsStore = useAircraftsStore();
-const poiStore = usePointsOfInterestStore();
-const flightsStore = useFlightsStore();
-const airportStore = useAirportsStore();
-useMeta({title: "New flight"});
onMounted(() => {
- aircraftsStore.fetch();
- poiStore.fetch();
- flightsStore.fetch();
- airportStore.fetch();
+ useAircraftsStore().fetch();
+ usePointsOfInterestStore().fetch();
+ useFlightsStore().fetch();
+ useAirportsStore().fetch();
+
+ useAppStore().setPageTitle("Nový let");
+ useAppStore().setBreadcrumbs([
+ {to: {name: "myFlights"}, label: "Moje lety"},
+ {label: "Nový"}
+ ]);
});
-const aircrafts = storeToRefs(aircraftsStore).items;
-const locations = storeToRefs(poiStore).items;
-const airports = storeToRefs(airportStore).items;
+const aircrafts = storeToRefs(useAircraftsStore()).items;
+const locations = storeToRefs(usePointsOfInterestStore()).items;
+const airports = storeToRefs(useAirportsStore()).items;
const router = useRouter();
const handleSave = (formData) => {
- flightsStore.create(formData).then((flight) => {
+ useFlightsStore().create(formData).then((flight) => {
router.push({name: "flightEdit", params: {id: flight.id, step: "copilot"}});
});
}
-
-const formStep = ref("basic")
-
-
-
- Moje lety
- Nový
-
-
-
-
diff --git a/src/router/routes.js b/src/router/routes.js
index 2b9e709..6ccc084 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -25,10 +25,10 @@ const routes = [
{path: 'poi/add', name: "addPOI", component: () => import('pages/profile/forms/NewPointOfInterestPage.vue')},
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/details/PointOfInterestDetailPage.vue')},
{path: 'poi/:id/edit', name: "poiEdit", component: () => import('pages/profile/forms/EditPointOfInterestPage.vue')},
- {path: 'pilots', name: "pilots", component: () => import('pages/profile/lists/CopilotsPage.vue')},
- {path: 'pilots/add', name: "addPilots", component: () => import('pages/profile/forms/NewCopilotPage.vue')},
- {path: 'pilots/:id', name: "pilotDetail", component: () => import('pages/profile/details/CopilotDetailPage.vue')},
- {path: 'pilots/:id/edit', name: "pilotEdit", component: () => import('pages/profile/forms/EditCopilotPage.vue')},
+ {path: 'copilots', name: "copilots", component: () => import('pages/profile/lists/CopilotsPage.vue')},
+ {path: 'copilots/add', name: "addCopilot", component: () => import('pages/profile/forms/NewCopilotPage.vue')},
+ {path: 'copilots/:id', name: "copilotDetail", component: () => import('pages/profile/details/CopilotDetailPage.vue')},
+ {path: 'copilots/:id/edit', name: "copilotEdit", component: () => import('pages/profile/forms/EditCopilotPage.vue')},
{path: 'aircrafts', name: "aircrafts", component: () => import('pages/profile/lists/AircraftsPage.vue')},
{path: 'aircrafts/new', name: "addAircraft", component: () => import('pages/profile/forms/NewAircraftsPage.vue')},
{path: 'aircrafts/:id', name: "aircraftDetail", component: () => import('pages/profile/details/AircraftDetailPage.vue')},
diff --git a/src/stores/Aircrafts.js b/src/stores/Aircrafts.js
index 6431755..9346a9b 100644
--- a/src/stores/Aircrafts.js
+++ b/src/stores/Aircrafts.js
@@ -42,9 +42,6 @@ export const useAircraftsStore = defineStore('Aircrafts', {
});
},
fetch() {
- /***
- * {id: id, name: "OK-ABC" + id, private: true, limits: {wind: {frontKt: 22, sideKt: 16}, speed: {vmax: 220}}};
- */
return apolloWrapper
.query(AIRCRAFTS_LIST)
.then((result) => {
diff --git a/src/stores/Copilots.js b/src/stores/Copilots.js
index 9cbf16a..cd237df 100644
--- a/src/stores/Copilots.js
+++ b/src/stores/Copilots.js
@@ -1,26 +1,35 @@
import {defineStore} from 'pinia'
import {apolloWrapper} from "src/graphql/apollo";
-import {COPILOTS_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
+import {COPILOT_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
+import {CREATE_COPILOT, EDIT_COPILOT} from "src/graphql/mutations/copilot";
export const useCopilotsStore = defineStore('SecondPilots', {
state: () => ({
items: []
}),
- getters: {},
-
actions: {
- create(formData) {
- console.log("not implemented");
- },
fetchDetail(copilotId) {
- return apolloWrapper.query(COPILOTS_DETAIL, {id: copilotId}).then(({data}) => data.copilot);
+ return apolloWrapper.query(COPILOT_DETAIL, {id: copilotId}).then(({data}) => data.copilot);
},
fetch() {
- return apolloWrapper.query(COPILOTS_LIST).then(result => {
+ return apolloWrapper.query(COPILOTS_LIST).then(result => {
this.items = result.data.copilots;
return result.data.copilots;
});
- }
+ },
+ create(formData) {
+ delete formData['id'];
+ return apolloWrapper.mutate(CREATE_COPILOT, {input: formData}).then(({data}) => {
+ this.items.push(data.createCopilot);
+
+ return data.createCopilot;
+ })
+ },
+ update(id, formData) {
+ return apolloWrapper.mutate(EDIT_COPILOT, {id: id, input: formData}).then(({data}) => {
+ return data.editCopilot;
+ });
+ },
}
})