Lepsi verejna cast, ssr, lepsi prace s fotkamaa
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ import {Notify} from "quasar";
|
|||||||
import {errorObject, warningObject} from "src/composables/dialog";
|
import {errorObject, warningObject} from "src/composables/dialog";
|
||||||
|
|
||||||
const handleRefreshToken = (store, forward, operation) => {
|
const handleRefreshToken = (store, forward, operation) => {
|
||||||
if (!operation._refreshUnauthorizedUser) return;
|
if (!operation.query?._refreshUnauthorizedUser) return;
|
||||||
|
|
||||||
return fromPromise(useUserStore(store).refreshAccessToken()
|
return fromPromise(useUserStore(store).refreshAccessToken()
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup>
|
||||||
|
import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
titlePhoto: {
|
||||||
|
type: Object,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-card class="flight-detail-card q-mb-lg">
|
||||||
|
<TitlePhotoWithGallery
|
||||||
|
v-if="titlePhoto"
|
||||||
|
:photo="titlePhoto"
|
||||||
|
:title="title"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-card-actions>
|
||||||
|
<slot name="actions" />
|
||||||
|
</q-card-actions>
|
||||||
|
|
||||||
|
<slot name="content"/>
|
||||||
|
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import {confirmObject} from "src/composables/dialog";
|
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
import {useUserStore} from "stores/User";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
aircraft: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const emits = defineEmits(["delete"]);
|
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
|
||||||
|
|
||||||
const confirmDelete = (aircraftId) => {
|
|
||||||
$q.dialog(confirmObject('Opravdu chceš smazat toto letadlo?'))
|
|
||||||
.onOk(() => {
|
|
||||||
emits("delete", aircraftId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<q-card class="q-mx-md q-my-md flight-detail-card">
|
|
||||||
<q-img :src="aircraft.photoUrl" v-if="aircraft.photoUrl"/>
|
|
||||||
|
|
||||||
<q-card-actions class="q-my-md" v-if="aircraft.createdById === loggedUser.id">
|
|
||||||
<div class="col-grow">
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
:to='{name: "aircraftEdit", params: {id: aircraft.id}}'
|
|
||||||
icon="edit"
|
|
||||||
text-color="primary"
|
|
||||||
label="Upravit"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<q-btn @click="confirmDelete(aircraft.id)" icon="delete" flat text-color="red" label="Smazat"/>
|
|
||||||
</q-card-actions>
|
|
||||||
|
|
||||||
<q-card-section>
|
|
||||||
<q-list>
|
|
||||||
|
|
||||||
<q-item v-if="aircraft.organization">
|
|
||||||
Provozovatel: {{ aircraft.organization.name }}
|
|
||||||
</q-item>
|
|
||||||
|
|
||||||
<q-item v-if="aircraft.manufacturer">
|
|
||||||
Výrobce: {{ aircraft.manufacturer }}
|
|
||||||
</q-item>
|
|
||||||
<q-item v-if="aircraft.model">
|
|
||||||
Model: {{ aircraft.model }}
|
|
||||||
</q-item>
|
|
||||||
<q-item v-if="aircraft.seats">
|
|
||||||
Počet míst: {{ aircraft.seats }}
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-card-section>
|
|
||||||
<q-card-section>
|
|
||||||
<article v-html="aircraft.description" class="q-my-md"/>
|
|
||||||
</q-card-section>
|
|
||||||
</q-card>
|
|
||||||
</template>
|
|
||||||
@@ -15,9 +15,9 @@ import BasicTextSkeleton from "components/basicSkeletons/BasicTextSkeleton.vue";
|
|||||||
<q-card-section class="q-my-md">
|
<q-card-section class="q-my-md">
|
||||||
<BasicTextSkeleton :paragraphs="1" :lines="2"/>
|
<BasicTextSkeleton :paragraphs="1" :lines="2"/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
|
||||||
|
|
||||||
<q-card class="flight-detail-card" flat>
|
|
||||||
<BasicListSkeleton :items-count-min="1" :items-count-max="4"/>
|
<h3>Lety</h3>
|
||||||
|
<BasicListSkeleton :items="5" />
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ const formData = reactive({
|
|||||||
seats: null,
|
seats: null,
|
||||||
manufacturer: "",
|
manufacturer: "",
|
||||||
description: "",
|
description: "",
|
||||||
photo: null,
|
organization: null,
|
||||||
organization: null
|
isPublic: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -84,8 +84,6 @@ onMounted(() => {
|
|||||||
v-bind="commonProps"
|
v-bind="commonProps"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
type="textarea"
|
type="textarea"
|
||||||
v-model="formData.description"
|
v-model="formData.description"
|
||||||
@@ -93,10 +91,7 @@ onMounted(() => {
|
|||||||
v-bind="commonProps"
|
v-bind="commonProps"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-file v-model="formData.photo" label="Fotografie" v-bind="commonProps">
|
<q-checkbox v-model="formData.isPublic" label="Veřejné?" v-bind="commonProps"/>
|
||||||
<template #prepend>
|
|
||||||
<q-icon name="upload"/>
|
|
||||||
</template>
|
|
||||||
</q-file>
|
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<script setup>
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
aircraft: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-list>
|
||||||
|
<q-item v-if="aircraft.organization">
|
||||||
|
Provozovatel: {{ aircraft.organization.name }}
|
||||||
|
</q-item>
|
||||||
|
|
||||||
|
<q-item v-if="aircraft.manufacturer">
|
||||||
|
Výrobce: {{ aircraft.manufacturer }}
|
||||||
|
</q-item>
|
||||||
|
<q-item v-if="aircraft.model">
|
||||||
|
Model: {{ aircraft.model }}
|
||||||
|
</q-item>
|
||||||
|
<q-item v-if="aircraft.seats">
|
||||||
|
Počet míst: {{ aircraft.seats }}
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
<article v-html="aircraft.description" class="q-my-md"/>
|
||||||
|
</template>
|
||||||
@@ -21,8 +21,8 @@ useAppStore().setPageTitle("Letadla");
|
|||||||
v-for="aircraft of props.items" :key="aircraft"
|
v-for="aircraft of props.items" :key="aircraft"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-avatar v-if="aircraft.photoUrl">
|
<q-avatar v-if="aircraft.titlePhoto">
|
||||||
<img :src="aircraft.photoUrl" alt=""/>
|
<img :src="aircraft.titlePhoto.url" alt=""/>
|
||||||
</q-avatar>
|
</q-avatar>
|
||||||
<q-avatar color="teal" text-color="white" icon="flight" v-else/>
|
<q-avatar color="teal" text-color="white" icon="flight" v-else/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-skeleton type="rect" class="q-my-lg" style="width: 200px; height: 40px" />
|
<q-skeleton type="rect" class="q-my-lg" style="width: 200px; height: 40px" />
|
||||||
<BasicListSkeleton :items-count-min="1" :items-count-max="5"/>
|
<BasicListSkeleton :items="4"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -11,7 +11,18 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: false,
|
required: false,
|
||||||
default: null
|
default: null
|
||||||
|
},
|
||||||
|
aircraftDetailRoute: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
poiDetailRoute: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -22,7 +33,15 @@ const props = defineProps({
|
|||||||
<q-icon name="flight"/>
|
<q-icon name="flight"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
|
<router-link
|
||||||
|
:to="{...aircraftDetailRoute, params: {...aircraftDetailRoute.params, id: flight.aircraft.id}}"
|
||||||
|
v-if="aircraftDetailRoute"
|
||||||
|
>
|
||||||
{{ flight.aircraft.callSign }}
|
{{ flight.aircraft.callSign }}
|
||||||
|
</router-link>
|
||||||
|
<template v-else>
|
||||||
|
{{ flight.aircraft.callSign }}
|
||||||
|
</template>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
@@ -53,12 +72,18 @@ 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" v-if="poi.pointOfInterest" />
|
<q-icon name="place" v-if="poi.pointOfInterest"/>
|
||||||
<q-icon name="local_airport" v-if="poi.airport" />
|
<q-icon name="local_airport" v-if="poi.airport"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<template v-if="poi.pointOfInterest">
|
<template v-if="poi.pointOfInterest">
|
||||||
|
<router-link
|
||||||
|
:to="{name: poiDetailRoute.name, params: {...poiDetailRoute.params, id: poi.pointOfInterest.id}}"
|
||||||
|
v-if="poi.pointOfInterest.isPublic"
|
||||||
|
>
|
||||||
{{ poi.pointOfInterest.name }}
|
{{ poi.pointOfInterest.name }}
|
||||||
|
</router-link>
|
||||||
|
<template v-else>{{ poi.pointOfInterest.name }}</template>
|
||||||
</template>
|
</template>
|
||||||
<span v-if="poi.airport">
|
<span v-if="poi.airport">
|
||||||
<strong>{{ poi.airport.icaoCode }}</strong> ({{ poi.airport.name }}),
|
<strong>{{ poi.airport.icaoCode }}</strong> ({{ poi.airport.name }}),
|
||||||
|
|||||||
@@ -7,11 +7,15 @@ const props = defineProps({
|
|||||||
flight: {
|
flight: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
photos: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const mapPhotos = computed(() => props.flight.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
|
const mapPhotos = computed(() => props.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
|
||||||
const poisWithGPS = computed(() => props.flight.track.map(poi => poi.pointOfInterest || poi.airport));
|
const poisWithGPS = computed(() => props.flight.track.map(poi => poi.pointOfInterest || poi.airport));
|
||||||
|
|
||||||
const mapMarkers = [props.flight.takeoffAirport].concat(poisWithGPS.value).concat([props.flight.landingAirport]);
|
const mapMarkers = [props.flight.takeoffAirport].concat(poisWithGPS.value).concat([props.flight.landingAirport]);
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ const props = defineProps({
|
|||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
routeDetail: {
|
public: {
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
default: () => ({name: 'flightDetail', params: {}})
|
|
||||||
},
|
|
||||||
displayVisibilityInfo: {
|
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: true
|
||||||
default: true
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const routeDetail = (flight) => {
|
||||||
|
if (props.public)
|
||||||
|
return {name: "publicFlightDetail", params: {username: flight.pilot.publicUsername, id: flight.id}}
|
||||||
|
else
|
||||||
|
return {name: "flightDetail", params: {id: flight.id}}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -28,16 +28,22 @@ const props = defineProps({
|
|||||||
v-for="flight of items" :key="flight"
|
v-for="flight of items" :key="flight"
|
||||||
ripple
|
ripple
|
||||||
clickable
|
clickable
|
||||||
:to="{name: routeDetail.name, params: {...routeDetail.params, id: flight.id}}"
|
:to="routeDetail(flight)"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<AvatarFromPhoto :size="120" v-if="flight.coverPhoto" :src="flight.coverPhoto.thumbnailUrl"/>
|
<AvatarFromPhoto :size="120" v-if="flight.titlePhoto" :src="flight.titlePhoto.thumbnailUrl"/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div class="text-h5 q-mb-md">{{ flightName(flight) }}</div>
|
<div class="text-h5 q-mb-md">{{ flightName(flight) }}</div>
|
||||||
|
|
||||||
|
<div class="text-secondary" v-if="props.public">
|
||||||
|
<q-icon name="support_agent"/>
|
||||||
|
@{{flight.pilot.publicUsername}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="text-secondary" v-if="flight.copilot">
|
<div class="text-secondary" v-if="flight.copilot">
|
||||||
<q-icon name="person"/>
|
<q-icon name="person"/>
|
||||||
|
{{ flight.pilot.name }}
|
||||||
{{ flight.copilot.name }}
|
{{ flight.copilot.name }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -51,12 +57,13 @@ const props = defineProps({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-secondary" v-if="flight.event">
|
<div class="text-secondary" v-if="flight.event">
|
||||||
<q-icon name="event" />
|
<q-icon name="event"/>
|
||||||
{{ flight.event.name }}
|
{{ flight.event.name }}
|
||||||
</div>
|
</div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
||||||
<q-item-section side top v-if="flight.isPublic && displayVisibilityInfo">
|
<q-item-section side top v-if="flight.isPublic && !props.public">
|
||||||
|
<!-- Zobraz jen v adminu -->
|
||||||
<q-icon name="visibility"></q-icon>
|
<q-icon name="visibility"></q-icon>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|||||||
@@ -12,13 +12,21 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
locations: {
|
locations: {
|
||||||
type: Array
|
type: Array
|
||||||
}
|
},
|
||||||
|
aircraft: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
copilots: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
name: "",
|
name: "",
|
||||||
description: "",
|
description: "",
|
||||||
pointOfInterest: null,
|
pointOfInterest: null,
|
||||||
|
copilots: [],
|
||||||
|
isAircraft: false,
|
||||||
photoIds: []
|
photoIds: []
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -34,23 +42,33 @@ const setup = () => {
|
|||||||
<template>
|
<template>
|
||||||
<DialogWrapper :formData="formData" @show="setup()">
|
<DialogWrapper :formData="formData" @show="setup()">
|
||||||
<q-card-section class="text-center">
|
<q-card-section class="text-center">
|
||||||
<!-- <q-scroll-area style="min-height: 80px; max-height: 150px">-->
|
|
||||||
<q-img :src="photo.thumbnailUrl" width="80px" class="q-ma-sm" v-for="photo in photos" :key="photo.thumbnailUrl"/>
|
<q-img :src="photo.thumbnailUrl" width="80px" class="q-ma-sm" v-for="photo in photos" :key="photo.thumbnailUrl"/>
|
||||||
<!-- {{ photos }}-->
|
|
||||||
<!-- </q-scroll-area>-->
|
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<FormWrapper :save-button="false">
|
<FormWrapper :save-button="false">
|
||||||
<q-input v-model="formData.name" label="Název" v-bind="commonProps"/>
|
|
||||||
<q-input type="textarea" v-model="formData.description" label="Popis" v-bind="commonProps"/>
|
|
||||||
|
|
||||||
<ComboboxInput
|
<ComboboxInput
|
||||||
:options="locations"
|
:options="locations"
|
||||||
v-bind="commonProps"
|
v-bind="commonProps"
|
||||||
v-model="formData.pointOfInterest"
|
v-model="formData.pointOfInterest"
|
||||||
:enable-new-values="false"
|
:enable-new-values="false"
|
||||||
label="POI"
|
label="Místo"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<q-select
|
||||||
|
v-if="copilots.length > 0"
|
||||||
|
:options="copilots"
|
||||||
|
v-model="formData.copilots"
|
||||||
|
v-bind="commonProps"
|
||||||
|
label="Kopiloti"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-checkbox v-model="formData.isAircraft" :label="`Letadlo (${aircraft.callSign})`"/>
|
||||||
|
|
||||||
|
<q-input v-model="formData.name" label="Název" v-bind="commonProps"/>
|
||||||
|
<q-input type="textarea" v-model="formData.description" label="Popis" v-bind="commonProps"/>
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</DialogWrapper>
|
</DialogWrapper>
|
||||||
|
|||||||
@@ -12,6 +12,12 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
locations: {
|
locations: {
|
||||||
type: Array
|
type: Array
|
||||||
|
},
|
||||||
|
aircraft: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
copilots: {
|
||||||
|
type: Array
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -20,7 +26,8 @@ const formData = ref({
|
|||||||
name: "",
|
name: "",
|
||||||
description: "",
|
description: "",
|
||||||
pointOfInterest: null,
|
pointOfInterest: null,
|
||||||
isFlightCover: false
|
copilots: [],
|
||||||
|
isAircraft: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const setup = (() => {
|
const setup = (() => {
|
||||||
@@ -33,17 +40,27 @@ const setup = (() => {
|
|||||||
<q-img :src="photo.thumbnailUrl"/>
|
<q-img :src="photo.thumbnailUrl"/>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<FormWrapper :save-button="false">
|
<FormWrapper :save-button="false">
|
||||||
<q-input v-model="formData.name" label="Název" v-bind="commonProps"/>
|
|
||||||
<q-input type="textarea" v-model="formData.description" label="Popis" v-bind="commonProps"/>
|
|
||||||
|
|
||||||
<ComboboxInput
|
<ComboboxInput
|
||||||
:options="locations"
|
:options="locations"
|
||||||
v-bind="commonProps"
|
v-bind="commonProps"
|
||||||
v-model="formData.pointOfInterest"
|
v-model="formData.pointOfInterest"
|
||||||
label="POI"
|
label="Místo"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-checkbox v-model="formData.isFlightCover" label="Úvodní fotografie k letu?"/>
|
<q-select
|
||||||
|
v-if="copilots.length > 0"
|
||||||
|
:options="copilots"
|
||||||
|
v-model="formData.copilots"
|
||||||
|
v-bind="commonProps"
|
||||||
|
label="Kopiloti"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-checkbox v-model="formData.isAircraft" :label="`Letadlo (${aircraft.callSign})`"/>
|
||||||
|
<q-input v-model="formData.name" label="Název" v-bind="commonProps"/>
|
||||||
|
<q-input type="textarea" v-model="formData.description" label="Popis" v-bind="commonProps"/>
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</DialogWrapper>
|
</DialogWrapper>
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, onUnmounted} from "vue";
|
import {computed, onMounted, onUnmounted, ref, watch} from "vue";
|
||||||
import 'photoswipe/style.css';
|
import 'photoswipe/style.css';
|
||||||
import "photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css";
|
import "photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css";
|
||||||
import PhotoSwipeDynamicCaption from "../../../node_modules/photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.esm";
|
import PhotoSwipeDynamicCaption from "../../../node_modules/photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.esm";
|
||||||
import PhotoCaption from "components/photos/PhotoCaption.vue";
|
import PhotoCaption from "components/photos/PhotoCaption.vue";
|
||||||
import PhotoSwipeLightbox from "../../../node_modules/photoswipe/dist/photoswipe-lightbox.esm"
|
import PhotoSwipeLightbox from "../../../node_modules/photoswipe/dist/photoswipe-lightbox.esm"
|
||||||
|
import PhotoSwipe from "../../../node_modules/photoswipe/dist/photoswipe.esm"
|
||||||
|
import {useRoute, useRouter} from "vue-router";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
galleryId: {
|
galleryId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: () => "randomGalleryId"
|
default: () => "photogallery"
|
||||||
},
|
},
|
||||||
photos: {
|
photos: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -19,29 +21,62 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let $lightbox = null;
|
|
||||||
|
|
||||||
onMounted(() => {
|
const route = useRoute();
|
||||||
if (!$lightbox) {
|
const $router = useRouter();
|
||||||
$lightbox = new PhotoSwipeLightbox({
|
|
||||||
|
let $lightbox = ref(null);
|
||||||
|
|
||||||
|
const initLightbox = () => {
|
||||||
|
if ($lightbox.value && $lightbox.value.pswp) {
|
||||||
|
// lightbox already initialized
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$lightbox.value = new PhotoSwipeLightbox({
|
||||||
gallery: '#' + props.galleryId,
|
gallery: '#' + props.galleryId,
|
||||||
children: 'a',
|
children: 'a',
|
||||||
pswpModule: () => import('photoswipe'),
|
pswpModule: () => PhotoSwipe,
|
||||||
});
|
});
|
||||||
|
|
||||||
let captionPlugin = new PhotoSwipeDynamicCaption($lightbox, {
|
let captionPlugin = new PhotoSwipeDynamicCaption($lightbox.value, {
|
||||||
type: 'auto',
|
type: 'auto',
|
||||||
});
|
});
|
||||||
|
|
||||||
$lightbox.init();
|
$lightbox.value.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initLightbox();
|
||||||
|
|
||||||
|
// todo: tohle nefunguje, sice se galerie zavre, ale i tak se user presmeruje na predchozi stranku
|
||||||
|
window.onpopstate = function (e) {
|
||||||
|
if (!$lightbox.value || !$lightbox.value.pswp) {
|
||||||
|
initLightbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($lightbox.value && $lightbox.value.pswp)
|
||||||
|
$lightbox.value.pswp.close();
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if ($lightbox) {
|
if ($lightbox.value) {
|
||||||
$lightbox.destroy();
|
$lightbox.value.destroy();
|
||||||
$lightbox = null;
|
$lightbox.value = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const openedPhoto = computed(() => usePhotosStore().openedPhoto);
|
||||||
|
watch(() => [openedPhoto.value, $lightbox.value], () => {
|
||||||
|
if (!$lightbox.value || !openedPhoto.value) return;
|
||||||
|
|
||||||
|
const idx = props.photos.findIndex(p => p.id === openedPhoto.value.id);
|
||||||
|
if (idx >= 0) {
|
||||||
|
$lightbox.value.loadAndOpen(idx);
|
||||||
|
usePhotosStore().setOpenedPhoto(null);
|
||||||
|
}
|
||||||
|
}, {immediate: true})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -3,24 +3,29 @@ import {computed, onMounted, reactive, ref, watch} from "vue";
|
|||||||
import {useQuasar} from "quasar";
|
import {useQuasar} from "quasar";
|
||||||
import {confirmObject} from "src/composables/dialog";
|
import {confirmObject} from "src/composables/dialog";
|
||||||
|
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
photos: {
|
photos: {
|
||||||
type: Array
|
type: Array
|
||||||
},
|
},
|
||||||
});
|
titlePhoto: {
|
||||||
|
type: Object,
|
||||||
const batchEdit = ref({});
|
},
|
||||||
|
showActions: {
|
||||||
onMounted(() => {
|
type: Boolean,
|
||||||
for (const photo of props.photos) {
|
required: false,
|
||||||
batchEdit.value[photo.id] = false;
|
default: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emits = defineEmits(["edit", "delete", "batch-edit", "batch-rotate"])
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
|
||||||
|
const batchEdit = ref({});
|
||||||
|
for (const photo of props.photos) {
|
||||||
|
batchEdit.value[photo.id] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(["edit", "delete", "set-title-photo", "batch-edit", "batch-rotate"])
|
||||||
|
|
||||||
const openEdit = (photo) => {
|
const openEdit = (photo) => {
|
||||||
emits("edit", photo);
|
emits("edit", photo);
|
||||||
@@ -108,6 +113,10 @@ const batchOptionsProps = computed(() => ({
|
|||||||
class: "q-ml-lg",
|
class: "q-ml-lg",
|
||||||
disable: !isBatchEditAllowed.value
|
disable: !isBatchEditAllowed.value
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const setFlightCover = (titlePhoto) => {
|
||||||
|
emits("set-title-photo", titlePhoto);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -115,6 +124,15 @@ const batchOptionsProps = computed(() => ({
|
|||||||
<div class="col-6 col-sm-4 col-md-4 col-lg-3" v-for="(photo, idx) in photos" :key="photo.id">
|
<div class="col-6 col-sm-4 col-md-4 col-lg-3" v-for="(photo, idx) in photos" :key="photo.id">
|
||||||
<q-card :class='{"q-ma-sm": true, "shadow-1": !batchEdit[photo.id], "shadow-10": batchEdit[photo.id]}'>
|
<q-card :class='{"q-ma-sm": true, "shadow-1": !batchEdit[photo.id], "shadow-10": batchEdit[photo.id]}'>
|
||||||
<q-img :src="photo.thumbnailUrl" @click="handleImageClick(photo, idx)" style="cursor: pointer">
|
<q-img :src="photo.thumbnailUrl" @click="handleImageClick(photo, idx)" style="cursor: pointer">
|
||||||
|
<div class="absolute-top bg-transparent text-right">
|
||||||
|
<q-btn
|
||||||
|
icon="star"
|
||||||
|
:color="titlePhoto?.id === photo.id ? 'amber-9' : 'grey-6'"
|
||||||
|
round
|
||||||
|
@click.stop.prevent="setFlightCover(photo)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="absolute-bottom" v-if="photo.name !== '' || photo.description !== ''">
|
<div class="absolute-bottom" v-if="photo.name !== '' || photo.description !== ''">
|
||||||
<div class="text-h6" v-if="photo.name !== ''">
|
<div class="text-h6" v-if="photo.name !== ''">
|
||||||
{{ photo.name }}
|
{{ photo.name }}
|
||||||
@@ -125,24 +143,26 @@ const batchOptionsProps = computed(() => ({
|
|||||||
</div>
|
</div>
|
||||||
</q-img>
|
</q-img>
|
||||||
|
|
||||||
<q-card-actions align="right" :class="{'bg-primary': batchEdit[photo.id], 'text-white': batchEdit[photo.id]}">
|
<q-card-actions align="right" :class="{'bg-primary': batchEdit[photo.id], 'text-white': batchEdit[photo.id]}" v-if="showActions">
|
||||||
<div class="col-grow">
|
<div class="col-grow">
|
||||||
<q-checkbox v-model="batchEdit[photo.id]"/>
|
<q-checkbox v-model="batchEdit[photo.id]"/>
|
||||||
<q-icon name="star" v-if="photo.isFlightCover" color="red"/>
|
|
||||||
|
<q-icon name="flight" v-if="photo.isAircraft" size="xs" color="grey-5" />
|
||||||
|
<q-icon name="person" v-if="photo.copilots.length > 0" size="xs" color="grey-5" />
|
||||||
</div>
|
</div>
|
||||||
<q-btn flat icon="edit" color="black" :to="{name: 'photoEditor', params: {id: photo.id}}"/>
|
<q-btn flat icon="edit" color="blue" @click="openEdit(photo)"/>
|
||||||
<q-btn flat icon="info" color="blue" @click="openEdit(photo)"/>
|
<q-btn flat icon="tune" color="black" :to="{name: 'photoEditor', params: {id: photo.id}}"/>
|
||||||
<q-btn flat icon="delete" color="red" @click="confirmPhotoDelete(photo.id)"/>
|
<q-btn flat icon="delete" color="red" @click="confirmPhotoDelete(photo.id)"/>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-page-sticky :offset="[50, 50]" position="bottom" v-if="photos.length > 0">
|
<q-page-sticky :offset="[50, 50]" position="bottom" v-if="photos.length > 0 && showActions">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-actions>
|
<q-card-actions>
|
||||||
<q-checkbox v-model="checkAll" label="Vybrat vše"/>
|
<q-checkbox v-model="checkAll" label="Vybrat vše"/>
|
||||||
<q-btn v-bind="batchOptionsProps" icon="info" :color="isBatchEditAllowed ? 'primary' : 'grey'" @click="openBatchEdit"/>
|
<q-btn v-bind="batchOptionsProps" icon="edit" :color="isBatchEditAllowed ? 'primary' : 'grey'" @click="openBatchEdit"/>
|
||||||
<q-btn v-bind="batchOptionsProps" icon="rotate_90_degrees_ccw" :color="isBatchEditAllowed ? 'secondary' : 'grey'" @click="batchRotate('counterClockwise')"/>
|
<q-btn v-bind="batchOptionsProps" icon="rotate_90_degrees_ccw" :color="isBatchEditAllowed ? 'secondary' : 'grey'" @click="batchRotate('counterClockwise')"/>
|
||||||
<q-btn v-bind="batchOptionsProps" icon="rotate_90_degrees_cw" :color="isBatchEditAllowed ? 'secondary' : 'grey'" @click="batchRotate('clockwise')"/>
|
<q-btn v-bind="batchOptionsProps" icon="rotate_90_degrees_cw" :color="isBatchEditAllowed ? 'secondary' : 'grey'" @click="batchRotate('clockwise')"/>
|
||||||
<q-btn v-bind="batchOptionsProps" icon="delete" :color="isBatchEditAllowed ? 'red' : 'grey'" @click="confirmBatchPhotoDelete"/>
|
<q-btn v-bind="batchOptionsProps" icon="delete" :color="isBatchEditAllowed ? 'red' : 'grey'" @click="confirmBatchPhotoDelete"/>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<script setup>
|
||||||
|
import {useRoute, useRouter} from "vue-router";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
photo: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const $router = useRouter();
|
||||||
|
const openGallery = (photo) => {
|
||||||
|
usePhotosStore().setOpenedPhoto(photo);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-img :src="photo.url" fit="cover" :ratio="4/3" @click="openGallery(photo)" class="cursor-pointer" v-if="photo">
|
||||||
|
<div class="absolute-bottom custom-caption" v-if="title && title !== ''">
|
||||||
|
<div class="text-h5">
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-img>
|
||||||
|
</template>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
// to match your app's branding.
|
// to match your app's branding.
|
||||||
// Tip: Use the "Theme Builder" on Quasar's documentation website.
|
// Tip: Use the "Theme Builder" on Quasar's documentation website.
|
||||||
|
|
||||||
$primary : #87c8ec; //#1976D2;
|
$primary : #469ccc; //#1976D2;
|
||||||
$secondary : #26A69A;
|
$secondary : #26A69A;
|
||||||
$accent : #9C27B0;
|
$accent : #9C27B0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
||||||
|
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
||||||
|
|
||||||
export const FRAGMENT_AIRCRAFT_FULL_INFO = gql`
|
export const FRAGMENT_AIRCRAFT_FULL_INFO = gql`
|
||||||
fragment aircraftFullInfo on Aircraft {
|
fragment aircraftFullInfo on Aircraft {
|
||||||
@@ -7,9 +9,15 @@ fragment aircraftFullInfo on Aircraft {
|
|||||||
model
|
model
|
||||||
description
|
description
|
||||||
manufacturer
|
manufacturer
|
||||||
photoUrl
|
|
||||||
seats
|
seats
|
||||||
|
|
||||||
createdById
|
createdById
|
||||||
|
isPublic
|
||||||
|
|
||||||
|
titlePhoto {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
|
||||||
organization {
|
organization {
|
||||||
id
|
id
|
||||||
@@ -18,15 +26,24 @@ fragment aircraftFullInfo on Aircraft {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
|
export const FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO = gql`
|
||||||
fragment aircraftBasicInfo on Aircraft {
|
fragment aircraftFullPrivateInfo on Aircraft {
|
||||||
id
|
...aircraftFullInfo
|
||||||
callSign
|
photos {
|
||||||
manufacturer
|
...photoFullInfo
|
||||||
|
|
||||||
organization {
|
copilots {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flights {
|
||||||
|
...flightListInfo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
||||||
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
|
export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
|
||||||
|
fragment aircraftBasicInfo on Aircraft {
|
||||||
|
id
|
||||||
|
callSign
|
||||||
|
manufacturer
|
||||||
|
|
||||||
|
organization {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -11,5 +11,10 @@ export const FRAGMENT_COPILOT_FULL_INFO = gql`
|
|||||||
fragment copilotFullInfo on Copilot {
|
fragment copilotFullInfo on Copilot {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|
||||||
|
titlePhoto {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -28,15 +28,28 @@ fragment flightFullInfo on Flight {
|
|||||||
durationMinCalculated
|
durationMinCalculated
|
||||||
isPublic
|
isPublic
|
||||||
|
|
||||||
coverPhoto {
|
titlePhoto {
|
||||||
thumbnailUrl
|
thumbnailUrl
|
||||||
url
|
url
|
||||||
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
takeoffAirport {
|
takeoffAirport {
|
||||||
...airportInfo
|
...airportInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
landingAirport {
|
||||||
|
...airportInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
landingWeatherInfo {
|
||||||
|
...weatherFullInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
takeoffWeatherInfo {
|
||||||
|
...weatherFullInfo
|
||||||
|
}
|
||||||
|
|
||||||
copilots {
|
copilots {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@@ -73,30 +86,30 @@ fragment flightFullInfo on Flight {
|
|||||||
landingDuration
|
landingDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
landingAirport {
|
|
||||||
...airportInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
landingWeatherInfo {
|
|
||||||
...weatherFullInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
takeoffWeatherInfo {
|
|
||||||
...weatherFullInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
aircraft {
|
aircraft {
|
||||||
...aircraftFullInfo
|
...aircraftFullInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
photos {
|
|
||||||
...photoFullInfo
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_PHOTO_FULL_INFO}
|
|
||||||
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
||||||
${FRAGMENT_AIRPORT_INFO}
|
${FRAGMENT_AIRPORT_INFO}
|
||||||
${FRAGMENT_POI_FULL_INFO}
|
${FRAGMENT_POI_FULL_INFO}
|
||||||
${FRAGMENT_WEATHER_FULL_INFO}
|
${FRAGMENT_WEATHER_FULL_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
export const FRAGMENT_FLIGHT_FULL_PRIVATE_INFO = gql`
|
||||||
|
fragment flightFullPrivateInfo on Flight {
|
||||||
|
...flightFullInfo
|
||||||
|
photos {
|
||||||
|
...photoFullInfo
|
||||||
|
|
||||||
|
copilots {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_FLIGHT_FULL_INFO}
|
||||||
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
|
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
|
||||||
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft";
|
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
|
||||||
|
|
||||||
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
|
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
|
||||||
fragment flightListInfo on Flight {
|
fragment flightListInfo on Flight {
|
||||||
@@ -11,13 +11,15 @@ fragment flightListInfo on Flight {
|
|||||||
durationMinCalculated
|
durationMinCalculated
|
||||||
isPublic
|
isPublic
|
||||||
|
|
||||||
coverPhoto {
|
titlePhoto {
|
||||||
thumbnailUrl
|
thumbnailUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
track {
|
track {
|
||||||
pointOfInterest {
|
pointOfInterest {
|
||||||
|
id
|
||||||
name
|
name
|
||||||
|
isPublic
|
||||||
}
|
}
|
||||||
airport {
|
airport {
|
||||||
icaoCode
|
icaoCode
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft";
|
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
|
||||||
|
|
||||||
export const FRAGMENT_ORGANIZATION_LIST_INFO = gql`
|
export const FRAGMENT_ORGANIZATION_LIST_INFO = gql`
|
||||||
fragment organizationListInfo on Organization {
|
fragment organizationListInfo on Organization {
|
||||||
|
|||||||
@@ -9,10 +9,7 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
|
|||||||
name
|
name
|
||||||
description
|
description
|
||||||
flightId
|
flightId
|
||||||
pointOfInterest {
|
isAircraft
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
width
|
width
|
||||||
height
|
height
|
||||||
isFlightCover
|
isFlightCover
|
||||||
@@ -21,4 +18,8 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
|
|||||||
gpsAltitude
|
gpsAltitude
|
||||||
terrainElevation
|
terrainElevation
|
||||||
exposedAt
|
exposedAt
|
||||||
|
copilots {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
||||||
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
||||||
|
|
||||||
|
|
||||||
export const FRAGMENT_POI_LIST_INFO = gql`
|
export const FRAGMENT_POI_LIST_INFO = gql`
|
||||||
fragment pointOfInterestListInfo on PointOfInterest {
|
fragment pointOfInterestListInfo on PointOfInterest {
|
||||||
id
|
id
|
||||||
@@ -22,20 +24,37 @@ fragment pointOfInterestFullInfo on PointOfInterest {
|
|||||||
gpsLatitude
|
gpsLatitude
|
||||||
gpsLongitude
|
gpsLongitude
|
||||||
createdById
|
createdById
|
||||||
|
|
||||||
|
titlePhoto {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
|
||||||
type {
|
type {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const FRAGMENT_POI_FULL_PRIVATE_INFO = gql`
|
||||||
|
fragment pointOfInterestFullPrivateInfo on PointOfInterest {
|
||||||
|
...pointOfInterestFullInfo
|
||||||
flights {
|
flights {
|
||||||
...flightListInfo
|
...flightListInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
photos {
|
photos {
|
||||||
thumbnailUrl
|
...photoFullInfo
|
||||||
url
|
|
||||||
|
copilots {
|
||||||
|
id
|
||||||
name
|
name
|
||||||
description
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_POI_FULL_INFO}
|
||||||
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
${FRAGMENT_FLIGHT_LIST_INFO}
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
|
import {FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO} from "src/graphql/fragments/aircraft";
|
||||||
|
|
||||||
export const CREATE_AIRCRAFT = gql`
|
export const CREATE_AIRCRAFT = gql`
|
||||||
mutation createAircraft($input: CreateAircraftInput!) {
|
mutation createAircraft($input: CreateAircraftInput!) {
|
||||||
createAircraft(input: $input) {
|
createAircraft(input: $input) {
|
||||||
...aircraftFullInfo
|
...aircraftFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const EDIT_AIRCRAFT = gql`
|
export const EDIT_AIRCRAFT = gql`
|
||||||
mutation editAircraft($id: Int!, $input: EditAircraftInput!) {
|
mutation editAircraft($id: Int!, $input: EditAircraftInput!) {
|
||||||
editAircraft(id: $id, input: $input) {
|
editAircraft(id: $id, input: $input) {
|
||||||
...aircraftFullInfo
|
...aircraftFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
export const DELETE_AIRCRAFT = gql`
|
export const DELETE_AIRCRAFT = gql`
|
||||||
mutation deleteAircraft($id: Int!) {
|
mutation deleteAircraft($id: Int!) {
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_FLIGHT_FULL_INFO} from "src/graphql/fragments/flight";
|
import {FRAGMENT_FLIGHT_FULL_PRIVATE_INFO} from "src/graphql/fragments/flight";
|
||||||
|
|
||||||
export const CREATE_FLIGHT = gql`
|
export const CREATE_FLIGHT = gql`
|
||||||
mutation createFlight($input: CreateFlightInput!) {
|
mutation createFlight($input: CreateFlightInput!) {
|
||||||
createFlight(input: $input) {
|
createFlight(input: $input) {
|
||||||
...flightFullInfo
|
...flightFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${FRAGMENT_FLIGHT_FULL_INFO}
|
${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const EDIT_FLIGHT = gql`
|
export const EDIT_FLIGHT = gql`
|
||||||
mutation editFlight($id: Int!, $input: EditFlightInput!) {
|
mutation editFlight($id: Int!, $input: EditFlightInput!) {
|
||||||
editFlight(id: $id, input: $input) {
|
editFlight(id: $id, input: $input) {
|
||||||
...flightFullInfo
|
...flightFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_FLIGHT_FULL_INFO}
|
${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
import {FRAGMENT_POI_FULL_PRIVATE_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) {
|
||||||
...pointOfInterestFullInfo
|
...pointOfInterestFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_POI_FULL_INFO}
|
${FRAGMENT_POI_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const EDIT_POI = gql`
|
export const EDIT_POI = gql`
|
||||||
mutation editPointOfInterest($id: Int!, $input: EditPointOfInterestInput!) {
|
mutation editPointOfInterest($id: Int!, $input: EditPointOfInterestInput!) {
|
||||||
editPointOfInterest(id: $id, input: $input) {
|
editPointOfInterest(id: $id, input: $input) {
|
||||||
...pointOfInterestFullInfo
|
...pointOfInterestFullPrivateInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_POI_FULL_INFO}
|
${FRAGMENT_POI_FULL_PRIVATE_INFO}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
|
import {FRAGMENT_AIRCRAFT_FULL_INFO, FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO} from "src/graphql/fragments/aircraft";
|
||||||
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
|
||||||
|
|
||||||
export const AIRCRAFTS_LIST = gql`
|
export const AIRCRAFTS_LIST = gql`
|
||||||
query AircraftsList {
|
query AircraftsList {
|
||||||
@@ -16,14 +15,17 @@ ${FRAGMENT_AIRCRAFT_FULL_INFO}
|
|||||||
export const AIRCRAFT_DETAIL = gql`
|
export const AIRCRAFT_DETAIL = gql`
|
||||||
query AircraftDetail($id: Int!) {
|
query AircraftDetail($id: Int!) {
|
||||||
aircraft(id: $id) {
|
aircraft(id: $id) {
|
||||||
...aircraftFullInfo
|
...aircraftFullPrivateInfo
|
||||||
|
|
||||||
flights {
|
|
||||||
...flightListInfo
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const AIRCRAFT_PUBLIC_DETAIL = gql`
|
||||||
|
query AircraftDetail($id: Int!) {
|
||||||
|
aircraft(id: $id, public: true) {
|
||||||
|
...aircraftFullInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
||||||
${FRAGMENT_FLIGHT_LIST_INFO}
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
||||||
import {FRAGMENT_COPILOT_FULL_INFO, FRAGMENT_COPILOT_LIST_INFO} from "src/graphql/fragments/copilot";
|
import {FRAGMENT_COPILOT_FULL_INFO, FRAGMENT_COPILOT_LIST_INFO} from "src/graphql/fragments/copilot";
|
||||||
|
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
||||||
|
|
||||||
export const COPILOTS_LIST = gql`
|
export const COPILOTS_LIST = gql`
|
||||||
query copilotsList {
|
query copilotsList {
|
||||||
@@ -17,12 +18,27 @@ query copilot($id: Int!, $pilotUsername: String) {
|
|||||||
copilot(id: $id, pilotUsername: $pilotUsername) {
|
copilot(id: $id, pilotUsername: $pilotUsername) {
|
||||||
...copilotFullInfo
|
...copilotFullInfo
|
||||||
|
|
||||||
|
photos {
|
||||||
|
...photoFullInfo
|
||||||
|
}
|
||||||
|
|
||||||
flights {
|
flights {
|
||||||
...flightListInfo
|
...flightListInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
${FRAGMENT_COPILOT_FULL_INFO}
|
${FRAGMENT_COPILOT_FULL_INFO}
|
||||||
${FRAGMENT_FLIGHT_LIST_INFO}
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const COPILOT_PUBLIC_DETAIL = gql`
|
||||||
|
query copilot($id: Int!, $pilotUsername: String) {
|
||||||
|
copilot(id: $id, pilotUsername: $pilotUsername) {
|
||||||
|
...copilotFullInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_COPILOT_FULL_INFO}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ query eventsList($username: String) {
|
|||||||
...eventListInfo
|
...eventListInfo
|
||||||
|
|
||||||
flights {
|
flights {
|
||||||
coverPhoto {
|
titlePhoto {
|
||||||
thumbnailUrl
|
thumbnailUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,44 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_FLIGHT_FULL_INFO} from "src/graphql/fragments/flight";
|
import {FRAGMENT_FLIGHT_FULL_INFO, FRAGMENT_FLIGHT_FULL_PRIVATE_INFO} from "src/graphql/fragments/flight";
|
||||||
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
|
||||||
|
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
||||||
|
|
||||||
export const FLIGHTS_LIST = gql`
|
export const FLIGHTS_LIST = gql`
|
||||||
query FlightsList($username: String) {
|
query FlightsList {
|
||||||
flights(username: $username) {
|
flights {
|
||||||
...flightListInfo
|
...flightListInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${FRAGMENT_FLIGHT_LIST_INFO}
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const FLIGHTS_PUBLIC_LIST = gql`
|
||||||
|
query FlightsPublicList($username: String, $aircraftId: Int, $copilotId: Int, $pointOfInterestId: Int) {
|
||||||
|
flights(username: $username, aircraftId: $aircraftId, copilotId: $copilotId, pointOfInterestId: $pointOfInterestId, public: true) {
|
||||||
|
...flightListInfo
|
||||||
|
|
||||||
|
pilot {
|
||||||
|
id
|
||||||
|
publicUsername
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
export const FLIGHT_DETAIL = gql`
|
export const FLIGHT_DETAIL = gql`
|
||||||
query FlightDetail($id: Int!, $username: String) {
|
query FlightDetail($id: Int!, $username: String) {
|
||||||
flight(id: $id, username: $username) {
|
flight(id: $id, username: $username) {
|
||||||
|
...flightFullPrivateInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const FLIGHT_PUBLIC_DETAIL = gql`
|
||||||
|
query FlightPublicDetail($id: Int!, $username: String) {
|
||||||
|
flight(id: $id, username: $username, public: true) {
|
||||||
...flightFullInfo
|
...flightFullInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ query photo($id: Int!) {
|
|||||||
photo(id: $id) {
|
photo(id: $id) {
|
||||||
...photoFullInfo
|
...photoFullInfo
|
||||||
|
|
||||||
|
pointOfInterest {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
copilots {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
|
||||||
adjustment {
|
adjustment {
|
||||||
contrast
|
contrast
|
||||||
saturation
|
saturation
|
||||||
@@ -28,3 +37,14 @@ query photo($id: Int!) {
|
|||||||
${FRAGMENT_PHOTO_FULL_INFO}
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
${FRAGMENT_FLIGHT_LIST_INFO}
|
${FRAGMENT_FLIGHT_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const PHOTOS_PUBLIC_LIST = gql`
|
||||||
|
query photos($flightId: Int, $pointOfInterestId: Int, $aircraftId: Int, $copilotId: Int) {
|
||||||
|
photos(public: true, flightId: $flightId, pointOfInterestId: $pointOfInterestId, aircraftId: $aircraftId, copilotId: $copilotId) {
|
||||||
|
...photoFullInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_PHOTO_FULL_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_FULL_PRIVATE_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
|
||||||
|
|
||||||
export const POI_LIST = gql`
|
export const POI_LIST = gql`
|
||||||
query poiList {
|
query poiList {
|
||||||
@@ -11,9 +11,29 @@ query poiList {
|
|||||||
${FRAGMENT_POI_LIST_INFO}
|
${FRAGMENT_POI_LIST_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const POI_PUBLIC_LIST = gql`
|
||||||
|
query poiList {
|
||||||
|
pointsOfInterest(public: true) {
|
||||||
|
...pointOfInterestListInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_POI_LIST_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
export const POI_DETAIL = gql`
|
export const POI_DETAIL = gql`
|
||||||
query poiDetail($id: Int!) {
|
query poiDetail($id: Int!) {
|
||||||
pointOfInterest(id: $id) {
|
pointOfInterest(id: $id) {
|
||||||
|
...pointOfInterestFullPrivateInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${FRAGMENT_POI_FULL_PRIVATE_INFO}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const POI_PUBLIC_DETAIL = gql`
|
||||||
|
query poiDetail($id: Int!) {
|
||||||
|
pointOfInterest(id: $id, public: true) {
|
||||||
...pointOfInterestFullInfo
|
...pointOfInterestFullInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,12 @@ import {useUserStore} from "stores/User";
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import BreadcrumbsNavigation from "components/navigation/BreadcrumbsNavigation.vue";
|
import BreadcrumbsNavigation from "components/navigation/BreadcrumbsNavigation.vue";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import {useQuasar} from "quasar";
|
import {useMeta, useQuasar} from "quasar";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
import {successObject} from "src/composables/dialog";
|
import {successObject} from "src/composables/dialog";
|
||||||
import SidebarNavigation from "components/navigation/SidebarNavigation.vue";
|
import SidebarNavigation from "components/navigation/SidebarNavigation.vue";
|
||||||
import TopMenuButton from "components/navigation/TopMenuButton.vue";
|
import TopMenuButton from "components/navigation/TopMenuButton.vue";
|
||||||
|
import {metaData} from "src/composables/meta";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
@@ -69,6 +70,10 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
const {isQueryRunning, user} = storeToRefs(useUserStore());
|
const {isQueryRunning, user} = storeToRefs(useUserStore());
|
||||||
|
|
||||||
|
useMeta(() => metaData({
|
||||||
|
title: pageTitle.value
|
||||||
|
}));
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
useUserStore().logout().then(() => {
|
useUserStore().logout().then(() => {
|
||||||
$q.notify(successObject("Odhlášení bylo úspěšné"));
|
$q.notify(successObject("Odhlášení bylo úspěšné"));
|
||||||
|
|||||||
@@ -1,28 +1,33 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, watch} from "vue";
|
|
||||||
import {useAircraftsStore} from "stores/Aircrafts";
|
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {useQuasar} from "quasar";
|
import {useMeta, useQuasar} from "quasar";
|
||||||
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
||||||
import {successObject} from "src/composables/dialog";
|
import {confirmObject, successObject} from "src/composables/dialog";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import AircraftDetailCard from "components/aircrafts/AircraftDetailCard.vue";
|
import AircraftDetailCard from "components/aircrafts/AircraftInfo.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
import {computed, watch} from "vue";
|
||||||
|
import {metaData} from "src/composables/meta";
|
||||||
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
import AircraftInfo from "components/aircrafts/AircraftInfo.vue";
|
||||||
|
import {useUserStore} from "stores/User";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
|
|
||||||
const aircraftId = parseInt(useRoute().params.id);
|
const aircraftId = parseInt(useRoute().params.id);
|
||||||
onMounted(() => {
|
useAircraftsStore().fetchDetail(aircraftId);
|
||||||
useAircraftsStore().fetchDetail(aircraftId);
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
})
|
|
||||||
|
|
||||||
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
||||||
watch(() => aircraft.value, (newVal) => {
|
watch(() => aircraft.value, (newVal) => {
|
||||||
if (!newVal) return;
|
if (!newVal) return;
|
||||||
|
|
||||||
useAppStore().setPageTitle(newVal.callSign);
|
useAppStore().setPageTitle(newVal.callSign);
|
||||||
|
useMeta(() => metaData({title: newVal.callSign}));
|
||||||
useAppStore().setBreadcrumbs([
|
useAppStore().setBreadcrumbs([
|
||||||
{label: "Letadla", to: {name: "aircrafts"}},
|
{label: "Letadla", to: {name: "aircrafts"}},
|
||||||
{label: newVal.callSign}
|
{label: newVal.callSign}
|
||||||
@@ -30,29 +35,47 @@ watch(() => aircraft.value, (newVal) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const deleteAircraft = (id) => {
|
const deleteAircraft = (id) => {
|
||||||
|
$q.dialog(confirmObject('Opravdu chceš smazat toto letadlo?'))
|
||||||
|
.onOk(() => {
|
||||||
useAircraftsStore().destroy(id).then(() => {
|
useAircraftsStore().destroy(id).then(() => {
|
||||||
$router.push({name: "aircrafts"});
|
$router.push({name: "aircrafts"});
|
||||||
$q.notify(successObject("Letadlo úspěšně odstraněno"));
|
$q.notify(successObject("Letadlo úspěšně odstraněno"));
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AircraftDetailSkeleton v-if="isQueryRunning || !aircraft"/>
|
<AircraftDetailSkeleton v-if="isQueryRunning || !aircraft"/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<AircraftDetailCard
|
<ContentCard :title-photo="aircraft.titlePhoto" :title="aircraft.callSign">
|
||||||
:aircraft="aircraft"
|
<template #actions v-if="aircraft.createdById === loggedUser?.id">
|
||||||
@delete="deleteAircraft"
|
<div class="col-grow">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
:to='{name: "aircraftEdit", params: {id: aircraft.id}}'
|
||||||
|
icon="edit"
|
||||||
|
text-color="primary"
|
||||||
|
label="Upravit"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
<q-btn @click="deleteAircraft(aircraft.id)" icon="delete" flat text-color="red" label="Smazat"/>
|
||||||
|
</template>
|
||||||
|
<template #content>
|
||||||
|
<q-card-section>
|
||||||
|
<AircraftInfo :aircraft="aircraft"/>
|
||||||
|
|
||||||
<q-card class="flight-detail-card" flat>
|
<PhotoGallery :photos="aircraft.photos"/>
|
||||||
<h3>Lety</h3>
|
<h3>Lety</h3>
|
||||||
<q-banner v-if="aircraft.flights.length === 0" class="bg-light-blue text-white">
|
<q-banner v-if="aircraft.flights.length === 0" class="bg-light-blue text-white">
|
||||||
Zatím žádné lety.
|
Zatím žádné lety.
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<FlightsList :items="aircraft.flights" v-else/>
|
<FlightsList :items="aircraft.flights" :public="false" v-else/>
|
||||||
</q-card>
|
</q-card-section>
|
||||||
|
</template>
|
||||||
|
</ContentCard>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,17 @@ 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} from "vue";
|
import {computed, onMounted} from "vue";
|
||||||
import AircraftEditSkeleton from "components/aircrafts/AircraftEditSkeleton.vue";
|
import AircraftEditSkeleton from "components/aircrafts/AircraftEditSkeleton.vue";
|
||||||
import {successObject} from "src/composables/dialog";
|
import {successObject} from "src/composables/dialog";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import AccessDeniedBanner from "components/banners/AccessDeniedBanner.vue";
|
import AccessDeniedBanner from "components/banners/AccessDeniedBanner.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
|
import POIForm from "components/poi/POIForm.vue";
|
||||||
|
import POIEditSkeleton from "components/poi/POIEditSkeleton.vue";
|
||||||
|
import PhotosEditorList from "components/photos/PhotosEditorList.vue";
|
||||||
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
|
|
||||||
|
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
@@ -36,6 +40,13 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const setTitlePhoto = (titlePhoto) => {
|
||||||
|
useAircraftsStore().update(aircraftId, {titlePhotoId: titlePhoto.id}).then(() => {
|
||||||
|
$q.notify(successObject("Úvodní fotka nastavena"));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const formStep = computed(() => useRoute().params.step || "basic");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -45,8 +56,26 @@ onMounted(() => {
|
|||||||
v-else-if="aircraft.createdById !== loggedUser.id"
|
v-else-if="aircraft.createdById !== loggedUser.id"
|
||||||
:route-back="{name: 'aircraftDetail', params: {id: aircraftId}}"
|
:route-back="{name: 'aircraftDetail', params: {id: aircraftId}}"
|
||||||
/>
|
/>
|
||||||
|
<template v-else>
|
||||||
|
<q-tabs active-color="primary" class="q-mb-lg" v-if="aircraft.photos.length > 0">
|
||||||
|
<q-route-tab
|
||||||
|
icon="edit"
|
||||||
|
label="Informace"
|
||||||
|
replace
|
||||||
|
:to="{name: 'aircraftEdit', params: {id: aircraft?.id, step: 'basic'}}"
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
<q-route-tab
|
||||||
|
icon="add_a_photo"
|
||||||
|
label="Fotky"
|
||||||
|
replace
|
||||||
|
:to="{name: 'aircraftEdit', params: {id: aircraft?.id, step: 'photo'}}"
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
</q-tabs>
|
||||||
|
|
||||||
<q-card v-else class="q-mx-md">
|
<template v-if="formStep === 'basic'">
|
||||||
|
<q-card class="q-mx-md">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<AircraftForm
|
<AircraftForm
|
||||||
@save="handleSave"
|
@save="handleSave"
|
||||||
@@ -56,5 +85,19 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="formStep === 'photo'">
|
||||||
|
|
||||||
|
<q-spinner v-if="isQueryRunning || !aircraft"/>
|
||||||
|
|
||||||
|
<PhotosEditorList
|
||||||
|
v-else
|
||||||
|
:photos="aircraft.photos"
|
||||||
|
:title-photo="aircraft.titlePhoto"
|
||||||
|
:show-actions="false"
|
||||||
|
@set-title-photo="setTitlePhoto"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {onMounted} from "vue";
|
import {computed, onMounted} from "vue";
|
||||||
import CopilotDetailSkeleton from "components/copilots/CopilotDetailSkeleton.vue";
|
import CopilotDetailSkeleton from "components/copilots/CopilotDetailSkeleton.vue";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import FAB from "components/FAB.vue";
|
import FAB from "components/FAB.vue";
|
||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import {useCopilotsStore} from "stores/Copilots";
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
|
||||||
const copilotId = parseInt(useRoute().params.id);
|
const copilotId = parseInt(useRoute().params.id);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -20,20 +23,51 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {isQueryRunning, copilot} = storeToRefs(useCopilotsStore());
|
const {isQueryRunning, copilot} = storeToRefs(useCopilotsStore());
|
||||||
|
|
||||||
|
const copilotTitlePhoto = computed(() => {
|
||||||
|
if (!copilot.value || copilot.value.photos.length === 0) return null;
|
||||||
|
|
||||||
|
return copilot.value.photos[0];
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CopilotDetailSkeleton v-if="isQueryRunning || !copilot"/>
|
<CopilotDetailSkeleton v-if="isQueryRunning || !copilot"/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
||||||
|
<ContentCard :title-photo="copilotTitlePhoto" :title="copilot.name">
|
||||||
|
<template #actions>
|
||||||
|
<div class="col-grow">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
:to="{name: 'copilotEdit', params: {id: copilotId}}"
|
||||||
|
icon="edit"
|
||||||
|
text-color="primary"
|
||||||
|
label="Upravit"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #content>
|
||||||
|
<q-card-section>
|
||||||
|
<PhotoGallery :photos="copilot.photos" v-if="copilot.photos.length > 0"/>
|
||||||
|
<q-banner v-else class="bg-light-blue text-white">
|
||||||
|
Zatím tu nemáš žádné společné fotky. Po nahrání fotky můžeš označit tuto osobu a takto označené
|
||||||
|
fotografie se zobrazí v galerii.
|
||||||
|
</q-banner>
|
||||||
|
|
||||||
<h3>Společné lety</h3>
|
<h3>Společné lety</h3>
|
||||||
|
|
||||||
<q-banner v-if="copilot.flights.length === 0" class="bg-light-blue text-white">
|
<q-banner v-if="copilot.flights.length === 0" class="bg-light-blue text-white">
|
||||||
Zatím tu nemáš uložené žádné společné lety.
|
Zatím tu nemáš uložené žádné společné lety.
|
||||||
</q-banner>
|
</q-banner>
|
||||||
|
|
||||||
<FlightsList :items="copilot.flights" v-else/>
|
<FlightsList :items="copilot.flights" :public="false" v-else/>
|
||||||
|
</q-card-section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ContentCard>
|
||||||
|
|
||||||
<FAB mode="edit" :router-link="{name: 'copilotEdit', params: {id: copilotId}}"/>
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const {isQueryRunning, event} = storeToRefs(useEventsStore());
|
|||||||
Zatím tu nemáš uložené žádné lety.
|
Zatím tu nemáš uložené žádné lety.
|
||||||
</q-banner>
|
</q-banner>
|
||||||
|
|
||||||
<FlightsList :items="event.flights" v-else/>
|
<FlightsList :items="event.flights" :public="false" v-else/>
|
||||||
|
|
||||||
<FAB mode="edit" :router-link="{name: 'eventEdit', params: {id: eventId}}"/>
|
<FAB mode="edit" :router-link="{name: 'eventEdit', params: {id: eventId}}"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import FlightFormSteps from "components/flights/form/FlightFormSteps.vue";
|
import FlightFormSteps from "components/flights/form/FlightFormSteps.vue";
|
||||||
import {onMounted, ref, watch} from "vue";
|
import {computed, onMounted, ref, watch} from "vue";
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
import FlightFormBasic from "components/flights/form/FlightFormBasic.vue";
|
import FlightFormBasic from "components/flights/form/FlightFormBasic.vue";
|
||||||
@@ -14,8 +14,8 @@ 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";
|
||||||
import FlightFormPhotos from "components/flights/form/FlightFormPhotos.vue";
|
import FlightFormPhotos from "components/flights/form/FlightFormPhotos.vue";
|
||||||
import {usePhotosStore} from "stores/Photo";
|
import {usePhotosStore} from "stores/Photos";
|
||||||
import PhotosList from "components/photos/PhotosEditorList.vue";
|
import PhotosEditorList from "components/photos/PhotosEditorList.vue";
|
||||||
import {errorObject, successObject, warningObject} from "src/composables/dialog";
|
import {errorObject, successObject, warningObject} from "src/composables/dialog";
|
||||||
import PhotoFormDialog from "components/photos/PhotoFormDialog.vue";
|
import PhotoFormDialog from "components/photos/PhotoFormDialog.vue";
|
||||||
import FlightFormTrack from "components/flights/form/FlightFormTrack.vue";
|
import FlightFormTrack from "components/flights/form/FlightFormTrack.vue";
|
||||||
@@ -67,7 +67,6 @@ const handleFlightEdit = (data) => {
|
|||||||
const isRequestPending = storeToRefs(useFlightsStore()).isMutationRunning;
|
const isRequestPending = storeToRefs(useFlightsStore()).isMutationRunning;
|
||||||
const uploadInProgress = ref(false);
|
const uploadInProgress = ref(false);
|
||||||
|
|
||||||
|
|
||||||
const handlePhotosUpload = (data) => {
|
const handlePhotosUpload = (data) => {
|
||||||
// todo udelat batch napr. po 5 requestech
|
// todo udelat batch napr. po 5 requestech
|
||||||
// TODO: udelat batch i pro rotace a davkove upravy (info)
|
// TODO: udelat batch i pro rotace a davkove upravy (info)
|
||||||
@@ -101,6 +100,12 @@ const deletePhoto = (id) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setTitlePhoto = (photo) => {
|
||||||
|
useFlightsStore().update(flight.value.id, {titlePhotoId: photo.id}).then(f => {
|
||||||
|
$q.notify(successObject("Úvodní fotografie úspěšně nastavena"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const rotatePhotos = ({photos, direction}) => {
|
const rotatePhotos = ({photos, direction}) => {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (const photo of photos) {
|
for (const photo of photos) {
|
||||||
@@ -123,11 +128,15 @@ const rotatePhotos = ({photos, direction}) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateSinglePhoto = (id, formData) => usePhotosStore().update(id, formData).then((data) => {
|
const updateSinglePhoto = (id, formData) => {
|
||||||
|
formData.copilots = formData.copilots.map(c => ({id: c.id, name: c.name}));
|
||||||
|
|
||||||
|
return usePhotosStore().update(id, formData).then((data) => {
|
||||||
const idx = _findPhotoIndex(data.id);
|
const idx = _findPhotoIndex(data.id);
|
||||||
flight.value.photos[idx] = data;
|
flight.value.photos[idx] = data;
|
||||||
usePointsOfInterestStore().fetch();
|
usePointsOfInterestStore().fetch();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const handlePhotoUpdate = (flightId, formData) => {
|
const handlePhotoUpdate = (flightId, formData) => {
|
||||||
const photoId = formData.id;
|
const photoId = formData.id;
|
||||||
@@ -170,13 +179,14 @@ const handleBatchPhotoEdit = async (flightId, data) => {
|
|||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (const id of photoIds) {
|
for (const id of photoIds) {
|
||||||
const updateData = {};
|
const updateData = {
|
||||||
|
isAircraft: data.isAircraft,
|
||||||
|
copilots: data.copilots.map(c => ({id: c.id, name: c.name}))
|
||||||
|
};
|
||||||
if (data.name !== '') updateData.name = data.name;
|
if (data.name !== '') updateData.name = data.name;
|
||||||
if (data.description !== '') updateData.description = data.description;
|
if (data.description !== '') updateData.description = data.description;
|
||||||
if (data.pointOfInterest) updateData.pointOfInterest = data.pointOfInterest;
|
if (data.pointOfInterest) updateData.pointOfInterest = data.pointOfInterest;
|
||||||
|
|
||||||
if (Object.keys(updateData).length === 0) continue;
|
|
||||||
|
|
||||||
promises.push(updateSinglePhoto(id, data));
|
promises.push(updateSinglePhoto(id, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +201,6 @@ const handleBatchPhotoEdit = async (flightId, data) => {
|
|||||||
if (error > 0) $q.notify(errorObject(`Nepovedlo se uložit ${error} fotografií`))
|
if (error > 0) $q.notify(errorObject(`Nepovedlo se uložit ${error} fotografií`))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -232,17 +241,22 @@ const handleBatchPhotoEdit = async (flightId, data) => {
|
|||||||
@save="handlePhotosUpload"
|
@save="handlePhotosUpload"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PhotosList
|
<PhotosEditorList
|
||||||
|
:title-photo="flight.titlePhoto"
|
||||||
:photos="flight.photos"
|
:photos="flight.photos"
|
||||||
|
:show-actions="true"
|
||||||
@edit="openPhotoEdit"
|
@edit="openPhotoEdit"
|
||||||
@batch-edit="openBatchPhotoForm"
|
@batch-edit="openBatchPhotoForm"
|
||||||
@batch-rotate="rotatePhotos"
|
@batch-rotate="rotatePhotos"
|
||||||
@delete="deletePhoto"
|
@delete="deletePhoto"
|
||||||
|
@set-title-photo="setTitlePhoto"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Dialogs for photo edit -->
|
<!-- Dialogs for photo edit -->
|
||||||
<PhotoFormDialog
|
<PhotoFormDialog
|
||||||
v-model="openEdit"
|
v-model="openEdit"
|
||||||
|
:copilots="flight.copilots"
|
||||||
|
:aircraft="flight.aircraft"
|
||||||
:locations="pointsOfInterest"
|
:locations="pointsOfInterest"
|
||||||
:photo="editPhoto"
|
:photo="editPhoto"
|
||||||
@save="handlePhotoUpdate(flightId, $event)"
|
@save="handlePhotoUpdate(flightId, $event)"
|
||||||
@@ -252,6 +266,8 @@ const handleBatchPhotoEdit = async (flightId, data) => {
|
|||||||
v-model="openBatchEdit"
|
v-model="openBatchEdit"
|
||||||
:locations="pointsOfInterest"
|
:locations="pointsOfInterest"
|
||||||
:photos="editBatchPhotos"
|
:photos="editBatchPhotos"
|
||||||
|
:copilots="flight.copilots"
|
||||||
|
:aircraft="flight.aircraft"
|
||||||
@save="handleBatchPhotoEdit(flightId, $event)"
|
@save="handleBatchPhotoEdit(flightId, $event)"
|
||||||
@delete="deletePhoto"
|
@delete="deletePhoto"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -13,13 +13,15 @@ import {useUserStore} from "stores/User";
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
||||||
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
const flightId = parseInt(useRoute().params.id);
|
const flightId = parseInt(useRoute().params.id);
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
|
|
||||||
onMounted(() => {flight.value
|
onMounted(() => {
|
||||||
useFlightsStore().fetchDetail(flightId).then(f => {
|
useFlightsStore().fetchDetail(flightId).then(f => {
|
||||||
const flightNameFormatted = flightName(f);
|
const flightNameFormatted = flightName(f);
|
||||||
useAppStore().setPageTitle(flightNameFormatted);
|
useAppStore().setPageTitle(flightNameFormatted);
|
||||||
@@ -40,7 +42,6 @@ const handleDeleteAndRedirect = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const togglePublicVisibility = () => {
|
const togglePublicVisibility = () => {
|
||||||
const newVisibility = !flight.value.isPublic;
|
const newVisibility = !flight.value.isPublic;
|
||||||
useFlightsStore()
|
useFlightsStore()
|
||||||
@@ -67,19 +68,14 @@ const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
|||||||
<template>
|
<template>
|
||||||
<FlightDetailSkeleton v-if="isQueryRunning || !flight"/>
|
<FlightDetailSkeleton v-if="isQueryRunning || !flight"/>
|
||||||
|
|
||||||
<q-card class="flight-detail-card" v-else>
|
<ContentCard :title-photo="flight.titlePhoto" :title="flightName(flight)" v-else>
|
||||||
<q-img :src="flight.coverPhoto.url" v-if="flight.coverPhoto">
|
|
||||||
<div class="absolute-bottom custom-caption">
|
|
||||||
<div class="text-h5"> {{ flightName(flight) }}</div>
|
|
||||||
</div>
|
|
||||||
</q-img>
|
|
||||||
|
|
||||||
<q-card-actions class="q-my-md">
|
<template #actions>
|
||||||
<div class="col-grow">
|
<div class="col-grow">
|
||||||
<q-btn
|
<q-btn
|
||||||
@click="togglePublicVisibility"
|
@click="togglePublicVisibility"
|
||||||
:icon="flight.isPublic ? 'visibility_off' : 'visibility'"
|
:icon="flight.isPublic ? 'visibility_off' : 'visibility'"
|
||||||
:disable="!loggedUser.publicUsername"
|
:disable="!loggedUser?.publicUsername"
|
||||||
flat
|
flat
|
||||||
:label="flight.isPublic ? 'Skrýt' : 'Zveřejnit'"
|
:label="flight.isPublic ? 'Skrýt' : 'Zveřejnit'"
|
||||||
/>
|
/>
|
||||||
@@ -93,14 +89,16 @@ const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<q-btn @click="handleDeleteAndRedirect" icon="delete" flat text-color="red" label="Smazat"/>
|
<q-btn @click="handleDeleteAndRedirect" icon="delete" flat text-color="red" label="Smazat"/>
|
||||||
</q-card-actions>
|
</template>
|
||||||
|
|
||||||
|
<template #content>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<q-btn flat class="q-my-sm" :to="{name: 'flightEdit', params: {id: flightId, step: 'basic'}}" icon="edit" color="primary">Upravit informace</q-btn>
|
<q-btn flat class="q-my-sm" :to="{name: 'flightEdit', params: {id: flightId, step: 'basic'}}" icon="edit" color="primary">Upravit informace</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<FlightBasicInfo
|
<FlightBasicInfo
|
||||||
:flight="flight"
|
:flight="flight"
|
||||||
|
:aircraft-detail-route="{name: 'aircraftDetail'}"
|
||||||
:copilot-detail-route="{name: 'copilotDetail'}"
|
:copilot-detail-route="{name: 'copilotDetail'}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -139,7 +137,10 @@ const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
|||||||
<FlightTrackMap
|
<FlightTrackMap
|
||||||
v-else
|
v-else
|
||||||
:flight="flight"
|
:flight="flight"
|
||||||
|
:photos="flight.photos"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</template>
|
||||||
|
</ContentCard>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const {flights, isQueryRunning} = storeToRefs(useFlightsStore());
|
|||||||
Nemáš zaznamenaný žádný let.
|
Nemáš zaznamenaný žádný let.
|
||||||
</BasicInfoBanner>
|
</BasicInfoBanner>
|
||||||
|
|
||||||
<FlightsList v-else :items="flights"/>
|
<FlightsList v-else :items="flights" :public="false" />
|
||||||
|
|
||||||
<FAB mode="add" :router-link="{name: 'addFlight'}"/>
|
<FAB mode="add" :router-link="{name: 'addFlight'}"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {onMounted, ref, watch} from "vue";
|
import {onMounted, ref, watch} from "vue";
|
||||||
import {usePhotosStore} from "stores/Photo";
|
import {usePhotosStore} from "stores/Photos";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import {flightName} from "src/composables/flight";
|
import {flightName} from "src/composables/flight";
|
||||||
import VuePictureCropper from 'vue-picture-cropper';
|
import VuePictureCropper from 'vue-picture-cropper';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import POIEditSkeleton from "components/poi/POIEditSkeleton.vue";
|
import POIEditSkeleton from "components/poi/POIEditSkeleton.vue";
|
||||||
import {onMounted} from "vue";
|
import {computed, onMounted} from "vue";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
@@ -11,6 +11,8 @@ import {storeToRefs} from "pinia";
|
|||||||
import POIForm from "components/poi/POIForm.vue";
|
import POIForm from "components/poi/POIForm.vue";
|
||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
import AccessDeniedBanner from "components/banners/AccessDeniedBanner.vue";
|
import AccessDeniedBanner from "components/banners/AccessDeniedBanner.vue";
|
||||||
|
import PhotoEditorSkeleton from "components/photos/PhotoEditorSkeleton.vue";
|
||||||
|
import PhotosEditorList from "components/photos/PhotosEditorList.vue";
|
||||||
|
|
||||||
const poiId = parseInt(useRoute().params.id);
|
const poiId = parseInt(useRoute().params.id);
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ onMounted(() => {
|
|||||||
usePointsOfInterestTypeStore().fetch();
|
usePointsOfInterestTypeStore().fetch();
|
||||||
})
|
})
|
||||||
|
|
||||||
const poiTypes = storeToRefs(usePointsOfInterestTypeStore()).items;
|
const poiTypes = storeToRefs(usePointsOfInterestTypeStore()).types;
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
const {isQueryRunning, pointOfInterest, isMutationRunning} = storeToRefs(usePointsOfInterestStore());
|
const {isQueryRunning, pointOfInterest, isMutationRunning} = storeToRefs(usePointsOfInterestStore());
|
||||||
|
|
||||||
@@ -39,13 +41,54 @@ const handleSave = (data) => {
|
|||||||
router.push({name: "poiDetail", params: {id: poiId}});
|
router.push({name: "poiDetail", params: {id: poiId}});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setTitlePhoto = (titlePhoto) => {
|
||||||
|
usePointsOfInterestStore().update(poiId, {titlePhotoId: titlePhoto.id}).then(() => {
|
||||||
|
$q.notify(successObject("Úvodní fotka nastavena"));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const formStep = computed(() => useRoute().params.step || "basic");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<POIEditSkeleton v-if="isQueryRunning"/>
|
|
||||||
<AccessDeniedBanner
|
<AccessDeniedBanner
|
||||||
v-else-if="pointOfInterest.createdById !== loggedUser.id"
|
v-if="pointOfInterest && !isQueryRunning && pointOfInterest.createdById !== loggedUser?.id"
|
||||||
:route-back="{name: 'poiDetail', params: {id: poiId}}"
|
:route-back="{name: 'poiDetail', params: {id: poiId}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<q-tabs active-color="primary" class="q-mb-lg">
|
||||||
|
<q-route-tab
|
||||||
|
icon="edit"
|
||||||
|
label="Informace"
|
||||||
|
replace
|
||||||
|
:to="{name: 'poiEdit', params: {id: pointOfInterest?.id, step: 'basic'}}"
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
<q-route-tab
|
||||||
|
icon="add_a_photo"
|
||||||
|
label="Fotky"
|
||||||
|
replace
|
||||||
|
:to="{name: 'poiEdit', params: {id: pointOfInterest?.id, step: 'photo'}}"
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
</q-tabs>
|
||||||
|
|
||||||
|
<template v-if="formStep === 'basic'">
|
||||||
|
<POIEditSkeleton v-if="isQueryRunning || !pointOfInterest"/>
|
||||||
<POIForm :poi="pointOfInterest" :types="poiTypes" v-else @save="handleSave"/>
|
<POIForm :poi="pointOfInterest" :types="poiTypes" v-else @save="handleSave"/>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="formStep === 'photo'">
|
||||||
|
|
||||||
|
<q-spinner v-if="isQueryRunning || !pointOfInterest"/>
|
||||||
|
|
||||||
|
<PhotosEditorList
|
||||||
|
v-else
|
||||||
|
:photos="pointOfInterest.photos"
|
||||||
|
:title-photo="pointOfInterest.titlePhoto"
|
||||||
|
:show-actions="false"
|
||||||
|
@set-title-photo="setTitlePhoto"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
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";
|
import POIDetailSkeleton from "components/poi/POIDetailSkeleton.vue";
|
||||||
import FAB from "components/FAB.vue";
|
import FAB from "components/FAB.vue";
|
||||||
@@ -11,6 +11,8 @@ import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
|
|||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
|
|
||||||
@@ -25,13 +27,35 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {isQueryRunning, pointOfInterest} = storeToRefs(usePointsOfInterestStore());
|
const {isQueryRunning, pointOfInterest} = storeToRefs(usePointsOfInterestStore());
|
||||||
|
|
||||||
|
const titlePhoto = computed(() => {
|
||||||
|
if (!pointOfInterest.value || pointOfInterest.value.photos.length === 0) return null;
|
||||||
|
|
||||||
|
return pointOfInterest.value.titlePhoto || pointOfInterest.value.photos[0];
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<POIDetailSkeleton v-if="isQueryRunning || !pointOfInterest"/>
|
<POIDetailSkeleton v-if="isQueryRunning || !pointOfInterest"/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<article v-html="pointOfInterest.description" class="q-my-lg" />
|
|
||||||
|
<ContentCard :title-photo="titlePhoto" :title="pointOfInterest.name">
|
||||||
|
<template #actions v-if="pointOfInterest.createdById === loggedUser.id">
|
||||||
|
<div class="col-grow">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
:to="{name: 'poiEdit', params:{id: pointOfInterest.id}}"
|
||||||
|
icon="edit"
|
||||||
|
text-color="primary"
|
||||||
|
label="Upravit"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #content>
|
||||||
|
<q-card-section>
|
||||||
|
<article v-html="pointOfInterest.description" class="q-my-lg"/>
|
||||||
|
|
||||||
<EmbeddedMap
|
<EmbeddedMap
|
||||||
v-if="pointOfInterest.gpsLatitude && pointOfInterest.gpsLongitude"
|
v-if="pointOfInterest.gpsLatitude && pointOfInterest.gpsLongitude"
|
||||||
@@ -47,14 +71,17 @@ const {isQueryRunning, pointOfInterest} = storeToRefs(usePointsOfInterestStore()
|
|||||||
:photos="pointOfInterest.photos"
|
:photos="pointOfInterest.photos"
|
||||||
v-if="pointOfInterest.photos.length > 0"
|
v-if="pointOfInterest.photos.length > 0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BasicInfoBanner v-else>
|
<BasicInfoBanner v-else>
|
||||||
Pokud přidáš toto místo k nějaké fotce, zobrazí se tu.
|
Pokud přidáš toto místo k nějaké fotce, zobrazí se tu.
|
||||||
</BasicInfoBanner>
|
</BasicInfoBanner>
|
||||||
|
|
||||||
<FlightsList :items="pointOfInterest.flights" v-if="pointOfInterest.flights.length > 0 && loggedUser.id === pointOfInterest.createdById"/>
|
<FlightsList
|
||||||
|
:items="pointOfInterest.flights"
|
||||||
<FAB v-if="pointOfInterest.createdById === loggedUser.id" :router-link="{name: 'poiEdit', params:{id: pointOfInterest.id}}" mode="edit"/>
|
:public="false"
|
||||||
|
v-if="pointOfInterest.flights.length > 0 && loggedUser.id === pointOfInterest.createdById"
|
||||||
|
/>
|
||||||
|
</q-card-section>
|
||||||
|
</template>
|
||||||
|
</ContentCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<script>
|
||||||
|
import {useAircraftsStore} from "stores/Aircrafts";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
preFetch({currentRoute}) {
|
||||||
|
return useAircraftsStore().fetchPublicDetail(currentRoute.params.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {useRouter} from "vue-router";
|
||||||
|
import {useMeta, useQuasar} from "quasar";
|
||||||
|
import AircraftDetailSkeleton from "components/aircrafts/AircraftDetailSkeleton.vue";
|
||||||
|
import {confirmObject, successObject} from "src/composables/dialog";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
import {computed, onMounted, watch} from "vue";
|
||||||
|
import {metaData} from "src/composables/meta";
|
||||||
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
import AircraftInfo from "components/aircrafts/AircraftInfo.vue";
|
||||||
|
import {useUserStore} from "stores/User";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const $router = useRouter();
|
||||||
|
|
||||||
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
|
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
||||||
|
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
||||||
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
|
|
||||||
|
usePhotosStore().fetchPublic({aircraftId: aircraft.value.id});
|
||||||
|
useFlightsStore().fetchPublic({aircraftId: aircraft.value.id})
|
||||||
|
|
||||||
|
useAppStore().setPageTitle(aircraft.value.callSign);
|
||||||
|
useMeta(() => metaData({
|
||||||
|
title: aircraft.value.callSign,
|
||||||
|
image: aircraft.value.titleImage?.url
|
||||||
|
}));
|
||||||
|
useAppStore().setBreadcrumbs([
|
||||||
|
{label: "Polétání.cz", to: {name: "homepage"}},
|
||||||
|
{label: aircraft.value.callSign}
|
||||||
|
]);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AircraftDetailSkeleton v-if="isQueryRunning || !aircraft"/>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<ContentCard :title-photo="aircraft.titlePhoto" :title="aircraft.callSign">
|
||||||
|
<template #content>
|
||||||
|
<q-card-section>
|
||||||
|
<AircraftInfo :aircraft="aircraft"/>
|
||||||
|
|
||||||
|
<PhotoGallery :photos="photos"/>
|
||||||
|
|
||||||
|
<h3>Lety</h3>
|
||||||
|
|
||||||
|
<FlightsList :items="flights" :public="true" />
|
||||||
|
</q-card-section>
|
||||||
|
</template>
|
||||||
|
</ContentCard>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
preFetch({currentRoute}) {
|
preFetch({store, currentRoute}) {
|
||||||
return useUserStore().fetchPublicUserDetail(currentRoute.params.username);
|
return useUserStore(store).fetchPublicUserDetail(currentRoute.params.username);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<script>
|
||||||
|
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
preFetch({currentRoute, store}) {
|
||||||
|
return usePointsOfInterestStore(store).fetchPublicDetail(currentRoute.params.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
import EmbeddedMap from "components/map/EmbeddedMap.vue";
|
||||||
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
|
import {useAppStore} from "stores/App";
|
||||||
|
import {useMeta} from "quasar";
|
||||||
|
import {metaData} from "src/composables/meta";
|
||||||
|
|
||||||
|
const {pointOfInterest, isQueryRunning} = storeToRefs(usePointsOfInterestStore());
|
||||||
|
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
||||||
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
|
|
||||||
|
usePhotosStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
||||||
|
useFlightsStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
||||||
|
|
||||||
|
useAppStore().setPageTitle(pointOfInterest.value.name);
|
||||||
|
useMeta(() => metaData({
|
||||||
|
title: pointOfInterest.value.name,
|
||||||
|
image: pointOfInterest.value.titlePhoto.url,
|
||||||
|
description: pointOfInterest.value.description,
|
||||||
|
}))
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-spinner v-if="isQueryRunning || !pointOfInterest"/>
|
||||||
|
<ContentCard :title-photo="pointOfInterest.titlePhoto" :title="pointOfInterest.name" v-else>
|
||||||
|
<template #content>
|
||||||
|
|
||||||
|
<q-card-section>
|
||||||
|
|
||||||
|
<article v-html="pointOfInterest.description"/>
|
||||||
|
|
||||||
|
<EmbeddedMap
|
||||||
|
v-if="pointOfInterest.gpsLatitude && pointOfInterest.gpsLongitude"
|
||||||
|
:gps-latitude="pointOfInterest.gpsLatitude"
|
||||||
|
:gps-longitude="pointOfInterest.gpsLongitude"
|
||||||
|
:zoom="13"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PhotoGallery :photos="photos"/>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Lety</h3>
|
||||||
|
|
||||||
|
<FlightsList :public="true" :items="flights" />
|
||||||
|
</q-card-section>
|
||||||
|
</template>
|
||||||
|
</ContentCard>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
poi
|
||||||
|
</template>
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
import {useCopilotsStore} from "stores/Copilots";
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
preFetch({currentRoute}) {
|
preFetch({store, currentRoute}) {
|
||||||
return useCopilotsStore().fetchDetail(currentRoute.params.id, currentRoute.params.username);
|
return useCopilotsStore(store).fetchPublicDetail(currentRoute.params.id, currentRoute.params.username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -13,6 +13,14 @@ import FlightsList from "components/flights/FlightsList.vue";
|
|||||||
import {useAppStore} from "stores/App";
|
import {useAppStore} from "stores/App";
|
||||||
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
|
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
import {onMounted} from "vue";
|
||||||
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
import PhotoGallery from "components/photos/PhotoGallery.vue";
|
||||||
|
import {useMeta} from "quasar";
|
||||||
|
import {metaData} from "src/composables/meta";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
pilot: {
|
pilot: {
|
||||||
@@ -22,25 +30,47 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {copilot, isQueryRunning} = storeToRefs(useCopilotsStore());
|
const {copilot, isQueryRunning} = storeToRefs(useCopilotsStore());
|
||||||
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
|
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
||||||
|
|
||||||
useAppStore().setPageTitle(`${pilot.name} + ${copilot.value.name}`);
|
useAppStore().setPageTitle(`${props.pilot.name} + ${copilot.value.name}`);
|
||||||
useAppStore().setBreadcrumbs([
|
useAppStore().setBreadcrumbs([
|
||||||
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
||||||
{to: {name: "publicProfileDetail", params: {username: props.username}}, label: `@${props.username}`},
|
{to: {name: "publicProfileDetail", params: {username: props.pilot.publicUsername}}, label: `@${props.pilot.publicUsername}`},
|
||||||
{label: props.pilot.name}
|
{label: copilot.value.name}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
useMeta(() => metaData({
|
||||||
|
title: copilot.value.name,
|
||||||
|
keywords: ["kopilot", "výlet", "fotogalerie", copilot.value.name, "létání", "fotografie"],
|
||||||
|
description: `Společné polétání: ${props.pilot.name} + ${copilot.value.name}.`,
|
||||||
|
image: copilot.value.titleImage?.url
|
||||||
|
}));
|
||||||
|
|
||||||
|
useFlightsStore().fetchPublic({copilotId: copilot.value.id});
|
||||||
|
usePhotosStore().fetchPublic({copilotId: copilot.value.id})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicListSkeleton v-if="isQueryRunning || !copilot" class="q-mb-md"/>
|
|
||||||
|
|
||||||
<template v-else>
|
<ContentCard v-if="!isQueryRunning" :title-photo="copilot.titlePhoto" :title="copilot.name">
|
||||||
|
<template #content>
|
||||||
|
<q-card-section>
|
||||||
|
|
||||||
|
<q-spinner v-if="arePhotosLoading"/>
|
||||||
|
<PhotoGallery :photos="photos" v-else/>
|
||||||
|
|
||||||
<h3>Společné lety</h3>
|
<h3>Společné lety</h3>
|
||||||
|
<FlightsListSkeleton v-if="areFlightsLoading && flights.length === 0"/>
|
||||||
<FlightsList
|
<FlightsList
|
||||||
:items="copilot.flights"
|
v-else
|
||||||
:route-detail="{name: 'publicFlightDetail', params: {username: pilot.publicUsername}}"
|
:items="flights"
|
||||||
|
:public="true"
|
||||||
class="q-mb-md"
|
class="q-mb-md"
|
||||||
/>
|
/>
|
||||||
|
</q-card-section>
|
||||||
</template>
|
</template>
|
||||||
|
</ContentCard>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ watch(() => event.value, (newVal) => {
|
|||||||
<FlightsList
|
<FlightsList
|
||||||
v-else
|
v-else
|
||||||
:items="event.flights"
|
:items="event.flights"
|
||||||
|
:public="true"
|
||||||
class="q-my-lg"
|
class="q-my-lg"
|
||||||
:route-detail="{name: 'publicFlightDetail', params: {username: routeParams.username}}"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
preFetch({currentRoute}) {
|
preFetch({store, currentRoute}) {
|
||||||
return useFlightsStore().fetchDetail(currentRoute.params.id, currentRoute.params.username)
|
return useFlightsStore(store).fetchPublicDetail(currentRoute.params.id, currentRoute.params.username)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -19,12 +19,18 @@ import {useRoute} from "vue-router";
|
|||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
import {useMeta} from "quasar";
|
import {useMeta} from "quasar";
|
||||||
import {metaData} from "src/composables/meta";
|
import {metaData} from "src/composables/meta";
|
||||||
|
import ContentCard from "components/ContentCard.vue";
|
||||||
|
import {usePhotosStore} from "stores/Photos";
|
||||||
|
import {onMounted} from "vue";
|
||||||
|
|
||||||
const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
||||||
const routeParams = useRoute().params;
|
const routeParams = useRoute().params;
|
||||||
|
|
||||||
const pilot = storeToRefs(useUserStore()).publicUser;
|
const pilot = storeToRefs(useUserStore()).publicUser;
|
||||||
|
|
||||||
|
usePhotosStore().fetchPublic({flightId: flight.value.id});
|
||||||
|
const {isQueryRunning: arePhotosLoading, photos: flightPhotos} = storeToRefs(usePhotosStore());
|
||||||
|
|
||||||
const flightNameFormatted = flightName(flight.value);
|
const flightNameFormatted = flightName(flight.value);
|
||||||
useAppStore().setPageTitle(flightNameFormatted);
|
useAppStore().setPageTitle(flightNameFormatted);
|
||||||
useAppStore().setBreadcrumbs([
|
useAppStore().setBreadcrumbs([
|
||||||
@@ -37,40 +43,35 @@ useMeta(() => metaData({
|
|||||||
title: `${flightNameFormatted} - ${pilot.value.name}`,
|
title: `${flightNameFormatted} - ${pilot.value.name}`,
|
||||||
keywords: ["let", "výlet", "letadlo", pilot.value.name, flight.value.aircraft.callSign],
|
keywords: ["let", "výlet", "letadlo", pilot.value.name, flight.value.aircraft.callSign],
|
||||||
description: flight.description,
|
description: flight.description,
|
||||||
image: flight.coverPhoto?.url
|
image: flight.titlePhoto?.url
|
||||||
}
|
}
|
||||||
))
|
));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<FlightDetailSkeleton v-if="isQueryRunning || !flight"/>
|
<FlightDetailSkeleton v-if="isQueryRunning || !flight"/>
|
||||||
|
|
||||||
<template v-else>
|
<ContentCard :title-photo="flight.titlePhoto" :title="flightName(flight)" v-else>
|
||||||
<q-banner class="bg-warning text-white q-mx-md q-my-md" v-if="!flight.isPublic">
|
<template #content>
|
||||||
Pozor! Tento let není publikován a nebude tak dostupný pro ostatní!
|
|
||||||
</q-banner>
|
|
||||||
|
|
||||||
<q-card class="q-mx-md q-my-md flight-detail-card">
|
|
||||||
<q-img :src="flight.coverPhoto.url" v-if="flight.coverPhoto">
|
|
||||||
<div class="absolute-bottom custom-caption">
|
|
||||||
<div class="text-h5">{{ flightName(flight) }}</div>
|
|
||||||
</div>
|
|
||||||
</q-img>
|
|
||||||
|
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<FlightBasicInfo
|
<FlightBasicInfo
|
||||||
:flight="flight"
|
:flight="flight"
|
||||||
|
:poi-detail-route="{name: 'publicPOIDetail'}"
|
||||||
|
:aircraft-detail-route="flight.aircraft.isPublic ? {name: 'publicAircraftDetail'} : null"
|
||||||
:copilot-detail-route="{name: 'publicCopilotDetail', params: {username: routeParams.username}}"
|
:copilot-detail-route="{name: 'publicCopilotDetail', params: {username: routeParams.username}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<article class="q-my-lg" v-html="flight.description"/>
|
<article class="q-my-lg" v-html="flight.description"/>
|
||||||
|
|
||||||
<PhotoGallery :photos="flight.photos"/>
|
<q-no-ssr>
|
||||||
|
<q-inner-loading v-if="arePhotosLoading"/>
|
||||||
|
<PhotoGallery :photos="flightPhotos" v-else/>
|
||||||
|
</q-no-ssr>
|
||||||
|
|
||||||
<FlightTrackMap :flight="flight"/>
|
<FlightTrackMap :flight="flight" :photos="flightPhotos"/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
|
||||||
</template>
|
</template>
|
||||||
|
</ContentCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ useAppStore().setBreadcrumbs([
|
|||||||
{label: `@${props.pilot.publicUsername}`},
|
{label: `@${props.pilot.publicUsername}`},
|
||||||
])
|
])
|
||||||
|
|
||||||
useFlightsStore().fetch(props.pilot.publicUsername);
|
useFlightsStore().fetchPublic({username: props.pilot.publicUsername});
|
||||||
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
const loggedUser = storeToRefs(useUserStore()).user;
|
const loggedUser = storeToRefs(useUserStore()).user;
|
||||||
</script>
|
</script>
|
||||||
@@ -37,7 +37,7 @@ const loggedUser = storeToRefs(useUserStore()).user;
|
|||||||
<template>
|
<template>
|
||||||
<PublicFlightEventSwitcher :username="pilot?.publicUsername"/>
|
<PublicFlightEventSwitcher :username="pilot?.publicUsername"/>
|
||||||
|
|
||||||
<FlightsListSkeleton v-if="areFlightsLoading"/>
|
<FlightsListSkeleton v-if="areFlightsLoading && flights?.length === 0"/>
|
||||||
|
|
||||||
<q-banner class="bg-primary text-white" v-else-if="!areFlightsLoading && flights.length === 0">
|
<q-banner class="bg-primary text-white" v-else-if="!areFlightsLoading && flights.length === 0">
|
||||||
Tento pilot zatím nepublikoval žádný let.
|
Tento pilot zatím nepublikoval žádný let.
|
||||||
@@ -46,8 +46,7 @@ const loggedUser = storeToRefs(useUserStore()).user;
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<FlightsList
|
<FlightsList
|
||||||
:items="flights"
|
:items="flights"
|
||||||
:displayVisibilityInfo="loggedUser?.id === pilot?.id"
|
:public="true"
|
||||||
:route-detail="{name: 'publicFlightDetail', params: {username: pilot?.publicUsername}}"
|
|
||||||
class="q-mb-md"
|
class="q-mb-md"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ const routes = [
|
|||||||
{path: 'udalosti/:id', name: "publicEventDetail", component: () => import('pages/public/pilotProfile/EventDetailPage.vue')},
|
{path: 'udalosti/:id', name: "publicEventDetail", component: () => import('pages/public/pilotProfile/EventDetailPage.vue')},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{path: 'letadlo/:id', name: "publicAircraftDetail", component: () => import('pages/public/AircraftDetailPage.vue')},
|
||||||
|
{path: 'mista', name: "publicPOIs", component: () => import('pages/public/PointsOfInterestMapPage.vue')},
|
||||||
|
{path: 'mista/:id', name: "publicPOIDetail", component: () => import('pages/public/PointOfInterestDetailPage.vue')},
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -41,7 +44,7 @@ const routes = [
|
|||||||
{path: 'poi', name: "poi", component: () => import('pages/profile/poi/PointsOfInterestPage.vue')},
|
{path: 'poi', name: "poi", component: () => import('pages/profile/poi/PointsOfInterestPage.vue')},
|
||||||
{path: 'poi/novy', name: "addPOI", component: () => import('pages/profile/poi/NewPointOfInterestPage.vue')},
|
{path: 'poi/novy', name: "addPOI", component: () => import('pages/profile/poi/NewPointOfInterestPage.vue')},
|
||||||
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/poi/PointOfInterestDetailPage.vue')},
|
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/poi/PointOfInterestDetailPage.vue')},
|
||||||
{path: 'poi/:id/edit', name: "poiEdit", component: () => import('pages/profile/poi/EditPointOfInterestPage.vue')},
|
{path: 'poi/:id/edit/:step?', name: "poiEdit", component: () => import('pages/profile/poi/EditPointOfInterestPage.vue')},
|
||||||
{path: 'kopiloti', name: "copilots", component: () => import('pages/profile/copilot/CopilotsPage.vue')},
|
{path: 'kopiloti', name: "copilots", component: () => import('pages/profile/copilot/CopilotsPage.vue')},
|
||||||
{path: 'kopiloti/novy', name: "addCopilot", component: () => import('pages/profile/copilot/NewCopilotPage.vue')},
|
{path: 'kopiloti/novy', name: "addCopilot", component: () => import('pages/profile/copilot/NewCopilotPage.vue')},
|
||||||
{path: 'kopiloti/:id', name: "copilotDetail", component: () => import('pages/profile/copilot/CopilotDetailPage.vue')},
|
{path: 'kopiloti/:id', name: "copilotDetail", component: () => import('pages/profile/copilot/CopilotDetailPage.vue')},
|
||||||
@@ -49,7 +52,7 @@ const routes = [
|
|||||||
{path: 'letadla', name: "aircrafts", component: () => import('pages/profile/aircraft/AircraftsPage.vue')},
|
{path: 'letadla', name: "aircrafts", component: () => import('pages/profile/aircraft/AircraftsPage.vue')},
|
||||||
{path: 'letadla/nove', name: "addAircraft", component: () => import('pages/profile/aircraft/NewAircraftsPage.vue')},
|
{path: 'letadla/nove', name: "addAircraft", component: () => import('pages/profile/aircraft/NewAircraftsPage.vue')},
|
||||||
{path: 'letadla/:id', name: "aircraftDetail", component: () => import('pages/profile/aircraft/AircraftDetailPage.vue')},
|
{path: 'letadla/:id', name: "aircraftDetail", component: () => import('pages/profile/aircraft/AircraftDetailPage.vue')},
|
||||||
{path: 'letadla/:id/edit', name: "aircraftEdit", component: () => import('pages/profile/aircraft/EditAircraftPage.vue')},
|
{path: 'letadla/:id/edit/:step?', name: "aircraftEdit", component: () => import('pages/profile/aircraft/EditAircraftPage.vue')},
|
||||||
|
|
||||||
{path: 'foto-editor/:id', name: "photoEditor", component: () => import("pages/profile/flight/PhotoEditorPage.vue")},
|
{path: 'foto-editor/:id', name: "photoEditor", component: () => import("pages/profile/flight/PhotoEditorPage.vue")},
|
||||||
|
|
||||||
|
|||||||
+14
-3
@@ -1,6 +1,6 @@
|
|||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {AIRCRAFT_DETAIL, AIRCRAFTS_LIST} from "src/graphql/queries/aircrafts";
|
import {AIRCRAFT_DETAIL, AIRCRAFT_PUBLIC_DETAIL, AIRCRAFTS_LIST} from "src/graphql/queries/aircrafts";
|
||||||
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
|
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
|
||||||
import {CREATE_AIRCRAFT, EDIT_AIRCRAFT, DELETE_AIRCRAFT} from "src/graphql/mutations/aircrafts";
|
import {CREATE_AIRCRAFT, EDIT_AIRCRAFT, DELETE_AIRCRAFT} from "src/graphql/mutations/aircrafts";
|
||||||
|
|
||||||
@@ -18,6 +18,14 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
|
|||||||
}).then(item => aircraft.value = item);
|
}).then(item => aircraft.value = item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchPublicDetail = (id) => {
|
||||||
|
return query({
|
||||||
|
isQueryRunning,
|
||||||
|
query: AIRCRAFT_PUBLIC_DETAIL,
|
||||||
|
variables: {id, public: true},
|
||||||
|
}).then(item => aircraft.value = item);
|
||||||
|
};
|
||||||
|
|
||||||
const fetch = () => {
|
const fetch = () => {
|
||||||
return query({
|
return query({
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
@@ -38,7 +46,10 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
|
|||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: EDIT_AIRCRAFT,
|
mutation: EDIT_AIRCRAFT,
|
||||||
variables: {id, input}
|
variables: {id, input}
|
||||||
}).then(item => updateInItems(aircrafts.value, 'id', item))
|
}).then(item => {
|
||||||
|
updateInItems(aircrafts.value, 'id', item);
|
||||||
|
aircraft.value = item;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const destroy = (id) => {
|
const destroy = (id) => {
|
||||||
@@ -51,7 +62,7 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
aircrafts, aircraft, isQueryRunning, isMutationRunning, fetchDetail, fetch, create,
|
aircrafts, aircraft, isQueryRunning, isMutationRunning, fetchDetail, fetch, create,
|
||||||
update, destroy
|
update, destroy, fetchPublicDetail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+10
-2
@@ -1,5 +1,5 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {COPILOT_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
|
import {COPILOT_DETAIL, COPILOT_PUBLIC_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
|
||||||
import {CREATE_COPILOT, EDIT_COPILOT} from "src/graphql/mutations/copilot";
|
import {CREATE_COPILOT, EDIT_COPILOT} from "src/graphql/mutations/copilot";
|
||||||
import {mutate, query, updateInItems} from "stores/helpers";
|
import {mutate, query, updateInItems} from "stores/helpers";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
@@ -18,6 +18,14 @@ export const useCopilotsStore = defineStore('Copilots', () => {
|
|||||||
}).then(item => copilot.value = item);
|
}).then(item => copilot.value = item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchPublicDetail = (id, username) => {
|
||||||
|
return query({
|
||||||
|
isQueryRunning,
|
||||||
|
query: COPILOT_PUBLIC_DETAIL,
|
||||||
|
variables: {id, pilotUsername: username},
|
||||||
|
}).then(item => copilot.value = item);
|
||||||
|
};
|
||||||
|
|
||||||
const fetch = () => {
|
const fetch = () => {
|
||||||
return query({
|
return query({
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
@@ -43,6 +51,6 @@ export const useCopilotsStore = defineStore('Copilots', () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
copilot, copilots, isMutationRunning, isQueryRunning,
|
copilot, copilots, isMutationRunning, isQueryRunning,
|
||||||
fetch, fetchDetail, create, update
|
fetch, fetchDetail, create, update, fetchPublicDetail
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+19
-17
@@ -1,5 +1,5 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
|
import {FLIGHT_DETAIL, FLIGHT_PUBLIC_DETAIL, FLIGHTS_LIST, FLIGHTS_PUBLIC_LIST} from "src/graphql/queries/flights";
|
||||||
import {EDIT_FLIGHT, CREATE_FLIGHT, DELETE_FLIGHT} from "src/graphql/mutations/flight";
|
import {EDIT_FLIGHT, CREATE_FLIGHT, DELETE_FLIGHT} from "src/graphql/mutations/flight";
|
||||||
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
|
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
@@ -10,25 +10,31 @@ export const useFlightsStore = defineStore('Flights', () => {
|
|||||||
const isMutationRunning = ref(false);
|
const isMutationRunning = ref(false);
|
||||||
const isQueryRunning = ref(false);
|
const isQueryRunning = ref(false);
|
||||||
|
|
||||||
const fetchDetail = (id, username) => {
|
const fetchDetail = (id, username) => query({
|
||||||
return query({
|
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
query: FLIGHT_DETAIL,
|
query: FLIGHT_DETAIL,
|
||||||
variables: {username, id},
|
variables: {username, id},
|
||||||
}).then(item => flight.value = item);
|
}).then(item => flight.value = item);
|
||||||
};
|
|
||||||
|
|
||||||
const fetch = (username = undefined) => {
|
const fetchPublicDetail = (id, username) => query({
|
||||||
return query({
|
isQueryRunning,
|
||||||
|
query: FLIGHT_PUBLIC_DETAIL,
|
||||||
|
variables: {username, id}
|
||||||
|
}).then(item => flight.value = item);
|
||||||
|
|
||||||
|
const fetch = (username = undefined) => query({
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
query: FLIGHTS_LIST,
|
query: FLIGHTS_LIST,
|
||||||
variables: {username}
|
variables: {username}
|
||||||
}).then(items => flights.value = items);
|
}).then(items => flights.value = items);
|
||||||
}
|
|
||||||
|
|
||||||
|
const fetchPublic = ({username, aircraftId, copilotId, pointOfInterestId}) => query({
|
||||||
|
isQueryRunning,
|
||||||
|
query: FLIGHTS_PUBLIC_LIST,
|
||||||
|
variables: {username, aircraftId, copilotId, pointOfInterestId}
|
||||||
|
}).then(items => flights.value = items);
|
||||||
|
|
||||||
const create = (input) => {
|
const create = (input) => mutate({
|
||||||
return mutate({
|
|
||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: CREATE_FLIGHT,
|
mutation: CREATE_FLIGHT,
|
||||||
variables: {input},
|
variables: {input},
|
||||||
@@ -36,10 +42,8 @@ export const useFlightsStore = defineStore('Flights', () => {
|
|||||||
flights.value.push(item);
|
flights.value.push(item);
|
||||||
return item;
|
return item;
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const update = (id, input) => {
|
const update = (id, input) => mutate({
|
||||||
return mutate({
|
|
||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: EDIT_FLIGHT,
|
mutation: EDIT_FLIGHT,
|
||||||
variables: {id, input}
|
variables: {id, input}
|
||||||
@@ -47,17 +51,15 @@ export const useFlightsStore = defineStore('Flights', () => {
|
|||||||
updateInItems(flights.value, 'id', item);
|
updateInItems(flights.value, 'id', item);
|
||||||
flight.value = item;
|
flight.value = item;
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const destroy = (id) => {
|
const destroy = (id) => mutate({
|
||||||
return mutate({
|
|
||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: DELETE_FLIGHT,
|
mutation: DELETE_FLIGHT,
|
||||||
variables: {id}
|
variables: {id}
|
||||||
}).then(item => deleteFromItems(flights.value, 'id', item))
|
}).then(item => deleteFromItems(flights.value, 'id', item))
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
flight, flights, isMutationRunning, isQueryRunning, fetchDetail, fetch, create, update, destroy
|
flight, flights, isMutationRunning, isQueryRunning, fetchDetail, fetchPublicDetail, fetch, create, update, destroy,
|
||||||
|
fetchPublic
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
import {defineStore} from "pinia";
|
|
||||||
import {ADJUST_PHOTO, CHANGE_PHOTO_ORIENTATION, DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
|
|
||||||
import {PHOTO_DETAIL} from "src/graphql/queries/photo";
|
|
||||||
import {ref} from "vue";
|
|
||||||
import {mutate, query} from "stores/helpers";
|
|
||||||
|
|
||||||
export const usePhotosStore = defineStore('Photos', () => {
|
|
||||||
const photo = ref(null);
|
|
||||||
const isMutationRunning = ref(false);
|
|
||||||
const isQueryRunning = ref(false);
|
|
||||||
|
|
||||||
const fetchDetail = (id) => query({
|
|
||||||
isQueryRunning,
|
|
||||||
query: PHOTO_DETAIL,
|
|
||||||
variables: {id}
|
|
||||||
}).then(item => photo.value = item);
|
|
||||||
|
|
||||||
const upload = (flightId, input) => {
|
|
||||||
if (!flightId) {
|
|
||||||
console.error("No flightId specified for photo upload! Aborting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
input.flightId = flightId;
|
|
||||||
|
|
||||||
if (!input.name) {
|
|
||||||
input.name = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!input.description) {
|
|
||||||
input.description = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: ^^ patri tohle do storu?
|
|
||||||
|
|
||||||
return mutate({
|
|
||||||
isMutationRunning,
|
|
||||||
mutation: UPLOAD_PHOTO,
|
|
||||||
variables: {input}
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
const update = (id, input) => mutate({
|
|
||||||
isMutationRunning,
|
|
||||||
mutation: EDIT_PHOTO,
|
|
||||||
variables: {id, input}
|
|
||||||
}).then(item => {
|
|
||||||
photo.value = item;
|
|
||||||
return item;
|
|
||||||
})
|
|
||||||
|
|
||||||
const changeOrientation = (id, direction) => mutate({
|
|
||||||
isMutationRunning,
|
|
||||||
mutation: CHANGE_PHOTO_ORIENTATION,
|
|
||||||
variables: {id, direction}
|
|
||||||
}).then(item => {
|
|
||||||
photo.value = item;
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
|
|
||||||
const adjust = (id, adjustment) => mutate({
|
|
||||||
isMutationRunning,
|
|
||||||
mutation: ADJUST_PHOTO,
|
|
||||||
variables: {id, adjustment}
|
|
||||||
}).then(item => {
|
|
||||||
photo.value = item;
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
|
|
||||||
const destroy = (id) => mutate({
|
|
||||||
isMutationRunning,
|
|
||||||
mutation: DELETE_PHOTO,
|
|
||||||
variables: {id}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
photo, isMutationRunning, isQueryRunning, fetchDetail, upload, update, changeOrientation, adjust, destroy
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import {defineStore} from "pinia";
|
||||||
|
import {ADJUST_PHOTO, CHANGE_PHOTO_ORIENTATION, DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
|
||||||
|
import {PHOTOS_PUBLIC_LIST, PHOTO_DETAIL} from "src/graphql/queries/photo";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {mutate, query} from "stores/helpers";
|
||||||
|
|
||||||
|
export const usePhotosStore = defineStore('Photos', () => {
|
||||||
|
const photo = ref(null);
|
||||||
|
const photos = ref([]);
|
||||||
|
const openedPhoto = ref(null);
|
||||||
|
const isMutationRunning = ref(false);
|
||||||
|
const isQueryRunning = ref(false);
|
||||||
|
|
||||||
|
const setOpenedPhoto = (photoObject) => {
|
||||||
|
openedPhoto.value = photoObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchDetail = (id) => query({
|
||||||
|
isQueryRunning,
|
||||||
|
query: PHOTO_DETAIL,
|
||||||
|
variables: {id}
|
||||||
|
}).then(item => photo.value = item);
|
||||||
|
|
||||||
|
const fetchPublic = ({flightId, pointOfInterestId, aircraftId, copilotId}) => query({
|
||||||
|
isQueryRunning,
|
||||||
|
query: PHOTOS_PUBLIC_LIST,
|
||||||
|
variables: {flightId, pointOfInterestId, aircraftId, copilotId}
|
||||||
|
}).then(items => photos.value = items);
|
||||||
|
|
||||||
|
const upload = (flightId, input) => {
|
||||||
|
if (!flightId) {
|
||||||
|
console.error("No flightId specified for photo upload! Aborting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.flightId = flightId;
|
||||||
|
|
||||||
|
if (!input.name) {
|
||||||
|
input.name = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!input.description) {
|
||||||
|
input.description = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: ^^ patri tohle do storu?
|
||||||
|
|
||||||
|
return mutate({
|
||||||
|
isMutationRunning,
|
||||||
|
mutation: UPLOAD_PHOTO,
|
||||||
|
variables: {input}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
const update = (id, input) => mutate({
|
||||||
|
isMutationRunning,
|
||||||
|
mutation: EDIT_PHOTO,
|
||||||
|
variables: {id, input}
|
||||||
|
}).then(item => {
|
||||||
|
photo.value = item;
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
|
||||||
|
const changeOrientation = (id, direction) => mutate({
|
||||||
|
isMutationRunning,
|
||||||
|
mutation: CHANGE_PHOTO_ORIENTATION,
|
||||||
|
variables: {id, direction}
|
||||||
|
}).then(item => {
|
||||||
|
photo.value = item;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
|
||||||
|
const adjust = (id, adjustment) => mutate({
|
||||||
|
isMutationRunning,
|
||||||
|
mutation: ADJUST_PHOTO,
|
||||||
|
variables: {id, adjustment}
|
||||||
|
}).then(item => {
|
||||||
|
photo.value = item;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
|
||||||
|
const destroy = (id) => mutate({
|
||||||
|
isMutationRunning,
|
||||||
|
mutation: DELETE_PHOTO,
|
||||||
|
variables: {id}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
photo, photos, isMutationRunning, isQueryRunning, fetchDetail, fetchPublic, upload, update,
|
||||||
|
changeOrientation, adjust, destroy,
|
||||||
|
openedPhoto, setOpenedPhoto
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,49 +1,55 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {POI_DETAIL, POI_LIST} from "src/graphql/queries/poi";
|
import {POI_DETAIL, POI_LIST, POI_PUBLIC_DETAIL, POI_PUBLIC_LIST} from "src/graphql/queries/poi";
|
||||||
import {CREATE_POI, EDIT_POI} from "src/graphql/mutations/poi";
|
import {CREATE_POI, EDIT_POI} from "src/graphql/mutations/poi";
|
||||||
import {mutate, query, updateInItems} from "stores/helpers";
|
import {mutate, query, updateInItems} from "stores/helpers";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
|
|
||||||
|
|
||||||
export const usePointsOfInterestStore = defineStore('PointsOfInterest', () => {
|
export const usePointsOfInterestStore = defineStore('PointsOfInterest', () => {
|
||||||
|
|
||||||
const pointOfInterest = ref(null);
|
const pointOfInterest = ref(null);
|
||||||
const pointsOfInterest = ref([]);
|
const pointsOfInterest = ref([]);
|
||||||
const isMutationRunning = ref(false);
|
const isMutationRunning = ref(false);
|
||||||
const isQueryRunning = ref(false);
|
const isQueryRunning = ref(false);
|
||||||
|
|
||||||
const fetchDetail = (id) => {
|
const fetchDetail = (id) => query({
|
||||||
return query({
|
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
query: POI_DETAIL,
|
query: POI_DETAIL,
|
||||||
variables: {id},
|
variables: {id},
|
||||||
}).then(item => pointOfInterest.value = item);
|
}).then(item => pointOfInterest.value = item);
|
||||||
};
|
|
||||||
|
|
||||||
const fetch = () => {
|
const fetchPublicDetail = (id) => query({
|
||||||
return query({
|
isQueryRunning,
|
||||||
|
query: POI_PUBLIC_DETAIL,
|
||||||
|
variables: {id},
|
||||||
|
}).then(item => pointOfInterest.value = item);
|
||||||
|
|
||||||
|
const fetch = () => query({
|
||||||
isQueryRunning,
|
isQueryRunning,
|
||||||
query: POI_LIST,
|
query: POI_LIST,
|
||||||
}).then(items => pointsOfInterest.value = items);
|
}).then(items => pointsOfInterest.value = items);
|
||||||
}
|
|
||||||
|
|
||||||
const create = (input) => {
|
const fetchPublic = () => query({
|
||||||
return mutate({
|
isQueryRunning,
|
||||||
|
query: POI_PUBLIC_LIST,
|
||||||
|
}).then(items => pointsOfInterest.value = items);
|
||||||
|
|
||||||
|
const create = (input) => mutate({
|
||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: CREATE_POI,
|
mutation: CREATE_POI,
|
||||||
variables: {input},
|
variables: {input},
|
||||||
}).then(item => pointsOfInterest.value.push(item))
|
}).then(item => pointsOfInterest.value.push(item))
|
||||||
}
|
|
||||||
|
|
||||||
const update = (id, input) => {
|
const update = (id, input) => mutate({
|
||||||
return mutate({
|
|
||||||
isMutationRunning,
|
isMutationRunning,
|
||||||
mutation: EDIT_POI,
|
mutation: EDIT_POI,
|
||||||
variables: {id, input}
|
variables: {id, input}
|
||||||
}).then(item => updateInItems(pointsOfInterest.value, 'id', item))
|
}).then(item => {
|
||||||
}
|
updateInItems(pointsOfInterest.value, 'id', item);
|
||||||
|
pointOfInterest.value = item;
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pointOfInterest, pointsOfInterest, isMutationRunning, isQueryRunning, fetch, fetchDetail, create, update
|
pointOfInterest, pointsOfInterest, isMutationRunning, isQueryRunning, fetch, fetchPublic, fetchDetail,
|
||||||
|
fetchPublicDetail, create, update
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export const useUserStore = defineStore('LoggedUser', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getAccessToken = () => {
|
const getAccessToken = () => {
|
||||||
|
// TODO: https://dev.to/quasar/quasar-ssr-using-cookies-with-other-libs-services-4nkl
|
||||||
if (typeof localStorage === 'undefined') return null;
|
if (typeof localStorage === 'undefined') return null;
|
||||||
|
|
||||||
const tokenValidity = localStorage.getItem("accessTokenValidity");
|
const tokenValidity = localStorage.getItem("accessTokenValidity");
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const query = ({isQueryRunning, query, variables, refreshUnauthorized}) =
|
|||||||
variables.id = parseInt(variables.id);
|
variables.id = parseInt(variables.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
query._refreshUnauthorizedUser = refreshUnauthorized;
|
query._refreshUnauthorizedUser = typeof refreshUnauthorized === 'undefined' ? true : refreshUnauthorized;
|
||||||
|
|
||||||
isQueryRunning.value = true;
|
isQueryRunning.value = true;
|
||||||
const queryName = query.definitions[0].selectionSet.selections[0].name.value;
|
const queryName = query.definitions[0].selectionSet.selections[0].name.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user