From e2d406b97bbce4ce5889a8f92e02126198d59a32 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 18:06:13 +0100 Subject: [PATCH] php validation added --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 ++ .../vuejs/AccompanyingCourse/components/StartDate.vue | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 728ef7322..c457d2863 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -212,6 +212,8 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) + * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue index c5ebc3513..349581452 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue @@ -25,7 +25,7 @@ export default { methods: { updateStartDate(event) { const date = event.target.value; - console.log(date) + // console.log(date) this.$store.dispatch('updateStartDate', date) .catch(({name, violations}) => { if (name === 'ValidationException' || name === 'AccessException') { @@ -37,11 +37,6 @@ export default { }, }, computed: { - // startDate() { - // const date = ISOToDatetime(this.$store.state.accompanyingCourse.openingDate.datetime) - // console.log(dateToISO(date)) - // // return datetimeToISO(this.$store.state.accompanyingCourse.openingDate) - // } ...mapState({ startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime)) })