diff --git a/src/pages/schedule/components/ScheduleBody.vue b/src/pages/schedule/components/ScheduleBody.vue index 7e6668f..c4e4461 100644 --- a/src/pages/schedule/components/ScheduleBody.vue +++ b/src/pages/schedule/components/ScheduleBody.vue @@ -19,12 +19,12 @@ .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)}} - .flex(v-for="day in result") + .flex .cell.flex.flex-col.items-center.justify-center.w-11( - v-for="item in scheduleList", - :style="{backgroundColor: day.format('YYYY-MM-DD') === item.date ? choiceColor(item.status) : ''}" + v-for="day in result", + :style="{backgroundColor: day.format('YYYY-MM-DD') === choiceDay(day.format('YYYY-MM-DD')) ? choiceColor(day.format('YYYY-MM-DD')) : ''}" ) - .flex {{day.format("YYYY-MM-DD") === item.date ? choiceWorks(item.status) : ''}} + .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 @@ -112,11 +112,13 @@ export default { this.currentEmployee.label = ""; this.currentEmployee.id = null; }, - choiceWorks(work) { - return this.works.find((e) => e.work === work).text; + choiceWorks(day) { + let a = this.scheduleList.find((e) => e.date === day).status; + return this.works.find((e) => e.work === a).text; }, - choiceColor(work) { - return this.works.find((e) => e.work === work).color; + choiceColor(day) { + let a = this.scheduleList.find((e) => e.date === day).status; + return this.works.find((e) => e.work === a).color; }, changeDays() { this.days = moment().daysInMonth(); @@ -138,6 +140,9 @@ export default { this.employee.push(this.employeeList[index]); } }, + choiceDay(day) { + return this.scheduleList.find((e) => day === e.date)?.date; + }, }, mounted() {