mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
New component for parcours startDate
This commit is contained in:
@@ -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>
|
Reference in New Issue
Block a user