feat: multiple day addition
This commit is contained in:
parent
cfa9371851
commit
9d4cd6321c
1 changed files with 5 additions and 2 deletions
|
@ -199,6 +199,7 @@
|
||||||
<v-select
|
<v-select
|
||||||
prepend-icon="event"
|
prepend-icon="event"
|
||||||
v-model="when.day"
|
v-model="when.day"
|
||||||
|
:multiple="mode == 'add'"
|
||||||
:items="days"
|
:items="days"
|
||||||
label="Sélectionnez un jour"
|
label="Sélectionnez un jour"
|
||||||
></v-select>
|
></v-select>
|
||||||
|
@ -281,7 +282,7 @@
|
||||||
@click="saveWhen()"
|
@click="saveWhen()"
|
||||||
text
|
text
|
||||||
color="success"
|
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
|
Valider
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
|
@ -477,7 +478,9 @@ export default {
|
||||||
if (!Array.isArray(i.when)) {
|
if (!Array.isArray(i.when)) {
|
||||||
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
|
// sort all days
|
||||||
i.when = i.when.sort((a, b) => this.days.indexOf(a.day) >= this.days.indexOf(b.day) ? 1 : -1)
|
i.when = i.when.sort((a, b) => this.days.indexOf(a.day) >= this.days.indexOf(b.day) ? 1 : -1)
|
||||||
|
|
Loading…
Reference in a new issue