diff --git a/src/components/FormWrapper.vue b/src/components/FormWrapper.vue
index 3d5d87e..902f80b 100644
--- a/src/components/FormWrapper.vue
+++ b/src/components/FormWrapper.vue
@@ -1,19 +1,20 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/src/components/inputs/LocationInput.vue b/src/components/inputs/LocationInput.vue
index 7cc9dfc..4f2c544 100644
--- a/src/components/inputs/LocationInput.vue
+++ b/src/components/inputs/LocationInput.vue
@@ -39,8 +39,6 @@ watch(selectedLocationModel, (newVal) => {
// TODO: rozdelit emit na dva modely - jeden na emit existujici lokality, druhy na emit nove vytvarene
if (!newVal) return;
- console.log(newVal);
-
let value, eventName;
if (newVal instanceof String) {
eventName = "update:modelValue";
diff --git a/src/composables/timeUtils.js b/src/composables/datetimeUtils.js
similarity index 50%
rename from src/composables/timeUtils.js
rename to src/composables/datetimeUtils.js
index cead0fc..444a3bb 100644
--- a/src/composables/timeUtils.js
+++ b/src/composables/datetimeUtils.js
@@ -3,3 +3,10 @@ export const minutesToHumanReadable = (totalMinutes) => {
const minutes = totalMinutes % 60;
return `${hours}h ${minutes}min`
}
+
+export const formatDate = (date) => {
+ if (typeof date === 'string') {
+ date = new Date(date);
+ }
+ return date.getDate()+". "+date.getMonth()+". "+date.getFullYear();
+}
diff --git a/src/graphql/fragments/flight.js b/src/graphql/fragments/flight.js
index 616a806..f4d23c6 100644
--- a/src/graphql/fragments/flight.js
+++ b/src/graphql/fragments/flight.js
@@ -4,8 +4,12 @@ export const FRAGMENT_FLIGHT_FULL_INFO = gql`
fragment flightFullInfo on Flight {
id
name
+ description
takeoffDatetime
landingDatetime
+ durationMinCalculated
+
+
takeoffAirport {
id
diff --git a/src/graphql/queries/flights.js b/src/graphql/queries/flights.js
index 4da3c79..1205824 100644
--- a/src/graphql/queries/flights.js
+++ b/src/graphql/queries/flights.js
@@ -7,7 +7,16 @@ query FlightsList {
...flightFullInfo
}
}
- ${FRAGMENT_FLIGHT_FULL_INFO}
+${FRAGMENT_FLIGHT_FULL_INFO}
+`;
+export const FLIGHT_DETAIL = gql`
+query FlightDetail($id: Int!) {
+ flight(id: $id) {
+ ...flightFullInfo
+ }
+}
+
+${FRAGMENT_FLIGHT_FULL_INFO}
`;
diff --git a/src/pages/profile/details/AircraftDetailPage.vue b/src/pages/profile/details/AircraftDetailPage.vue
index 4591d41..356f26b 100644
--- a/src/pages/profile/details/AircraftDetailPage.vue
+++ b/src/pages/profile/details/AircraftDetailPage.vue
@@ -10,7 +10,7 @@ const route = useRoute();
const router = useRouter();
const aircraftId = computed(() => parseInt(route.params.id));
-let loading = ref(false);
+const loading = ref(false);
let aircraft = reactive({});
onMounted(() => {
loading.value = true;
diff --git a/src/pages/profile/details/FlightDetailPage.vue b/src/pages/profile/details/FlightDetailPage.vue
index c5fa152..5417240 100644
--- a/src/pages/profile/details/FlightDetailPage.vue
+++ b/src/pages/profile/details/FlightDetailPage.vue
@@ -1,34 +1,41 @@
- {{flight.takeOffLocation}} - {{flight.landingLocation}}
+
- {{flight.date}}
-
- Clouds: few
- Wind: 220/12kt
- Temp: 12°C
-
+
+ {{ flight.name }}
+ {{ flight.takeoffAirport.name }} - {{ flight.landingAirport.name }}
- Track: {{ flight.turnPoints }}
+
- {{ minutesToHumanReadable(flight.flightDurationMinutes) }}
+
+ {{ formatDate(flight.takeoffDatetime) }}
+ {{ minutesToHumanReadable(flight.durationMinCalculated) }}
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/pages/profile/details/SecondPilotDetailPage.vue b/src/pages/profile/details/SecondPilotDetailPage.vue
index 475ea43..a9635a5 100644
--- a/src/pages/profile/details/SecondPilotDetailPage.vue
+++ b/src/pages/profile/details/SecondPilotDetailPage.vue
@@ -4,7 +4,7 @@ import {useRoute} from "vue-router";
import {useFlightsStore} from "stores/Flights";
import {computed, onMounted} from "vue";
import {storeToRefs} from "pinia";
-import {minutesToHumanReadable} from "src/composables/timeUtils";
+import {minutesToHumanReadable} from "src/composables/datetimeUtils";
const secondPilotStore = useSecondPilotsStore();
const flightsStore = useFlightsStore();
diff --git a/src/pages/public/LoginPage.vue b/src/pages/public/LoginPage.vue
index 6f8bec7..37ca2b7 100644
--- a/src/pages/public/LoginPage.vue
+++ b/src/pages/public/LoginPage.vue
@@ -9,7 +9,6 @@ const password = ref("");
const router = useRouter();
const logUser = () => {
useUserStore().login({email: email.value, password: password.value}).then(() => {
- console.log("tu ok");
router.push({name: "myFlights"});
});
};
diff --git a/src/stores/Aircrafts.js b/src/stores/Aircrafts.js
index 819bfde..ca9ef9b 100644
--- a/src/stores/Aircrafts.js
+++ b/src/stores/Aircrafts.js
@@ -17,9 +17,7 @@ export const useAircraftsStore = defineStore('Aircrafts', {
fetchDetail(id) {
return apolloWrapper
.query(AIRCRAFT_DETAIL, {id})
- .then((result) => {
- return result.data.aircraft;
- });
+ .then((result) => result.data.aircraft);
},
create(formData) {
delete formData['id'];
diff --git a/src/stores/Flights.js b/src/stores/Flights.js
index 6429eea..898cb03 100644
--- a/src/stores/Flights.js
+++ b/src/stores/Flights.js
@@ -1,6 +1,6 @@
import {defineStore} from 'pinia'
import {apolloWrapper} from "src/graphql/apollo"
-import {FLIGHTS_LIST} from "src/graphql/queries/flights";
+import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
import {CREATE_FLIGHT} from "src/graphql/mutations/flight";
export const useFlightsStore = defineStore('Flights', {
@@ -24,7 +24,7 @@ export const useFlightsStore = defineStore('Flights', {
})
},
fetchDetail(id) {
- this.items.push({id: id, takeOffLocation: "LKLT", landingLocation: "LKLT", date: "2023-02-01", aircraft: {id: 1, name: "OK-AUR28"}, flightDurationMinutes: 76})
+ return apolloWrapper.query(FLIGHT_DETAIL, {id}).then(result => result.data.flight);
},
fetch() {
return apolloWrapper