Zdockerovani, sjednoceni marginu, drobnejsi upravy

This commit is contained in:
Michal Kváček
2023-08-15 10:30:30 +02:00
parent b6ae794489
commit 8bc477a611
18 changed files with 280 additions and 159 deletions
+51 -9
View File
@@ -4,12 +4,14 @@ import {onMounted, reactive} from "vue";
import FormWrapper from "components/FormWrapper.vue";
import {setDefaultData} from "src/composables/form/formHandling";
import {defaultValues, isRequestPending} from "src/composables/form/props";
import {isRequired} from "src/composables/form/rules";
import {isRequired, maxLength, minLength} from "src/composables/form/rules";
import {commonProps} from "src/composables/inputs";
const formData = reactive({
id: null,
callSign: "",
model: "",
seats: null,
manufacturer: "",
description: "",
photo: null,
@@ -23,8 +25,13 @@ const props = defineProps({
const rules = {
callSign: [
v => isRequired(v)
isRequired,
minLength(4),
maxLength(8)
],
seats: [
isNumber
]
};
onMounted(() => {
@@ -35,14 +42,49 @@ onMounted(() => {
<template>
<FormWrapper v-model="formData" :is-request-pending="isRequestPending">
<q-input type="text" :rules="rules.callSign" v-model="formData.callSign" label="Volací značka"/>
<q-input type="text" v-model="formData.model" label="Model"/>
<q-input type="text" v-model="formData.manufacturer" label="Výrobce"/>
<q-input type="textarea" v-model="formData.description" label="Popis" />
<q-img :src="props.defaultValues.photoUrl" v-if="props.defaultValues.photoUrl"/>
<q-input
type="text"
:rules="rules.callSign"
v-model="formData.callSign"
label="Volací značka"
v-bind="commonProps"
/>
{{ props.defaultValues.photoUrl }}
<q-img :src="props.defaultValues.photoUrl" v-if="props.defaultValues.photoUrl" />
<q-file v-model="formData.photo" label="Fotografie" />
<q-input
type="text"
v-model="formData.manufacturer"
label="Výrobce"
v-bind="commonProps"
/>
<q-input
type="text"
v-model="formData.model"
label="Model"
v-bind="commonProps"
/>
<q-input
type="number"
v-model="formData.seats"
label="Počet míst"
min="1"
:rules="rules.seats"
v-bind="commonProps"
/>
<q-input
type="textarea"
v-model="formData.description"
label="Popis"
v-bind="commonProps"
/>
<q-file v-model="formData.photo" label="Fotografie" v-bind="commonProps">
<template #prepend>
<q-icon name="upload"/>
</template>
</q-file>
</FormWrapper>
</template>