84 lines
2.0 KiB
Vue
84 lines
2.0 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({
|
|
photo: {
|
|
type: Object
|
|
},
|
|
locations: {
|
|
type: Array
|
|
},
|
|
aircrafts: {
|
|
type: Array
|
|
},
|
|
copilots: {
|
|
type: Array
|
|
},
|
|
loading: {
|
|
type: Boolean
|
|
}
|
|
});
|
|
|
|
const photoId = computed(() => props.photo?.id || null);
|
|
const formData = ref({
|
|
name: "",
|
|
description: "",
|
|
pointOfInterest: null,
|
|
copilots: [],
|
|
aircraftId: null,
|
|
});
|
|
|
|
const setup = (() => {
|
|
setDefaultData(formData.value, props.photo || {});
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<DialogWrapper :formData="formData" :object-id="photoId" @show="setup">
|
|
<q-img :src="photo.thumbnailUrl"/>
|
|
<q-card-section v-if="loading">
|
|
<q-spinner />
|
|
</q-card-section>
|
|
<q-card-section v-else>
|
|
<FormWrapper :save-button="false">
|
|
<ComboboxInput
|
|
:options="locations"
|
|
v-bind="commonProps"
|
|
v-model="formData.pointOfInterest"
|
|
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>
|