feat: multiple day addition

This commit is contained in:
Matthieu Bessat 2020-07-25 12:33:18 +02:00
parent cfa9371851
commit 9d4cd6321c

View file

@ -199,6 +199,7 @@
<v-select
prepend-icon="event"
v-model="when.day"
:multiple="mode == 'add'"
:items="days"
label="Sélectionnez un jour"
></v-select>
@ -281,7 +282,7 @@
@click="saveWhen()"
text
color="success"
:disabled="when.day.length < 4 || when.to === null || when.from === null || when.to.length !== 5 || when.from.length !== 5">
:disabled="(mode == 'add' ? when.day.length === 0 : when.day.length < 4) || when.to === null || when.from === null || when.to.length !== 5 || when.from.length !== 5">
Valider
</v-btn>
</v-card-actions>
@ -477,7 +478,9 @@ export default {
if (!Array.isArray(i.when)) {
i.when = []
}
i.when.push(this.when)
this.when.day.forEach((d) => {
i.when.push({ ...this.when, day: d, _id: Date.now().toString() })
})
}
// sort all days
i.when = i.when.sort((a, b) => this.days.indexOf(a.day) >= this.days.indexOf(b.day) ? 1 : -1)