Files
app/src/pages/profile/flightPlanner/FlightPlanEditPage.vue
T

43 lines
1.3 KiB
Vue

<script>
import {useFlightPlansStore} from "stores/FlightPlans";
export default {
preFetch({currentRoute}) {
return useFlightPlansStore().fetchDetail(currentRoute.params.id);
}
}
</script>
<script setup>
import {computed} from "vue";
import {storeToRefs} from "pinia";
const {flightPlan} = storeToRefs(useFlightPlansStore());
const flightPlanName = computed(() => flightPlan.value.name || "Nepojmenovaný plán");
const displayedTabs = computed(() => {
const tabs = [
{label: "Trasa", route: "editFlightPlan", icon: "route"},
{label: "Informace", route: "editFlightPlanInfo", icon: "info"},
{label: "Počasí", route: "editFlightPlanWeather", icon: "mdi-weather-windy"}, // TODO: jen pokud se povedlo nejake pocasi stahnout
{label: "Navigační štítek", route: "editFlightPlanNavlog", icon: "navigation"},
];
if (flightPlan.value.aircraft) {
tabs.push({label: "Let", route: "flightPlanFlight", icon: "flight"})
}
return tabs;
});
</script>
<template>
<q-tabs>
<q-route-tab v-for="tab in displayedTabs" :key="tab.route" replace exact :to="{name: tab.route, params: {id: flightPlan.id}}">
<q-icon :name="tab.icon"/>
{{ tab.label }}
</q-route-tab>
</q-tabs>
<router-view :flight-plan-name="flightPlanName" :flight-plan="flightPlan"/>
</template>