WIP Переделала создание клиента
This commit is contained in:
@@ -270,7 +270,7 @@ export default {
|
|||||||
closeModal() {
|
closeModal() {
|
||||||
!this.showModal ? this.closeForm() : null;
|
!this.showModal ? this.closeForm() : null;
|
||||||
},
|
},
|
||||||
createIdentityDocument(id) {
|
async createIdentityDocument(id) {
|
||||||
let doc = null;
|
let doc = null;
|
||||||
let filteredData = Object.keys(
|
let filteredData = Object.keys(
|
||||||
this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
|
this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
|
||||||
@@ -291,12 +291,9 @@ export default {
|
|||||||
"Паспортные данные не будут записаны в профиль клиента"
|
"Паспортные данные не будут записаны в профиль клиента"
|
||||||
);
|
);
|
||||||
} else
|
} else
|
||||||
fetchWrapper
|
doc = await fetchWrapper.post("general/identity_document/create/", {
|
||||||
.post("general/identity_document/create/", {
|
series_number: this.infoClient.identity_document.pass.series_number,
|
||||||
series_number:
|
issued_by_org: this.infoClient.identity_document.pass.issued_by_org,
|
||||||
this.infoClient.identity_document.pass.series_number,
|
|
||||||
issued_by_org:
|
|
||||||
this.infoClient.identity_document.pass.issued_by_org,
|
|
||||||
issued_by_date: moment(
|
issued_by_date: moment(
|
||||||
this.infoClient.identity_document.pass.issued_by_date
|
this.infoClient.identity_document.pass.issued_by_date
|
||||||
).format("YYYY-MM-DD"),
|
).format("YYYY-MM-DD"),
|
||||||
@@ -304,8 +301,7 @@ export default {
|
|||||||
this.infoClient.identity_document.pass.issued_by_org_code,
|
this.infoClient.identity_document.pass.issued_by_org_code,
|
||||||
person: id,
|
person: id,
|
||||||
kind: "Паспорт",
|
kind: "Паспорт",
|
||||||
})
|
});
|
||||||
.then((res) => (doc = res));
|
|
||||||
return Promise.resolve(doc);
|
return Promise.resolve(doc);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -335,17 +331,17 @@ export default {
|
|||||||
...this.filterDataEmptyProperty(this.infoClient.email),
|
...this.filterDataEmptyProperty(this.infoClient.email),
|
||||||
person: id,
|
person: id,
|
||||||
});
|
});
|
||||||
this.infoClient.basic.contacts.forEach((el) => {
|
for (const network of this.infoClient.basic.contacts) {
|
||||||
if (el.username)
|
if (network.username) {
|
||||||
fetchWrapper
|
contacts.push(
|
||||||
.post("general/contact/create/", {
|
await fetchWrapper.post("general/contact/create/", {
|
||||||
kind: el.kind.id,
|
kind: network.kind.id,
|
||||||
username: el.username,
|
username: network.username,
|
||||||
person: id,
|
person: id,
|
||||||
})
|
})
|
||||||
.then((res) => contacts.push(res));
|
);
|
||||||
});
|
}
|
||||||
console.log(Promise.allSettled([phone, email, contacts]));
|
}
|
||||||
return Promise.allSettled([phone, email, contacts]);
|
return Promise.allSettled([phone, email, contacts]);
|
||||||
},
|
},
|
||||||
postNewClient() {
|
postNewClient() {
|
||||||
@@ -370,8 +366,7 @@ export default {
|
|||||||
this.createIdentityDocument(result.id),
|
this.createIdentityDocument(result.id),
|
||||||
this.createAddress(result.id),
|
this.createAddress(result.id),
|
||||||
this.createContacts(result.id),
|
this.createContacts(result.id),
|
||||||
]).then((res) => {
|
]).then(() => {
|
||||||
console.log(res);
|
|
||||||
this.writeCreatedClientId(result.id);
|
this.writeCreatedClientId(result.id);
|
||||||
this.setUpdatedClients();
|
this.setUpdatedClients();
|
||||||
this.addSuccessNotification();
|
this.addSuccessNotification();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
:dense="dense",
|
:dense="dense",
|
||||||
:type="type",
|
:type="type",
|
||||||
:filled="filled",
|
:filled="filled",
|
||||||
:bg-color="!filled && 'white'",
|
:bg-color="filled ? '' : 'white'",
|
||||||
:disable="disabled",
|
:disable="disabled",
|
||||||
:rules="rule",
|
:rules="rule",
|
||||||
:mask="mask",
|
:mask="mask",
|
||||||
|
|||||||
Reference in New Issue
Block a user