diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index 5d9d1f3..495b5ed 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -270,7 +270,7 @@ export default { closeModal() { !this.showModal ? this.closeForm() : null; }, - createIdentityDocument(id) { + async createIdentityDocument(id) { let doc = null; let filteredData = Object.keys( this.filterDataEmptyProperty(this.infoClient.identity_document.pass) @@ -291,21 +291,17 @@ export default { "Паспортные данные не будут записаны в профиль клиента" ); } else - fetchWrapper - .post("general/identity_document/create/", { - series_number: - this.infoClient.identity_document.pass.series_number, - issued_by_org: - this.infoClient.identity_document.pass.issued_by_org, - issued_by_date: moment( - this.infoClient.identity_document.pass.issued_by_date - ).format("YYYY-MM-DD"), - issued_by_org_code: - this.infoClient.identity_document.pass.issued_by_org_code, - person: id, - kind: "Паспорт", - }) - .then((res) => (doc = res)); + doc = await fetchWrapper.post("general/identity_document/create/", { + series_number: this.infoClient.identity_document.pass.series_number, + issued_by_org: this.infoClient.identity_document.pass.issued_by_org, + issued_by_date: moment( + this.infoClient.identity_document.pass.issued_by_date + ).format("YYYY-MM-DD"), + issued_by_org_code: + this.infoClient.identity_document.pass.issued_by_org_code, + person: id, + kind: "Паспорт", + }); return Promise.resolve(doc); } }, @@ -335,17 +331,17 @@ export default { ...this.filterDataEmptyProperty(this.infoClient.email), person: id, }); - this.infoClient.basic.contacts.forEach((el) => { - if (el.username) - fetchWrapper - .post("general/contact/create/", { - kind: el.kind.id, - username: el.username, + for (const network of this.infoClient.basic.contacts) { + if (network.username) { + contacts.push( + await fetchWrapper.post("general/contact/create/", { + kind: network.kind.id, + username: network.username, person: id, }) - .then((res) => contacts.push(res)); - }); - console.log(Promise.allSettled([phone, email, contacts])); + ); + } + } return Promise.allSettled([phone, email, contacts]); }, postNewClient() { @@ -370,8 +366,7 @@ export default { this.createIdentityDocument(result.id), this.createAddress(result.id), this.createContacts(result.id), - ]).then((res) => { - console.log(res); + ]).then(() => { this.writeCreatedClientId(result.id); this.setUpdatedClients(); this.addSuccessNotification(); diff --git a/src/components/base/BaseInput.vue b/src/components/base/BaseInput.vue index 5707185..27db359 100644 --- a/src/components/base/BaseInput.vue +++ b/src/components/base/BaseInput.vue @@ -10,7 +10,7 @@ :dense="dense", :type="type", :filled="filled", - :bg-color="!filled && 'white'", + :bg-color="filled ? '' : 'white'", :disable="disabled", :rules="rule", :mask="mask",