Prace na sprave letu

This commit is contained in:
Michal Kváček
2023-06-07 08:56:52 +02:00
parent 25bf93589e
commit 4d9950e362
15 changed files with 267 additions and 154 deletions
@@ -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;
+26 -19
View File
@@ -1,34 +1,41 @@
<script setup>
import {useFlightsStore} from "stores/Flights";
import {useRoute} from "vue-router";
import {computed, onMounted} from "vue";
import {minutesToHumanReadable} from "src/composables/timeUtils";
import {onMounted, reactive, ref} from "vue";
import {formatDate, minutesToHumanReadable} from "src/composables/datetimeUtils";
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
import AddFAB from "components/AddFAB.vue";
const flightsStore = useFlightsStore();
const route = useRoute();
const loading = ref(false)
let flight = reactive({});
onMounted(() => {
flightsStore.fetchDetail(route.params.id);
loading.value = true;
useFlightsStore().fetchDetail(parseInt(route.params.id))
.then(respFlight => flight = respFlight)
.finally(() => loading.value = false);
})
const flight = computed(() => flightsStore.getDetail(route.params.id) || {});
</script>
<template>
<h1>{{flight.takeOffLocation}} - {{flight.landingLocation}}</h1>
<FlightDetailSkeleton v-if="loading || Object.keys(flight).length === 0"/>
<q-icon name="calendar">{{flight.date}}</q-icon>
<q-icon name="weather">
Clouds: few
Wind: 220/12kt
Temp: 12°C
</q-icon>
<template v-else>
<h1>{{ flight.name }}</h1>
<h2>{{ flight.takeoffAirport.name }} - {{ flight.landingAirport.name }}</h2>
Track: {{ flight.turnPoints }}
<article v-html="flight.description" />
{{ minutesToHumanReadable(flight.flightDurationMinutes) }}
<q-icon name="calendar"/>
{{ formatDate(flight.takeoffDatetime) }}
{{ minutesToHumanReadable(flight.durationMinCalculated) }}
<q-page-sticky location="bottom-right" :offset="[30, 30]">
<q-fab color="primary" icon="edit" label="Edit" @click="$router.push({name: 'flightEdit', params:{id: flight.id}})"/>
</q-page-sticky>
<!-- <q-icon name="weather"/>-->
<!-- Clouds: few-->
<!-- Wind: 220/12kt-->
<!-- Temp: 12°C-->
<AddFAB :router-link="{name: 'flightEdit', params:{id: flight.id}}" label="Upravit"/>
</template>
</template>
@@ -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();
-1
View File
@@ -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"});
});
};