WIP Переделала создание клиента

This commit is contained in:
Daria Golova
2023-02-22 14:01:55 +03:00
parent 2f2c331189
commit 0f9d271575
2 changed files with 23 additions and 28 deletions

View File

@@ -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,12 +291,9 @@ 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,
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"),
@@ -304,8 +301,7 @@ export default {
this.infoClient.identity_document.pass.issued_by_org_code,
person: id,
kind: "Паспорт",
})
.then((res) => (doc = res));
});
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();

View File

@@ -10,7 +10,7 @@
:dense="dense",
:type="type",
:filled="filled",
:bg-color="!filled && 'white'",
:bg-color="filled ? '' : 'white'",
:disable="disabled",
:rules="rule",
:mask="mask",