updating openingdate parcours fixed

This commit is contained in:
2022-04-19 15:09:25 +02:00
parent 65e6471a02
commit bc550ea42a
3 changed files with 21 additions and 13 deletions

View File

@@ -5,9 +5,9 @@
</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 class="col-sm-12 date-update">
<input class="form-control" type="date" id="startDate" v-model="startDate">
<button class="btn btn-save date-update-btn" type="submit" @click="updateStartDate"></button>
</div>
</div>
</div>
@@ -23,10 +23,12 @@ import { mapState, mapGetters } from 'vuex';
export default {
name: 'startDate',
methods: {
updateStartDate(event) {
const date = event.target.value;
// console.log(date)
updateStartDate(e) {
e.preventDefault();
const date = e.target.previousSibling.value;
this.$store.dispatch('updateStartDate', date)
.then(this.$toast.open({type: 'success', message: this.$t('startdate.update')}))
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
@@ -43,4 +45,14 @@ export default {
}
}
</script>
</script>
<style lang="scss" scoped>
.date-update {
display: flex;
justify-content: space-between;
&-btn {
margin-left: 1rem;
}
}
</style>