mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
rdv: reset calendar after all promises are done
This commit is contained in:
parent
c82efc4fd5
commit
813da1f9e0
@ -47,11 +47,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<p>{{ $t('copy_range_how_to')}}</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div v-if="newCalendarRanges.length > 0">
|
<div v-if="newCalendarRanges.length > 0">
|
||||||
<h4>{{ $t('new_range_to_save') }}</h4>
|
<h4>{{ $t('new_range_to_save') }}</h4>
|
||||||
@ -334,7 +329,7 @@ export default {
|
|||||||
onClickSave(payload) {
|
onClickSave(payload) {
|
||||||
this.flag.loading = true;
|
this.flag.loading = true;
|
||||||
if (this.$store.state.newCalendarRanges.length > 0){
|
if (this.$store.state.newCalendarRanges.length > 0){
|
||||||
this.$store.state.newCalendarRanges.map(cr => {
|
Promise.all(this.$store.state.newCalendarRanges.map(cr => {
|
||||||
postCalendarRange({
|
postCalendarRange({
|
||||||
user: {
|
user: {
|
||||||
type: 'user',
|
type: 'user',
|
||||||
@ -346,12 +341,14 @@ export default {
|
|||||||
endDate: {
|
endDate: {
|
||||||
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
||||||
},
|
},
|
||||||
}).then((_r) => this.resetCalendar());
|
})
|
||||||
});
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
|
|
||||||
this.$store.dispatch('clearNewCalendarRanges', payload);
|
this.$store.dispatch('clearNewCalendarRanges', payload);
|
||||||
}
|
}
|
||||||
if (this.$store.state.updateCalendarRanges.length > 0){
|
if (this.$store.state.updateCalendarRanges.length > 0){
|
||||||
this.$store.state.updateCalendarRanges.map(cr => {
|
Promise.all(this.$store.state.updateCalendarRanges.map(cr => {
|
||||||
patchCalendarRange(cr.id,
|
patchCalendarRange(cr.id,
|
||||||
{
|
{
|
||||||
startDate: {
|
startDate: {
|
||||||
@ -360,14 +357,16 @@ export default {
|
|||||||
endDate: {
|
endDate: {
|
||||||
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
||||||
},
|
},
|
||||||
}).then((_r) => this.resetCalendar());
|
})
|
||||||
})
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
this.$store.dispatch('clearUpdateCalendarRanges', payload);
|
this.$store.dispatch('clearUpdateCalendarRanges', payload);
|
||||||
}
|
}
|
||||||
if (this.$store.state.deleteCalendarRanges.length > 0){
|
if (this.$store.state.deleteCalendarRanges.length > 0){
|
||||||
this.$store.state.deleteCalendarRanges.map(cr => {
|
Promise.all(this.$store.state.deleteCalendarRanges.map(cr => {
|
||||||
deleteCalendarRange(cr.id).then((_r) => this.resetCalendar());;
|
deleteCalendarRange(cr.id)
|
||||||
})
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
this.$store.dispatch('clearDeleteCalendarRanges', payload);
|
this.$store.dispatch('clearDeleteCalendarRanges', payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user