fix add jobs
This commit is contained in:
parent
f54911ed48
commit
9359db3881
|
@ -82,13 +82,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<template v-for="(job, index) in event.jobs" :key="index">
|
||||
<!--:ref="active === index ? 'activeJob' : undefined"-->
|
||||
<edit-job-slot
|
||||
:ref="active === index ? 'activeJob' : undefined"
|
||||
ref="activeJob"
|
||||
v-model="event.jobs[index]"
|
||||
:active="index === active"
|
||||
class="q-mb-md"
|
||||
@activate="activate(index)"
|
||||
@remove-job="removeJob(index)"
|
||||
@activate="activate(index)"
|
||||
/>
|
||||
</template>
|
||||
</q-card-section>
|
||||
|
@ -113,7 +114,7 @@ import { IsoDateInput } from '@flaschengeist/api/components';
|
|||
import { useEventStore } from '../../store';
|
||||
import { emptyEvent, emptyJob, EditableEvent } from '../../store/models';
|
||||
|
||||
import { date, ModifyDateOptions } from 'quasar';
|
||||
import { date, DateOptions } from 'quasar';
|
||||
import { computed, defineComponent, PropType, ref, onBeforeMount, watch } from 'vue';
|
||||
|
||||
import EditJobSlot from './EditJobSlot.vue';
|
||||
|
@ -164,9 +165,12 @@ export default defineComponent({
|
|||
);
|
||||
|
||||
function addJob() {
|
||||
if (!activeJob.value) event.value.jobs.push(emptyJob());
|
||||
else
|
||||
void activeJob.value.validate().then((success) => {
|
||||
console.log('addJob', activeJob.value);
|
||||
if (!activeJob.value[active.value]) {
|
||||
event.value.jobs.push(emptyJob());
|
||||
active.value = event.value.jobs.length - 1;
|
||||
} else
|
||||
void activeJob.value[active.value].validate().then((success) => {
|
||||
if (success) {
|
||||
event.value.jobs.push(emptyJob());
|
||||
active.value = event.value.jobs.length - 1;
|
||||
|
@ -210,7 +214,7 @@ export default defineComponent({
|
|||
|
||||
if (props.modelValue === undefined && recurrent.value && !event.value.is_template) {
|
||||
let count = 0;
|
||||
const options: ModifyDateOptions = {};
|
||||
const options: DateOptions = {};
|
||||
switch (recurrenceRule.value.frequency) {
|
||||
case 'daily':
|
||||
options['days'] = 1 * recurrenceRule.value.interval;
|
||||
|
@ -263,7 +267,7 @@ export default defineComponent({
|
|||
!d || event.value.start <= d || 'Das Veranstaltungsende muss vor dem Beginn liegen';
|
||||
|
||||
function activate(idx: number) {
|
||||
void activeJob.value?.validate().then((s) => {
|
||||
void activeJob.value[active.value]?.validate().then((s) => {
|
||||
if (s) active.value = idx;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -30,13 +30,7 @@
|
|||
|
||||
<q-table :title="title" :rows="rows" row-key="id" :columns="columns">
|
||||
<template #top-right>
|
||||
<q-input
|
||||
ref="input"
|
||||
v-model="actualType.name"
|
||||
:rules="rules"
|
||||
dense
|
||||
placeholder="Neuer Typ"
|
||||
>
|
||||
<q-input ref="input" v-model="actualType.name" :rules="rules" dense placeholder="Neuer Typ">
|
||||
<slot name="after"
|
||||
><q-btn color="primary" icon="mdi-plus" title="Hinzufügen" @click="addType"
|
||||
/></slot>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "@quasar/app/tsconfig-preset",
|
||||
"extends": "@quasar/app-webpack/tsconfig-preset",
|
||||
"target": "esnext",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src/",
|
||||
|
|
Loading…
Reference in New Issue