[WIP] Добавил отображение сотрудников на графике, поправил стили, изменил запросы логина

This commit is contained in:
megavrilinvv
2022-12-22 18:18:43 +03:00
parent 838266c0e9
commit 3773c15ad5
6 changed files with 145 additions and 104 deletions

View File

@@ -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'}"
)
</template>
@@ -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;
},
},