From 9d4cd6321c68ceaf6e2cb8e101cae5fa7e92c3e9 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sat, 25 Jul 2020 12:33:18 +0200 Subject: [PATCH] feat: multiple day addition --- src/views/Delegate/Schedule.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/Delegate/Schedule.vue b/src/views/Delegate/Schedule.vue index f50dcdb..b5c91b1 100644 --- a/src/views/Delegate/Schedule.vue +++ b/src/views/Delegate/Schedule.vue @@ -199,6 +199,7 @@ @@ -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 @@ -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)