From cf9678e2b7c099012bda54aae720bade134d5f01 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Thu, 1 Dec 2022 15:20:28 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= =?UTF-8?q?=20=D1=81=D0=BE=D1=86=20=D1=81=D0=B5=D1=82=D0=B5=D0=B9=20=D0=B8?= =?UTF-8?q?=20=D1=82=D0=B5=D0=BB=D0=B5=D1=84=D0=BE=D0=BD=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0,=20=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D1=81=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BE=D1=80=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D1=82=D0=B0,=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=98=D0=9D=D0=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/BaseClientFormCreate.vue | 41 +++++++++++++++---- .../FormCreateIdentityDocuments.vue | 4 +- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index 2a8e108..70d1543 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -14,7 +14,7 @@ .icon-download.text-xl(v-if="img === defaultIcon") .wrapper-img.flex.w-10.h-10(v-else) img.current-avatar(:src="img") - base-popup.right-5.top-7(v-if="showPopup", :width="230") + base-popup.right-5.top-7(v-if="showPopup", v-click-outside="closePopup", :width="230") .flex.items-center.gap-x-2 img(src="@/assets/icons/computer.svg") span.text-smm(@click="changeOpenModal") Загрузить с компьютера @@ -34,7 +34,7 @@ ) .avatar.flex.absolute.items-center.gap-x-6(v-for="img in image") img.avatar(for="image-upload", :src="img", v-if="img") - base-button(:rounded="true", :size="48", @click="closeModal") + base-button(:rounded="true", :size="48", @click="closeAddImage") .icon-ok base-input.w-full(v-model:value="infoClient.basic.full_name" placeholder="ФИО*") .flex.flex-col.flex-auto.l.gap-y-8 @@ -222,10 +222,6 @@ export default { }, }, methods: { - closeModal() { - this.showModal = false; - this.showPopup = false; - }, previewImages(event) { this.image = []; var pictures = event.target.files; @@ -238,6 +234,13 @@ export default { } this.imageData = [...this.imageData, ...event.target.files]; }, + closeAddImage() { + this.showModal = false; + this.showPopup = false; + }, + closePopup() { + this.showPopup = false; + }, createIdentityDocument(id) { Object.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) @@ -258,6 +261,26 @@ export default { person_id: id, }); }, + createContacts(id) { + if (this.infoClient.phone.username) + fetchWrapper.post("general/contact/create/", { + ...this.filterDataEmptyProperty(this.infoClient.phone), + person_id: id, + }); + if (this.infoClient.email.username) + fetchWrapper.post("general/contact/create/", { + ...this.filterDataEmptyProperty(this.infoClient.email), + person_id: id, + }); + this.infoClient.basic.contacts.forEach((el) => { + if (el.username) + fetchWrapper.post("general/contact/create/", { + kind: el.kind, + username: el.username, + person_id: id, + }); + }); + }, postNewClient() { const formData = new FormData(); formData.append("full_name", this.infoClient.basic.full_name); @@ -269,12 +292,14 @@ export default { let foundElement = this.prioritySettings.settings.find( (el) => el.priority === this.infoClient.basic.priority.id ); - if (foundElement) formData.append("priority", foundElement.priority); + if (foundElement.priority) + formData.append("priority", foundElement.priority); fetchWrapper .post("general/person/create/", formData, "formData") .then((result) => { this.createIdentityDocument(result.id); this.createAddress(result.id); + this.createContacts(result.id); this.addSuccessNotification(); }); this.$emit("update-client"); @@ -385,7 +410,7 @@ export default { watch: { showModal: function () { if (this.showModal === false) { - this.closeModal(); + this.closeAddImage(); } }, }, diff --git a/src/pages/clients/components/FormCreateIdentityDocuments.vue b/src/pages/clients/components/FormCreateIdentityDocuments.vue index d938929..82b02f4 100644 --- a/src/pages/clients/components/FormCreateIdentityDocuments.vue +++ b/src/pages/clients/components/FormCreateIdentityDocuments.vue @@ -12,7 +12,7 @@ :width-input="277" ) .flex.flex-col(class="gap-y-1.5") - span.text-sm Кем и когда выдан + span.text-sm Кем выдан base-input.input-info( v-model:value="identityDocument.pass.issued_by_org", placeholder="Точно как в паспорте", @@ -47,7 +47,7 @@ .flex.flex-col(class="gap-y-1.5") span.text-sm Номер ИНН base-input.input-info( - v-mask="'##########'", + v-mask="'############'", v-model:value="identityDocument.inn.numba", placeholder="000000000000", :width-input="277"