50 lines
1.3 KiB
Vue
50 lines
1.3 KiB
Vue
<script setup>
|
|
import {reactive, watch} from "vue";
|
|
import FormWrapper from "components/FormWrapper.vue";
|
|
import {setDefaultData} from "src/composables/form/formHandling";
|
|
import RichTextEditor from "components/inputs/RichTextEditor.vue";
|
|
import {commonProps} from "src/composables/inputs";
|
|
import ComboboxInput from "components/inputs/ComboboxInput.vue";
|
|
|
|
const props = defineProps({
|
|
flight: {
|
|
type: Object,
|
|
required: false
|
|
},
|
|
events: {
|
|
type: Array,
|
|
required: false,
|
|
},
|
|
isRequestPending: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
}
|
|
});
|
|
|
|
const formData = reactive({
|
|
name: "",
|
|
event: null,
|
|
description: ""
|
|
})
|
|
|
|
watch(() => props.flight, (newVal) => {
|
|
if (newVal) {
|
|
setDefaultData(formData, newVal);
|
|
|
|
if (newVal.event) {
|
|
formData.event = {id: newVal.event.id, name: newVal.event.name};
|
|
}
|
|
}
|
|
}, {immediate: true});
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<FormWrapper v-model="formData" :is-request-pending="props.isRequestPending">
|
|
<ComboboxInput :options="events" v-if="events" v-model="formData.event" label="Událost" v-bind="commonProps"/>
|
|
<q-input type="text" v-model="formData.name" label="Jméno letu" v-bind="commonProps"/>
|
|
<RichTextEditor v-model="formData.description" v-bind="commonProps" label="Popis letu, poznámky, ..."/>
|
|
</FormWrapper>
|
|
</template>
|