Merge branch 'UC-206' into 'master'

WIP В редактировании ДУЛ настроены dateInputs

See merge request andrusyakka/urban-couscous!231
This commit is contained in:
Daria Golova
2022-12-28 13:54:40 +00:00
4 changed files with 71 additions and 34 deletions

View File

@@ -37,6 +37,7 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.field .field
height: 100%
display: flex display: flex
align-items: center align-items: center
border: 1.5px solid var(--border-light-grey-color) border: 1.5px solid var(--border-light-grey-color)

View File

@@ -3,7 +3,7 @@
:style="{width: settings[section].width + 'px', 'min-height': settings[section].height + 'px', background: changeBackground}", :style="{width: settings[section].width + 'px', 'min-height': settings[section].height + 'px', background: changeBackground}",
) )
.section-header.flex.items-center.justify-between.pl-4.pr-3(:class="{small:settings[section].rowFlex}") .section-header.flex.items-center.justify-between.pl-4.pr-3(:class="{small:settings[section].rowFlex}")
span.text-sm.font-semibold.whitespace-nowrap {{settings[section].title}} span.text-sm.font-semibold.whitespace-nowrap {{settings[section]?.title}}
.flex.items-center.gap-x-8 .flex.items-center.gap-x-8
base-button( base-button(
v-if="isChange && (this.isData || this.isAddress || this.isAttachments || this.isNotes)", v-if="isChange && (this.isData || this.isAddress || this.isAttachments || this.isNotes)",
@@ -76,22 +76,22 @@
.flex.flex-col.gap-y-4 .flex.flex-col.gap-y-4
.flex.flex-col(v-for="(item, key) in sectionInfo", class="gap-y-1.5") .flex.flex-col(v-for="(item, key) in sectionInfo", class="gap-y-1.5")
span.title-section.font-semibold.text-xs(v-if="settings[section].options") {{settings[section].options[key]}} span.title-section.font-semibold.text-xs(v-if="settings[section].options") {{settings[section].options[key]}}
span.title-section.font-semibold.text-xs(v-if="item.header") {{item.header}} span.title-section.font-semibold.text-xs(v-if="item?.header") {{item?.header}}
.flex(v-if="settings[section].options && !isChange") .flex(v-if="settings[section].options && !isChange")
span.text-sm.w-fit(:style="{fontWeight:key === 'number'&&600}") {{key === 'issued_by_date' ? formattedDate : item}} span.text-sm.w-fit(:style="{fontWeight:key === 'number'&&600}") {{key === 'issued_by_date' ? formattedDate : item}}
.copy.icon-copy.cursor-pointer.pl-4( .copy.icon-copy.cursor-pointer.pl-4(
v-if="key === 'number'", v-if="key === 'number'",
@click="() => copyValue(item)" @click="() => copyValue(item)"
) )
.flex(v-if="item.name && !isChange") .flex(v-if="item?.name && !isChange")
span.text-sm.w-fit {{item.title}} span.text-sm.w-fit {{item?.title}}
.flex.items-center(v-if="item.title && section !== 'additional'") .flex.items-center(v-if="item?.title && section !== 'additional'")
.flex.gap-x-2.items-center .flex.gap-x-2.items-center
img(:src="iconDictionary[item?.document?.substr(item.document.lastIndexOf('.') + 1)]") img(:src="iconDictionary[item?.document?.substr(item.document.lastIndexOf('.') + 1)]")
span.text-sm {{item.title}} span.text-sm {{item?.title}}
span.text-sm(v-if="item.document") {{`.${item?.document?.substr(item.document.lastIndexOf(".") + 1)}`}} span.text-sm(v-if="item.document") {{`.${item?.document?.substr(item.document.lastIndexOf(".") + 1)}`}}
.flex.flex-col(v-if="section === 'additional' && !isChange", class="gap-y-1.5") .flex.flex-col(v-if="section === 'additional' && !isChange", class="gap-y-1.5")
.title-section.text-xxs.font-semibold {{item.title}} .title-section.text-xxs.font-semibold {{item?.title}}
span.text-smm {{item.description}} span.text-smm {{item.description}}
.section-body.flex.flex-col.gap-y-4.px-4( .section-body.flex.flex-col.gap-y-4.px-4(
v-else-if="(this.isData || this.isAddress || this.isAttachments || this.isNotes) && isChange", v-else-if="(this.isData || this.isAddress || this.isAttachments || this.isNotes) && isChange",
@@ -102,7 +102,7 @@
span.title-section.font-semibold.text-xs( span.title-section.font-semibold.text-xs(
v-if="settings[section].options", v-if="settings[section].options",
) {{settings[section].options[key]}} ) {{settings[section].options[key]}}
span.title-section.font-semibold.text-xs(v-if="item.header") {{item.header}} span.title-section.font-semibold.text-xs(v-if="item?.header") {{item?.header}}
client-detail-input.text-sm.w-max-fit( client-detail-input.text-sm.w-max-fit(
v-if="section!=='docs' && section!=='additional' && isChange && settings[section].options[key] !== 'Дата выдачи'", v-if="section!=='docs' && section!=='additional' && isChange && settings[section].options[key] !== 'Дата выдачи'",
:style="{fontWeight:key === 'number'&&600}", :style="{fontWeight:key === 'number'&&600}",
@@ -111,9 +111,9 @@
:placeholder="settings[section].placeholder[key] || settings[section].placeholder" :placeholder="settings[section].placeholder[key] || settings[section].placeholder"
:sharp="settings[section].sharps[key] && section === 'pass' ? settings[section].sharps[key] : ''" :sharp="settings[section].sharps[key] && section === 'pass' ? settings[section].sharps[key] : ''"
) )
base-input-date.input.text-sm( base-input-date.input-date.text-sm(
v-else-if="isChange && section !== 'docs' && section !== 'additional'", v-else-if="isChange && section !== 'docs' && section !== 'additional'",
v-model:value="sectionInfo.issued_by_date" v-model="sectionInfo.issued_by_date"
) )
.copy.icon-copy.cursor-pointer( .copy.icon-copy.cursor-pointer(
v-if="item.copy", v-if="item.copy",
@@ -152,7 +152,7 @@
v-model:value="sectionInfo[key].description", v-model:value="sectionInfo[key].description",
placeholder="Описание" placeholder="Описание"
) )
.flex.items-center(v-if="item.title && section !== 'additional'") .flex.items-center(v-if="item?.title && section !== 'additional'")
.icon-cancel.cancel.cursor-pointer.pr-3.text-xsm( .icon-cancel.cancel.cursor-pointer.pr-3.text-xsm(
v-if="isChange", v-if="isChange",
:id="item.id", :id="item.id",
@@ -160,7 +160,7 @@
) )
.flex.gap-x-2.items-center .flex.gap-x-2.items-center
img(:src="iconDictionary[item?.document?.substr(item.document.lastIndexOf('.') + 1)]") img(:src="iconDictionary[item?.document?.substr(item.document.lastIndexOf('.') + 1)]")
span.text-sm {{item.title}} span.text-sm {{item?.title}}
span.text-sm(v-if="item.document") {{`.${item?.document?.substr(item.document.lastIndexOf(".") + 1)}`}} span.text-sm(v-if="item.document") {{`.${item?.document?.substr(item.document.lastIndexOf(".") + 1)}`}}
.section-add.flex.justify-center.items-center.cursor-pointer( .section-add.flex.justify-center.items-center.cursor-pointer(
v-else v-else
@@ -263,7 +263,11 @@ export default {
}, },
formattedDate() { formattedDate() {
return this.sectionInfo["issued_by_date"] return this.sectionInfo["issued_by_date"]
? this.sectionInfo.issued_by_date.split("-").reverse().join(".") ? moment(this.sectionInfo.issued_by_date)
.format("YYYY-MM-DD")
.split("-")
.reverse()
.join(".")
: ""; : "";
}, },
sectionDataPresence() { sectionDataPresence() {
@@ -315,6 +319,9 @@ export default {
}, },
checkDataPresence(data) { checkDataPresence(data) {
let postData = JSON.parse(JSON.stringify(data)); let postData = JSON.parse(JSON.stringify(data));
postData.issued_by_date = data.issued_by_date
? moment(data.issued_by_date).format("YYYY-MM-DD")
: null;
let keys = Object.keys(postData); let keys = Object.keys(postData);
keys.forEach((key) => { keys.forEach((key) => {
if (!postData[key]) { if (!postData[key]) {
@@ -521,4 +528,8 @@ export default {
.input .input
border: 1.5px solid var(--border-light-grey-color) border: 1.5px solid var(--border-light-grey-color)
height: 40px height: 40px
.input-date
height: 40px
background-color: var(--default-white)
</style> </style>

View File

@@ -55,7 +55,7 @@
:is-open-change="isOpenChange", :is-open-change="isOpenChange",
:width="columnBody.find(el => el.name === 'fullName').width" :width="columnBody.find(el => el.name === 'fullName').width"
) )
table-cell-body-age( table-cell-body-birthday(
v-if="!rowOverlay", v-if="!rowOverlay",
:value="dataClient", :value="dataClient",
:is-open-change="isOpenChange", :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 TableCellBodyPhone from "@/pages/clients/components/cells/TableCellBodyPhone";
import TableCellBodyPriority from "@/pages/clients/components/cells/TableCellBodyPriority"; import TableCellBodyPriority from "@/pages/clients/components/cells/TableCellBodyPriority";
import TableCellBodyJobTitle from "@/pages/clients/components/cells/TableCellBodyJobTitle"; 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 TableCellBodyName from "@/pages/clients/components/cells/TableCellBodyName";
import ClientsActionPopup from "@/pages/clients/components/ClientsActionPopup"; import ClientsActionPopup from "@/pages/clients/components/ClientsActionPopup";
import ClientsTableCheckbox from "@/pages/clients/components/ClientsTableCheckbox"; import ClientsTableCheckbox from "@/pages/clients/components/ClientsTableCheckbox";
@@ -141,7 +141,7 @@ export default {
ClientsTableCheckbox, ClientsTableCheckbox,
ClientsActionPopup, ClientsActionPopup,
TableCellBodyName, TableCellBodyName,
TableCellBodyAge, TableCellBodyBirthday,
TableCellBodyJobTitle, TableCellBodyJobTitle,
TableCellBodyPriority, TableCellBodyPriority,
TableCellBodyPhone, TableCellBodyPhone,
@@ -243,19 +243,22 @@ export default {
let clientName = `${this.client.last_name || ""} ${ let clientName = `${this.client.last_name || ""} ${
this.client.first_name || "" this.client.first_name || ""
} ${this.client.patronymic || ""}`; } ${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; if (!this.dataClient.fullName) this.dataClient.fullName = clientName;
else if (this.dataClient.fullName !== clientName) else if (this.dataClient.fullName !== clientName)
data.full_name = this.dataClient.fullName; data.full_name = this.dataClient.fullName;
if (age !== this.client.birth_date && age) data.birth_date = age;
if (this.dataClient.age !== this.client.birth_date && this.dataClient.age) else if (!age && this.client.birth_date) {
data.birth_date = this.dataClient.age;
else if (!this.dataClient.age && this.client.birth_date) {
this.addErrorNotification( 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) if (foundElement.id !== this.client.priority)
data.priority = foundElement.id; data.priority = foundElement.id;
@@ -267,8 +270,10 @@ export default {
"Некорректная дата рождения", "Некорректная дата рождения",
"Дата рождения позже текущего дня" "Дата рождения позже текущего дня"
); );
this.dataClient.age = this.client.birth_date || ""; this.dataClient.age = this.client.birth_date
} else if (!Object.keys(data).length === 0) ? new Date(this.client.birth_date)
: null;
} else if (Object.keys(data).length !== 0)
fetchWrapper fetchWrapper
.post(`general/person/${this.client.id}/update/`, { .post(`general/person/${this.client.id}/update/`, {
...data, ...data,
@@ -460,7 +465,9 @@ export default {
issued_by_org_code: data.issued_by_org_code issued_by_org_code: data.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; this.lackData = true;
} else { } else {
@@ -469,7 +476,7 @@ export default {
number: "", number: "",
issued_by_org: "", issued_by_org: "",
issued_by_org_code: "", issued_by_org_code: "",
issued_by_date: "", issued_by_date: null,
}; };
} }
}, },
@@ -480,7 +487,9 @@ export default {
series_number: this.dataIdentityDocument.number, series_number: this.dataIdentityDocument.number,
issued_by_org: this.dataIdentityDocument.issued_by_org, issued_by_org: this.dataIdentityDocument.issued_by_org,
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code, 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) => { .then((response) => {
this.fetchClientDetail(this.id); this.fetchClientDetail(this.id);
@@ -490,7 +499,7 @@ export default {
"Ошибка редактрирования ДУЛ", "Ошибка редактрирования ДУЛ",
"Часть паспортных данных не заполнена" "Часть паспортных данных не заполнена"
); );
if (response.errors[0].code === "Ошибка редактрирования ДУЛ") if (response.errors[0].code === "Ошибка редактирования ДУЛ")
this.addErrorNotification( this.addErrorNotification(
response.errors[0].code, response.errors[0].code,
response.errors[0].detail response.errors[0].detail
@@ -611,7 +620,9 @@ export default {
series_number: this.dataIdentityDocument.number, series_number: this.dataIdentityDocument.number,
issued_by_org: this.dataIdentityDocument.issued_by_org, issued_by_org: this.dataIdentityDocument.issued_by_org,
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code, 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) => { .then((response) => {
this.fetchClientDetail(this.id); this.fetchClientDetail(this.id);
@@ -691,7 +702,9 @@ export default {
fullName: `${this.client.last_name || ""} ${ fullName: `${this.client.last_name || ""} ${
this.client.first_name || "" this.client.first_name || ""
} ${this.client.patronymic || ""}`, } ${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( priority: this.prioritySettings.settings.find(
(el) => (el) =>
el.priority === this.client.priority || el.priority === this.client.priority ||

View File

@@ -2,27 +2,39 @@
.flex.box-border.px-4.items-center.w-full.text-sm( .flex.box-border.px-4.items-center.w-full.text-sm(
:style="{ minWidth : width + 'px', maxWidth : width + 'px' }" :style="{ minWidth : width + 'px', maxWidth : width + 'px' }"
) )
span(v-if="!isOpenChange") {{value.age ? value.age.split("-").reverse().join(".") : ""}} span(v-if="!isOpenChange") {{ birthday }}
base-input-date.input.max-h-10( base-input-date.input.h-10(
v-if="isOpenChange", v-if="isOpenChange",
@click.stop, @click.stop,
v-model:value="value.age" v-model="value.age"
) )
</template> </template>
<script> <script>
import BaseInputDate from "@/components/base/BaseInputDate"; import BaseInputDate from "@/components/base/BaseInputDate";
import * as moment from "moment/moment";
export default { export default {
name: "TableCellBodyAge", name: "TableCellBodyBirthday",
components: { BaseInputDate }, components: { BaseInputDate },
props: { props: {
value: Object, value: Object,
width: Number, width: Number,
isOpenChange: Boolean, isOpenChange: Boolean,
}, },
computed: {
birthday() {
return this.value.age
? moment(this.value.age)
.format("YYYY-MM-DD")
.split("-")
.reverse()
.join(".")
: "";
},
},
}; };
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
.input .input
border: 1.5px solid var(--border-light-grey-color) background-color: var(--default-white)
</style> </style>