From 07800c05d1f0416e5149d79a2043061c3c345f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 1 Oct 2019 22:06:06 +0200 Subject: [PATCH] WIP Improve js code --- .../Private/Assets/js/myep/Address.vue | 133 ++++++------------ .../Resources/Private/Assets/js/myep/App.vue | 16 +-- .../Private/Assets/js/myep/Registration.vue | 89 +++++------- .../Private/Assets/js/myep/Teamer.vue | 39 +++-- .../js/myep/components/FormCheckbox.vue | 20 +++ .../Assets/js/myep/components/FormGroup.vue | 23 +++ 6 files changed, 139 insertions(+), 181 deletions(-) create mode 100644 public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/FormCheckbox.vue create mode 100644 public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/FormGroup.vue diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue index 6d5a4fa1..22ba82b8 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue @@ -4,94 +4,51 @@
-
- - -
-
- - -
-
- - - {{ formErrors.lastName }} -
-
- - - {{ formErrors.firstName }} -
-
- + + + + + + + + + + + -
+
-
- - - {{ formErrors.street }} -
-
- - - {{ formErrors.zipCode }} -
-
- - - {{ formErrors.city }} -
-
- - + + + + + + + + + - {{ formErrors.country }} -
-
- - - {{ formErrors.email }} -
-
- - -
-
- - -
+ + + + + + + + + +
@@ -111,8 +68,12 @@ import axios from 'axios' import flatpickr from 'flatpickr' import { German } from 'flatpickr/dist/l10n/de' + import FormGroup from './components/FormGroup'; export default { + components: { + FormGroup + }, data () { return { picker: null, @@ -121,7 +82,6 @@ } }, created () { - this.initFormErrors(); this.loadFormOptions(); this.$store.dispatch('loadAddress') .then(() => { @@ -142,19 +102,6 @@ }, methods: { ...mapMutations(['alert', 'beginLoading', 'endLoading']), - initFormErrors () { - this.formErrors = { - lastName: null, - firstName: null, - dateOfBirth: null, - email: null, - gender: null, - street: null, - zipCode: null, - city: null, - country: null - } - }, loadFormOptions () { this.beginLoading(); return axios({ @@ -167,7 +114,7 @@ }); }, save () { - this.initFormErrors(); + this.formErrors = {}; this.$store.dispatch('saveAddress', this.userData) .catch(error => { this.alert({ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue index 15611b0b..f5d6183d 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue @@ -2,7 +2,8 @@