[WIP] Добавил возможность отправки соц сетей и телефона при создании клиента, фикс отображения приоритета, правка ИНН

This commit is contained in:
megavrilinvv
2022-12-01 15:20:28 +03:00
parent e24f301e44
commit cf9678e2b7
2 changed files with 35 additions and 10 deletions

View File

@@ -14,7 +14,7 @@
.icon-download.text-xl(v-if="img === defaultIcon") .icon-download.text-xl(v-if="img === defaultIcon")
.wrapper-img.flex.w-10.h-10(v-else) .wrapper-img.flex.w-10.h-10(v-else)
img.current-avatar(:src="img") 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 .flex.items-center.gap-x-2
img(src="@/assets/icons/computer.svg") img(src="@/assets/icons/computer.svg")
span.text-smm(@click="changeOpenModal") Загрузить с компьютера span.text-smm(@click="changeOpenModal") Загрузить с компьютера
@@ -34,7 +34,7 @@
) )
.avatar.flex.absolute.items-center.gap-x-6(v-for="img in image") .avatar.flex.absolute.items-center.gap-x-6(v-for="img in image")
img.avatar(for="image-upload", :src="img", v-if="img") 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 .icon-ok
base-input.w-full(v-model:value="infoClient.basic.full_name" placeholder="ФИО*") base-input.w-full(v-model:value="infoClient.basic.full_name" placeholder="ФИО*")
.flex.flex-col.flex-auto.l.gap-y-8 .flex.flex-col.flex-auto.l.gap-y-8
@@ -222,10 +222,6 @@ export default {
}, },
}, },
methods: { methods: {
closeModal() {
this.showModal = false;
this.showPopup = false;
},
previewImages(event) { previewImages(event) {
this.image = []; this.image = [];
var pictures = event.target.files; var pictures = event.target.files;
@@ -238,6 +234,13 @@ export default {
} }
this.imageData = [...this.imageData, ...event.target.files]; this.imageData = [...this.imageData, ...event.target.files];
}, },
closeAddImage() {
this.showModal = false;
this.showPopup = false;
},
closePopup() {
this.showPopup = false;
},
createIdentityDocument(id) { createIdentityDocument(id) {
Object.keys( Object.keys(
this.filterDataEmptyProperty(this.infoClient.identity_document.pass) this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
@@ -258,6 +261,26 @@ export default {
person_id: id, 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() { postNewClient() {
const formData = new FormData(); const formData = new FormData();
formData.append("full_name", this.infoClient.basic.full_name); formData.append("full_name", this.infoClient.basic.full_name);
@@ -269,12 +292,14 @@ export default {
let foundElement = this.prioritySettings.settings.find( let foundElement = this.prioritySettings.settings.find(
(el) => el.priority === this.infoClient.basic.priority.id (el) => el.priority === this.infoClient.basic.priority.id
); );
if (foundElement) formData.append("priority", foundElement.priority); if (foundElement.priority)
formData.append("priority", foundElement.priority);
fetchWrapper fetchWrapper
.post("general/person/create/", formData, "formData") .post("general/person/create/", formData, "formData")
.then((result) => { .then((result) => {
this.createIdentityDocument(result.id); this.createIdentityDocument(result.id);
this.createAddress(result.id); this.createAddress(result.id);
this.createContacts(result.id);
this.addSuccessNotification(); this.addSuccessNotification();
}); });
this.$emit("update-client"); this.$emit("update-client");
@@ -385,7 +410,7 @@ export default {
watch: { watch: {
showModal: function () { showModal: function () {
if (this.showModal === false) { if (this.showModal === false) {
this.closeModal(); this.closeAddImage();
} }
}, },
}, },

View File

@@ -12,7 +12,7 @@
:width-input="277" :width-input="277"
) )
.flex.flex-col(class="gap-y-1.5") .flex.flex-col(class="gap-y-1.5")
span.text-sm Кем и когда выдан span.text-sm Кем выдан
base-input.input-info( base-input.input-info(
v-model:value="identityDocument.pass.issued_by_org", v-model:value="identityDocument.pass.issued_by_org",
placeholder="Точно как в паспорте", placeholder="Точно как в паспорте",
@@ -47,7 +47,7 @@
.flex.flex-col(class="gap-y-1.5") .flex.flex-col(class="gap-y-1.5")
span.text-sm Номер ИНН span.text-sm Номер ИНН
base-input.input-info( base-input.input-info(
v-mask="'##########'", v-mask="'############'",
v-model:value="identityDocument.inn.numba", v-model:value="identityDocument.inn.numba",
placeholder="000000000000", placeholder="000000000000",
:width-input="277" :width-input="277"