84 lines
2.1 KiB
Vue
84 lines
2.1 KiB
Vue
<script setup>
|
|
import {computed, ref} from "vue";
|
|
import {setDefaultData} from "src/composables/form/formHandling";
|
|
import DialogWrapper from "components/DialogWrapper.vue";
|
|
import FormWrapper from "components/FormWrapper.vue";
|
|
import {commonProps} from "src/composables/inputs";
|
|
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
|
|
|
const props = defineProps({
|
|
photos: {
|
|
type: Array
|
|
},
|
|
locations: {
|
|
type: Array
|
|
},
|
|
aircrafts: {
|
|
type: Array
|
|
},
|
|
copilots: {
|
|
type: Array
|
|
},
|
|
});
|
|
|
|
const formData = ref({
|
|
name: "",
|
|
description: "",
|
|
pointOfInterest: null,
|
|
copilots: [],
|
|
aircraftId: null,
|
|
photoIds: []
|
|
});
|
|
|
|
const setup = () => {
|
|
formData.value.photoIds = props.photos.map(p => p.id);
|
|
formData.value.name = "";
|
|
formData.value.description = "";
|
|
formData.value.pointOfInterest = null;
|
|
}
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<DialogWrapper :formData="formData" @show="setup()">
|
|
<q-card-section class="text-center">
|
|
<q-img :src="photo.thumbnailUrl" width="80px" class="q-ma-sm" v-for="photo in photos" :key="photo.thumbnailUrl"/>
|
|
</q-card-section>
|
|
<q-card-section>
|
|
<FormWrapper :save-button="false">
|
|
<ComboboxInput
|
|
:options="locations"
|
|
v-bind="commonProps"
|
|
v-model="formData.pointOfInterest"
|
|
:enable-new-values="false"
|
|
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-select
|
|
:options="aircrafts"
|
|
v-model="formData.aircraftId"
|
|
v-bind="commonProps"
|
|
label="Letadlo"
|
|
option-label="callSign"
|
|
option-value="id"
|
|
emit-value
|
|
map-options
|
|
/>
|
|
<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>
|
|
</q-card-section>
|
|
</DialogWrapper>
|
|
</template>
|