81 lines
2.1 KiB
Vue
81 lines
2.1 KiB
Vue
<script setup>
|
|
import {onMounted, watch} from "vue";
|
|
import {useAircraftsStore} from "stores/Aircrafts";
|
|
import {useRoute, useRouter} from "vue-router";
|
|
import {useQuasar} from "quasar";
|
|
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
|
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";
|
|
|
|
const aircraftId = parseInt(useRoute().params.id);
|
|
onMounted(() => {
|
|
fetchAircraft(aircraftId);
|
|
})
|
|
|
|
const $q = useQuasar();
|
|
const confirmDelete = (id) => {
|
|
$q.dialog(confirmObject('Opravdu chceš smazat toto letadlo?'))
|
|
.onOk(() => {
|
|
useAircraftsStore().delete(id).then(() => {
|
|
useRouter().push({name: "aircrafts"});
|
|
$q.notify(successObject("Letadlo uspesne odstraneno"));
|
|
});
|
|
})
|
|
};
|
|
|
|
watch(aircraft, (newVal) => {
|
|
useAppStore().setPageTitle(newVal.callSign);
|
|
useAppStore().setBreadcrumbs([
|
|
{label: "Letadla", to: {name: "aircrafts"}},
|
|
{label: newVal.callSign}
|
|
])
|
|
});
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<AircraftDetailSkeleton v-if="loading || !aircraft"/>
|
|
<template v-else>
|
|
|
|
<q-card>
|
|
<q-img :src="aircraft.photoUrl"/>
|
|
|
|
<q-card-section>
|
|
<q-list>
|
|
<q-item>
|
|
Výrobce: {{ aircraft.manufacturer }}
|
|
</q-item>
|
|
|
|
<q-item>
|
|
Model: {{ aircraft.model }}
|
|
</q-item>
|
|
|
|
</q-list>
|
|
</q-card-section>
|
|
|
|
<q-card-actions align="right">
|
|
<q-btn @click="confirmDelete(aircraft.id)" icon="delete" text-color="red" rounded flat/>
|
|
|
|
</q-card-actions>
|
|
</q-card>
|
|
|
|
|
|
|
|
|
|
<!-- <h2>Limits</h2>-->
|
|
<!-- Wind: {{ aircraft.limits.wind.frontKt }}/{{ aircraft.limits.wind.sideKt }} kt-->
|
|
<!-- Neprekrocitelna rychlost: {{ aircraft.limits.speed.vmax }}-->
|
|
<!-- Cestovni rychlost:-->
|
|
<!-- Maximalni rychlost s klapkami:-->
|
|
<!-- Padova rychlost bez klapek:-->
|
|
<!-- Padova rychlost s klapkami (plne vysunute):-->
|
|
|
|
|
|
<FAB :router-link='{name: "aircraftEdit", params: {id: aircraft.id}}' mode="edit"/>
|
|
</template>
|
|
|
|
|
|
</template>
|