INIT commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<script setup>
|
||||
import {computed, onMounted, reactive, ref} from "vue";
|
||||
import {useAircraftsStore} from "stores/Aircrafts";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import {storeToRefs} from "pinia";
|
||||
import {useQuasar} from "quasar";
|
||||
|
||||
const aircraftStore = useAircraftsStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const aircraftId = computed(() => parseInt(route.params.id));
|
||||
let loading = ref(false);
|
||||
let aircraft = reactive({});
|
||||
onMounted(() => {
|
||||
loading.value = true;
|
||||
aircraftStore.fetchDetail(aircraftId.value)
|
||||
.then(respAircraft => aircraft = respAircraft)
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
})
|
||||
|
||||
const $q = useQuasar();
|
||||
const confirmDelete = (id) => {
|
||||
$q.dialog({
|
||||
title: 'Potvrzení',
|
||||
message: 'Opravdu chceš smazat toto letadlo?',
|
||||
cancel: true,
|
||||
persistent: true
|
||||
}).onOk(() => {
|
||||
aircraftStore.delete(id).then(() => {
|
||||
router.push({name: "aircrafts"});
|
||||
$q.notify({message: "Letadlo uspesne odstraneno", position: "top", color: "positive"});
|
||||
});
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-skeleton v-if="loading && aircraft"/>
|
||||
<template v-else>
|
||||
<q-breadcrumbs>
|
||||
<q-breadcrumbs-el :to="{name: 'aircrafts'}">Letadla</q-breadcrumbs-el>
|
||||
<q-breadcrumbs-el>{{ aircraft.name }}</q-breadcrumbs-el>
|
||||
</q-breadcrumbs>
|
||||
|
||||
<h1>{{ aircraft.name }}</h1>
|
||||
|
||||
<q-list>
|
||||
<q-item>
|
||||
Výrobce: {{ aircraft.manufacturer }}
|
||||
</q-item>
|
||||
|
||||
<q-item>
|
||||
Model: {{ aircraft.model }}
|
||||
</q-item>
|
||||
|
||||
</q-list>
|
||||
<q-btn :to='{name: "aircraftEdit", params: {id: aircraft.id}}'>Edit {{ aircraft.id }}</q-btn>
|
||||
<q-btn @click="confirmDelete(aircraft.id)">Delete</q-btn>
|
||||
|
||||
<!-- <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):-->
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user