diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue
index e24b6a7..3069491 100644
--- a/src/pages/clients/components/ClientsTableRow.vue
+++ b/src/pages/clients/components/ClientsTableRow.vue
@@ -84,7 +84,7 @@
:disabled-delete="!!deletedClientId && !rowOverlay",
@delete-client="transmitDeleteClient"
)
- client-detail-info-wrapper(
+ client-detail-info-wrapper.detail(
v-if="isOpenDetailInfo",
:data-address="dataAddress"
:data-detail="dataDetail"
@@ -122,6 +122,7 @@ import { fetchWrapper } from "@/shared/fetchWrapper";
import { column } from "@/pages/clients/utils/tableConfig";
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
import { addNotification } from "@/components/Notifications/notificationContext";
+import * as moment from "moment";
export default {
name: "ClientsTableRow",
@@ -211,15 +212,31 @@ export default {
(el) => el.text === this.dataClient.priority
);
let data = {};
- if (this.dataClient.age) {
+ if (
+ this.dataClient.age !== this.client.birth_date &&
+ this.dataClient.age
+ ) {
data.birth_date = this.dataClient.age;
}
if (
- this.dataClient.priority !== this.client.priority &&
- this.dataClient.priority
+ foundElement.id !== this.client.priority &&
+ foundElement.text !== "-"
) {
data.priority = foundElement.priority;
+ } else if (foundElement.text === "-") {
+ data.priority = 4;
}
+ if (
+ data.birth_date &&
+ moment(data.birth_date).isAfter(moment().format("YYYY-MM-DD"))
+ ) {
+ this.addErrorNotification();
+ this.dataClient.age = this.client.birth_date;
+ } else
+ fetchWrapper.post(`general/person/${this.client.id}/update/`, {
+ full_name: this.dataClient.fullName,
+ ...data,
+ });
},
postContactsClient() {
let contacts = [...this.dataClient.contacts];
@@ -319,6 +336,15 @@ export default {
5000
);
},
+ addErrorNotification() {
+ addNotification(
+ "Некорректная дата рождения",
+ "Некорректная дата рождения",
+ "Дата рождения позже текущего дня",
+ "error",
+ 5000
+ );
+ },
fetchClientDetail(id) {
fetchWrapper
.get(`general/person/${id}/detail/`)
@@ -489,7 +515,8 @@ export default {
} ${this.client.patronymic || ""}`,
age: this.client.birth_date || "",
priority: this.prioritySettings.settings.find(
- (el) => el.priority === this.client.priority
+ (el) =>
+ el.priority === this.client.priority || this.client.priority === el.id
).text,
phone: {
id: this.client.contacts.find((el) => el.kind === "PHONE")?.id || "",
@@ -506,7 +533,9 @@ export default {
"",
},
contacts: [...this.client.contacts],
- avatar: `${this.client.last_name[0]}${this.client.first_name[0]}`,
+ avatar: this.client.first_name
+ ? this.client.last_name[0] + this.client.first_name[0]
+ : this.client.last_name.substr(0, 2),
color: this.client.color,
photo: this.client.photo,
};
@@ -524,11 +553,13 @@ export default {
.row-wrapper
border-bottom: 1px solid var(--border-light-grey-color)
min-width: 1556px
+.row-wrapper:hover .detail
+ background-color: var(--bg-hover-row-table)
+.row-wrapper:hover .row-body
+ background-color: var(--bg-hover-row-table)
.row-body
color: var(--font-dark-blue-color)
min-height: 56px
- &:hover
- background-color: var(--bg-hover-row-table)
.check-box
min-width: 36px
.dots
diff --git a/src/pages/clients/components/cells/TableCellBodyAge.vue b/src/pages/clients/components/cells/TableCellBodyAge.vue
index 28992d7..076cb58 100644
--- a/src/pages/clients/components/cells/TableCellBodyAge.vue
+++ b/src/pages/clients/components/cells/TableCellBodyAge.vue
@@ -1,14 +1,19 @@
.flex.box-border.px-4.items-center.w-full.text-sm(:style="{ minWidth : width + 'px' }")
- span(v-if="!isOpenChange") {{value.age ? new Date().getFullYear() - new Date(value.age).getFullYear() : ""}}
- base-input(v-if="isOpenChange" type="date" v-model:value="value.age" :width-input="124")
+ span(v-if="!isOpenChange") {{value.age ? value.age.split("-").reverse().join(".") : ""}}
+ base-input-date.input.max-h-10(
+ v-if="isOpenChange",
+ @click.stop,
+ v-model:value="value.age",
+ :width-input="124"
+ )
+
diff --git a/src/pages/clients/components/cells/TableCellBodyEmail.vue b/src/pages/clients/components/cells/TableCellBodyEmail.vue
index e04796c..fbc33ea 100644
--- a/src/pages/clients/components/cells/TableCellBodyEmail.vue
+++ b/src/pages/clients/components/cells/TableCellBodyEmail.vue
@@ -1,7 +1,13 @@
.flex.box-border.px-4.items-center.w-full.text-sm(:style="{ minWidth : width + 'px' }")
span(v-if="!isOpenChange") {{value.email.username}}
- base-input(v-if="isOpenChange" :width-input="234" v-model:value="value.email.username" :placeholder="value.email.username" )
+ base-input(
+ v-if="isOpenChange",
+ :width-input="234",
+ @click.stop,
+ v-model:value="value.email.username",
+ :placeholder="value.email.username"
+ )