update schema module
This commit is contained in:
@@ -11,6 +11,8 @@ function repeatLabel(schema) {
|
||||
if (!schema.repeat) return 'Einmalig'
|
||||
if (schema.repeat.daily) return 'Täglich'
|
||||
if (schema.repeat.weekly) return 'Wöchentlich'
|
||||
if (schema.repeat['2week']) return '2-Wöchentlich'
|
||||
if (schema.repeat['4week']) return '4-Wöchentlich'
|
||||
if (schema.repeat.monthly) return 'Monatlich'
|
||||
return ''
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ function buildPayload() {
|
||||
data.repeat = { daily: true }
|
||||
} else if (form.value.repeatType === 'weekly') {
|
||||
data.repeat = { weekly: [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === '2week') {
|
||||
data.repeat = { '2week': [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === '4week') {
|
||||
data.repeat = { '4week': [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === 'monthly') {
|
||||
data.repeat = { monthly: [...form.value.monthly] }
|
||||
}
|
||||
@@ -93,6 +97,8 @@ async function onSave() {
|
||||
<option value="none">Keine (Einmalig)</option>
|
||||
<option value="daily">Täglich</option>
|
||||
<option value="weekly">Wöchentlich</option>
|
||||
<option value="2week">2-Wöchentlich</option>
|
||||
<option value="4week">4-Wöchentlich</option>
|
||||
<option value="monthly">Monatlich</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -102,7 +108,7 @@ async function onSave() {
|
||||
<input id="date" v-model="form.date" type="date" />
|
||||
</div>
|
||||
|
||||
<div v-if="form.repeatType === 'weekly'" class="field">
|
||||
<div v-if="['weekly', '2week', '4week'].includes(form.repeatType)" class="field">
|
||||
<label>Wochentage</label>
|
||||
<div class="day-grid">
|
||||
<label v-for="(day, i) in weekdays" :key="i" class="day-label" :class="{ selected: form.weekly[i] }">
|
||||
|
||||
@@ -34,6 +34,8 @@ function detectRepeatType(schema) {
|
||||
if (!schema.repeat) return 'none'
|
||||
if (schema.repeat.daily) return 'daily'
|
||||
if (schema.repeat.weekly) return 'weekly'
|
||||
if (schema.repeat['2week']) return '2week'
|
||||
if (schema.repeat['4week']) return '4week'
|
||||
if (schema.repeat.monthly) return 'monthly'
|
||||
return 'none'
|
||||
}
|
||||
@@ -48,7 +50,10 @@ function loadFromSchema(schema) {
|
||||
date: toFormDate(schema.date),
|
||||
start: toFormDate(schema.start),
|
||||
end: toFormDate(schema.end),
|
||||
weekly: schema.repeat?.weekly ? [...schema.repeat.weekly] : Array(7).fill(false),
|
||||
weekly: schema.repeat?.weekly ? [...schema.repeat.weekly]
|
||||
: schema.repeat?.['2week'] ? [...schema.repeat['2week']]
|
||||
: schema.repeat?.['4week'] ? [...schema.repeat['4week']]
|
||||
: Array(7).fill(false),
|
||||
monthly: schema.repeat?.monthly ? [...schema.repeat.monthly] : Array(31).fill(false),
|
||||
}
|
||||
}
|
||||
@@ -70,6 +75,10 @@ function buildPayload() {
|
||||
data.repeat = { daily: true }
|
||||
} else if (form.value.repeatType === 'weekly') {
|
||||
data.repeat = { weekly: [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === '2week') {
|
||||
data.repeat = { '2week': [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === '4week') {
|
||||
data.repeat = { '4week': [...form.value.weekly] }
|
||||
} else if (form.value.repeatType === 'monthly') {
|
||||
data.repeat = { monthly: [...form.value.monthly] }
|
||||
}
|
||||
@@ -139,6 +148,8 @@ function onReset() {
|
||||
<option value="none">Keine (Einmalig)</option>
|
||||
<option value="daily">Täglich</option>
|
||||
<option value="weekly">Wöchentlich</option>
|
||||
<option value="2week">2-Wöchentlich</option>
|
||||
<option value="4week">4-Wöchentlich</option>
|
||||
<option value="monthly">Monatlich</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -148,7 +159,7 @@ function onReset() {
|
||||
<input id="date" v-model="form.date" type="date" />
|
||||
</div>
|
||||
|
||||
<div v-if="form.repeatType === 'weekly'" class="field">
|
||||
<div v-if="['weekly', '2week', '4week'].includes(form.repeatType)" class="field">
|
||||
<label>Wochentage</label>
|
||||
<div class="day-grid">
|
||||
<label v-for="(day, i) in weekdays" :key="i" class="day-label" :class="{ selected: form.weekly[i] }">
|
||||
|
||||
Reference in New Issue
Block a user