Drobne upravy ve vizualu, oprava comboboxu, funkcni prakticky cela editace letu
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ module.exports = configure(function (/* ctx */) {
|
|||||||
// https://github.com/quasarframework/quasar/tree/dev/extras
|
// https://github.com/quasarframework/quasar/tree/dev/extras
|
||||||
extras: [
|
extras: [
|
||||||
// 'ionicons-v4',
|
// 'ionicons-v4',
|
||||||
// 'mdi-v5',
|
'mdi-v5',
|
||||||
// 'fontawesome-v6',
|
// 'fontawesome-v6',
|
||||||
// 'eva-icons',
|
// 'eva-icons',
|
||||||
// 'themify',
|
// 'themify',
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
const props = defineProps({
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: "Přidat"
|
|
||||||
},
|
|
||||||
routerLink: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<q-page-sticky location="bottom" :offset="[30, 30]">
|
|
||||||
<q-fab icon="add" color="primary" :label="props.label" @click="$router.push(props.routerLink)"/>
|
|
||||||
</q-page-sticky>
|
|
||||||
</template>
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed} from "vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
routerLink: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const config = computed(() => {
|
||||||
|
|
||||||
|
if (props.mode === "add") {
|
||||||
|
return {icon: "add", label: "Přidat"};
|
||||||
|
} else if (props.mode === "edit") {
|
||||||
|
return {icon: "edit", label: "Upravit"};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {icon: "unknown", label: `Neznámý typ ${props.mode}`}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-page-sticky location="bottom" :offset="[30, 30]">
|
||||||
|
<q-fab :icon="config.icon" color="primary" :label="config.label" @click="$router.push(props.routerLink)"/>
|
||||||
|
</q-page-sticky>
|
||||||
|
</template>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import {isRequestPending} from "src/composables/form/props";
|
import {isRequestPending} from "src/composables/form/props";
|
||||||
import {useSlots} from "vue";
|
import {computed, useSlots} from "vue";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@@ -32,6 +32,10 @@ const saveForm = () => {
|
|||||||
console.error("Not implemented")
|
console.error("Not implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const fullwidthBtn = computed(() => $q.screen.width <= $q.screen.sizes.md);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -40,11 +44,25 @@ const saveForm = () => {
|
|||||||
|
|
||||||
<slot name="saveButton" />
|
<slot name="saveButton" />
|
||||||
|
|
||||||
<q-btn type="submit" color="primary" v-if="saveButton" :icon="props.saveButton.icon" :loading="props.isRequestPending">
|
<q-btn
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
:class="{'q-my-lg': true, 'btn--fullwidth': fullwidthBtn}"
|
||||||
|
v-if="saveButton"
|
||||||
|
:icon="props.saveButton.icon"
|
||||||
|
:loading="props.isRequestPending"
|
||||||
|
>
|
||||||
{{ props.saveButton.label }}
|
{{ props.saveButton.label }}
|
||||||
|
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
Loading...
|
Loading...
|
||||||
</template>
|
</template>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-form>
|
</q-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.btn--fullwidth {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ const deleteFlight = (flightId) => {
|
|||||||
const totalFlightTime = computed(() => {
|
const totalFlightTime = computed(() => {
|
||||||
return props.items.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
|
return props.items.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const flightName = (item) => {
|
||||||
|
if (item.name) {
|
||||||
|
return item.name;
|
||||||
|
} else {
|
||||||
|
return `${item.takeoffAirport.name} - ${item.landingAirport.name}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -34,23 +43,17 @@ const totalFlightTime = computed(() => {
|
|||||||
<div class="col-12 col-md-4 col-lg-3" v-for="flight of items" :key="flight">
|
<div class="col-12 col-md-4 col-lg-3" v-for="flight of items" :key="flight">
|
||||||
|
|
||||||
<q-card class="q-my-sm q-mx-sm">
|
<q-card class="q-my-sm q-mx-sm">
|
||||||
<q-img :src="flight.titlePhotoUrl" v-if="flight.titlePhotoUrl">
|
<q-img :src="flight.coverPhoto.thumbnailUrl" v-if="flight.coverPhoto">
|
||||||
<div class="absolute-bottom text-center text-h6">
|
<div class="absolute-bottom text-center text-h6">
|
||||||
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}" class="text-white">
|
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}" class="text-white">
|
||||||
{{ flight.name }}
|
{{ flightName(flight) }}
|
||||||
<!-- {{ flight.takeoffAirport.name }} - {{ flight.landingAirport.name }}-->
|
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</q-img>
|
</q-img>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-h6" v-if="!flight.titlePhotoUrl">
|
<div class="text-h6" v-if="!flight.coverPhoto">
|
||||||
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}">
|
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}">
|
||||||
<template v-if="flight.name">
|
{{ flightName(flight) }}
|
||||||
{{ flight.name }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ flight.takeoffAirport.icaoCode }} - {{ flight.landingAirport.icaoCode }}
|
|
||||||
</template>
|
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-subtitle2">{{ minutesToHumanReadable(flight.durationMinCalculated) }}</div>
|
<div class="text-subtitle2">{{ minutesToHumanReadable(flight.durationMinCalculated) }}</div>
|
||||||
@@ -67,8 +70,8 @@ const totalFlightTime = computed(() => {
|
|||||||
<q-separator/>
|
<q-separator/>
|
||||||
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<!-- <q-btn flat icon="visibility"></q-btn>-->
|
<q-btn flat icon="visibility"></q-btn>
|
||||||
<!-- <q-btn flat icon="edit" :to="{name: 'flightEdit', params:{id: flight.id}}"></q-btn>-->
|
<q-btn flat icon="edit" :to="{name: 'flightEdit', params:{id: flight.id}}"></q-btn>
|
||||||
<q-btn flat icon="delete" color="red" @click="deleteFlight(flight.id)"></q-btn>
|
<q-btn flat icon="delete" color="red" @click="deleteFlight(flight.id)"></q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|||||||
@@ -30,13 +30,9 @@ const formData = reactive({
|
|||||||
landingAirportId: null,
|
landingAirportId: null,
|
||||||
takeoffDatetime: null,
|
takeoffDatetime: null,
|
||||||
landingDatetime: null,
|
landingDatetime: null,
|
||||||
durationTotal: null,
|
|
||||||
landings: 1,
|
landings: 1,
|
||||||
solo: true,
|
solo: true,
|
||||||
|
|
||||||
durationPic: 0,
|
|
||||||
withInstructor: false,
|
|
||||||
copilotId: null,
|
|
||||||
name: "",
|
name: "",
|
||||||
description: ""
|
description: ""
|
||||||
})
|
})
|
||||||
@@ -101,7 +97,7 @@ onMounted(() => {
|
|||||||
<q-checkbox v-model="formData.solo" label="Solo?"/>
|
<q-checkbox v-model="formData.solo" label="Solo?"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-input v-model="formData.landings" label="Počet přistání" type="number" min="1"/>
|
<q-input v-model.number="formData.landings" label="Počet přistání" type="number" min="1"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -34,12 +34,19 @@ onMounted(() => {
|
|||||||
|
|
||||||
<q-btn-toggle spread no-caps v-model="formData.solo" toggle-color="primary" :options="[{label: 'Solo', value: true}, {label: 'S někým', value: false}]"/>
|
<q-btn-toggle spread no-caps v-model="formData.solo" toggle-color="primary" :options="[{label: 'Solo', value: true}, {label: 'S někým', value: false}]"/>
|
||||||
|
|
||||||
{{ formData.copilot }}
|
|
||||||
|
|
||||||
<div v-if="!formData.solo">
|
<div v-if="!formData.solo">
|
||||||
<ComboboxInput :options="copilots" v-model="formData.copilot" :key="formData.copilot" label="Druhy pilot" />
|
<ComboboxInput
|
||||||
|
class="q-my-lg"
|
||||||
|
outlined
|
||||||
|
standout
|
||||||
|
:options="copilots"
|
||||||
|
v-model="formData.copilot"
|
||||||
|
:key="formData.copilot"
|
||||||
|
:clearable="true"
|
||||||
|
label="Druhy pilot"
|
||||||
|
/>
|
||||||
|
|
||||||
<q-checkbox v-model="formData.withInstructor" v-if="formData.copilot" label="Instruktor"/>
|
<!-- <q-checkbox v-model="formData.withInstructor" v-if="formData.copilot" label="Instruktor"/>-->
|
||||||
<!-- <q-input v-model="formData.picTime" label="PIC time"/>-->
|
<!-- <q-input v-model="formData.picTime" label="PIC time"/>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import FormWrapper from "components/FormWrapper.vue";
|
import FormWrapper from "components/FormWrapper.vue";
|
||||||
import {onMounted, reactive, ref} from "vue";
|
import {onMounted, reactive, ref, watch} from "vue";
|
||||||
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -29,6 +29,11 @@ const addTrackItem = (item) => {
|
|||||||
formData.track.push(item);
|
formData.track.push(item);
|
||||||
poi.value = null;
|
poi.value = null;
|
||||||
}
|
}
|
||||||
|
watch(poi, (newVal) => {
|
||||||
|
if (newVal?.name) {
|
||||||
|
addTrackItem(newVal);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
for (const i in props.flight.track) {
|
for (const i in props.flight.track) {
|
||||||
@@ -43,26 +48,56 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormWrapper v-model="formData">
|
<FormWrapper v-model="formData">
|
||||||
|
<ComboboxInput
|
||||||
|
outlined
|
||||||
|
standout
|
||||||
|
class="q-my-lg"
|
||||||
|
v-model="poi"
|
||||||
|
:key="formData.track.length"
|
||||||
|
:options="locations"
|
||||||
|
@select="addTrackItem"
|
||||||
|
clearable
|
||||||
|
label="Otočný bod"
|
||||||
|
/>
|
||||||
|
|
||||||
{{ flight.track }}
|
<q-list bordered>
|
||||||
|
<q-item-label header>Trasa</q-item-label>
|
||||||
<q-list>
|
<q-item>
|
||||||
<q-item>{{ flight.takeoffAirport.name }}</q-item>
|
<q-item-section avatar>
|
||||||
|
<q-avatar color="primary" text-color="white" icon="flight_takeoff"/>
|
||||||
<q-item v-for="(item, index) in formData.track" :key="item">
|
</q-item-section>
|
||||||
{{ index + 1 }}. {{ item.name }}
|
<q-item-section>
|
||||||
|
{{ flight.takeoffAirport.name }}
|
||||||
<q-btn @click="removeTrackItem(index)" icon="delete" text-color="red"/>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
<q-item>{{ flight.landingAirport.name }}</q-item>
|
<q-item v-for="(item, index) in formData.track" :key="item">
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-avatar size="32px" color="secondary" text-color="white">{{ index + 1 }}.</q-avatar>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<span>
|
||||||
|
{{ item.name }}
|
||||||
|
|
||||||
|
<q-badge color="green" v-if="!item.id">
|
||||||
|
<q-icon name="add"/>
|
||||||
|
</q-badge>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section top side>
|
||||||
|
<q-btn @click="removeTrackItem(index)" flat dense round icon="delete" text-color="red"/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-avatar color="primary" text-color="white" icon="flight_land"/>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ flight.landingAirport.name }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
|
|
||||||
<ComboboxInput v-model="poi" :options="locations" clearable label="Location">
|
|
||||||
<template #after>
|
|
||||||
<q-btn @click="addTrackItem(poi)" v-if="poi" rounded>+</q-btn>
|
|
||||||
</template>
|
|
||||||
</ComboboxInput>
|
|
||||||
</FormWrapper>
|
</FormWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, ref, watch} from "vue";
|
import {onMounted, ref, watch} from "vue";
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [Object, Array]
|
type: [Object, Array]
|
||||||
@@ -17,23 +16,42 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
let model = ref({});
|
const model = ref({});
|
||||||
watch(() => props.modelValue, (newVal) => {
|
|
||||||
model.value = newVal;
|
|
||||||
console.log("zmena!", newVal);
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
model.value = props.modelValue;
|
model.value = props.modelValue;
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue', 'clear']);
|
||||||
watch(model, (val) => {
|
watch(model, (val) => {
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
const value = val.name ? val : {name: val};
|
|
||||||
|
let value = val;
|
||||||
|
if (typeof val === 'string') value = {name: val};
|
||||||
emit("update:modelValue", value);
|
emit("update:modelValue", value);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const clearValue = () => {
|
||||||
|
model.value = {};
|
||||||
|
emit("clear");
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputValue = ref("");
|
||||||
|
const inputValueChanged = (value) => {
|
||||||
|
if (model.value?.name && value !== '') {
|
||||||
|
// reset model
|
||||||
|
delete model.value.id;
|
||||||
|
model.value.name = '';
|
||||||
|
}
|
||||||
|
inputValue.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleOnBlur = () => {
|
||||||
|
if (inputValue.value !== '') {
|
||||||
|
model.value = inputValue.value;
|
||||||
|
inputValue.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let availableOptions = ref([]);
|
let availableOptions = ref([]);
|
||||||
const filterFn = (val, update, abort) => {
|
const filterFn = (val, update, abort) => {
|
||||||
update(() => {
|
update(() => {
|
||||||
@@ -57,31 +75,26 @@ const filterFn = (val, update, abort) => {
|
|||||||
v-model="model"
|
v-model="model"
|
||||||
use-input
|
use-input
|
||||||
input-debounce="100"
|
input-debounce="100"
|
||||||
:display-value="`${model.name}`"
|
:display-value="`${model?.name || ''}`"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
@filter="filterFn"
|
@filter="filterFn"
|
||||||
|
@input-value="inputValueChanged"
|
||||||
|
@blur="handleOnBlur"
|
||||||
|
@clear="clearValue"
|
||||||
:options="availableOptions"
|
:options="availableOptions"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
new-value-mode="add"
|
new-value-mode="add"
|
||||||
|
clear-icon="clear"
|
||||||
|
:v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<template #before>
|
|
||||||
<slot name="before"/>
|
|
||||||
</template>
|
|
||||||
<template #after>
|
|
||||||
<slot name="after"/>
|
|
||||||
</template>
|
|
||||||
<template #append>
|
|
||||||
<slot name="append"/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- <template>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
|
|
||||||
<template v-slot:no-option>
|
<template v-slot:no-option>
|
||||||
<q-item>
|
<q-item>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-avatar text-color="green" size="32px" icon="add" />
|
||||||
|
</q-item-section>
|
||||||
<q-item-section class="text-grey">
|
<q-item-section class="text-grey">
|
||||||
Add new option
|
<span>Vytvořit novou hodnotu <q-chip>{{ inputValue }}</q-chip></span>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -132,8 +132,4 @@ const myLocale = {
|
|||||||
.proxy-wrapper {
|
.proxy-wrapper {
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-date, .q-time {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,3 +10,11 @@ fragment aircraftFullInfo on Aircraft {
|
|||||||
photoUrl
|
photoUrl
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
|
||||||
|
fragment aircraftBasicInfo on Aircraft {
|
||||||
|
id
|
||||||
|
callSign
|
||||||
|
manufacturer
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,5 +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_BASIC_INFO, FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
|
||||||
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
|
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
|
||||||
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
|
||||||
|
|
||||||
@@ -10,10 +10,16 @@ fragment flightFullInfo on Flight {
|
|||||||
description
|
description
|
||||||
takeoffDatetime
|
takeoffDatetime
|
||||||
landingDatetime
|
landingDatetime
|
||||||
|
landings
|
||||||
durationMinCalculated
|
durationMinCalculated
|
||||||
solo
|
solo
|
||||||
withInstructor
|
withInstructor
|
||||||
|
|
||||||
|
coverPhoto {
|
||||||
|
thumbnailUrl
|
||||||
|
url
|
||||||
|
}
|
||||||
|
|
||||||
takeoffAirport {
|
takeoffAirport {
|
||||||
...airportInfo
|
...airportInfo
|
||||||
}
|
}
|
||||||
@@ -64,12 +70,12 @@ fragment flightListInfo on Flight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aircraft {
|
aircraft {
|
||||||
...aircraftFullInfo
|
...aircraftBasicInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_AIRCRAFT_FULL_INFO}
|
|
||||||
${FRAGMENT_AIRPORT_INFO}
|
${FRAGMENT_AIRPORT_INFO}
|
||||||
|
${FRAGMENT_AIRCRAFT_BASIC_INFO}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const FRAGMENT_FLIGHT_EDIT_IDS = gql`
|
export const FRAGMENT_FLIGHT_EDIT_IDS = gql`
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
|
export const COPILOTS_LIST = gql`
|
||||||
|
query copilotsList {
|
||||||
|
copilots {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -4,7 +4,7 @@ import {useRoute} from "vue-router";
|
|||||||
import {onMounted, reactive, ref} from "vue";
|
import {onMounted, reactive, ref} from "vue";
|
||||||
import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUtils";
|
import {formatDatetime, minutesToHumanReadable} from "src/composables/datetimeUtils";
|
||||||
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
||||||
import AddFAB from "components/AddFAB.vue";
|
import FAB from "components/FAB.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -36,6 +36,6 @@ onMounted(() => {
|
|||||||
<!-- Temp: 12°C-->
|
<!-- Temp: 12°C-->
|
||||||
|
|
||||||
|
|
||||||
<AddFAB :router-link="{name: 'flightEdit', params:{id: flight.id}}" label="Upravit"/>
|
<FAB mode="edit" :router-link="{name: 'flightEdit', params:{id: flight.id}}"/>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {useSecondPilotsStore} from "stores/SecondPilots";
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
import {computed, onMounted} from "vue";
|
import {computed, onMounted} from "vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {minutesToHumanReadable} from "src/composables/datetimeUtils";
|
import {minutesToHumanReadable} from "src/composables/datetimeUtils";
|
||||||
|
|
||||||
const secondPilotStore = useSecondPilotsStore();
|
const secondPilotStore = useCopilotsStore();
|
||||||
const flightsStore = useFlightsStore();
|
const flightsStore = useFlightsStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {useMeta, useQuasar} from "quasar";
|
|||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {flightName} from "src/composables/flight";
|
import {flightName} from "src/composables/flight";
|
||||||
import FlightFormCopilot from "components/flights/form/FlightFormCopilot.vue";
|
import FlightFormCopilot from "components/flights/form/FlightFormCopilot.vue";
|
||||||
import {useSecondPilotsStore} from "stores/SecondPilots";
|
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/Photo";
|
||||||
@@ -29,7 +29,7 @@ const flightId = parseInt(route.params.id);
|
|||||||
const aircrafts = storeToRefs(useAircraftsStore()).items;
|
const aircrafts = storeToRefs(useAircraftsStore()).items;
|
||||||
const locations = storeToRefs(usePointsOfInterestStore()).items;
|
const locations = storeToRefs(usePointsOfInterestStore()).items;
|
||||||
const airports = storeToRefs(useAirportsStore()).items;
|
const airports = storeToRefs(useAirportsStore()).items;
|
||||||
const copilots = storeToRefs(useSecondPilotsStore()).items;
|
const copilots = storeToRefs(useCopilotsStore()).items;
|
||||||
|
|
||||||
let flight = ref({});
|
let flight = ref({});
|
||||||
const disabledSteps = computed(() => flight.value.solo ? ["copilot"] : [flight.value.solo]);
|
const disabledSteps = computed(() => flight.value.solo ? ["copilot"] : [flight.value.solo]);
|
||||||
@@ -51,13 +51,12 @@ onMounted(() => {
|
|||||||
useAircraftsStore().fetch();
|
useAircraftsStore().fetch();
|
||||||
usePointsOfInterestStore().fetch();
|
usePointsOfInterestStore().fetch();
|
||||||
useAirportsStore().fetch();
|
useAirportsStore().fetch();
|
||||||
useSecondPilotsStore().fetch();
|
useCopilotsStore().fetch();
|
||||||
|
|
||||||
fetchFlight(flightId);
|
fetchFlight(flightId);
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleFlightEdit = (data) => {
|
const handleFlightEdit = (data) => {
|
||||||
console.log(data);
|
|
||||||
useFlightsStore().update(flightId, data).then(() => {
|
useFlightsStore().update(flightId, data).then(() => {
|
||||||
$q.notify(successObject("Úspěšně upraveno"));
|
$q.notify(successObject("Úspěšně upraveno"));
|
||||||
fetchFlight(flightId);
|
fetchFlight(flightId);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {useAircraftsStore} from "stores/Aircrafts";
|
|||||||
import {onMounted, ref} from "vue";
|
import {onMounted, ref} from "vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import AircraftsList from "components/aircrafts/AircraftsList.vue";
|
import AircraftsList from "components/aircrafts/AircraftsList.vue";
|
||||||
import AddFAB from "components/AddFAB.vue";
|
import AddFAB from "components/FAB.vue";
|
||||||
import AircraftsListSkeleton from "components/aircrafts/AircraftsListSkeleton.vue";
|
import AircraftsListSkeleton from "components/aircrafts/AircraftsListSkeleton.vue";
|
||||||
|
|
||||||
const aircraftStore = useAircraftsStore();
|
const aircraftStore = useAircraftsStore();
|
||||||
@@ -24,5 +24,5 @@ onMounted(() => {
|
|||||||
<AircraftsListSkeleton v-if="loading" />
|
<AircraftsListSkeleton v-if="loading" />
|
||||||
<AircraftsList :items="aircrafts" v-if="!loading"/>
|
<AircraftsList :items="aircrafts" v-if="!loading"/>
|
||||||
|
|
||||||
<AddFAB :router-link="{name: 'addAircraft'}"/>
|
<AddFAB mode="add" :router-link="{name: 'addAircraft'}"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {useMeta} from "quasar";
|
|||||||
import FlightsList from "components/flights/FlightsList.vue";
|
import FlightsList from "components/flights/FlightsList.vue";
|
||||||
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import AddFAB from "components/AddFAB.vue";
|
import AddFAB from "components/FAB.vue";
|
||||||
|
|
||||||
useMeta({title: "Moje lety"});
|
useMeta({title: "Moje lety"});
|
||||||
|
|
||||||
@@ -39,5 +39,5 @@ onMounted(() => {
|
|||||||
<FlightsList :items="flights" v-else/>
|
<FlightsList :items="flights" v-else/>
|
||||||
|
|
||||||
|
|
||||||
<AddFAB :router-link="{name: 'addFlight'}"/>
|
<AddFAB mode="add" :router-link="{name: 'addFlight'}"/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {useSecondPilotsStore} from "stores/SecondPilots";
|
import {useCopilotsStore} from "stores/Copilots";
|
||||||
import {onMounted} from "vue";
|
import {onMounted} from "vue";
|
||||||
|
|
||||||
const pilotsStore = useSecondPilotsStore();
|
const pilotsStore = useCopilotsStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
pilotsStore.fetch();
|
pilotsStore.fetch();
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import {defineStore} from 'pinia'
|
||||||
|
import {apolloWrapper} from "src/graphql/apollo";
|
||||||
|
import {COPILOTS_LIST} from "src/graphql/queries/copilots";
|
||||||
|
|
||||||
|
export const useCopilotsStore = defineStore('SecondPilots', {
|
||||||
|
state: () => ({
|
||||||
|
items: []
|
||||||
|
}),
|
||||||
|
|
||||||
|
getters: {},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
create(formData) {
|
||||||
|
console.log("not implemented");
|
||||||
|
},
|
||||||
|
fetch() {
|
||||||
|
return apolloWrapper.query(COPILOTS_LIST).then(result => {
|
||||||
|
this.items = result.data.copilots;
|
||||||
|
return result.data.copilots;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import {defineStore} from 'pinia'
|
|
||||||
|
|
||||||
export const useSecondPilotsStore = defineStore('SecondPilots', {
|
|
||||||
state: () => ({
|
|
||||||
items: []
|
|
||||||
}),
|
|
||||||
|
|
||||||
getters: {},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
create(formData) {
|
|
||||||
this.items.push(formData);
|
|
||||||
},
|
|
||||||
fetch() {
|
|
||||||
if (this.items.length > 0) return;
|
|
||||||
|
|
||||||
this.$patch({
|
|
||||||
items: [
|
|
||||||
{id: 1, name: "Karel Franta", isInstructor: false},
|
|
||||||
{id: 2, name: "Franta Pepa", isInstructor: false},
|
|
||||||
{id: 3, name: "Instruktor Letajici", isInstructor: true},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user