57 lines
1.7 KiB
Vue
57 lines
1.7 KiB
Vue
<script setup>
|
|
import {onMounted, ref} from "vue";
|
|
import {useAircraftsStore} from "stores/Aircrafts";
|
|
import {useFlightsStore} from "stores/Flights";
|
|
import {useRouter} from "vue-router";
|
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
|
import {storeToRefs} from "pinia";
|
|
import {useMeta} from "quasar";
|
|
import FlightForm from "components/flights/__FlightForm.vue";
|
|
import {useAirportsStore} from "stores/Airports";
|
|
import FlightFormSteps from "components/flights/form/FlightFormSteps.vue";
|
|
import FlightFormBasic from "components/flights/form/FlightFormBasic.vue";
|
|
|
|
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();
|
|
});
|
|
|
|
|
|
const aircrafts = storeToRefs(aircraftsStore).items;
|
|
const locations = storeToRefs(poiStore).items;
|
|
const airports = storeToRefs(airportStore).items;
|
|
|
|
const router = useRouter();
|
|
const handleSave = (formData) => {
|
|
flightsStore.create(formData).then((flight) => {
|
|
router.push({name: "flightEdit", params: {id: flight.id, step: "copilot"}});
|
|
});
|
|
}
|
|
|
|
const formStep = ref("basic")
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<q-breadcrumbs>
|
|
<q-breadcrumbs-el :to="{name: 'myFlights'}">Moje lety</q-breadcrumbs-el>
|
|
<q-breadcrumbs-el>Nový</q-breadcrumbs-el>
|
|
</q-breadcrumbs>
|
|
|
|
<!-- {{ formData }}-->
|
|
|
|
<FlightFormSteps :disabled="['copilot', 'track', 'photos', 'notes']"/>
|
|
|
|
<FlightFormBasic @save="handleSave" :aircrafts="aircrafts" :airports="airports" :locations="locations" />
|
|
|
|
</template>
|