New component for parcours startDate

This commit is contained in:
2022-01-28 17:05:41 +01:00
parent 71ca912749
commit ad4153a07e
4 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<template>
<div class="vue-component">
<h2><a id="section-110"></a>
{{ $t('startdate.change') }}
</h2>
<div>
<div class="mb-3 row">
<label class="col-form-label col-sm-4">{{ $t('startdate.date') }}</label>
<div class="col-sm-8">
<input class="form-control" type="date" v-model="startDate" @change="updateStartDate" />
</div>
</div>
</div>
</div>
</template>
<script>
import { datetimeToISO, ISOToDate} from 'ChillMainAssets/chill/js/date.js';
import { mapState, mapGetters } from 'vuex';
export default {
name: 'startDate',
methods: {
updateStartDate(event) {
const date = event.target.value;
console.log(date)
this.$store.dispatch('updateStartDate', date)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
},
},
computed: {
startDate() {
console.log(datetimeToISO(this.$store.state.accompanyingCourse.openingDate))
return datetimeToISO(this.$store.state.accompanyingCourse.openingDate)
}
// ...mapState({
// startDate: state => dateToISO(state.accompanyingCourse.openingDate)
// })
}
}
</script>