composables, mazani letu, skeletony
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
items: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-breadcrumbs>
|
||||||
|
<q-breadcrumbs-el v-for="item in items" :key="item.label" :to="item.to"> {{ item.label }} </q-breadcrumbs-el>
|
||||||
|
</q-breadcrumbs>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>Aircraft edit skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -34,11 +34,15 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormWrapper v-model="formData">
|
<FormWrapper v-model="formData" :is-request-pending="isRequestPending">
|
||||||
<q-input type="text" :rules="rules.callSign" v-model="formData.callSign" label="Volací značka"/>
|
<q-input type="text" :rules="rules.callSign" v-model="formData.callSign" label="Volací značka"/>
|
||||||
<q-input type="text" v-model="formData.model" label="Model"/>
|
<q-input type="text" v-model="formData.model" label="Model"/>
|
||||||
<q-input type="text" v-model="formData.manufacturer" label="Výrobce"/>
|
<q-input type="text" v-model="formData.manufacturer" label="Výrobce"/>
|
||||||
<q-input type="textarea" v-model="formData.description" label="Popis" />
|
<q-input type="textarea" v-model="formData.description" label="Popis" />
|
||||||
<q-file v-model="formData.photo" label="Avatar" />
|
|
||||||
|
|
||||||
|
{{ props.defaultValues.photoUrl }}
|
||||||
|
<q-img :src="props.defaultValues.photoUrl" v-if="props.defaultValues.photoUrl" />
|
||||||
|
<q-file v-model="formData.photo" label="Fotografie" />
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
items: {
|
items: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useAppStore().setPageTitle("Letadla");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>Copilot skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>Copilot skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>Copilot skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
items: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-list bordered separator>
|
||||||
|
<q-item clickable v-ripple v-for="pilot of items" :key="pilot">
|
||||||
|
<q-item-label>
|
||||||
|
<router-link :to="{name: 'pilotDetail', params: {id: pilot.id }}">
|
||||||
|
{{ pilot.name }}
|
||||||
|
</router-link>
|
||||||
|
</q-item-label>
|
||||||
|
<q-item-section>
|
||||||
|
section
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup>
|
||||||
|
import {flight} from "src/composables/objects/flight";
|
||||||
|
import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUtils";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
flight: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-list bordered separator>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="flight_takeoff"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ flight.takeoffAirport.name }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="flight_land"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ flight.landingAirport.name }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="event"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ formatDatetime(flight.takeoffDatetime) }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="thermostat"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
Clouds: few, Wind: 220/12kt, Temp: 12°C
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="schedule"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ minutesToHumanReadable(flight.durationMinCalculated) }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item v-if="!flight.solo">
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="people"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ flight.copilot.name }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</template>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const props = defineProps({});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ props }}
|
<em>Flight edit skeleton</em>
|
||||||
</template>
|
</template>
|
||||||
@@ -3,6 +3,7 @@ import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUt
|
|||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {useQuasar} from "quasar";
|
import {useQuasar} from "quasar";
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
import {flightName} from "../../composables/objects/flight";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
items: {
|
items: {
|
||||||
@@ -11,31 +12,14 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
|
||||||
const deleteFlight = (flightId) => {
|
|
||||||
$q.dialog({
|
|
||||||
title: 'Potvrzení',
|
|
||||||
message: 'Opravdu chceš smazat tento let?',
|
|
||||||
cancel: true,
|
|
||||||
persistent: true
|
|
||||||
}).onOk(() => {
|
|
||||||
useFlightsStore().deleteItem(flightId);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const totalFlightTime = computed(() => {
|
const totalFlightTime = computed(() => {
|
||||||
return props.items.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
|
return props.items.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
|
||||||
})
|
})
|
||||||
|
|
||||||
const flightName = (item) => {
|
const emit = defineEmits(["delete"]);
|
||||||
if (item.name) {
|
const deleteFlight = (flightId) => {
|
||||||
return item.name;
|
emit("delete", flightId);
|
||||||
} else {
|
|
||||||
return `${item.takeoffAirport.name} - ${item.landingAirport.name}`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -70,7 +54,6 @@ const flightName = (item) => {
|
|||||||
<q-separator/>
|
<q-separator/>
|
||||||
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<q-btn flat icon="visibility"></q-btn>
|
|
||||||
<q-btn flat icon="edit" :to="{name: 'flightEdit', params:{id: flight.id}}"></q-btn>
|
<q-btn flat icon="edit" :to="{name: 'flightEdit', params:{id: flight.id}}"></q-btn>
|
||||||
<q-btn flat icon="delete" color="red" @click="deleteFlight(flight.id)"></q-btn>
|
<q-btn flat icon="delete" color="red" @click="deleteFlight(flight.id)"></q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
|
|||||||
@@ -7,13 +7,18 @@ import FormWrapper from "components/FormWrapper.vue";
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
photo: {
|
photo: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
locations: {
|
||||||
|
type: Array
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const photoId = computed(() => props.photo?.id || null);
|
const photoId = computed(() => props.photo?.id || null);
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
name: "",
|
name: "",
|
||||||
description: ""
|
description: "",
|
||||||
|
pointOfInterestId: null,
|
||||||
|
isFlightCover: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const setup = (() => {
|
const setup = (() => {
|
||||||
@@ -29,6 +34,18 @@ const setup = (() => {
|
|||||||
<FormWrapper :save-button="false">
|
<FormWrapper :save-button="false">
|
||||||
<q-input v-model="formData.name" label="Název"/>
|
<q-input v-model="formData.name" label="Název"/>
|
||||||
<q-input type="textarea" v-model="formData.description" label="Popis"/>
|
<q-input type="textarea" v-model="formData.description" label="Popis"/>
|
||||||
|
|
||||||
|
<q-select
|
||||||
|
:options="locations"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
v-model="formData.pointOfInterestId"
|
||||||
|
label="POI"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-checkbox v-model="formData.isFlightCover" label="Úvodní fotografie k letu?" />
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</DialogWrapper>
|
</DialogWrapper>
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ const props = defineProps({
|
|||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
locations: {
|
|
||||||
type: Array,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
flight: {
|
flight: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>Tu bude mapa s GPS pointerem</div>
|
||||||
|
</template>
|
||||||
@@ -41,6 +41,7 @@ const openDetail = (photo) => {
|
|||||||
</q-img>
|
</q-img>
|
||||||
|
|
||||||
<q-card-actions v-if="showActions">
|
<q-card-actions v-if="showActions">
|
||||||
|
{{ photo.isFlightCover ? 'ano' : 'ne' }}
|
||||||
<q-btn flat icon="edit" color="blue" @click="openEdit(photo)"></q-btn>
|
<q-btn flat icon="edit" color="blue" @click="openEdit(photo)"></q-btn>
|
||||||
<q-btn flat icon="delete" color="red" @click="deletePhoto(photo.id)"></q-btn>
|
<q-btn flat icon="delete" color="red" @click="deletePhoto(photo.id)"></q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>POI detail skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<script setup>
|
||||||
|
import FormWrapper from "components/FormWrapper.vue";
|
||||||
|
import {onMounted, reactive} from "vue";
|
||||||
|
import {setDefaultData} from "src/composables/form/formHandling";
|
||||||
|
import MapGPSInput from "components/inputs/MapGPSInput.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
poi: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const formData = reactive({
|
||||||
|
name: null,
|
||||||
|
isPublic: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setDefaultData(formData, props.poi)
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FormWrapper v-model="formData">
|
||||||
|
|
||||||
|
<q-input v-model="formData.name" label="Jméno" />
|
||||||
|
<q-checkbox v-model="formData.isPublic" label="Veřejný?" />
|
||||||
|
|
||||||
|
<MapGPSInput />
|
||||||
|
|
||||||
|
</FormWrapper>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<script setup>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>POI edit skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<script setup>
|
||||||
|
import {pointsOfInterest} from "src/composables/objects/poi";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
items: {
|
||||||
|
type: Array,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<q-list bordered separator>
|
||||||
|
<q-item clickable v-ripple v-for="poi of items" :key="poi">
|
||||||
|
<q-item-section>
|
||||||
|
<router-link :to="{name: 'poiDetail', params: {id: poi.id}}">
|
||||||
|
{{ poi.name }}
|
||||||
|
</router-link>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<em>POI list skeleton</em>
|
||||||
|
</template>
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
|
||||||
|
|
||||||
export const flightName = (flight) => {
|
|
||||||
const date = formatDatetime(flight.takeoffDatetime, FORMAT_DATE);
|
|
||||||
if (flight.name !== '') {
|
|
||||||
return `${flight.name} (${date})`
|
|
||||||
} else {
|
|
||||||
return `${flight.takeoffAirport.icaoCode} - ${flight.takeoffAirport.icaoCode} (${date})`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
|
||||||
|
export const loading = ref(true);
|
||||||
|
|
||||||
|
export const aircraft = ref(null);
|
||||||
|
|
||||||
|
export const fetchAircraft = (aircraftId) => {
|
||||||
|
loading.value = true;
|
||||||
|
useAircraftsStore().fetchDetail(aircraftId).then((data) => {
|
||||||
|
aircraft.value = data;
|
||||||
|
}).catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
}).finally(() => loading.value = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const aircrafts = storeToRefs(useAircraftsStore()).items;
|
||||||
|
export const fetchAircrafts = () => {
|
||||||
|
loading.value = true;
|
||||||
|
useAircraftsStore().fetch().finally(() => loading.value = false);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import {ref} from "vue";
|
||||||
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
|
||||||
|
export const loading = ref(true);
|
||||||
|
export const copilot = ref(null);
|
||||||
|
export const fetchCopilot = (copilotId) => {
|
||||||
|
loading.value = true;
|
||||||
|
useCopilotsStore().fetchDetail(parseInt(copilotId))
|
||||||
|
.then(resp => copilot.value = resp)
|
||||||
|
.finally(() => loading.value = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const copilots = storeToRefs(useCopilotsStore()).items;
|
||||||
|
export const fetchCopilots = () => {
|
||||||
|
loading.value = true;
|
||||||
|
useCopilotsStore().fetch().finally(() => loading.value = false);
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
||||||
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
import {confirmObject} from "src/composables/dialog";
|
||||||
|
|
||||||
|
export const flightName = (flight) => {
|
||||||
|
const date = formatDatetime(flight.takeoffDatetime, FORMAT_DATE);
|
||||||
|
if (flight.name !== '') {
|
||||||
|
return `${flight.name} (${date})`
|
||||||
|
} else {
|
||||||
|
return `${flight.takeoffAirport.icaoCode} - ${flight.takeoffAirport.icaoCode} (${date})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const loading = ref(true);
|
||||||
|
export const flight = ref(null);
|
||||||
|
export const fetchFlight = (flightId) => {
|
||||||
|
loading.value = true;
|
||||||
|
useFlightsStore().fetchDetail(parseInt(flightId))
|
||||||
|
.then(respFlight => flight.value = respFlight)
|
||||||
|
.finally(() => loading.value = false);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const flights = storeToRefs(useFlightsStore()).items;
|
||||||
|
|
||||||
|
export const fetchFlights = () => {
|
||||||
|
loading.value = true;
|
||||||
|
useFlightsStore().fetch().finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const handleDeleteFlight = ($q, flightId, onOkCallback = () => {}) => {
|
||||||
|
$q.dialog(confirmObject(`Opravdu chceš smazat tento let?`))
|
||||||
|
.onOk(() => {
|
||||||
|
useFlightsStore().delete(flightId).then(onOkCallback);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import {ref} from "vue";
|
||||||
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
|
||||||
|
export const loading = ref(true);
|
||||||
|
export const poi = ref(null);
|
||||||
|
export const fetchPoi = (poiId) => {
|
||||||
|
loading.value = true;
|
||||||
|
usePointsOfInterestStore().fetchDetail(poiId)
|
||||||
|
.then(data => poi.value = data)
|
||||||
|
.finally(() => loading.value = false);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const pointsOfInterest = storeToRefs(usePointsOfInterestStore()).items;
|
||||||
|
export const fetchPOIList = () => {
|
||||||
|
loading.value = true;
|
||||||
|
usePointsOfInterestStore().fetch().finally(() => loading.value = false);
|
||||||
|
}
|
||||||
@@ -8,4 +8,7 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
|
|||||||
filename
|
filename
|
||||||
name
|
name
|
||||||
description
|
description
|
||||||
|
flightId
|
||||||
|
pointOfInterestId
|
||||||
|
isFlightCover
|
||||||
}`;
|
}`;
|
||||||
|
|||||||
@@ -6,3 +6,19 @@ fragment pointOfInterestListInfo on PointOfInterest {
|
|||||||
name
|
name
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const FRAGMENT_POI_FULL_INFO = gql`
|
||||||
|
fragment pointOfInterestFullInfo on PointOfInterest {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isPublic
|
||||||
|
gpsLatitude
|
||||||
|
gpsLongitude
|
||||||
|
photos {
|
||||||
|
thumbnailUrl
|
||||||
|
url
|
||||||
|
name
|
||||||
|
description
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -20,3 +20,12 @@ mutation editFlight($id: Int!, $input: EditFlightInput!) {
|
|||||||
|
|
||||||
${FRAGMENT_FLIGHT_FULL_INFO}
|
${FRAGMENT_FLIGHT_FULL_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
export const DELETE_FLIGHT = gql`
|
||||||
|
mutation deleteFlight($id: Int!) {
|
||||||
|
deleteFlight(id: $id) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
||||||
|
|
||||||
export const CREATE_POI = gql`
|
export const CREATE_POI = gql`
|
||||||
mutation createPointOfInterest($input: CreatePointOfInterestInput!) {
|
mutation createPointOfInterest($input: CreatePointOfInterestInput!) {
|
||||||
createPointOfInterest(input: $input) {
|
createPointOfInterest(input: $input) {
|
||||||
...pointOfInterestListInfo
|
...pointOfInterestFullInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_POI_LIST_INFO}
|
${FRAGMENT_POI_FULL_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const EDIT_POI = gql`
|
||||||
|
mutation editPointOfInterest($id: Int!, $input: EditPointOfInterestInput!) {
|
||||||
|
editPointOfInterest(id: $id, input: $input) {
|
||||||
|
...pointOfInterestFullInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_POI_FULL_INFO}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -8,3 +8,12 @@ query copilotsList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const COPILOTS_DETAIL = gql`
|
||||||
|
query copilot($id: Int!) {
|
||||||
|
copilot(id: $id) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
||||||
|
|
||||||
export const POI_LIST = gql`
|
export const POI_LIST = gql`
|
||||||
query poiList {
|
query poiList {
|
||||||
@@ -10,3 +10,13 @@ query poiList {
|
|||||||
|
|
||||||
${FRAGMENT_POI_LIST_INFO}
|
${FRAGMENT_POI_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const POI_DETAIL = gql`
|
||||||
|
query poiDetail($id: Int!) {
|
||||||
|
pointOfInterest(id: $id) {
|
||||||
|
...pointOfInterestFullInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_POI_FULL_INFO}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<q-toolbar-title>
|
<q-toolbar-title>
|
||||||
Polétání.cz
|
{{ app.pageTitle.value || "Polétání.cz"}}
|
||||||
</q-toolbar-title>
|
</q-toolbar-title>
|
||||||
|
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
@@ -47,22 +47,21 @@
|
|||||||
</q-drawer>
|
</q-drawer>
|
||||||
|
|
||||||
<q-page-container class="q-px-md">
|
<q-page-container class="q-px-md">
|
||||||
|
<BreadcrumbsNavigation :items="app.breadcrumbs.value" />
|
||||||
<router-view/>
|
<router-view/>
|
||||||
</q-page-container>
|
</q-page-container>
|
||||||
</q-layout>
|
</q-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {computed, onMounted, ref} from 'vue'
|
import {onMounted, ref} from 'vue'
|
||||||
import NavigationButton from "../components/navigation/NavigationButton.vue";
|
import NavigationButton from "../components/navigation/NavigationButton.vue";
|
||||||
import {useMeta} from "quasar";
|
|
||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
import BreadcrumbsNavigation from "components/BreadcrumbsNavigation.vue";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
|
||||||
const metadata = {
|
const app = storeToRefs(useAppStore());
|
||||||
titleTemplate: title => `${title} - Polétání.cz`,
|
|
||||||
}
|
|
||||||
useMeta(metadata);
|
|
||||||
|
|
||||||
const linksList = [
|
const linksList = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,50 +1,47 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {computed, onMounted, reactive, ref} from "vue";
|
import {onMounted, watch} from "vue";
|
||||||
import {useAircraftsStore} from "stores/Aircrafts";
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {useQuasar} from "quasar";
|
import {useQuasar} from "quasar";
|
||||||
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
||||||
import {confirmObject} from "src/composables/dialog";
|
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 aircraftStore = useAircraftsStore();
|
const aircraftId = parseInt(useRoute().params.id);
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const aircraftId = computed(() => parseInt(route.params.id));
|
|
||||||
const loading = ref(false);
|
|
||||||
let aircraft = reactive({});
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loading.value = true;
|
fetchAircraft(aircraftId);
|
||||||
aircraftStore.fetchDetail(aircraftId.value)
|
|
||||||
.then(respAircraft => aircraft = respAircraft)
|
|
||||||
.finally(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const confirmDelete = (id) => {
|
const confirmDelete = (id) => {
|
||||||
$q.dialog(confirmObject('Opravdu chceš smazat toto letadlo?'))
|
$q.dialog(confirmObject('Opravdu chceš smazat toto letadlo?'))
|
||||||
.onOk(() => {
|
.onOk(() => {
|
||||||
aircraftStore.delete(id).then(() => {
|
useAircraftsStore().delete(id).then(() => {
|
||||||
router.push({name: "aircrafts"});
|
useRouter().push({name: "aircrafts"});
|
||||||
$q.notify({message: "Letadlo uspesne odstraneno", position: "top", color: "positive"});
|
$q.notify(successObject("Letadlo uspesne odstraneno"));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(aircraft, (newVal) => {
|
||||||
|
useAppStore().setPageTitle(newVal.callSign);
|
||||||
|
useAppStore().setBreadcrumbs([
|
||||||
|
{label: "Letadla", to: {name: "aircrafts"}},
|
||||||
|
{label: newVal.callSign}
|
||||||
|
])
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AircraftDetailSkeleton v-if="loading && aircraft"/>
|
<AircraftDetailSkeleton v-if="loading || !aircraft"/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<q-breadcrumbs>
|
|
||||||
<q-breadcrumbs-el :to="{name: 'aircrafts'}">Letadla</q-breadcrumbs-el>
|
|
||||||
<q-breadcrumbs-el>{{ aircraft.callSign }}</q-breadcrumbs-el>
|
|
||||||
</q-breadcrumbs>
|
|
||||||
|
|
||||||
<h1>{{ aircraft.callSign }}</h1>
|
<h1>{{ aircraft.callSign }}</h1>
|
||||||
|
|
||||||
{{ aircraft.photoUrl }}
|
<q-img :src="aircraft.photoUrl"/>
|
||||||
|
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item>
|
<q-item>
|
||||||
@@ -56,7 +53,6 @@ const confirmDelete = (id) => {
|
|||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
</q-list>
|
</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>
|
<q-btn @click="confirmDelete(aircraft.id)">Delete</q-btn>
|
||||||
|
|
||||||
<!-- <h2>Limits</h2>-->
|
<!-- <h2>Limits</h2>-->
|
||||||
@@ -67,6 +63,8 @@ const confirmDelete = (id) => {
|
|||||||
<!-- Padova rychlost bez klapek:-->
|
<!-- Padova rychlost bez klapek:-->
|
||||||
<!-- Padova rychlost s klapkami (plne vysunute):-->
|
<!-- Padova rychlost s klapkami (plne vysunute):-->
|
||||||
|
|
||||||
|
|
||||||
|
<FAB :router-link='{name: "aircraftEdit", params: {id: aircraft.id}}' mode="edit"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<script setup>
|
||||||
|
import {useRoute} from "vue-router";
|
||||||
|
import {computed, onMounted} from "vue";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
import {minutesToHumanReadable} from "src/composables/datetimeUtils";
|
||||||
|
import {copilot, fetchCopilot, loading} from "src/composables/objects/copilot";
|
||||||
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
import CopilotDetailSkeleton from "components/copilots/CopilotDetailSkeleton.vue";
|
||||||
|
|
||||||
|
const copilotId = parseInt(useRoute().params.copilotId);
|
||||||
|
onMounted(() => {
|
||||||
|
useFlightsStore().fetch();
|
||||||
|
fetchCopilot(copilotId);
|
||||||
|
})
|
||||||
|
|
||||||
|
const flights = storeToRefs(useFlightsStore()).items;
|
||||||
|
const commonFlights = computed(() => flights.value.filter(f => f.secondPilot.id === copilot.id))
|
||||||
|
const totalFlightTime = computed(() => {
|
||||||
|
return commonFlights.value.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<CopilotDetailSkeleton v-if="loading || !copilot"/>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<q-breadcrumbs>
|
||||||
|
<q-breadcrumbs-el :to="{name: 'pilots'}">Pilots</q-breadcrumbs-el>
|
||||||
|
<q-breadcrumbs-el>{{ copilot.name }}</q-breadcrumbs-el>
|
||||||
|
</q-breadcrumbs>
|
||||||
|
|
||||||
|
<h1>{{ copilot.name }}</h1>
|
||||||
|
|
||||||
|
Flights:
|
||||||
|
{{ commonFlights }}
|
||||||
|
|
||||||
|
Total time together: {{ minutesToHumanReadable(totalFlightTime) }}
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
@@ -1,41 +1,71 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {useRoute} from "vue-router";
|
import {onMounted, watch} from "vue";
|
||||||
import {onMounted, reactive, ref} from "vue";
|
|
||||||
import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUtils";
|
|
||||||
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
||||||
import FAB from "components/FAB.vue";
|
import {fetchFlight, flight, flightName, handleDeleteFlight, loading} from "src/composables/objects/flight";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
import PhotosList from "components/photos/PhotosList.vue";
|
||||||
|
import FlightBasicInfo from "components/flights/FlightBasicInfo.vue";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
import {successObject} from "src/composables/dialog";
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const $router = useRouter();
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const loading = ref(false)
|
|
||||||
let flight = reactive({});
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loading.value = true;
|
fetchFlight(useRoute().params.id)
|
||||||
useFlightsStore().fetchDetail(parseInt(route.params.id))
|
|
||||||
.then(respFlight => flight = respFlight)
|
|
||||||
.finally(() => loading.value = false);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(flight, (newVal) => {
|
||||||
|
const flightNameFormatted = flightName(newVal);
|
||||||
|
useAppStore().setPageTitle(flightNameFormatted);
|
||||||
|
useAppStore().setBreadcrumbs([
|
||||||
|
{to: {name: "myFlights"}, label: "Moje lety"},
|
||||||
|
{label: flightNameFormatted}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDeleteAndRedirect = () => {
|
||||||
|
const flightId = flight.value.id;
|
||||||
|
|
||||||
|
handleDeleteFlight($q, flightId, (flight) => {
|
||||||
|
$router.push({name: "myFlights"});
|
||||||
|
$q.notify(successObject(`Úspěšně smazáno`));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FlightDetailSkeleton v-if="loading || Object.keys(flight).length === 0"/>
|
<FlightDetailSkeleton v-if="loading || !flight"/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<h1>{{ flight.name }}</h1>
|
<q-card class="q-mx-md q-my-md">
|
||||||
<h2>{{ flight.takeoffAirport.name }} - {{ flight.landingAirport.name }}</h2>
|
<q-parallax
|
||||||
|
:src="flight.coverPhoto.url"
|
||||||
|
v-if="flight.coverPhoto"
|
||||||
|
:height="450"
|
||||||
|
/>
|
||||||
|
|
||||||
<article v-html="flight.description" />
|
<q-card-section>
|
||||||
|
<FlightBasicInfo :flight="flight"/>
|
||||||
|
|
||||||
<q-icon name="calendar"/>
|
<article v-html="flight.description"/>
|
||||||
{{ formatDatetime(flight.takeoffDatetime) }}
|
|
||||||
{{ minutesToHumanReadable(flight.durationMinCalculated) }}
|
|
||||||
|
|
||||||
<!-- <q-icon name="weather"/>-->
|
<ul>
|
||||||
<!-- Clouds: few-->
|
<li v-for="poi in flight.track" :key="poi.pointOfInterest.id">
|
||||||
<!-- Wind: 220/12kt-->
|
{{ poi.pointOfInterest.name }}
|
||||||
<!-- Temp: 12°C-->
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<PhotosList :photos="flight.photos" :show-actions="false"/>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
<FAB mode="edit" :router-link="{name: 'flightEdit', params:{id: flight.id}}"/>
|
<q-card-actions align="right">
|
||||||
|
<q-btn @click="handleDeleteAndRedirect" icon="delete" rounded flat text-color="red"/>
|
||||||
|
<q-btn :to="{name: 'flightEdit', params:{id: flight.id}}" icon="edit" rounded flat text-color="primary"/>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-card>
|
||||||
|
<!-- <FAB mode="edit" :router-link=""/>-->
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,24 +1,28 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
import {onMounted} from "vue";
|
||||||
import {computed, onMounted} from "vue";
|
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
|
import POIDetailSkeleton from "components/poi/POIDetailSkeleton.vue";
|
||||||
const route = useRoute();
|
import FAB from "components/FAB.vue";
|
||||||
const poiId = route.params.id;
|
import {fetchPoi, loading, poi} from "src/composables/objects/poi";
|
||||||
const poiStore = usePointsOfInterestStore();
|
import {flight} from "src/composables/objects/flight";
|
||||||
|
import PhotosList from "components/photos/PhotosList.vue";
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
poiStore.fetchDetail(poiId);
|
fetchPoi(useRoute().params.id);
|
||||||
})
|
})
|
||||||
|
|
||||||
const poi = computed(() => poiStore.getDetail(poiId));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>{{ poi.name }}</h1>
|
<POIDetailSkeleton v-if="loading || !poi"/>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<h1>{{ poi.name }}</h1>
|
||||||
|
|
||||||
|
<PhotosList
|
||||||
|
:photos="poi.photos"
|
||||||
|
:show-actions="false"
|
||||||
|
/>
|
||||||
|
<FAB :router-link="{name: 'poiEdit', params:{id: poi.id}}" mode="edit"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<q-page-sticky position="bottom-right" :offset="[30, 30]">
|
|
||||||
<q-fab icon="edit" label="Edit"/>
|
|
||||||
</q-page-sticky>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -3,45 +3,41 @@ import AircraftForm from "components/aircrafts/AircraftForm.vue";
|
|||||||
import {useAircraftsStore} from "stores/Aircrafts";
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {useQuasar} from "quasar";
|
import {useQuasar} from "quasar";
|
||||||
import {onMounted, reactive, ref} from "vue";
|
import {onMounted, ref} from "vue";
|
||||||
|
import AircraftEditSkeleton from "components/aircrafts/AircraftEditSkeleton.vue";
|
||||||
|
import {successObject} from "src/composables/dialog";
|
||||||
|
import {aircraft, fetchAircraft, loading} from "src/composables/objects/aircraft";
|
||||||
|
|
||||||
|
|
||||||
let isRequestPending = ref(false);
|
let isRequestPending = ref(false);
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const aircraftId = parseInt(useRoute().params.id);
|
const aircraftId = parseInt(useRoute().params.id);
|
||||||
|
|
||||||
const handleSave = (formData) => {
|
const handleSave = (formData) => {
|
||||||
isRequestPending.value = true;
|
isRequestPending.value = true;
|
||||||
useAircraftsStore().update(aircraftId, formData).then(() => {
|
useAircraftsStore().update(aircraftId, formData).then(() => {
|
||||||
$q.notify({message: "Letadlo uspesne upraveno", position: "top", color: "positive"});
|
$q.notify(successObject("Letadlo uspesne upraveno"));
|
||||||
|
|
||||||
router.push({name: "aircrafts"});
|
useRouter().push({name: "aircrafts"});
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
isRequestPending.value = true;
|
isRequestPending.value = true;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let loadedAircraft = ref(null);
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
useAircraftsStore().fetchDetail(aircraftId).then((data) => {
|
fetchAircraft(aircraftId)
|
||||||
loadedAircraft.value = data;
|
|
||||||
}).catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-skeleton v-if="!loadedAircraft"/>
|
<AircraftEditSkeleton v-if="loading"/>
|
||||||
|
|
||||||
<template v-if="loadedAircraft">
|
<template v-else>
|
||||||
<h1>Editace letadla {{ loadedAircraft.callSign }}</h1>
|
<h1>Editace letadla {{ aircraft.callSign }}</h1>
|
||||||
|
|
||||||
<AircraftForm
|
<AircraftForm
|
||||||
@save="handleSave"
|
@save="handleSave"
|
||||||
:default-values="loadedAircraft"
|
:default-values="aircraft"
|
||||||
:is-request-pending="isRequestPending"
|
:is-request-pending="isRequestPending"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+1
-10
@@ -25,16 +25,7 @@ const totalFlightTime = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-breadcrumbs>
|
|
||||||
<q-breadcrumbs-el :to="{name: 'pilots'}">Pilots</q-breadcrumbs-el>
|
|
||||||
<q-breadcrumbs-el>{{secondPilot.name}}</q-breadcrumbs-el>
|
|
||||||
</q-breadcrumbs>
|
|
||||||
|
|
||||||
<h1>{{secondPilot.name}}</h1>
|
Editace copilota
|
||||||
|
|
||||||
Flights:
|
|
||||||
{{ commonFlights }}
|
|
||||||
|
|
||||||
Total time together: {{minutesToHumanReadable(totalFlightTime)}}
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
+5
-12
@@ -9,7 +9,7 @@ import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
|||||||
import {useAirportsStore} from "stores/Airports";
|
import {useAirportsStore} from "stores/Airports";
|
||||||
import {useMeta, useQuasar} from "quasar";
|
import {useMeta, useQuasar} from "quasar";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {flightName} from "src/composables/flight";
|
import {flightName} from "src/composables/objects/flight";
|
||||||
import FlightFormCopilot from "components/flights/form/FlightFormCopilot.vue";
|
import FlightFormCopilot from "components/flights/form/FlightFormCopilot.vue";
|
||||||
import {useCopilotsStore} from "stores/Copilots";
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
import FlightFormNotes from "components/flights/form/FlightFormNotes.vue";
|
import FlightFormNotes from "components/flights/form/FlightFormNotes.vue";
|
||||||
@@ -19,6 +19,8 @@ import PhotosList from "components/photos/PhotosList.vue";
|
|||||||
import {confirmObject, successObject} from "src/composables/dialog";
|
import {confirmObject, successObject} from "src/composables/dialog";
|
||||||
import PhotoForm from "components/flights/PhotoForm.vue";
|
import PhotoForm from "components/flights/PhotoForm.vue";
|
||||||
import FlightFormTrack from "components/flights/form/FlightFormTrack.vue";
|
import FlightFormTrack from "components/flights/form/FlightFormTrack.vue";
|
||||||
|
import {fetchFlight, flight, loading} from "src/composables/objects/flight";
|
||||||
|
import FlightEditSkeleton from "components/flights/FlightEditSkeleton.vue";
|
||||||
|
|
||||||
useMeta({title: "Editace letu"});
|
useMeta({title: "Editace letu"});
|
||||||
|
|
||||||
@@ -31,17 +33,8 @@ const locations = storeToRefs(usePointsOfInterestStore()).items;
|
|||||||
const airports = storeToRefs(useAirportsStore()).items;
|
const airports = storeToRefs(useAirportsStore()).items;
|
||||||
const copilots = storeToRefs(useCopilotsStore()).items;
|
const copilots = storeToRefs(useCopilotsStore()).items;
|
||||||
|
|
||||||
let flight = ref({});
|
|
||||||
const disabledSteps = computed(() => flight.value.solo ? ["copilot"] : [flight.value.solo]);
|
const disabledSteps = computed(() => flight.value.solo ? ["copilot"] : [flight.value.solo]);
|
||||||
|
|
||||||
const loading = ref(false);
|
|
||||||
const fetchFlight = (flightId) => {
|
|
||||||
loading.value = true;
|
|
||||||
useFlightsStore().fetchDetail(flightId)
|
|
||||||
.then(f => flight.value = f)
|
|
||||||
.finally(() => loading.value = false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const formStep = ref("");
|
const formStep = ref("");
|
||||||
watch(() => route.params.step, (val) => formStep.value = val);
|
watch(() => route.params.step, (val) => formStep.value = val);
|
||||||
|
|
||||||
@@ -104,7 +97,7 @@ const openPhotoEdit = (photo) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="loading">loading</div>
|
<FlightEditSkeleton v-if="loading" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<q-breadcrumbs :key="loading">
|
<q-breadcrumbs :key="loading">
|
||||||
@@ -145,7 +138,7 @@ const openPhotoEdit = (photo) => {
|
|||||||
@edit="openPhotoEdit"
|
@edit="openPhotoEdit"
|
||||||
@delete="confirmPhotoDelete"
|
@delete="confirmPhotoDelete"
|
||||||
/>
|
/>
|
||||||
<PhotoForm v-model="openEdit" :photo="editPhoto" @save="handlePhotoUpdate"/>
|
<PhotoForm v-model="openEdit" :locations="locations" :photo="editPhoto" @save="handlePhotoUpdate"/>
|
||||||
|
|
||||||
<FlightFormPhotos
|
<FlightFormPhotos
|
||||||
:flight="flight"
|
:flight="flight"
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<script setup>
|
||||||
|
import POIEditSkeleton from "components/poi/POIEditSkeleton.vue";
|
||||||
|
import {fetchPoi, loading, poi} from "src/composables/objects/poi";
|
||||||
|
import {onMounted} from "vue";
|
||||||
|
import {useRoute} from "vue-router";
|
||||||
|
import POIEditForm from "components/poi/POIEditForm.vue";
|
||||||
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
|
|
||||||
|
const poiId = parseInt(useRoute().params.id);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchPoi(poiId)
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleSave = (data) => {
|
||||||
|
usePointsOfInterestStore().update(poiId, data).then(respData => {
|
||||||
|
console.log(respData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<POIEditSkeleton v-if="loading" />
|
||||||
|
|
||||||
|
<POIEditForm :poi="poi" v-else @save="handleSave"/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup>
|
||||||
|
import AircraftForm from "components/aircrafts/AircraftForm.vue";
|
||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
import {useRouter} from "vue-router";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
import {ref} from "vue";
|
||||||
|
|
||||||
|
let isRequestPending = ref(false);
|
||||||
|
const $q = useQuasar();
|
||||||
|
const router = useRouter();
|
||||||
|
const handleSave = (formData) => {
|
||||||
|
isRequestPending.value = true;
|
||||||
|
useAircraftsStore().create(formData).then(() => {
|
||||||
|
$q.notify({message: "Letadlo úspěšně vytvořeno", position: "top", color: "positive"});
|
||||||
|
|
||||||
|
router.push({name: "aircrafts"});
|
||||||
|
}).finally(() => {
|
||||||
|
isRequestPending.value = true;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AircraftForm @save="handleSave" :is-request-pending="isRequestPending"/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup>
|
||||||
|
import AircraftForm from "components/aircrafts/AircraftForm.vue";
|
||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
import {useRouter} from "vue-router";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
import {ref} from "vue";
|
||||||
|
|
||||||
|
let isRequestPending = ref(false);
|
||||||
|
const $q = useQuasar();
|
||||||
|
const router = useRouter();
|
||||||
|
const handleSave = (formData) => {
|
||||||
|
isRequestPending.value = true;
|
||||||
|
useAircraftsStore().create(formData).then(() => {
|
||||||
|
$q.notify({message: "Letadlo úspěšně vytvořeno", position: "top", color: "positive"});
|
||||||
|
|
||||||
|
router.push({name: "aircrafts"});
|
||||||
|
}).finally(() => {
|
||||||
|
isRequestPending.value = true;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AircraftForm @save="handleSave" :is-request-pending="isRequestPending"/>
|
||||||
|
</template>
|
||||||
@@ -1,28 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {useAircraftsStore} from "stores/Aircrafts";
|
import {onMounted} from "vue";
|
||||||
import {onMounted, ref} from "vue";
|
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
import AircraftsList from "components/aircrafts/AircraftsList.vue";
|
import AircraftsList from "components/aircrafts/AircraftsList.vue";
|
||||||
import AddFAB from "components/FAB.vue";
|
|
||||||
import AircraftsListSkeleton from "components/aircrafts/AircraftsListSkeleton.vue";
|
import AircraftsListSkeleton from "components/aircrafts/AircraftsListSkeleton.vue";
|
||||||
|
import {aircrafts, fetchAircrafts, loading} from "src/composables/objects/aircraft";
|
||||||
|
import FAB from "components/FAB.vue";
|
||||||
|
|
||||||
const aircraftStore = useAircraftsStore();
|
|
||||||
const aircrafts = storeToRefs(aircraftStore).items;
|
|
||||||
|
|
||||||
let loading = ref(false);
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loading.value = true
|
fetchAircrafts();
|
||||||
aircraftStore.fetch().finally(() => {
|
|
||||||
loading.value = false
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h4>Letadla</h4>
|
|
||||||
|
|
||||||
<AircraftsListSkeleton v-if="loading" />
|
<AircraftsListSkeleton v-if="loading" />
|
||||||
<AircraftsList :items="aircrafts" v-if="!loading"/>
|
|
||||||
|
|
||||||
<AddFAB mode="add" :router-link="{name: 'addAircraft'}"/>
|
<AircraftsList :items="aircrafts" v-else />
|
||||||
|
|
||||||
|
<FAB mode="add" :router-link="{name: 'addAircraft'}"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, ref} from "vue";
|
import {onMounted} from "vue";
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useQuasar} from "quasar";
|
||||||
import {useMeta} from "quasar";
|
|
||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import FAB from "components/FAB.vue";
|
||||||
import AddFAB from "components/FAB.vue";
|
import {fetchFlights, flights, handleDeleteFlight, loading} from "src/composables/objects/flight";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
|
||||||
useMeta({title: "Moje lety"});
|
const $q = useQuasar();
|
||||||
|
|
||||||
const flightsStore = useFlightsStore();
|
useAppStore().setPageTitle("Moje lety")
|
||||||
const flights = storeToRefs(flightsStore).items;
|
|
||||||
|
|
||||||
const loading = ref(false);
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loading.value = true;
|
fetchFlights();
|
||||||
flightsStore.fetch().finally(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -36,8 +30,7 @@ onMounted(() => {
|
|||||||
</q-banner>
|
</q-banner>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FlightsList :items="flights" v-else/>
|
<FlightsList v-else :items="flights" @delete="handleDeleteFlight($q, $event)" />
|
||||||
|
|
||||||
|
<FAB mode="add" :router-link="{name: 'addFlight'}"/>
|
||||||
<AddFAB mode="add" :router-link="{name: 'addFlight'}"/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,31 +1,22 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
import {onMounted} from "vue";
|
||||||
import {computed, onMounted, ref} from "vue";
|
import POIListSkeleton from "components/poi/POIListSkeleton.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {fetchPOIList, loading, pointsOfInterest} from "src/composables/objects/poi";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
const poiStore = usePointsOfInterestStore();
|
import POIList from "components/poi/POIList.vue";
|
||||||
|
import FAB from "components/FAB.vue";
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
poiStore.fetch();
|
fetchPOIList();
|
||||||
})
|
});
|
||||||
|
|
||||||
const pointsOfInterest = computed(() => poiStore.groupByTypes);
|
useAppStore().setPageTitle("Zajímavá místa")
|
||||||
const availableTypes = computed(() => Object.keys(pointsOfInterest.value));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ pointsOfInterest }}
|
<POIListSkeleton v-if="loading"/>
|
||||||
<div v-for="type of availableTypes" :key="type">
|
|
||||||
<h2>{{ poiStore.pointTypeName(type) }}</h2>
|
|
||||||
|
|
||||||
<q-list bordered separator>
|
<POIList v-else :items="pointsOfInterest"/>
|
||||||
<q-item clickable v-ripple v-for="poi of pointsOfInterest[type]" :key="poi">
|
|
||||||
<q-item-section>
|
<FAB :router-link="{name: 'addPOI'}" mode="add" />
|
||||||
<router-link :to="{name: 'poiDetail', params: {id: poi.id}}">
|
|
||||||
{{ poi.name }}
|
|
||||||
</router-link>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,29 +1,20 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
import {useCopilotsStore} from "stores/Copilots";
|
|
||||||
import {onMounted} from "vue";
|
import {onMounted} from "vue";
|
||||||
|
import CopilotListSkeleton from "components/copilots/CopilotListSkeleton.vue";
|
||||||
const pilotsStore = useCopilotsStore();
|
import {fetchCopilots, loading, copilots} from "src/composables/objects/copilot";
|
||||||
|
import CopilotsList from "components/copilots/CopilotsList.vue";
|
||||||
|
import FAB from "components/FAB.vue";
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
pilotsStore.fetch();
|
fetchCopilots();
|
||||||
})
|
})
|
||||||
|
|
||||||
const secondPilots = storeToRefs(pilotsStore).items;
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-list bordered separator>
|
<CopilotListSkeleton v-if="loading" />
|
||||||
<q-item clickable v-ripple v-for="pilot of secondPilots" :key="pilot">
|
|
||||||
<q-item-label>
|
<CopilotsList :items="copilots" />
|
||||||
<router-link :to="{name: 'pilotDetail', params: {id: pilot.id }}">
|
|
||||||
{{ pilot.name }}
|
<FAB :router-link="{name: 'addCopilot'}" mode="add" />
|
||||||
</router-link>
|
|
||||||
</q-item-label>
|
|
||||||
<q-item-section>
|
|
||||||
section
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { route } from 'quasar/wrappers'
|
|||||||
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
|
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
|
||||||
import routes from './routes'
|
import routes from './routes'
|
||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If not building with SSR mode, you can
|
* If not building with SSR mode, you can
|
||||||
@@ -32,6 +33,8 @@ export default route(function (/* { store, ssrContext } */) {
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
// const $q = useQuasar();
|
// const $q = useQuasar();
|
||||||
|
|
||||||
|
useAppStore().resetAfterRouteChange();
|
||||||
|
|
||||||
userStore.setupCredentials().then(()=>{
|
userStore.setupCredentials().then(()=>{
|
||||||
if (!userStore.user.id) {
|
if (!userStore.user.id) {
|
||||||
// console.log("neni prihlaseny")
|
// console.log("neni prihlaseny")
|
||||||
|
|||||||
@@ -18,13 +18,17 @@ const routes = [
|
|||||||
children: [
|
children: [
|
||||||
{path: '', name: "profile", component: () => import('pages/profile/ProfilePage.vue')},
|
{path: '', name: "profile", component: () => import('pages/profile/ProfilePage.vue')},
|
||||||
{path: 'my-flights', name: "myFlights", component: () => import('pages/profile/lists/FlightsPage.vue')},
|
{path: 'my-flights', name: "myFlights", component: () => import('pages/profile/lists/FlightsPage.vue')},
|
||||||
{path: 'my-flights/add', name: "addFlight", component: () => import('pages/profile/forms/FlightLogPage.vue')},
|
{path: 'my-flights/add', name: "addFlight", component: () => import('pages/profile/forms/NewFlightPage.vue')},
|
||||||
{path: 'my-flights/:id', name: "flightDetail", component: () => import('pages/profile/details/FlightDetailPage.vue')},
|
{path: 'my-flights/:id', name: "flightDetail", component: () => import('pages/profile/details/FlightDetailPage.vue')},
|
||||||
{path: 'my-flights/:id/edit/:step?', name: "flightEdit", component: () => import('pages/profile/forms/FlightEditPage.vue')},
|
{path: 'my-flights/:id/edit/:step?', name: "flightEdit", component: () => import('pages/profile/forms/EditFlightPage.vue')},
|
||||||
{path: 'poi', name: "poi", component: () => import('pages/profile/lists/PointsOfInterestPage.vue')},
|
{path: 'poi', name: "poi", component: () => import('pages/profile/lists/PointsOfInterestPage.vue')},
|
||||||
|
{path: 'poi/add', name: "addPOI", component: () => import('pages/profile/forms/NewPointOfInterestPage.vue')},
|
||||||
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/details/PointOfInterestDetailPage.vue')},
|
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/details/PointOfInterestDetailPage.vue')},
|
||||||
|
{path: 'poi/:id/edit', name: "poiEdit", component: () => import('pages/profile/forms/EditPointOfInterestPage.vue')},
|
||||||
{path: 'pilots', name: "pilots", component: () => import('pages/profile/lists/SecondPilotPage.vue')},
|
{path: 'pilots', name: "pilots", component: () => import('pages/profile/lists/SecondPilotPage.vue')},
|
||||||
{path: 'pilots/:id', name: "pilotDetail", component: () => import('pages/profile/details/SecondPilotDetailPage.vue')},
|
{path: 'pilots/add', name: "addPilots", component: () => import('pages/profile/forms/NewCopilotPage.vue')},
|
||||||
|
{path: 'pilots/:id', name: "pilotDetail", component: () => import('pages/profile/details/CopilotDetailPage.vue')},
|
||||||
|
{path: 'pilots/:id/edit', name: "pilotEdit", component: () => import('pages/profile/details/EditCopilotPage.vue')},
|
||||||
{path: 'aircrafts', name: "aircrafts", component: () => import('pages/profile/lists/AircraftsPage.vue')},
|
{path: 'aircrafts', name: "aircrafts", component: () => import('pages/profile/lists/AircraftsPage.vue')},
|
||||||
{path: 'aircrafts/new', name: "addAircraft", component: () => import('pages/profile/forms/NewAircraftsPage.vue')},
|
{path: 'aircrafts/new', name: "addAircraft", component: () => import('pages/profile/forms/NewAircraftsPage.vue')},
|
||||||
{path: 'aircrafts/:id', name: "aircraftDetail", component: () => import('pages/profile/details/AircraftDetailPage.vue')},
|
{path: 'aircrafts/:id', name: "aircraftDetail", component: () => import('pages/profile/details/AircraftDetailPage.vue')},
|
||||||
|
|||||||
+16
-5
@@ -1,14 +1,25 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {useQuasar} from "quasar";
|
import {useMeta} from "quasar";
|
||||||
|
|
||||||
export const useAppStore = defineStore('App', {
|
export const useAppStore = defineStore('App', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
pageTitle: null,
|
pageTitle: null,
|
||||||
fabButton: {icon: null, label: null, action: {}}
|
breadcrumbs: []
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {},
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
resetAfterRouteChange() {
|
||||||
|
this.setPageTitle("");
|
||||||
|
this.setBreadcrumbs([]);
|
||||||
|
},
|
||||||
|
setPageTitle(pageTitle) {
|
||||||
|
this.pageTitle = pageTitle;
|
||||||
|
useMeta({title: pageTitle !== '' ? `${pageTitle} - Polétání.cz` : 'Polétání.cz'});
|
||||||
|
|
||||||
|
|
||||||
|
console.log("setPageTitle:", pageTitle);
|
||||||
|
},
|
||||||
|
setBreadcrumbs(breadcrumbs) {
|
||||||
|
this.breadcrumbs = breadcrumbs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {apolloWrapper} from "src/graphql/apollo";
|
import {apolloWrapper} from "src/graphql/apollo";
|
||||||
import {COPILOTS_LIST} from "src/graphql/queries/copilots";
|
import {COPILOTS_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
|
||||||
|
|
||||||
export const useCopilotsStore = defineStore('SecondPilots', {
|
export const useCopilotsStore = defineStore('SecondPilots', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -13,6 +13,9 @@ export const useCopilotsStore = defineStore('SecondPilots', {
|
|||||||
create(formData) {
|
create(formData) {
|
||||||
console.log("not implemented");
|
console.log("not implemented");
|
||||||
},
|
},
|
||||||
|
fetchDetail(copilotId) {
|
||||||
|
return apolloWrapper.query(COPILOTS_DETAIL, {id: copilotId}).then(({data}) => data.copilot);
|
||||||
|
},
|
||||||
fetch() {
|
fetch() {
|
||||||
return apolloWrapper.query(COPILOTS_LIST).then(result => {
|
return apolloWrapper.query(COPILOTS_LIST).then(result => {
|
||||||
this.items = result.data.copilots;
|
this.items = result.data.copilots;
|
||||||
|
|||||||
+15
-11
@@ -1,7 +1,7 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {apolloWrapper} from "src/graphql/apollo"
|
import {apolloWrapper} from "src/graphql/apollo"
|
||||||
import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
|
import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
|
||||||
import {EDIT_FLIGHT, CREATE_FLIGHT} from "src/graphql/mutations/flight";
|
import {EDIT_FLIGHT, CREATE_FLIGHT, DELETE_FLIGHT} from "src/graphql/mutations/flight";
|
||||||
|
|
||||||
export const useFlightsStore = defineStore('Flights', {
|
export const useFlightsStore = defineStore('Flights', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -38,16 +38,20 @@ export const useFlightsStore = defineStore('Flights', {
|
|||||||
fetch() {
|
fetch() {
|
||||||
return apolloWrapper
|
return apolloWrapper
|
||||||
.query(FLIGHTS_LIST)
|
.query(FLIGHTS_LIST)
|
||||||
.then((result) => {
|
.then(({data}) => {
|
||||||
this.items = result.data.flights;
|
this.items = data.flights;
|
||||||
|
|
||||||
return result.data.flights;
|
return data.flights;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteItem(id) {
|
delete(id) {
|
||||||
const idx = this.items.indexOf(this.items.find(f => f.id === id));
|
return apolloWrapper.mutate(DELETE_FLIGHT, {id}).then(({data}) => {
|
||||||
this.items.splice(idx, 1);
|
|
||||||
console.log("maxu let ID " + id + " na indexu " + idx);
|
const idx = this.items.indexOf(this.items.find(f => f.id === id));
|
||||||
}
|
this.items.splice(idx, 1);
|
||||||
}
|
|
||||||
})
|
return data.deleteFlight;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {apolloWrapper} from "src/graphql/apollo";
|
import {apolloWrapper} from "src/graphql/apollo";
|
||||||
import {POI_LIST} from "src/graphql/queries/poi";
|
import {POI_DETAIL, POI_LIST} from "src/graphql/queries/poi";
|
||||||
|
import {EDIT_POI} from "src/graphql/mutations/poi";
|
||||||
|
|
||||||
export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -18,42 +19,27 @@ export const usePointsOfInterestStore = defineStore('PointsOfInterest', {
|
|||||||
console.log('item', item);
|
console.log('item', item);
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
// pointTypeName() {
|
|
||||||
// return (typeName) => {
|
|
||||||
// const typeToNameMap = {
|
|
||||||
// poi: "General POI",
|
|
||||||
// airport: "Airport",
|
|
||||||
// }
|
|
||||||
// return typeToNameMap[typeName] || "Unknown";
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// groupByTypes() {
|
|
||||||
// const groupedByType = {};
|
|
||||||
// for (const item of this.items) {
|
|
||||||
// if (!groupedByType[item.type]) groupedByType[item.type] = [];
|
|
||||||
// groupedByType[item.type].push(item);
|
|
||||||
// }
|
|
||||||
// return groupedByType;
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
fetchDetail(poiId) {
|
update(id, input) {
|
||||||
console.log("fetch poi detail");
|
return apolloWrapper.mutate(EDIT_POI, {id, input}).then((data) => {
|
||||||
this.items.push({id: poiId, "name": "Zamek " + poiId, "type": "poi", "location": {"lat": 50, "lng": 10}});
|
console.log("Pridat update POI ve store");
|
||||||
|
return data.data.editPointOfInterest;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
fetchDetail(id) {
|
||||||
|
if (typeof id !== "number") {
|
||||||
|
id = parseInt(id);
|
||||||
|
}
|
||||||
|
return apolloWrapper.query(POI_DETAIL, {id}).then(result => result.data.pointOfInterest);
|
||||||
},
|
},
|
||||||
fetch() {
|
fetch() {
|
||||||
return apolloWrapper.query(POI_LIST).then(result => {
|
return apolloWrapper.query(POI_LIST).then(result => {
|
||||||
this.items = result.data.pointsOfInterest;
|
this.items = result.data.pointsOfInterest;
|
||||||
return result.data.pointsOfInterest;
|
return result.data.pointsOfInterest;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("fetch poi");
|
|
||||||
// this.items = [
|
|
||||||
// {id: 1, "name": "LKLT", private: false, "type": "airport", "location": {"lat": 50, "lng": 10}},
|
|
||||||
// {id: 2, "name": "Hrad", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
|
||||||
// {id: 3, "name": "Zamek", "type": "poi", "location": {"lat": 50, "lng": 10}},
|
|
||||||
// ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user