From 7d5341e61a6c153b91ad7ff29cfd5d4e4f729dd1 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Tue, 24 Jan 2023 12:09:19 +0300 Subject: [PATCH 1/2] =?UTF-8?q?[WIP]=20=D0=97=D0=B0=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D0=B5=D0=BB=D0=B5=D0=BA=D1=82=D1=8B,=20?= =?UTF-8?q?=D1=88=D1=80=D0=B8=D1=84=D1=82=20=D0=B8=D0=BD=D0=BF=D1=83=D1=82?= =?UTF-8?q?=D0=B0,=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BC=D0=B5=D0=BD=20=D0=BD=D0=B0=20=D1=80=D0=B0?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/BaseInput.vue | 5 ++++- .../components/FormsAgreementCreate/AgreementCommon.vue | 8 ++++---- .../components/FormsAgreementCreate/AgreementPerson.vue | 6 ++---- .../components/FormsAgreementCreate/AgreementServices.vue | 8 ++++---- src/pages/schedule/components/ScheduleTableBody.vue | 3 +++ src/pages/schedule/components/ScheduleTableSelect.vue | 3 +++ 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/components/base/BaseInput.vue b/src/components/base/BaseInput.vue index 2ceda86..028fe35 100644 --- a/src/components/base/BaseInput.vue +++ b/src/components/base/BaseInput.vue @@ -2,7 +2,7 @@ base-input-container.gap-y-2(:label="label") q-input( v-model="value", - :class="{'circle': circle}", + :class="{'circle': circle, 'font-input': true}", :input-style="{ color: textColor, width: width + 'px' }", :borderless="borderless", :placeholder="placeholder", @@ -85,6 +85,9 @@ export default { diff --git a/src/pages/schedule/components/ScheduleTableSelect.vue b/src/pages/schedule/components/ScheduleTableSelect.vue index c15d272..445fd00 100644 --- a/src/pages/schedule/components/ScheduleTableSelect.vue +++ b/src/pages/schedule/components/ScheduleTableSelect.vue @@ -110,4 +110,7 @@ export default { .set-template background-color: var(--bg-event-orange-color) !important + +.set-template::after + content: var(--text-status) From a3eb8606f5f3b890ca5a6dfe3673863e07762548 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Tue, 24 Jan 2023 16:50:09 +0300 Subject: [PATCH 2/2] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D1=81=D0=BC=D0=B5=D0=BD,=20=D1=84=D0=B8=D0=BA=D1=81=20=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/TheLogin.vue | 3 - src/pages/schedule/TheSchedule.vue | 81 ++++++++++++++----- .../schedule/components/FormChangeShift.vue | 63 ++++++++++++--- src/pages/schedule/components/ScheduleBar.vue | 2 +- .../schedule/components/ScheduleHeader.vue | 22 +---- .../schedule/components/ScheduleTable.vue | 27 ++++--- .../schedule/components/ScheduleTableBody.vue | 33 +++++++- .../components/ScheduleTableSelect.vue | 6 +- 8 files changed, 166 insertions(+), 71 deletions(-) diff --git a/src/pages/login/TheLogin.vue b/src/pages/login/TheLogin.vue index 812b7fe..fa0380b 100644 --- a/src/pages/login/TheLogin.vue +++ b/src/pages/login/TheLogin.vue @@ -141,9 +141,6 @@ export default { letter-spacing: 0.02em color: var(--font-dark-blue-color) -.input-wrapper - border-width: 1.5px - .right-col height: 100% background-color: var(--font-dark-blue-color) diff --git a/src/pages/schedule/TheSchedule.vue b/src/pages/schedule/TheSchedule.vue index 022b40b..53f8635 100644 --- a/src/pages/schedule/TheSchedule.vue +++ b/src/pages/schedule/TheSchedule.vue @@ -9,9 +9,8 @@ .relative.flex.flex-col.px-6.py-6.h-full.w-full.gap-y-5(v-else) schedule-header( :start-month="startMonth", - :times-shift="timesShift", :change-show-time="changeShowTime", - :show-time="showTime" + :show-time="showTime", @switch-previous-month="switchPreviousMonth", @switch-next-month="switchNextMonth" ) @@ -21,11 +20,15 @@ :serialized="serialized", :buttons="buttons", :start-month="startMonth", - :clear-employee="clearEmployee", + :employees="employees", :show-time="showTime", :clear-select="clearSelect", :select-employee="selectEmployee", + :replacement-sheet="replacementSheet", :template="template", + :trim-owner-name="trimOwnerName", + :open-form="openForm", + :change-shift="postUpdateSchedule", @schedule-employee="createScheduleEmployee", @schedules="distributeRequest" ) @@ -62,14 +65,20 @@ export default { }, ], scheduleList: [], - clearEmployee: [], + employees: [], serialized: [], selectEmployee: { label: "", id: null, }, times: { start_time: "", end_time: "" }, - timesShift: { start_time: "", end_time: "" }, + replacementSheet: { + currentEmployee: "", + replacementEmployee: "", + date: null, + start_time: "", + end_time: "", + }, buttons: [ { class: "button-work", @@ -100,6 +109,7 @@ export default { startMonth: moment().startOf("month"), showTime: false, schedulesDate: {}, + currenSchedule: null, }; }, computed: { @@ -111,9 +121,22 @@ export default { }, }, methods: { + openForm(e) { + this.currenSchedule = e; + this.replacementSheet.currentEmployee = this.trimOwnerName( + e.last_name, + e.first_name, + e.patronymic + ); + }, changeShowTime() { this.showTime = !this.showTime; }, + trimOwnerName(lastName, firstName, patronymic) { + let checkedFirstName = firstName !== null ? firstName[0] + "." : ""; + let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : ""; + return `${lastName} ${checkedFirstName}${checkedPatronymic}`; + }, clearSelect(employee) { if (employee) { employee.label = ""; @@ -184,8 +207,8 @@ export default { this.filterEmployee(); }, filterEmployee() { - this.clearEmployee = []; - this.clearEmployee = this.employeeList.filter((item) => + this.employees = []; + this.employees = this.employeeList.filter((item) => this.serialized.every((el) => el.id !== item.id) ); }, @@ -225,18 +248,34 @@ export default { } }, postUpdateSchedule() { - let ids = ""; - this.insideSchedules.forEach((e) => (ids += e.id + ",")); - ids = ids.slice(0, -1); - fetchWrapper - .post(`accounts/schedules/${ids}/update/`, { - employee: this.insideSchedules[0].employeeId, - active_flg: true, - start_time: this.times.start_time, - end_time: this.times.end_time, - status: this.buttons.find((e) => e.active).work, - }) - .then(() => this.fetchSchedules()); + if (this.replacementSheet.date) { + let scheduleList = this.currenSchedule.schedules.find( + (el) => + el.date === moment(this.replacementSheet.date).format("YYYY-MM-DD") + ); + fetchWrapper + .post(`accounts/schedules/${scheduleList.id}/update/`, { + employee: this.replacementSheet.replacementEmployee.id, + active_flg: true, + start_time: this.replacementSheet.start_time, + end_time: this.replacementSheet.end_time, + status: scheduleList.status, + }) + .then(() => this.fetchSchedules()); + } else { + let ids = ""; + this.insideSchedules.forEach((e) => (ids += e.id + ",")); + ids = ids.slice(0, -1); + fetchWrapper + .post(`accounts/schedules/${ids}/update/`, { + employee: this.insideSchedules[0].employeeId, + active_flg: true, + start_time: this.times.start_time, + end_time: this.times.end_time, + status: this.buttons.find((e) => e.active).work, + }) + .then(() => this.fetchSchedules()); + } }, createScheduleEmployee(e, id) { this.schedulesDate = { @@ -271,8 +310,8 @@ export default { (minute < 10 ? "0" + minute.toString() : minute); this.times.start_time = localDatetime; this.times.end_time = localDatetime; - this.timesShift.start_time = localDatetime; - this.timesShift.end_time = localDatetime; + this.replacementSheet.start_time = localDatetime; + this.replacementSheet.end_time = localDatetime; }, }, watch: { diff --git a/src/pages/schedule/components/FormChangeShift.vue b/src/pages/schedule/components/FormChangeShift.vue index bae050d..40d997f 100644 --- a/src/pages/schedule/components/FormChangeShift.vue +++ b/src/pages/schedule/components/FormChangeShift.vue @@ -5,14 +5,22 @@ .flex.pt-2 .icon-cancel.close-icon.tesxt-xs.cursor-pointer(@click="closeForm") .flex.flex-col.gap-y-6 - base-input(label="Дата", type="date", outlined) - base-select( - v-model="currentEmployee", + base-input( + label="Дата", + type="date", + v-model="replacementSheet.date", + outlined + ) + base-input.input(, + type="text" + v-model="replacementSheet.currentEmployee", label="Текущий сотрудник", - placeholder="Выберите сотрудника" + outlined, + disabled ) base-select( - v-model="currentEmployee", + :items="ownersList", + v-model="replacementSheet.replacementEmployee", label="Замена сотрудника", placeholder="Выберите сотрудника" ) @@ -20,14 +28,14 @@ base-input( type="time", label="Начало", - v-model="timesShift.start_time", + v-model="replacementSheet.start_time", outlined ) .flex.items-center.mt-4 — base-input( type="time", label="Конец", - v-model="timesShift.end_time", + v-model="replacementSheet.end_time", outlined ) .flex.justify-center @@ -36,6 +44,7 @@ color="primary", padding="8px 24px", no-caps + @click="changeShift(); closeForm()" ) @@ -48,13 +57,41 @@ export default { components: { BaseSelect, BaseInput }, emits: ["update:model-value"], props: { - timesShift: Object, + employees: Array, + serialized: Array, + replacementSheet: Object, + trimOwnerName: Function, + changeShift: Function, modelValue: Boolean, }, - data() { - return { - currentEmployee: { label: "", id: null }, - }; + computed: { + ownersList() { + if (this.employees) { + let filteredArray = []; + this.employees.forEach((elem) => { + filteredArray.push({ + id: elem.id, + label: this.trimOwnerName( + elem.last_name, + elem.first_name, + elem.patronymic + ), + }); + }); + this.serialized.forEach((elem) => { + filteredArray.push({ + id: elem.id, + label: this.trimOwnerName( + elem.last_name, + elem.first_name, + elem.patronymic + ), + }); + }); + return filteredArray; + } + return []; + }, }, methods: { closeForm() { @@ -69,7 +106,7 @@ export default { height: fit-content width: 534px background-color: var(--default-white) - box-shadow: var(--default-shadow) + box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.05) border-radius: 4px z-index: 5 diff --git a/src/pages/schedule/components/ScheduleBar.vue b/src/pages/schedule/components/ScheduleBar.vue index d34b3ed..97960d5 100644 --- a/src/pages/schedule/components/ScheduleBar.vue +++ b/src/pages/schedule/components/ScheduleBar.vue @@ -26,7 +26,7 @@ :label="item.name", :class="item.class", text-color="white", - :style="{border: item.active ? '1.5px solid #5E5E5E' : 'none'}", + no-caps, style="width: 200px" ) diff --git a/src/pages/schedule/components/ScheduleHeader.vue b/src/pages/schedule/components/ScheduleHeader.vue index 3fb7e66..3e543b2 100644 --- a/src/pages/schedule/components/ScheduleHeader.vue +++ b/src/pages/schedule/components/ScheduleHeader.vue @@ -34,17 +34,6 @@ style="width: 174px" @click="changeShowTime", ) - q-btn( - label="Замена смен", - color="primary", - no-caps, - padding="8px 24px", - ) - q-menu(v-model="showForm") - form-change-shift( - v-model="showForm", - :times-shift="timesShift" - )