WIP Сделан переход на клиента при создании

This commit is contained in:
Daria Golova
2022-12-14 18:47:14 +03:00
parent 86d64bc771
commit e09e707ec9
3 changed files with 35 additions and 22 deletions

View File

@@ -122,12 +122,18 @@ export default {
}, },
methods: { methods: {
updateDataClient() { updateDataClient() {
this.clearCreatedClientName();
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) {

View File

@@ -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,
@@ -209,7 +210,7 @@ export default {
this.timer = null; this.timer = null;
}, },
startTimer() { startTimer() {
this.countdown = 600; this.countdown = 30;
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.changeCountdown(); this.changeCountdown();
}, 1000); }, 1000);
@@ -339,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
@@ -348,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);
@@ -703,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>

View File

@@ -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>