From 1e31e74c5b931224c9a545a410dbbd8a48bae1ba Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Wed, 28 Dec 2022 16:50:51 +0300 Subject: [PATCH] =?UTF-8?q?WIP=20=D0=92=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=94?= =?UTF-8?q?=D0=A3=D0=9B=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20dateInputs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ClientDetailInfoSection.vue | 37 ++++++++++++------- .../clients/components/ClientsTableRow.vue | 16 +++++--- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index 0ce6e3f..80d4e44 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -3,7 +3,7 @@ :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}") - 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 base-button( v-if="isChange && (this.isData || this.isAddress || this.isAttachments || this.isNotes)", @@ -76,22 +76,22 @@ .flex.flex-col.gap-y-4 .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="item.header") {{item.header}} + span.title-section.font-semibold.text-xs(v-if="item?.header") {{item?.header}} .flex(v-if="settings[section].options && !isChange") span.text-sm.w-fit(:style="{fontWeight:key === 'number'&&600}") {{key === 'issued_by_date' ? formattedDate : item}} .copy.icon-copy.cursor-pointer.pl-4( v-if="key === 'number'", @click="() => copyValue(item)" ) - .flex(v-if="item.name && !isChange") - span.text-sm.w-fit {{item.title}} - .flex.items-center(v-if="item.title && section !== 'additional'") + .flex(v-if="item?.name && !isChange") + span.text-sm.w-fit {{item?.title}} + .flex.items-center(v-if="item?.title && section !== 'additional'") .flex.gap-x-2.items-center 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)}`}} .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}} .section-body.flex.flex-col.gap-y-4.px-4( v-else-if="(this.isData || this.isAddress || this.isAttachments || this.isNotes) && isChange", @@ -102,7 +102,7 @@ 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}} client-detail-input.text-sm.w-max-fit( v-if="section!=='docs' && section!=='additional' && isChange && settings[section].options[key] !== 'Дата выдачи'", :style="{fontWeight:key === 'number'&&600}", @@ -111,9 +111,9 @@ :placeholder="settings[section].placeholder[key] || settings[section].placeholder" :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-model:value="sectionInfo.issued_by_date" + v-model="sectionInfo.issued_by_date" ) .copy.icon-copy.cursor-pointer( v-if="item.copy", @@ -152,7 +152,7 @@ v-model:value="sectionInfo[key].description", 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( v-if="isChange", :id="item.id", @@ -160,7 +160,7 @@ ) .flex.gap-x-2.items-center 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)}`}} .section-add.flex.justify-center.items-center.cursor-pointer( v-else @@ -263,7 +263,11 @@ export default { }, formattedDate() { 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() { @@ -315,6 +319,9 @@ export default { }, checkDataPresence(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); keys.forEach((key) => { if (!postData[key]) { @@ -521,4 +528,8 @@ export default { .input border: 1.5px solid var(--border-light-grey-color) height: 40px + +.input-date + height: 40px + background-color: var(--default-white) diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 2ff174c..d86fc74 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -465,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 { @@ -474,7 +476,7 @@ export default { number: "", issued_by_org: "", issued_by_org_code: "", - issued_by_date: "", + issued_by_date: null, }; } }, @@ -485,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); @@ -495,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 @@ -616,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);