[WIP] Фикс апдейта данных клиента
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
<template lang="pug">
|
||||
.flex.box-border.container.items-center.cursor-pointer.justify-center.relative(
|
||||
@click="changeSelect"
|
||||
@click="changeSelect",
|
||||
v-click-outside="closeSelect",
|
||||
:class="{border: styleBorder}"
|
||||
)
|
||||
.flex.select.cursor-pointer.w-full.text-xl.items-center.networks(:class="optionData, 'px-2.5'")
|
||||
.absolute.options.top-11.left-0(
|
||||
v-show="isSelectOpen"
|
||||
:id="id")
|
||||
v-show="isSelectOpen",
|
||||
:id="id"
|
||||
)
|
||||
.flex.option.justify-center.py-1.text-xl(
|
||||
v-for="data in listData"
|
||||
@click="(e) => chooseOption(e)"
|
||||
:key="data.network"
|
||||
:id="data.network"
|
||||
v-for="data in listData",
|
||||
@click="(e) => chooseOption(e)",
|
||||
:key="data.network",
|
||||
:id="data.network",
|
||||
:class="data.icon"
|
||||
)
|
||||
.select-form-separator.cursor-pointer.mr-6px(v-if="separator")
|
||||
@@ -45,6 +47,9 @@ export default {
|
||||
changeSelect() {
|
||||
this.isSelectOpen = !this.isSelectOpen;
|
||||
},
|
||||
closeSelect() {
|
||||
this.isSelectOpen = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -286,7 +286,9 @@ export default {
|
||||
)
|
||||
updateContacts.push(this.dataClient.email);
|
||||
});
|
||||
createContacts.forEach((el) => this.postCreateContact(el));
|
||||
createContacts.forEach((el) => {
|
||||
if (!el.id) this.postCreateContact(el);
|
||||
});
|
||||
deleteContacts.forEach((el) => this.postDeleteContact(el));
|
||||
updateContacts.forEach((el) => this.postUpdateContact(el));
|
||||
},
|
||||
@@ -300,11 +302,13 @@ export default {
|
||||
.then(() => this.fetchDataClients());
|
||||
},
|
||||
postUpdateContact(contact) {
|
||||
fetchWrapper.post(`general/contact/${contact.id}/update/`, {
|
||||
fetchWrapper
|
||||
.post(`general/contact/${contact.id}/update/`, {
|
||||
kind: contact.kind,
|
||||
username: contact.username,
|
||||
person_id: this.client.id,
|
||||
});
|
||||
})
|
||||
.then(() => this.fetchDataClients());
|
||||
},
|
||||
postDeleteContact(contact) {
|
||||
fetchWrapper.del(`general/contact/${contact.id}/delete/`);
|
||||
@@ -555,7 +559,15 @@ export default {
|
||||
});
|
||||
},
|
||||
},
|
||||
created() {
|
||||
watch: {
|
||||
rowOverlay() {
|
||||
if (this.rowOverlay) this.startTimer();
|
||||
},
|
||||
client: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.dataClient = {
|
||||
id: this.client.id,
|
||||
fullName: `${this.client.last_name || ""} ${
|
||||
@@ -564,21 +576,26 @@ export default {
|
||||
age: this.client.birth_date || "",
|
||||
priority: this.prioritySettings.settings.find(
|
||||
(el) =>
|
||||
el.priority === this.client.priority || this.client.priority === el.id
|
||||
el.priority === this.client.priority ||
|
||||
this.client.priority === el.id
|
||||
).text,
|
||||
phone: {
|
||||
id: this.client.contacts.find((el) => el.kind === "PHONE")?.id || "",
|
||||
id:
|
||||
this.client.contacts.find((el) => el.kind === "PHONE")?.id ||
|
||||
"",
|
||||
kind: "PHONE",
|
||||
username:
|
||||
this.client.contacts.find((el) => el.kind === "PHONE")?.username ||
|
||||
"",
|
||||
this.client.contacts.find((el) => el.kind === "PHONE")
|
||||
?.username || "",
|
||||
},
|
||||
email: {
|
||||
id: this.client.contacts.find((el) => el.kind === "EMAIL")?.id || "",
|
||||
id:
|
||||
this.client.contacts.find((el) => el.kind === "EMAIL")?.id ||
|
||||
"",
|
||||
kind: "EMAIL",
|
||||
username:
|
||||
this.client.contacts.find((el) => el.kind === "EMAIL")?.username ||
|
||||
"",
|
||||
this.client.contacts.find((el) => el.kind === "EMAIL")
|
||||
?.username || "",
|
||||
},
|
||||
contacts: [...this.client.contacts],
|
||||
avatar: this.client.first_name
|
||||
@@ -587,13 +604,10 @@ export default {
|
||||
color: this.client.color,
|
||||
photo: this.client.photo,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
rowOverlay() {
|
||||
if (this.rowOverlay) this.startTimer();
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
if (this.timer) {
|
||||
this.deleteClient();
|
||||
|
||||
@@ -73,7 +73,7 @@ export const column = [
|
||||
icon: "icon-tg",
|
||||
},
|
||||
{
|
||||
network: "GOOGLE",
|
||||
network: "GMAIL",
|
||||
icon: "icon-google",
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user