From 3773c15ad59385c2200b1f9e6719c6bb8bdce7bb Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Thu, 22 Dec 2022 18:18:43 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20=D0=BD=D0=B0=20=D0=B3=D1=80=D0=B0=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=B5,=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D1=82=D0=B8=D0=BB=D0=B8,=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D1=8B=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar/components/CalendarSidebar.vue | 16 ++--- src/pages/login/TheLogin.vue | 47 +++++--------- src/pages/schedule/TheSchedule.vue | 60 ++++++++++++++--- src/pages/schedule/components/ScheduleBar.vue | 53 ++++++++++----- .../schedule/components/ScheduleBody.vue | 64 ++++++++++--------- src/shared/fetchWrapper.js | 9 +-- 6 files changed, 145 insertions(+), 104 deletions(-) diff --git a/src/pages/calendar/components/CalendarSidebar.vue b/src/pages/calendar/components/CalendarSidebar.vue index 8f785f0..73089a5 100644 --- a/src/pages/calendar/components/CalendarSidebar.vue +++ b/src/pages/calendar/components/CalendarSidebar.vue @@ -21,14 +21,14 @@ ) Создать событие calendar-sidebar-event(:is-open="isOpen", :event-statuses="eventStatuses") calendar-sidebar-teammate(:team-data="teamData", :is-open="isOpen", :url="url") - .button-wrapper.flex.justify-center.mb-23px - base-button( - left-icon="icon-long-arrow", - rounded, :size="40", - :icon-left-size="18", - secondary, - :style="{ transform: `rotate(${turnButton})`}", - @click="changeSize" + //- .button-wrapper.flex.justify-center.mb-23px + //- base-button( + //- left-icon="icon-long-arrow", + //- rounded, :size="40", + //- :icon-left-size="18", + //- secondary, + //- :style="{ transform: `rotate(${turnButton})`}", + //- @click="changeSize" ) diff --git a/src/pages/login/TheLogin.vue b/src/pages/login/TheLogin.vue index a079a85..335bb26 100644 --- a/src/pages/login/TheLogin.vue +++ b/src/pages/login/TheLogin.vue @@ -36,6 +36,7 @@ @@ -60,7 +74,7 @@ export default { border-radius: 4px .time-wrapper - width: 350px + width: 420px height: 102px border: 1.5px solid var(--border-light-grey-color-1) border-radius: 4px @@ -128,4 +142,9 @@ export default { .graph-template width: 218px height: 40px + +.select + height: 40px + border: 1.5px solid var(--border-light-grey-color) + border-radius: 4px diff --git a/src/pages/schedule/components/ScheduleBody.vue b/src/pages/schedule/components/ScheduleBody.vue index c4e4461..8c7c824 100644 --- a/src/pages/schedule/components/ScheduleBody.vue +++ b/src/pages/schedule/components/ScheduleBody.vue @@ -14,40 +14,40 @@ .text.flex.font-bold( :style="{opacity: day.format('ddd') === 'сб' || day.format('ddd') === 'вс' ? '0.6' : '1'}" ) {{day.format("ddd")}} - .schedule-body.flex.w-full(v-if="this.scheduleList[0]?.id") + .schedule-body.flex.w-full(v-for="schedule in serialized") .edit.flex.items-center.justify-center.h-9.w-9 .flex.icon-edit .name-employee.flex.justify-center.items-center.cursor-pointer(@click="openSelect") - span {{trimOwnerName(this.scheduleList[0]?.employee.last_name, this.scheduleList[0]?.employee.first_name, this.scheduleList[0]?.employee.patronymic)}} + span {{trimOwnerName(schedule.last_name, schedule.first_name, schedule.patronymic)}} .flex .cell.flex.flex-col.items-center.justify-center.w-11( v-for="day in result", - :style="{backgroundColor: day.format('YYYY-MM-DD') === choiceDay(day.format('YYYY-MM-DD')) ? choiceColor(day.format('YYYY-MM-DD')) : ''}" + :style="{backgroundColor: day.format('YYYY-MM-DD') === choiceDay(day.format('YYYY-MM-DD'), schedule.id) ? choiceColor(day.format('YYYY-MM-DD')) : ''}" ) - .flex {{day.format("YYYY-MM-DD") === choiceDay(day.format("YYYY-MM-DD")) ? choiceWorks(day.format('YYYY-MM-DD')) : ''}} - .schedule-body.flex.w-full - .edit.flex.items-center.justify-center.h-9.w-9 - .flex.items-center.gap-x-8 - base-button( - confirm, - rounded, - outlined, - :size="20", - @click="saveEmployee", - v-if="currentEmployee.label" - ) - .icon-ok.text-xsm(class="pt-[3px]") - .name.flex.justify-center.items-center.cursor-pointer( - v-if="currentEmployee.label", - @click="openSelect" - ) - span {{currentEmployee.label}} - .name.flex(v-if="!currentEmployee.label") - base-custom-select( - :items="ownersList", - v-model="currentEmployee", - placeholder="Добавить сотрудника", - :style="{border: 'none'}" + .flex {{day.format("YYYY-MM-DD") === choiceDay(day.format("YYYY-MM-DD"), schedule.id) ? choiceWorks(day.format('YYYY-MM-DD')) : ''}} + //- .schedule-body.flex.w-full + //- .edit.flex.items-center.justify-center.h-9.w-9 + //- .flex.items-center.gap-x-8 + //- base-button( + //- confirm, + //- rounded, + //- outlined, + //- :size="20", + //- @click="saveEmployee", + //- v-if="currentEmployee.label" + //- ) + //- .icon-ok.text-xsm(class="pt-[3px]") + //- .name.flex.justify-center.items-center.cursor-pointer( + //- v-if="currentEmployee.label", + //- @click="openSelect" + //- ) + //- span {{currentEmployee.label}} + //- .name.flex(v-if="!currentEmployee.label") + //- base-custom-select( + //- :items="ownersList", + //- v-model="currentEmployee", + //- placeholder="Добавить сотрудника", + //- :style="{border: 'none'}" ) @@ -66,8 +66,8 @@ export default { return []; }, }, - schedulesEmployee: Function, scheduleList: Array, + serialized: Array, }, data() { return { @@ -85,6 +85,7 @@ export default { { work: "VACATION", color: "#D7D9FF", text: "О" }, { work: "DAY_OFF", color: "#9294A7", text: "В" }, ], + curWork: "", }; }, computed: { @@ -108,7 +109,6 @@ export default { }, methods: { saveEmployee() { - this.schedulesEmployee(this.currentEmployee.id); this.currentEmployee.label = ""; this.currentEmployee.id = null; }, @@ -140,8 +140,10 @@ export default { this.employee.push(this.employeeList[index]); } }, - choiceDay(day) { - return this.scheduleList.find((e) => day === e.date)?.date; + choiceDay(day, employee) { + return this.scheduleList.find( + (e) => day === e.date && e.employee.id === employee + )?.date; }, }, diff --git a/src/shared/fetchWrapper.js b/src/shared/fetchWrapper.js index 0709183..ec7b2c0 100644 --- a/src/shared/fetchWrapper.js +++ b/src/shared/fetchWrapper.js @@ -5,11 +5,6 @@ function prepareUrl(url) { return `https://astra-dev.dopcore.com/api/${url}`; } -function prepareUrlApi(url) { - if (url.startsWith("http")) return url; - return `https://astra-dev.dopcore.com/${url}`; -} - function handleRequest(method, url, headers, attempts, body, type) { return new Promise((resolve, reject) => { (function internalRequest() { @@ -72,9 +67,7 @@ function request(method, url, headers = {}, body, type = "") { body: JSON.stringify(body), }; } - if (type === "api") { - return fetch(prepareUrlApi(url), requestOptions); - } else return fetch(prepareUrl(url), requestOptions); + return fetch(prepareUrl(url), requestOptions); } function get(url, type, headers, attempts = 3) {