diff --git a/src/components/base/BaseInputDate.vue b/src/components/base/BaseInputDate.vue
index 04d2813..bc8921d 100644
--- a/src/components/base/BaseInputDate.vue
+++ b/src/components/base/BaseInputDate.vue
@@ -37,6 +37,7 @@ export default {
diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue
index 0fd3170..d86fc74 100644
--- a/src/pages/clients/components/ClientsTableRow.vue
+++ b/src/pages/clients/components/ClientsTableRow.vue
@@ -55,7 +55,7 @@
:is-open-change="isOpenChange",
:width="columnBody.find(el => el.name === 'fullName').width"
)
- table-cell-body-age(
+ table-cell-body-birthday(
v-if="!rowOverlay",
:value="dataClient",
:is-open-change="isOpenChange",
@@ -120,7 +120,7 @@ import TableCellBodyEmail from "@/pages/clients/components/cells/TableCellBodyEm
import TableCellBodyPhone from "@/pages/clients/components/cells/TableCellBodyPhone";
import TableCellBodyPriority from "@/pages/clients/components/cells/TableCellBodyPriority";
import TableCellBodyJobTitle from "@/pages/clients/components/cells/TableCellBodyJobTitle";
-import TableCellBodyAge from "@/pages/clients/components/cells/TableCellBodyAge";
+import TableCellBodyBirthday from "@/pages/clients/components/cells/TableCellBodyBirthday";
import TableCellBodyName from "@/pages/clients/components/cells/TableCellBodyName";
import ClientsActionPopup from "@/pages/clients/components/ClientsActionPopup";
import ClientsTableCheckbox from "@/pages/clients/components/ClientsTableCheckbox";
@@ -141,7 +141,7 @@ export default {
ClientsTableCheckbox,
ClientsActionPopup,
TableCellBodyName,
- TableCellBodyAge,
+ TableCellBodyBirthday,
TableCellBodyJobTitle,
TableCellBodyPriority,
TableCellBodyPhone,
@@ -243,19 +243,22 @@ export default {
let clientName = `${this.client.last_name || ""} ${
this.client.first_name || ""
} ${this.client.patronymic || ""}`;
+ let age = this.dataClient.age
+ ? moment(this.dataClient.age).format("YYYY-MM-DD")
+ : null;
if (!this.dataClient.fullName) this.dataClient.fullName = clientName;
else if (this.dataClient.fullName !== clientName)
data.full_name = this.dataClient.fullName;
-
- if (this.dataClient.age !== this.client.birth_date && this.dataClient.age)
- data.birth_date = this.dataClient.age;
- else if (!this.dataClient.age && this.client.birth_date) {
+ if (age !== this.client.birth_date && age) data.birth_date = age;
+ else if (!age && this.client.birth_date) {
this.addErrorNotification(
"Некорректная дата рождения",
"Пожалуйста, введите дату рождения корректно"
);
- this.dataClient.age = this.client.birth_date || "";
+ this.dataClient.age = this.client.birth_date
+ ? new Date(this.client.birth_date)
+ : null;
}
if (foundElement.id !== this.client.priority)
data.priority = foundElement.id;
@@ -267,8 +270,10 @@ export default {
"Некорректная дата рождения",
"Дата рождения позже текущего дня"
);
- this.dataClient.age = this.client.birth_date || "";
- } else if (!Object.keys(data).length === 0)
+ this.dataClient.age = this.client.birth_date
+ ? new Date(this.client.birth_date)
+ : null;
+ } else if (Object.keys(data).length !== 0)
fetchWrapper
.post(`general/person/${this.client.id}/update/`, {
...data,
@@ -460,7 +465,9 @@ export default {
issued_by_org_code: data.issued_by_org_code
? data?.issued_by_org_code
: "",
- issued_by_date: data.issued_by_date ? data?.issued_by_date : "",
+ issued_by_date: data.issued_by_date
+ ? new Date(data?.issued_by_date)
+ : null,
};
this.lackData = true;
} else {
@@ -469,7 +476,7 @@ export default {
number: "",
issued_by_org: "",
issued_by_org_code: "",
- issued_by_date: "",
+ issued_by_date: null,
};
}
},
@@ -480,7 +487,9 @@ export default {
series_number: this.dataIdentityDocument.number,
issued_by_org: this.dataIdentityDocument.issued_by_org,
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code,
- issued_by_date: this.dataIdentityDocument.issued_by_date,
+ issued_by_date: moment(
+ this.dataIdentityDocument.issued_by_date
+ ).format("YYYY-MM-DD"),
})
.then((response) => {
this.fetchClientDetail(this.id);
@@ -490,7 +499,7 @@ export default {
"Ошибка редактрирования ДУЛ",
"Часть паспортных данных не заполнена"
);
- if (response.errors[0].code === "Ошибка редактрирования ДУЛ")
+ if (response.errors[0].code === "Ошибка редактирования ДУЛ")
this.addErrorNotification(
response.errors[0].code,
response.errors[0].detail
@@ -611,7 +620,9 @@ export default {
series_number: this.dataIdentityDocument.number,
issued_by_org: this.dataIdentityDocument.issued_by_org,
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code,
- issued_by_date: this.dataIdentityDocument.issued_by_date,
+ issued_by_date: moment(
+ this.dataIdentityDocument.issued_by_date
+ ).format("YYYY-MM-DD"),
})
.then((response) => {
this.fetchClientDetail(this.id);
@@ -691,7 +702,9 @@ export default {
fullName: `${this.client.last_name || ""} ${
this.client.first_name || ""
} ${this.client.patronymic || ""}`,
- age: this.client.birth_date || "",
+ age: this.client.birth_date
+ ? new Date(this.client.birth_date)
+ : null,
priority: this.prioritySettings.settings.find(
(el) =>
el.priority === this.client.priority ||
diff --git a/src/pages/clients/components/cells/TableCellBodyAge.vue b/src/pages/clients/components/cells/TableCellBodyBirthday.vue
similarity index 51%
rename from src/pages/clients/components/cells/TableCellBodyAge.vue
rename to src/pages/clients/components/cells/TableCellBodyBirthday.vue
index 4ea2aef..fee581c 100644
--- a/src/pages/clients/components/cells/TableCellBodyAge.vue
+++ b/src/pages/clients/components/cells/TableCellBodyBirthday.vue
@@ -2,27 +2,39 @@
.flex.box-border.px-4.items-center.w-full.text-sm(
:style="{ minWidth : width + 'px', maxWidth : width + 'px' }"
)
- span(v-if="!isOpenChange") {{value.age ? value.age.split("-").reverse().join(".") : ""}}
- base-input-date.input.max-h-10(
+ span(v-if="!isOpenChange") {{ birthday }}
+ base-input-date.input.h-10(
v-if="isOpenChange",
@click.stop,
- v-model:value="value.age"
+ v-model="value.age"
)