From 687a56defbc21053411966235330c4668b926e8e Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Tue, 27 Dec 2022 14:16:39 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85,=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 42 ++++++++-------- src/components/base/BaseClientFormCreate.vue | 14 +++--- .../components/ClientDetailInfoSection.vue | 10 ++-- .../clients/components/ClientsTableRow.vue | 24 +++++----- .../FormCreateIdentityDocuments.vue | 4 +- src/pages/clients/utils/tableConfig.js | 18 +++---- src/pages/schedule/TheSchedule.vue | 14 ++++++ .../schedule/components/ScheduleBody.vue | 48 +++++++++++-------- 8 files changed, 97 insertions(+), 77 deletions(-) diff --git a/server.js b/server.js index 64da363..04c1031 100644 --- a/server.js +++ b/server.js @@ -31,13 +31,13 @@ const dataClients = { updated_at: "2022-10-24T15:44:29.235350Z", deleted_flg: false, kind: "Паспорт", - numba: "1233 123312", + number: "1233 123312", issued_by_org: "Отделом УФМС России по рязанской области", issued_by_date: "2022-10-10", issued_by_org_code: "426–234", created_by: null, updated_by: null, - person_id: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", + person: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", }, ], }, @@ -67,13 +67,13 @@ const dataClients = { updated_at: "2022-10-24T15:44:29.235350Z", deleted_flg: false, kind: "Паспорт", - numba: "9543 547021", + number: "9543 547021", issued_by_org: "Отделом УФМС России по владимирской области", issued_by_date: "2014-09-08", issued_by_org_code: "743–126", created_by: null, updated_by: null, - person_id: "db831a14-e836-481f-a653-6325de7c311e", + person: "db831a14-e836-481f-a653-6325de7c311e", }, ], }, @@ -113,13 +113,13 @@ const dataClients = { updated_at: "2022-10-24T15:44:29.235350Z", deleted_flg: false, kind: "Паспорт", - numba: "4308 205732", + number: "4308 205732", issued_by_org: "Отделом УФМС России по московской области", issued_by_date: "2018-11-03", issued_by_org_code: "902–571", created_by: null, updated_by: null, - person_id: "db8jd58x-e836-481f-a653-oq1m4e7c09e1", + person: "db8jd58x-e836-481f-a653-oq1m4e7c09e1", }, ], }, @@ -154,13 +154,13 @@ const dataClients = { updated_at: "2022-10-24T15:44:29.235350Z", deleted_flg: false, kind: "Паспорт", - numba: "1602 671922", + number: "1602 671922", issued_by_org: "Отделом УФМС России по тульской области", issued_by_date: "2017-01-21", issued_by_org_code: "101–238", created_by: null, updated_by: null, - person_id: "cs5ms771-e836-kdc4-a653-sc4n567sx123", + person: "cs5ms771-e836-kdc4-a653-sc4n567sx123", }, ], }, @@ -169,12 +169,12 @@ const dataClients = { const clientDetail = [ { - person_id: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", + person: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", snils: { - numba: "812–183–139 21", + number: "812–183–139 21", }, inn: { - numba: "138291382731", + number: "138291382731", }, birthday: { date: "1994-12-04", @@ -239,12 +239,12 @@ const clientDetail = [ ], }, { - person_id: "db831a14-e836-481f-a653-6325de7c311e", + person: "db831a14-e836-481f-a653-6325de7c311e", snils: { - numba: "834–001–555 35", + number: "834–001–555 35", }, inn: { - numba: "371942327342", + number: "371942327342", }, birthday: { date: "1997-09-03", @@ -307,12 +307,12 @@ const clientDetail = [ ], }, { - person_id: "db8jd58x-e836-481f-a653-oq1m4e7c09e1", + person: "db8jd58x-e836-481f-a653-oq1m4e7c09e1", snils: { - numba: "812–183–139 21", + number: "812–183–139 21", }, inn: { - numba: "138291382731", + number: "138291382731", }, birthday: { date: "1990-11-05", @@ -377,12 +377,12 @@ const clientDetail = [ ], }, { - person_id: "cs5ms771-e836-kdc4-a653-sc4n567sx123", + person: "cs5ms771-e836-kdc4-a653-sc4n567sx123", snils: { - numba: "834–001–555 35", + number: "834–001–555 35", }, inn: { - numba: "371942327342", + number: "371942327342", }, birthday: { date: "2000-08-17", @@ -720,7 +720,7 @@ export function clientsServer() { this.passthrough("https://astra-dev.dopcore.com/**"); this.get("/api/detail/:id", (schema, request) => { let id = request.params.id; - return clientDetail.find((el) => el.person_id === id); + return clientDetail.find((el) => el.person === id); }); this.get("/api/detail/identity_document/:id", (schema, request) => { let id = request.params.id; diff --git a/src/components/base/BaseClientFormCreate.vue b/src/components/base/BaseClientFormCreate.vue index 04d89d9..d7f4ca3 100644 --- a/src/components/base/BaseClientFormCreate.vue +++ b/src/components/base/BaseClientFormCreate.vue @@ -152,11 +152,11 @@ export default { }, snils: { kind: "СНИЛС", - numba: "", + number: "", }, inn: { kind: "ИНН", - numba: "", + number: "", }, }, addresses: { @@ -273,7 +273,7 @@ export default { ...this.filterDataEmptyProperty( this.infoClient.identity_document.pass ), - person_id: id, + person: id, kind: "Паспорт", }); } @@ -283,26 +283,26 @@ export default { .length > 0 && fetchWrapper.post("general/address/create/", { ...this.filterDataEmptyProperty(this.infoClient.addresses), - person_id: id, + person: id, }); }, createContacts(id) { if (this.infoClient.phone.username) fetchWrapper.post("general/contact/create/", { ...this.filterDataEmptyProperty(this.infoClient.phone), - person_id: id, + person: id, }); if (this.infoClient.email.username) fetchWrapper.post("general/contact/create/", { ...this.filterDataEmptyProperty(this.infoClient.email), - person_id: id, + person: id, }); this.infoClient.basic.contacts.forEach((el) => { if (el.username) fetchWrapper.post("general/contact/create/", { kind: el.kind, username: el.username, - person_id: id, + person: id, }); }); }, diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index c00c48c..b5f0e22 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -78,9 +78,9 @@ 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}} .flex(v-if="settings[section].options && !isChange") - span.text-sm.w-fit(:style="{fontWeight:key === 'numba'&&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( - v-if="key === 'numba'", + v-if="key === 'number'", @click="() => copyValue(item)" ) .flex(v-if="item.name && !isChange") @@ -105,7 +105,7 @@ 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 === 'numba'&&600}", + :style="{fontWeight:key === 'number'&&600}", v-model:value="sectionInfo[key]", :rows="section ==='pass' ? 2 : 1", :placeholder="settings[section].placeholder[key] || settings[section].placeholder" @@ -137,7 +137,7 @@ ) client-detail-input.text-sm.w-max-fit.pr-12.relative( :maxLength="40", - :style="{fontWeight:key === 'numba'&&600}", + :style="{fontWeight:key === 'number'&&600}", v-model:value="sectionInfo[key].title", placeholder="Заголовок" ) @@ -148,7 +148,7 @@ .title-section.text-xxs.font-semibold Описание client-detail-input.text-sm.w-max-fit( :maxLength="40", - :style="{fontWeight:key === 'numba'&&600}", + :style="{fontWeight:key === 'number'&&600}", v-model:value="sectionInfo[key].description", placeholder="Описание" ) diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index bb9ec20..7712d78 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -347,7 +347,7 @@ export default { .post("general/contact/create/", { kind: contact.kind, username: contact.username, - person_id: this.client.id, + person: this.client.id, }) .then(() => { if (this.createdClientName) this.fetchCreatedClientData; @@ -359,7 +359,7 @@ export default { .post(`general/contact/${contact.id}/update/`, { kind: contact.kind, username: contact.username, - person_id: this.client.id, + person: this.client.id, }) .then(() => { if (this.createdClientName) this.fetchCreatedClientData; @@ -430,7 +430,7 @@ export default { .then((data) => this.saveAttachment(data.results)); }, saveAttachment(data) { - this.dataAttachments = data.filter((e) => e.person_id.id === this.id); + this.dataAttachments = data.filter((e) => e.person.id === this.id); this.lackAttachments = this.dataAttachments[0]?.id ? true : false; }, saveNote(data) { @@ -446,8 +446,8 @@ export default { if (data?.id) { this.docId = data.id; this.dataIdentityDocument = { - numba: - data.series && data.numba ? data?.series + " " + data?.numba : "", + number: + data.series && data.number ? data?.series + " " + data?.number : "", issued_by_org: data.issued_by_org ? data?.issued_by_org : "", issued_by_org_code: data.issued_by_org_code ? data?.issued_by_org_code @@ -458,7 +458,7 @@ export default { } else { this.lackData = false; this.dataIdentityDocument = { - numba: "", + number: "", issued_by_org: "", issued_by_org_code: "", issued_by_date: "", @@ -469,7 +469,7 @@ export default { fetchWrapper .post(`general/identity_document/${this.docId}/update/`, { kind: "PASSPORT", - series_number: this.dataIdentityDocument.numba, + 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, @@ -565,7 +565,7 @@ export default { this.dataAttachments = [...data]; const formData = new FormData(); this.dataAttachments.forEach((e) => { - formData.append("person_id", this.id); + formData.append("person", this.id); formData.append("document", e); formData.append("title", e.name.substr(0, e.name.lastIndexOf("."))); fetchWrapper @@ -581,7 +581,7 @@ export default { postCreateAddress() { fetchWrapper .post("general/address/create/", { - person_id: this.id, + person: this.id, full_address: this.mergeFullAddress() || this.dataAddress.full_address, }) @@ -598,9 +598,9 @@ export default { postCreateIdentityDocument() { fetchWrapper .post("general/identity_document/create/", { - person_id: this.id, + person: this.id, kind: "PASSPORT", - series_number: this.dataIdentityDocument.numba, + 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, @@ -639,7 +639,7 @@ export default { } else fetchWrapper .post("general/note/create/", { - person_id: this.id, + person: this.id, title: title, description: description, }) diff --git a/src/pages/clients/components/FormCreateIdentityDocuments.vue b/src/pages/clients/components/FormCreateIdentityDocuments.vue index 459f7ee..fc93e51 100644 --- a/src/pages/clients/components/FormCreateIdentityDocuments.vue +++ b/src/pages/clients/components/FormCreateIdentityDocuments.vue @@ -41,7 +41,7 @@ base-input.input-info( disabled, v-mask="'###-###-### ##'", - v-model:value="identityDocument.snils.numba", + v-model:value="identityDocument.snils.number", placeholder="000–000–000 00", :width-input="277", :style="{backgroundColor: 'var(--bg-disable-grey-color)'}" @@ -51,7 +51,7 @@ base-input.input-info( disabled, v-mask="'############'", - v-model:value="identityDocument.inn.numba", + v-model:value="identityDocument.inn.number", placeholder="000000000000", :width-input="277", :style="{backgroundColor: 'var(--bg-disable-grey-color)'}" diff --git a/src/pages/clients/utils/tableConfig.js b/src/pages/clients/utils/tableConfig.js index 5886a35..161fe3f 100644 --- a/src/pages/clients/utils/tableConfig.js +++ b/src/pages/clients/utils/tableConfig.js @@ -108,19 +108,19 @@ export const detail = { pass: { title: "Паспортные данные", options: { - numba: "Серия и номер", + number: "Серия и номер", issued_by_org: "Выдан", issued_by_org_code: "Код подразделения", issued_by_date: "Дата выдачи", }, sharps: { - numba: "#### ######", + number: "#### ######", issued_by_org: "", issued_by_org_code: "###-###", issued_by_date: "##.##.####", }, placeholder: { - numba: "0000 000000", + number: "0000 000000", issued_by_org: "Точно как в паспорте", issued_by_org_code: "000-000", issued_by_date: "Дата", @@ -131,20 +131,20 @@ export const detail = { snils: { title: "СНИЛС", options: { - numba: "Номер", + number: "Номер", }, placeholder: { - numba: "000-000-000 00", + number: "000-000-000 00", }, width: 180, }, inn: { title: "ИНН", options: { - numba: "Номер", + number: "Номер", }, placeholder: { - numba: "000000000000", + number: "000000000000", }, width: 180, }, @@ -166,7 +166,7 @@ export const detail = { docs: { title: "Документы", placeholder: { - numba: "Редактировать данные", + number: "Редактировать данные", }, height: 280, width: 360, @@ -176,7 +176,7 @@ export const detail = { additional: { title: "Дополнительные данные", placeholder: { - numba: "Редактировать данные", + number: "Редактировать данные", }, height: 280, width: 360, diff --git a/src/pages/schedule/TheSchedule.vue b/src/pages/schedule/TheSchedule.vue index b900238..b80f6a8 100644 --- a/src/pages/schedule/TheSchedule.vue +++ b/src/pages/schedule/TheSchedule.vue @@ -161,6 +161,20 @@ export default { }) .then(() => this.fetchSchedules()); }, + postUpdateSchedule(id) { + let currentEmployee = this.clearEmployee.find((e) => e.schedules); + fetchWrapper + .post(`accounts/schedules/${id}/update/`, { + employee: currentEmployee.id, + active_flg: true, + start_date: currentEmployee.schedules.start_date, + end_date: currentEmployee.schedules.end_date, + start_time: this.times.start_time, + end_time: this.times.end_time, + status: this.buttons.find((e) => e.active).work, + }) + .then(() => this.fetchSchedules()); + }, createNewDate(e) { let schedules = { start_date: e.start, diff --git a/src/pages/schedule/components/ScheduleBody.vue b/src/pages/schedule/components/ScheduleBody.vue index 99a44a4..eaad47a 100644 --- a/src/pages/schedule/components/ScheduleBody.vue +++ b/src/pages/schedule/components/ScheduleBody.vue @@ -14,21 +14,22 @@ .text.flex.font-bold( :style="{opacity: changeOpacity(day)}" ) {{day.format("ddd")}} - .schedule-body.flex.w-full(v-for="schedule in serialized", :key="schedule.id") - .edit.flex.items-center.justify-center.h-11.w-11 - .flex.icon-edit - .name-employee.flex.justify-center.items-center.cursor-pointer - span {{trimOwnerName(schedule.last_name, schedule.first_name, schedule.patronymic)}} - .cell.flex.flex-col.items-center.justify-center.w-11.h-11.cursor-pointer( - v-for="day in result", - :key="day", - :id="schedule.id + day", - @click="choiceCell(day, schedule.id)", - :class="selectTime(day, schedule.id)", - :style="{backgroundColor: day.format('YYYY-MM-DD') === choiceDay(day, schedule.id) ? choiceColor(day) : ''}" - ) - .flex {{day.format("YYYY-MM-DD") === choiceDay(day, schedule.id) ? choiceWorks(day) : ''}} - .schedule-body.flex.w-full(v-if="clearEmployee") + .flex.w-full.flex-col(:style="{overflowY: 'scroll', maxHeight: '351px'}") + .schedule-body.flex.w-full(v-for="schedule in serialized", :key="schedule.id") + .edit.flex.items-center.justify-center.h-11.w-11 + .flex.icon-edit + .name-employee.flex.justify-center.items-center.cursor-pointer + span {{trimOwnerName(schedule.last_name, schedule.first_name, schedule.patronymic)}} + .cell.flex.flex-col.items-center.justify-center.w-11.h-11.cursor-pointer( + v-for="day in result", + :key="day", + :id="schedule.id + day", + @click="choiceCell(day, schedule.id)", + :class="selectTime(day, schedule.id)", + :style="{backgroundColor: choiceDay(day, schedule.id) ? choiceColor(day) : ''}" + ) + .flex {{choiceDay(day, schedule.id) ? choiceWorks(day) : ''}} + .schedule-body.flex.w-full(v-if="clearEmployee", :style="{height: '44px'}") .edit.flex.items-center.justify-center.h-11.w-11(:style="{borderBottom: 'none'}") .flex.icon-edit(v-if="currentEmployee.label") //- base-button( @@ -151,7 +152,8 @@ export default { this.dateInterval.id = id; } else if (time.isAfter(this.dateInterval.start)) { this.dateInterval.end = formatTime; - this.$emit("new-date", this.dateInterval); + if (this.currentEmployee.label) + this.$emit("new-date", this.dateInterval); } else this.dateInterval.start = formatTime; }, selectTime(day, id) { @@ -185,12 +187,16 @@ export default { choiceWorks(day) { let currentDay = day.format("YYYY-MM-DD"); let res = this.scheduleList.find((e) => e.date === currentDay).status; + // if (this.activeButton) { + // return this.buttons.find((e) => e.work === this.activeButton?.text[1]) + // ?.text[1]; + // } return this.buttons.find((e) => e.work === res).text[1]; }, choiceColor(day) { let currentDay = day.format("YYYY-MM-DD"); let res = this.scheduleList.find((e) => e.date === currentDay).status; - return this.buttons.find((e) => e.work === res).color; + if (res) return this.buttons.find((e) => e.work === res).color; }, changeDays() { this.days = moment().daysInMonth(); @@ -280,15 +286,15 @@ export default { .status background-color: var(--bg-color-status) -.status::before +.status::after content: var(--text-status) .from-date - background: limegreen + background-color: limegreen !important .to-date - background: red + background-color: red !important .middle-dates - background: yellow + background-color: yellow !important