From 419e6a1a71c606ec8092f9a55b3bd171702066ec Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Wed, 22 Jul 2020 23:14:12 +0200 Subject: [PATCH] add additional contact component --- src/components/AdditionalContacts.vue | 221 ++++++++++++++++++++++++++ src/layouts/Delegate.vue | 6 + src/views/Delegate/Contact.vue | 91 ++++++----- src/views/Delegate/Main.vue | 2 +- 4 files changed, 273 insertions(+), 47 deletions(-) create mode 100644 src/components/AdditionalContacts.vue diff --git a/src/components/AdditionalContacts.vue b/src/components/AdditionalContacts.vue new file mode 100644 index 0000000..7297383 --- /dev/null +++ b/src/components/AdditionalContacts.vue @@ -0,0 +1,221 @@ + + + diff --git a/src/layouts/Delegate.vue b/src/layouts/Delegate.vue index 47cb270..92ea7b7 100644 --- a/src/layouts/Delegate.vue +++ b/src/layouts/Delegate.vue @@ -343,6 +343,12 @@ export default { } return i }) + if (Array.isArray(data.contacts.peoples)) { + data.contacts.peoples = data.contacts.peoples.map(p => { + delete p._id + return p + }) + } this.$apitator.put('/delegate', data, { withAuth: true }).then(() => { this.isSaving = false this.$store.commit('ADD_ALERT', { diff --git a/src/views/Delegate/Contact.vue b/src/views/Delegate/Contact.vue index 350c5c8..d04a1c6 100644 --- a/src/views/Delegate/Contact.vue +++ b/src/views/Delegate/Contact.vue @@ -8,11 +8,11 @@ Ici vous pouvez préciser quelques manières de contacter votre association, aucun des champs indiqués n'est obligatoire. - + v-model="$store.state.data.contacts.phone" /> --> -

Contacts additionels

- Ajouter un contact additionel - + diff --git a/src/views/Delegate/Main.vue b/src/views/Delegate/Main.vue index 4fec376..a2071ad 100644 --- a/src/views/Delegate/Main.vue +++ b/src/views/Delegate/Main.vue @@ -115,7 +115,7 @@ export default { v => v.length <= 200 || 'Au maximum 200 caractères' ], tags: [v => (Array.isArray(v) && v.length > 0) || 'Vous devez choisir au minimum une catégorie'], - email: [v => /.+@.+\..+/.test(v) || "L'email est requis et dois être valide"], + email: [v => /.+@.+\..+/.test(v) || "L'email est requis et doit être valide"], person: [v => v.length >= 4 || 'Au minimum 4 caractères'] } }),