Merge pull request #200 from dderbentsov/UC-165
WIP Сделан переход на клиента при создании
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
:close-form="closeForm",
|
:close-form="closeForm",
|
||||||
:open-form="openForm",
|
:open-form="openForm",
|
||||||
:set-updated-clients="setUpdatedClients",
|
:set-updated-clients="setUpdatedClients",
|
||||||
|
:write-created-client-id="writeCreatedClientId"
|
||||||
)
|
)
|
||||||
.flex.flex-auto
|
.flex.flex-auto
|
||||||
the-sidebar
|
the-sidebar
|
||||||
@@ -14,7 +15,8 @@
|
|||||||
:is-open-form="isOpenForm",
|
:is-open-form="isOpenForm",
|
||||||
:updated-clients="updatedClients",
|
:updated-clients="updatedClients",
|
||||||
@reset-updated-clients="resetUpdatedClients",
|
@reset-updated-clients="resetUpdatedClients",
|
||||||
:url="url"
|
:url="url",
|
||||||
|
:created-client-id="createdClientId"
|
||||||
)
|
)
|
||||||
the-notification-provider
|
the-notification-provider
|
||||||
</template>
|
</template>
|
||||||
@@ -32,6 +34,7 @@ export default {
|
|||||||
isOpenForm: false,
|
isOpenForm: false,
|
||||||
updatedClients: false,
|
updatedClients: false,
|
||||||
url: "http://45.84.227.122:8080",
|
url: "http://45.84.227.122:8080",
|
||||||
|
createdClientId: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -46,6 +49,10 @@ export default {
|
|||||||
},
|
},
|
||||||
resetUpdatedClients() {
|
resetUpdatedClients() {
|
||||||
this.updatedClients = false;
|
this.updatedClients = false;
|
||||||
|
this.createdClientId = "";
|
||||||
|
},
|
||||||
|
writeCreatedClientId(id) {
|
||||||
|
this.createdClientId = id;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
v-if="isOpenForm",
|
v-if="isOpenForm",
|
||||||
:close-form="closeForm",
|
:close-form="closeForm",
|
||||||
:set-updated-clients="setUpdatedClients",
|
:set-updated-clients="setUpdatedClients",
|
||||||
|
:write-created-client-id="writeCreatedClientId",
|
||||||
)
|
)
|
||||||
.flex.items-center.box-border.cursor-pointer.mr-auto
|
.flex.items-center.box-border.cursor-pointer.mr-auto
|
||||||
img.logo-img.mr-29_25px(src="@/assets/images/logo.svg", alt="Logo")
|
img.logo-img.mr-29_25px(src="@/assets/images/logo.svg", alt="Logo")
|
||||||
@@ -60,6 +61,7 @@ export default {
|
|||||||
closeForm: Function,
|
closeForm: Function,
|
||||||
isOpenForm: Boolean,
|
isOpenForm: Boolean,
|
||||||
setUpdatedClients: Function,
|
setUpdatedClients: Function,
|
||||||
|
writeCreatedClientId: Function,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
closeForm: Function,
|
closeForm: Function,
|
||||||
setUpdatedClients: Function,
|
setUpdatedClients: Function,
|
||||||
|
writeCreatedClientId: Function,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -325,6 +326,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);
|
||||||
|
this.writeCreatedClientId(result.id);
|
||||||
this.setUpdatedClients();
|
this.setUpdatedClients();
|
||||||
this.addSuccessNotification();
|
this.addSuccessNotification();
|
||||||
} else {
|
} else {
|
||||||
@@ -415,7 +417,27 @@ export default {
|
|||||||
if (!this.infoClient.basic.full_name) {
|
if (!this.infoClient.basic.full_name) {
|
||||||
this.addErrorNotification(
|
this.addErrorNotification(
|
||||||
"Не заполнено ФИО клиента",
|
"Не заполнено ФИО клиента",
|
||||||
"Пожалуйста, заполните ФИО клиента"
|
"Заполните ФИО клиента"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} else if (
|
||||||
|
this.infoClient.basic.birth_date &&
|
||||||
|
moment(this.infoClient.basic.birth_date).isAfter(
|
||||||
|
moment().format("YYYY-MM-DD")
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
this.addErrorNotification(
|
||||||
|
"Некорректная дата рождения",
|
||||||
|
"Дата рождения позже текущего дня"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} else if (
|
||||||
|
this.infoClient.phone.username &&
|
||||||
|
this.infoClient.phone.username.length < 18
|
||||||
|
) {
|
||||||
|
this.addErrorNotification(
|
||||||
|
"Неккоретный номер телефона",
|
||||||
|
"Введите мобильный номер, состоящий из 11 цифр"
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
:is-open-form="isOpenForm",
|
:is-open-form="isOpenForm",
|
||||||
:updated-clients="updatedClients",
|
:updated-clients="updatedClients",
|
||||||
@reset-updated-clients="transmitReset",
|
@reset-updated-clients="transmitReset",
|
||||||
:url="url"
|
:url="url",
|
||||||
|
:created-client-id="createdClientId"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ export default {
|
|||||||
isOpenForm: Boolean,
|
isOpenForm: Boolean,
|
||||||
updatedClients: Boolean,
|
updatedClients: Boolean,
|
||||||
url: String,
|
url: String,
|
||||||
|
createdClientId: String,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
transmitReset() {
|
transmitReset() {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
:clearing-text-search="clearingTextSearch",
|
:clearing-text-search="clearingTextSearch",
|
||||||
:change-clearing-text-search="changeClearingTextSearch",
|
:change-clearing-text-search="changeClearingTextSearch",
|
||||||
@search="filterDataClients",
|
@search="filterDataClients",
|
||||||
|
:created-client-name="createdClientName",
|
||||||
)
|
)
|
||||||
.flex.flex-col.h-full.table-container.w-full.mt-8.mb-3
|
.flex.flex-col.h-full.table-container.w-full.mt-8.mb-3
|
||||||
base-modal(v-model="showMedicalCard")
|
base-modal(v-model="showMedicalCard")
|
||||||
@@ -30,7 +31,9 @@
|
|||||||
:deleted-client-id="deletedRowId",
|
:deleted-client-id="deletedRowId",
|
||||||
:update-data-client="updateDataClient",
|
:update-data-client="updateDataClient",
|
||||||
:fetch-data-clients="fetchDataClients",
|
:fetch-data-clients="fetchDataClients",
|
||||||
|
:fetch-created-client-data="fetchCreatedClientData",
|
||||||
:create-medical-card="createMedicalCard",
|
:create-medical-card="createMedicalCard",
|
||||||
|
:created-client-name="createdClientName",
|
||||||
@delete-client="deleteClientHandler",
|
@delete-client="deleteClientHandler",
|
||||||
@recover-client="clearDeletedRowId",
|
@recover-client="clearDeletedRowId",
|
||||||
)
|
)
|
||||||
@@ -83,6 +86,7 @@ export default {
|
|||||||
isOpenForm: Boolean,
|
isOpenForm: Boolean,
|
||||||
updatedClients: Boolean,
|
updatedClients: Boolean,
|
||||||
url: String,
|
url: String,
|
||||||
|
createdClientId: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@@ -108,6 +112,7 @@ export default {
|
|||||||
deletedRowId: "",
|
deletedRowId: "",
|
||||||
clearingTextSearch: false,
|
clearingTextSearch: false,
|
||||||
showMedicalCard: false,
|
showMedicalCard: false,
|
||||||
|
createdClientName: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -120,8 +125,15 @@ export default {
|
|||||||
if (this.textSearch) this.filteredClientsCount -= 1;
|
if (this.textSearch) this.filteredClientsCount -= 1;
|
||||||
else this.clientsCount -= 1;
|
else this.clientsCount -= 1;
|
||||||
if (this.dataClients.find(({ id }) => id === this.deletedRowId)) {
|
if (this.dataClients.find(({ id }) => id === this.deletedRowId)) {
|
||||||
if (this.dataClients.length === 1) this.currentTablePage -= 1;
|
if (this.createdClientName) {
|
||||||
else this.fetchDataClients();
|
this.clearingTextSearch = true;
|
||||||
|
this.currentTablePage === 1
|
||||||
|
? this.fetchDataClients()
|
||||||
|
: (this.currentTablePage = 1);
|
||||||
|
} else {
|
||||||
|
if (this.dataClients.length === 1) this.currentTablePage -= 1;
|
||||||
|
else this.fetchDataClients();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveDataClients(data) {
|
saveDataClients(data) {
|
||||||
@@ -134,6 +146,7 @@ export default {
|
|||||||
if (!this.filteredClientsCoun) this.filteredClientsCount = data.count;
|
if (!this.filteredClientsCoun) this.filteredClientsCount = data.count;
|
||||||
},
|
},
|
||||||
filterDataClients(text) {
|
filterDataClients(text) {
|
||||||
|
this.clearCreatedClientName();
|
||||||
if (text) {
|
if (text) {
|
||||||
this.textSearch = text;
|
this.textSearch = text;
|
||||||
this.filteredClientsCount = 0;
|
this.filteredClientsCount = 0;
|
||||||
@@ -171,6 +184,18 @@ export default {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async fetchCreatedClientData() {
|
||||||
|
fetchWrapper
|
||||||
|
.get(`general/person/${this.createdClientId}/detail/`)
|
||||||
|
.then((response) => {
|
||||||
|
this.dataClients = [response];
|
||||||
|
this.createdClientName = `${response.last_name} ${response.first_name} ${response.patronymic}`;
|
||||||
|
this.paginationInfo = {
|
||||||
|
currentPage: 0,
|
||||||
|
length: 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
calculatePageCount(count) {
|
calculatePageCount(count) {
|
||||||
return Math.ceil(count / this.limit);
|
return Math.ceil(count / this.limit);
|
||||||
},
|
},
|
||||||
@@ -226,19 +251,18 @@ export default {
|
|||||||
},
|
},
|
||||||
changeClearingTextSearch() {
|
changeClearingTextSearch() {
|
||||||
this.clearingTextSearch = false;
|
this.clearingTextSearch = false;
|
||||||
|
this.clearCreatedClientName();
|
||||||
|
},
|
||||||
|
clearCreatedClientName() {
|
||||||
|
this.createdClientName = "";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
updatedClients() {
|
updatedClients() {
|
||||||
if (this.updatedClients === true) {
|
if (this.updatedClients === true) {
|
||||||
this.textSearch = "";
|
this.textSearch = "";
|
||||||
this.clearingTextSearch = true;
|
|
||||||
this.clientsCount += 1;
|
this.clientsCount += 1;
|
||||||
if (
|
this.fetchCreatedClientData();
|
||||||
this.currentTablePage !== this.calculatePageCount(this.clientsCount)
|
|
||||||
)
|
|
||||||
this.currentTablePage = this.calculatePageCount(this.clientsCount);
|
|
||||||
else this.fetchDataClients();
|
|
||||||
this.$emit("reset-updated-clients");
|
this.$emit("reset-updated-clients");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
)
|
)
|
||||||
.icon-search
|
.icon-search
|
||||||
base-button.font-semibold(
|
base-button.font-semibold(
|
||||||
|
v-if="createdClientName === ''",
|
||||||
@click="searchLastName",
|
@click="searchLastName",
|
||||||
:size=40
|
:size=40
|
||||||
) Поиск
|
) Поиск
|
||||||
@@ -43,6 +44,7 @@ export default {
|
|||||||
isOpenActions: Number,
|
isOpenActions: Number,
|
||||||
clearingTextSearch: Boolean,
|
clearingTextSearch: Boolean,
|
||||||
changeClearingTextSearch: Function,
|
changeClearingTextSearch: Function,
|
||||||
|
createdClientName: String,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -51,7 +53,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
searchLastName() {
|
searchLastName() {
|
||||||
if (this.searchClient.length >= 3)
|
if (this.searchClient.length >= 3 && !this.createdClientName)
|
||||||
this.$emit("search", this.searchClient);
|
this.$emit("search", this.searchClient);
|
||||||
},
|
},
|
||||||
resetLastName() {
|
resetLastName() {
|
||||||
@@ -59,6 +61,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
createdClientName() {
|
||||||
|
if (this.createdClientName) this.searchClient = this.createdClientName;
|
||||||
|
},
|
||||||
searchClient() {
|
searchClient() {
|
||||||
if (!this.searchClient && !this.clearingTextSearch) {
|
if (!this.searchClient && !this.clearingTextSearch) {
|
||||||
this.$emit("search");
|
this.$emit("search");
|
||||||
@@ -76,5 +81,5 @@ export default {
|
|||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.input
|
.input
|
||||||
width: 280px
|
min-width: 280px
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
@click="(e) => openDetailInfo(e)",
|
@click="(e) => openDetailInfo(e)",
|
||||||
:class="{'row-overlay-color': rowOverlay}"
|
:class="{'row-overlay-color': rowOverlay}"
|
||||||
)
|
)
|
||||||
.flex.items-center.px-2(
|
.dots-wrapper.flex.items-center.px-2
|
||||||
v-show="!isOpenChange",
|
.relative.dots-button.icon-dots.cursor-pointer.leading-6.text-center(
|
||||||
:tabindex="1",
|
v-show="!isOpenChange && !rowOverlay",
|
||||||
@click="(e) => openPopup(e)",
|
:tabindex="1",
|
||||||
@blur="handleUnFocusPopup"
|
@click="(e) => openPopup(e)",
|
||||||
)
|
@blur="handleUnFocusPopup"
|
||||||
.relative.dots-button.icon-dots.cursor-pointer.leading-6.text-center
|
)
|
||||||
clients-action-popup(
|
clients-action-popup(
|
||||||
v-if="isOpenPopup",
|
v-if="isOpenPopup",
|
||||||
:open-change-data="openChangeData",
|
:open-change-data="openChangeData",
|
||||||
@@ -25,8 +25,9 @@
|
|||||||
@delete-client="transmitDeleteClient",
|
@delete-client="transmitDeleteClient",
|
||||||
:create-medical-card="createMedicalCard"
|
:create-medical-card="createMedicalCard"
|
||||||
)
|
)
|
||||||
.dots.flex.justify-center.items-center(v-if="!rowOverlay")
|
.flex.z-10(
|
||||||
.flex.z-10(v-if="isOpenChange", class="pl-[10px]")
|
v-if="isOpenChange && !rowOverlay",
|
||||||
|
)
|
||||||
base-button(
|
base-button(
|
||||||
@click="closeChangeData",
|
@click="closeChangeData",
|
||||||
confirm,
|
confirm,
|
||||||
@@ -188,6 +189,8 @@ export default {
|
|||||||
url: String,
|
url: String,
|
||||||
fetchDataClients: Function,
|
fetchDataClients: Function,
|
||||||
createMedicalCard: Function,
|
createMedicalCard: Function,
|
||||||
|
fetchCreatedClientData: Function,
|
||||||
|
createdClientName: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
rowOverlay() {
|
rowOverlay() {
|
||||||
@@ -260,7 +263,10 @@ export default {
|
|||||||
.post(`general/person/${this.client.id}/update/`, {
|
.post(`general/person/${this.client.id}/update/`, {
|
||||||
...data,
|
...data,
|
||||||
})
|
})
|
||||||
.then(() => this.fetchDataClients());
|
.then(() => {
|
||||||
|
if (this.createdClientName) this.fetchCreatedClientData;
|
||||||
|
else this.fetchDataClients();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
postContactsClient() {
|
postContactsClient() {
|
||||||
let contacts = [...this.dataClient.contacts];
|
let contacts = [...this.dataClient.contacts];
|
||||||
@@ -334,7 +340,10 @@ export default {
|
|||||||
username: contact.username,
|
username: contact.username,
|
||||||
person_id: this.client.id,
|
person_id: this.client.id,
|
||||||
})
|
})
|
||||||
.then(() => this.fetchDataClients());
|
.then(() => {
|
||||||
|
if (this.createdClientName) this.fetchCreatedClientData;
|
||||||
|
else this.fetchDataClients();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
postUpdateContact(contact) {
|
postUpdateContact(contact) {
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
@@ -343,12 +352,16 @@ export default {
|
|||||||
username: contact.username,
|
username: contact.username,
|
||||||
person_id: this.client.id,
|
person_id: this.client.id,
|
||||||
})
|
})
|
||||||
.then(() => this.fetchDataClients());
|
.then(() => {
|
||||||
|
if (this.createdClientName) this.fetchCreatedClientData;
|
||||||
|
else this.fetchDataClients();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
postDeleteContact(contact) {
|
postDeleteContact(contact) {
|
||||||
fetchWrapper
|
fetchWrapper.del(`general/contact/${contact.id}/delete/`).then(() => {
|
||||||
.del(`general/contact/${contact.id}/delete/`)
|
if (this.createdClientName) this.fetchCreatedClientData;
|
||||||
.then(() => this.fetchDataClients());
|
else this.fetchDataClients();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
addNetwork(network) {
|
addNetwork(network) {
|
||||||
this.dataClient.contacts.push(network);
|
this.dataClient.contacts.push(network);
|
||||||
@@ -698,4 +711,6 @@ export default {
|
|||||||
overflow: hidden
|
overflow: hidden
|
||||||
.closed-detail .detail
|
.closed-detail .detail
|
||||||
max-height: 0
|
max-height: 0
|
||||||
|
.dots-wrapper
|
||||||
|
width: 36px
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
:is-open-form="isOpenForm",
|
:is-open-form="isOpenForm",
|
||||||
:updated-clients="updatedClients",
|
:updated-clients="updatedClients",
|
||||||
@reset-updated-clients="transmitReset",
|
@reset-updated-clients="transmitReset",
|
||||||
:url="url"
|
:url="url",
|
||||||
|
:created-client-id="createdClientId"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ export default {
|
|||||||
isOpenForm: Boolean,
|
isOpenForm: Boolean,
|
||||||
updatedClients: Boolean,
|
updatedClients: Boolean,
|
||||||
url: String,
|
url: String,
|
||||||
|
createdClientId: String,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
transmitReset() {
|
transmitReset() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.flex.box-border.px-4.items-center.gap-x-3.w-full.text-sm(
|
.flex.box-border.px-8.pr-4.items-center.gap-x-3.w-full.text-sm(
|
||||||
:style="{ minWidth : width + 'px', maxWidth : width + 'px' }",
|
:style="{ minWidth : width + 'px', maxWidth : width + 'px' }",
|
||||||
:class="{'open-change': isOpenChange}"
|
|
||||||
)
|
)
|
||||||
base-avatar(:size="36", :color="avatarColor", v-if="!photo") {{avatar}}
|
base-avatar(:size="36", :color="avatarColor", v-if="!photo") {{avatar}}
|
||||||
base-avatar(:size="36", v-else)
|
base-avatar(:size="36", v-else)
|
||||||
@@ -42,6 +41,4 @@ export default {
|
|||||||
border-radius: 50%
|
border-radius: 50%
|
||||||
background-color: var(--font-grey-color)
|
background-color: var(--font-grey-color)
|
||||||
color: var(--font-dark-blue-color)
|
color: var(--font-dark-blue-color)
|
||||||
.open-change
|
|
||||||
padding-left: 36px
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user