Pridani letiste pro mezipristani
This commit is contained in:
@@ -44,7 +44,7 @@ const props = defineProps({
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div>
|
<div>
|
||||||
<strong>{{flight.takeoffAirport.icaoCode}}</strong> ({{ flight.takeoffAirport.name }}),
|
<strong>{{ flight.takeoffAirport.icaoCode }}</strong> ({{ flight.takeoffAirport.name }}),
|
||||||
čas vzletu: {{ formatDatetime(flight.takeoffDatetime, FORMAT_TIME) }}
|
čas vzletu: {{ formatDatetime(flight.takeoffDatetime, FORMAT_TIME) }}
|
||||||
|
|
||||||
<WeatherInfo class="q-mx-sm" v-if="flight.takeoffWeatherInfo" :weather="flight.takeoffWeatherInfo"/>
|
<WeatherInfo class="q-mx-sm" v-if="flight.takeoffWeatherInfo" :weather="flight.takeoffWeatherInfo"/>
|
||||||
@@ -54,10 +54,17 @@ const props = defineProps({
|
|||||||
|
|
||||||
<q-item v-for="poi in flight.track" :key="poi.id">
|
<q-item v-for="poi in flight.track" :key="poi.id">
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon name="place"/>
|
<q-icon name="place" v-if="poi.pointOfInterest" />
|
||||||
|
<q-icon name="local_airport" v-if="poi.airport" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
{{ poi.pointOfInterest.name }}
|
<template v-if="poi.pointOfInterest">
|
||||||
|
{{ poi.pointOfInterest.name }}
|
||||||
|
</template>
|
||||||
|
<span v-if="poi.airport">
|
||||||
|
<strong>{{ poi.airport.icaoCode }}</strong> ({{ poi.airport.name }}),
|
||||||
|
délka mezipřistání {{ minutesToHumanReadable(poi.landingDuration) }}
|
||||||
|
</span>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const mapPhotos = computed(() => flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
|
const mapPhotos = computed(() => flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
|
||||||
const poisWithGPS = computed(() => {
|
const poisWithGPS = computed(() => {
|
||||||
return flight.value.track.filter(poi => poi.pointOfInterest.gpsLatitude && poi.pointOfInterest.gpsLongitude)
|
return flight.value.track.filter(poi => poi.pointOfInterest?.gpsLatitude && poi.pointOfInterest?.gpsLongitude)
|
||||||
});
|
});
|
||||||
|
|
||||||
const pointsOfInterests = computed(() => {
|
const pointsOfInterests = computed(() => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import FormWrapper from "components/FormWrapper.vue";
|
import FormWrapper from "components/FormWrapper.vue";
|
||||||
import {onMounted, reactive, ref, watch} from "vue";
|
import {reactive, ref, watch} from "vue";
|
||||||
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
||||||
import {commonProps} from "src/composables/inputs";
|
import {commonProps} from "src/composables/inputs";
|
||||||
|
|
||||||
@@ -12,6 +12,10 @@ const props = defineProps({
|
|||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
airports: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
flight: {
|
flight: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false
|
required: false
|
||||||
@@ -27,25 +31,44 @@ const removeTrackItem = (index) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const poi = ref(null);
|
const poi = ref(null);
|
||||||
const addTrackItem = (item) => {
|
const airport = ref(null);
|
||||||
formData.track.push(item);
|
const landingDuration = ref(null);
|
||||||
|
|
||||||
|
const addTrackPOIItem = (item) => {
|
||||||
|
formData.track.push({pointOfInterest: item});
|
||||||
poi.value = null;
|
poi.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const addAirportToTrack = (airportData, duration) => {
|
||||||
|
formData.track.push({airport: airportData, landingDuration: parseInt(duration)})
|
||||||
|
airport.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
watch(poi, (newVal) => {
|
watch(poi, (newVal) => {
|
||||||
if (newVal?.name) {
|
if (newVal?.name) {
|
||||||
addTrackItem(newVal);
|
addTrackPOIItem(newVal);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
watch(() => props.flight.track, (newVal) => {
|
||||||
for (const i in props.flight.track) {
|
for (const i in newVal) {
|
||||||
const poiInfo = props.flight.track[i].pointOfInterest;
|
const trackInfo = newVal[i];
|
||||||
formData.track.push({
|
const info = {landingDuration: trackInfo.landingDuration};
|
||||||
id: poiInfo.id,
|
if (trackInfo.pointOfInterest) {
|
||||||
name: poiInfo.name
|
info['pointOfInterest'] = {
|
||||||
});
|
id: trackInfo.pointOfInterest.id,
|
||||||
|
name: trackInfo.pointOfInterest.name,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (trackInfo.airport) {
|
||||||
|
info['airport'] = {
|
||||||
|
id: trackInfo.airport.id,
|
||||||
|
name: trackInfo.airport.name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData.track.push(info);
|
||||||
}
|
}
|
||||||
});
|
}, {immediate: true});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -73,12 +96,39 @@ onMounted(() => {
|
|||||||
v-model="poi"
|
v-model="poi"
|
||||||
:key="formData.track.length"
|
:key="formData.track.length"
|
||||||
:options="locations"
|
:options="locations"
|
||||||
@select="addTrackItem"
|
@select="addTrackPOIItem"
|
||||||
clearable
|
clearable
|
||||||
label="Přidat otočný bod"
|
label="Přidat otočný bod"
|
||||||
hint="Nastav významné otočné body"
|
hint="Nastav významné otočné body"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<ComboboxInput
|
||||||
|
v-bind="commonProps"
|
||||||
|
v-model="airport"
|
||||||
|
:key="formData.track.length"
|
||||||
|
:options="airports"
|
||||||
|
clearable
|
||||||
|
label="Letiště pro mezipřistání"
|
||||||
|
hint="Nastav letiště a dobu mezispřistání"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col" v-if="airport?.name">
|
||||||
|
<q-input
|
||||||
|
type="number"
|
||||||
|
v-bind="commonProps"
|
||||||
|
v-model="landingDuration"
|
||||||
|
label="Délka mezipřistání (minuty)"
|
||||||
|
class="q-mx-md"
|
||||||
|
>
|
||||||
|
<template #after>
|
||||||
|
<q-btn @click="addAirportToTrack(airport, landingDuration)" color="primary" icon="add"></q-btn>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<q-list bordered>
|
<q-list bordered>
|
||||||
<q-item-label header>Trasa</q-item-label>
|
<q-item-label header>Trasa</q-item-label>
|
||||||
<q-item>
|
<q-item>
|
||||||
@@ -95,13 +145,16 @@ onMounted(() => {
|
|||||||
<q-avatar size="32px" color="secondary" text-color="white">{{ index + 1 }}.</q-avatar>
|
<q-avatar size="32px" color="secondary" text-color="white">{{ index + 1 }}.</q-avatar>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<span>
|
<span v-if="item.pointOfInterest">
|
||||||
{{ item.name }}
|
{{ item.pointOfInterest.name }}
|
||||||
|
|
||||||
<q-badge color="green" v-if="!item.id">
|
<q-badge color="green" v-if="!item.pointOfInterest.id">
|
||||||
<q-icon name="add"/>
|
<q-icon name="add"/>
|
||||||
</q-badge>
|
</q-badge>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="item.airport">
|
||||||
|
{{ item.airport.name }}, mezipřistání: {{ item.landingDuration }} minut
|
||||||
|
</span>
|
||||||
|
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section top side>
|
<q-item-section top side>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const flightName = (flight) => {
|
|||||||
if (flight.name !== '') {
|
if (flight.name !== '') {
|
||||||
return `${flight.name} (${date})`
|
return `${flight.name} (${date})`
|
||||||
} else {
|
} else {
|
||||||
const track = flight.track ? flight.track.map(t => t.pointOfInterest.name) : [];
|
const track = flight.track ? flight.track.map(t => t.pointOfInterest?.name || t.airport?.icaoCode) : [];
|
||||||
const trackStr = track.length > 0 ? ` - ${track.join(" - ")} - ` : ' - ';
|
const trackStr = track.length > 0 ? ` - ${track.join(" - ")} - ` : ' - ';
|
||||||
|
|
||||||
return `${flight.takeoffAirport.icaoCode} ${trackStr} ${flight.landingAirport.icaoCode} (${date})`;
|
return `${flight.takeoffAirport.icaoCode} ${trackStr} ${flight.landingAirport.icaoCode} (${date})`;
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ fragment flightFullInfo on Flight {
|
|||||||
pointOfInterest {
|
pointOfInterest {
|
||||||
...pointOfInterestFullInfo
|
...pointOfInterestFullInfo
|
||||||
}
|
}
|
||||||
|
airport {
|
||||||
|
...airportInfo
|
||||||
|
}
|
||||||
|
landingDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
landingAirport {
|
landingAirport {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ fragment flightListInfo on Flight {
|
|||||||
pointOfInterest {
|
pointOfInterest {
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
airport {
|
||||||
|
icaoCode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event {
|
event {
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ const rotatePhotos = ({photos, angle}) => {
|
|||||||
v-if="locations"
|
v-if="locations"
|
||||||
:flight="flight"
|
:flight="flight"
|
||||||
:locations="locations"
|
:locations="locations"
|
||||||
|
:airports="airports"
|
||||||
@save="handleFlightEdit"
|
@save="handleFlightEdit"
|
||||||
/>
|
/>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|||||||
Reference in New Issue
Block a user