Merge branch 'master' into UC-22

This commit is contained in:
Алексей Дёмин
2022-10-26 16:14:46 +03:00
committed by GitHub
15 changed files with 336 additions and 220 deletions

144
server.js
View File

@@ -459,8 +459,8 @@ export function clientsServer() {
results: [ results: [
{ {
id: "6faa6bb6-1de6-422c-a401-1b35cd455303", id: "6faa6bb6-1de6-422c-a401-1b35cd455303",
start: "2022-10-24T20:23:49Z", start: "2022-10-25T11:15:49Z",
end: "2022-10-24T21:23:53Z", end: "2022-10-25T12:00:53Z",
kind: "call", kind: "call",
subkind: null, subkind: null,
description: "", description: "",
@@ -486,7 +486,7 @@ export function clientsServer() {
first_name: "Ольга", first_name: "Ольга",
patronymic: "Александровна", patronymic: "Александровна",
}, },
role: null, role: "owner",
}, },
{ {
id: "f941a0c6-c750-4f79-92c0-d7a19354e422", id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
@@ -496,14 +496,14 @@ export function clientsServer() {
first_name: "Егор", first_name: "Егор",
patronymic: "Сергеевич", patronymic: "Сергеевич",
}, },
role: "owner", role: null,
}, },
], ],
}, },
{ {
id: "6faa6bb6-1de6-422c-a401-1b35cd455303", id: "6faa6bb6-1de6-422c-a401-1b35cd455303",
start: "2022-10-24T15:23:49Z", start: "2022-10-25T13:00:49Z",
end: "2022-10-24T16:23:53Z", end: "2022-10-25T13:30:53Z",
kind: "call", kind: "call",
subkind: null, subkind: null,
description: "", description: "",
@@ -543,63 +543,10 @@ export function clientsServer() {
}, },
], ],
}, },
{
id: "7faa7bb7-2de6-422c-a401-1b35cd455303",
start: "2022-10-23T10:00:00Z",
end: "2022-10-23T11:10:00Z",
kind: "call",
subkind: null,
description: "",
location: null,
members: [
{
id: "b0509f9a-e824-4bb3-a260-2b32dae9bc81",
person: {
id: "14ff401c-2b7b-4d9a-9159-720c74d8b23c",
last_name: "Гагарин",
first_name: "Юрий",
patronymic: "Алексеевич",
},
role: null,
},
{
id: "a9239f9a-e824-4bb3-a260-2b32dae9bc76",
person: {
id: "15ff465c-2b7b-4d9a-9159-720c74d8b56d",
last_name: "Елесеевская",
first_name: "Татьяна",
patronymic: "Ивановна",
},
role: "primary",
},
],
employees: [
{
id: "f941a0c6-c734-4f79-92c2-d7a5674459e422",
employee: {
id: "db831a15-e876-481f-a658-6325de7c311e",
last_name: "Константинопольская",
first_name: "Юлия",
patronymic: "Викторовна",
},
role: null,
},
{
id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
employee: {
id: "db541a67-e836-481f-a653-6325de7c567e",
last_name: "Захарова",
first_name: "Ольга",
patronymic: "Александровна",
},
role: "owner",
},
],
},
{ {
id: "2faa7bb2-2de6-422c-a401-1b35cd455223", id: "2faa7bb2-2de6-422c-a401-1b35cd455223",
start: "2022-10-24T10:00:00Z", start: "2022-10-25T15:00:00Z",
end: "2022-10-24T11:10:00Z", end: "2022-10-25T16:10:00Z",
kind: "call", kind: "call",
subkind: null, subkind: null,
description: "", description: "",
@@ -640,9 +587,9 @@ export function clientsServer() {
], ],
}, },
{ {
id: "2faa7bb2-2de6-422c-a401-1b35cd455223", id: "2faa5ff2-2de6-422c-a401-1b35cd455223",
start: "2022-10-24T10:00:00Z", start: "2022-10-25T17:10:00Z",
end: "2022-10-24T11:10:00Z", end: "2022-10-25T18:00:00Z",
kind: "call", kind: "call",
subkind: null, subkind: null,
description: "", description: "",
@@ -661,25 +608,68 @@ export function clientsServer() {
], ],
employees: [ employees: [
{ {
id: "f451a0c3-c734-4f73-91c2-d7a5674459e422", id: "f941a0c6-c734-4f79-92c2-d7a5674459e422",
employee: { employee: {
id: "dv841a15-e867-331f-a658-6325de7c311e", id: "db831a15-e876-481f-a658-6325de7c311e",
last_name: "Константинопольская",
first_name: "Юлия",
patronymic: "Викторовна",
},
role: null,
},
{
id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
employee: {
id: "db541a67-e836-481f-a653-6325de7c567e",
last_name: "Захарова",
first_name: "Ольга",
patronymic: "Александровна",
},
role: "owner",
},
],
},
{
id: "2faa5ff2-2de6-422c-a401-1b35cd455223",
start: "2022-10-26T20:10:00Z",
end: "2022-10-26T21:00:00Z",
kind: "call",
subkind: null,
description: "",
location: null,
members: [
{
id: "a9239f9a-e824-4bb3-a260-2b32dae9bc76",
person: {
id: "15ff465c-2b7b-4d9a-9159-720c74d8b56d",
last_name: "Елесеевская",
first_name: "Татьяна",
patronymic: "Ивановна",
},
role: null,
},
],
employees: [
{
id: "f941a0c6-c734-4f79-92c2-d7a5674459e422",
employee: {
id: "db831a15-e876-481f-a658-6325de7c311e",
last_name: "Константинопольская",
first_name: "Юлия",
patronymic: "Викторовна",
},
role: null,
},
{
id: "f541a0c7-c750-4f79-92c0-d7a19354e422",
employee: {
id: "db938a67-e756-481f-a653-6325de7c567e",
last_name: "Коломойцев", last_name: "Коломойцев",
first_name: "Илья", first_name: "Илья",
patronymic: "Петрович", patronymic: "Константинович",
}, },
role: "owner", role: "owner",
}, },
{
id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
employee: {
id: "db541a67-e836-481f-a653-6325de7c567e",
last_name: "Захарова",
first_name: "Ольга",
patronymic: "Александровна",
},
role: null,
},
], ],
}, },
], ],

View File

@@ -28,3 +28,4 @@
--btn-green-color: rgba(60, 217, 75, 1) --btn-green-color: rgba(60, 217, 75, 1)
--btn-light-green-color: rgba(60, 217, 75, 0.2) --btn-light-green-color: rgba(60, 217, 75, 0.2)
--border-light-grey-color-1: rgba(211, 212, 220, 0.5) --border-light-grey-color-1: rgba(211, 212, 220, 0.5)
--bg-white-color-0: rgba(255, 255, 255, 0.3)

View File

@@ -4,15 +4,15 @@
img.img-wrapper.mr-2(:src="info.avatarSrc" alt="Charge person avatar") img.img-wrapper.mr-2(:src="info.avatarSrc" alt="Charge person avatar")
span.font-bold.text-sm.mr-6px {{ info.name }} span.font-bold.text-sm.mr-6px {{ info.name }}
.dot.mr-4 .dot.mr-4
.icon-wrapper.icon-down-arrow.flex.items-center.justify-center.text-xxs(@click="changeState") .icon-wrapper.icon-down-arrow.flex.items-center.justify-center.text-xxs.cursor-pointer(@click="changeState")
.options.flex.flex-col.p-4.mt-1.font-medium.text-sm.gap-y-3(v-if="isOpen") .options.flex.flex-col.p-4.mt-1.font-medium.text-sm.gap-y-3(v-if="isOpen")
.flex.items-center .flex.items-center.cursor-pointer
.options-icon-wrapper.icon-star-off.flex.items-center.justify-center.text-base.mr-2 .options-icon-wrapper.icon-star-off.flex.items-center.justify-center.text-base.mr-2
span Снять с ведения span Снять с ведения
.flex.items-center .flex.items-center.cursor-pointer
.options-icon-wrapper.icon-table.flex.items-center.justify-center.text-lg.mr-2.pb-px .options-icon-wrapper.icon-table.flex.items-center.justify-center.text-lg.mr-2.pb-px
span Перейти в таблицу span Перейти в таблицу
.flex.items-center .flex.items-center.cursor-pointer
.options-icon-wrapper.flex.items-center.justify-center.icon-user-data.text-base.mr-2 .options-icon-wrapper.flex.items-center.justify-center.icon-user-data.text-base.mr-2
span Данные span Данные
</template> </template>

View File

@@ -48,7 +48,7 @@ export default {
height: 56px height: 56px
background-color: var(--default-white) background-color: var(--default-white)
position: relative position: relative
z-index: 2 z-index: 11
.logo-img .logo-img
height: 32px height: 32px

View File

@@ -24,8 +24,6 @@ export default {
default: "Поиск", default: "Поиск",
}, },
widthInput: Number, widthInput: Number,
backgroundInput: String,
fontSizeInput: String,
}, },
}; };
</script> </script>

View File

@@ -1,8 +1,8 @@
<template lang="pug"> <template lang="pug">
button.button.flex.w-fit.gap-x-2.text-base.pt-3.pb-2.px-6 button.button.flex.w-fit.gap-x-2.text-base.pt-3.pb-2.px-6
.flex.text-xs.w-fit.pt-1(v-if="withIcon") .flex.text-xs.w-fit.pt-1(v-if="withIcon" :class="iconPosition")
span.icon-plus span.icon-plus(:style="{fontSize:iconSize + 'px'}")
span.text-base.font-semibold {{text}} span.text-base.font-semibold(:class="textStyled") {{text}}
</template> </template>
<script> <script>
@@ -15,6 +15,15 @@ export default {
withIcon: { withIcon: {
default: false, default: false,
}, },
iconPosition: {
default: "left",
},
iconSize: {
default: 13,
},
textStyled: {
default: "normal",
},
}, },
}; };
</script> </script>
@@ -30,4 +39,16 @@ export default {
&:active &:active
opacity: 1 opacity: 1
background-color: var(--font-dark-blue-color) background-color: var(--font-dark-blue-color)
.left
order: -1
.right
order: 1
padding-top: 1px
border-left: 1px solid var(--bg-white-color-0)
padding-left: 14px
height: 24px
align-items: center
.createEvent
font-weight: 500
padding-right: 2px
</style> </style>

View File

@@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
.calendar-container.flex .calendar-container.flex
calendar-sidebar(@width="changeWidth" :team="team") calendar-sidebar(@width="changeWidth" :team-data="teamData")
calendar-schedule( calendar-schedule(
:current-date="currentDate" :current-date="currentDate"
:time-information="timeInformation" :time-information="timeInformation"
@@ -16,7 +16,6 @@
import * as moment from "moment/moment"; import * as moment from "moment/moment";
import CalendarSchedule from "./components/CalendarSchedule.vue"; import CalendarSchedule from "./components/CalendarSchedule.vue";
import CalendarSidebar from "./components/CalendarSidebar.vue"; import CalendarSidebar from "./components/CalendarSidebar.vue";
import img from "../../assets/images/team-member.svg";
export default { export default {
name: "TheCalendar", name: "TheCalendar",
components: { CalendarSchedule, CalendarSidebar }, components: { CalendarSchedule, CalendarSidebar },
@@ -26,40 +25,11 @@ export default {
calendarLayout: "", calendarLayout: "",
currentDate: moment(), currentDate: moment(),
timeInformation: { timeInformation: {
dayStartTime: "8:00", dayStartTime: "0:00",
dayEndTime: "18:00", dayEndTime: "20:00",
}, },
eventsData: [], eventsData: [],
team: [ teamData: [],
{
id: 1,
last_name: "Гагарин",
first_name: "Юрий",
patronymic: "Алексеевич",
avatar: img,
},
{
id: 2,
last_name: "Константинопольская",
first_name: "Юлия",
patronymic: "Витальевна",
avatar: img,
},
{
id: 3,
last_name: "Коломойцев",
first_name: "Игорь",
patronymic: "Константинович",
avatar: img,
},
{
id: 4,
last_name: "Зайцев",
first_name: "Валерий",
patronymic: "Сергеевич",
avatar: img,
},
],
}; };
}, },
methods: { methods: {
@@ -75,10 +45,16 @@ export default {
saveEventsData(res) { saveEventsData(res) {
this.eventsData = res.results; this.eventsData = res.results;
}, },
saveTeamData(res) {
this.teamData = res.results;
},
fetchEventsData() { fetchEventsData() {
fetch("/registry/event/") fetch("/registry/event/")
.then((res) => res.json()) .then((res) => res.json())
.then((res) => this.saveEventsData(res)); .then((res) => this.saveEventsData(res));
fetch("http://45.84.227.122:8080/general/employee/")
.then((res) => res.json())
.then((res) => this.saveTeamData(res));
}, },
changeWidth(value) { changeWidth(value) {
this.sidebarWidth = value; this.sidebarWidth = value;

View File

@@ -1,22 +1,25 @@
<template lang="pug"> <template lang="pug">
.calendar-background-wrapper.flex.flex-col( .calendar-background-wrapper.flex.flex-col(
ref="backgroundWrapper" ref="backgroundWrapper"
:class="scrollPresence" :class="horizontalScrollPresence"
) )
.header-wrapper
.header(:style="backgroundExtendedWidth")
calendar-column( calendar-column(
v-for="(owner, index) in filteredOwners" v-for="(owner, index) in filteredOwners"
:key="owner.id" :key="owner.id"
:owner-data="owner" :owner-data="owner"
:style="calculateColumnPosition(index)" :style="calculateColumnPosition(index)"
:day-events="filterEventsByOwner(owner)" :day-events="filterEventsByOwner(owner)"
:day-start-time="dayStartTime"
:day-end-time="dayEndTime"
) )
.header(:style="backgroundExtendedWidth")
.body.flex.flex-col( .body.flex.flex-col(
:style="backgroundExtendedWidth" :style="backgroundExtendedWidth"
) )
.line-wrapper .line-wrapper
.line.flex.items-center( .line.flex.items-center(
v-for="hour in hoursArray" v-for="hour in timeCoil"
:key="hour" :key="hour"
) )
.middle-line .middle-line
@@ -28,10 +31,13 @@ export default {
name: "CalendarBackground", name: "CalendarBackground",
components: { CalendarColumn }, components: { CalendarColumn },
props: { props: {
hoursArray: Array, timeCoil: Array,
filteredOwners: Array,
eventsData: Array, eventsData: Array,
currentDate: Object, currentDate: Object,
sidebarWidth: String, sidebarWidth: String,
dayStartTime: Number,
dayEndTime: Number,
}, },
data() { data() {
return { return {
@@ -56,43 +62,7 @@ export default {
}; };
}, },
backgroundHeight() { backgroundHeight() {
return (this.hoursArray.length - 1) * this.pixelsPerHour + 48; return (this.timeCoil.length - 1) * this.pixelsPerHour + 48;
},
scrollPresence() {
return {
scroll: this.ownersArrayLength > 3,
};
},
filteredOwners() {
let filteredArray = [];
let ownerAbsence = {
id: null,
last_name: null,
first_name: null,
patronymic: null,
};
this.eventsData.forEach(({ employees }) => {
let findedElement = employees.find((elem) => elem.role === "owner");
let emptyObjectPresence = this.findObjectInArray(
filteredArray,
ownerAbsence
);
if (!findedElement && !emptyObjectPresence) {
filteredArray.push(ownerAbsence);
}
if (findedElement) {
let ownerPresence = this.findObjectInArray(
filteredArray,
findedElement.employee
);
if (!ownerPresence) {
filteredArray.push(findedElement.employee);
}
}
});
return filteredArray.sort(
(previous, subsequent) => Boolean(subsequent.id) - Boolean(previous.id)
);
}, },
filteredEventsByDate() { filteredEventsByDate() {
return this.eventsData.filter( return this.eventsData.filter(
@@ -100,6 +70,11 @@ export default {
start.slice(0, 10) === this.currentDate.format("YYYY-MM-DD") start.slice(0, 10) === this.currentDate.format("YYYY-MM-DD")
); );
}, },
horizontalScrollPresence() {
return {
"scroll-x": this.ownersArrayLength > 3,
};
},
}, },
methods: { methods: {
calculateColumnPosition(elemIndex) { calculateColumnPosition(elemIndex) {
@@ -120,12 +95,7 @@ export default {
}; };
}, },
calculateBackgroundWidth() { calculateBackgroundWidth() {
this.backgroundWidth = this.$refs.backgroundWrapper.offsetWidth; this.backgroundWidth = this.$refs.backgroundWrapper.scrollWidth;
},
findObjectInArray(array, object) {
return array.find(
(item) => JSON.stringify(item) === JSON.stringify(object)
);
}, },
filterEventsByOwner(owner) { filterEventsByOwner(owner) {
let filteredArray = []; let filteredArray = [];
@@ -147,13 +117,16 @@ export default {
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
.scroll .scroll-x
overflow-x: scroll overflow-x: auto
.calendar-background-wrapper .calendar-background-wrapper
width: 100% width: 100%
position: relative position: relative
.header-wrapper
position: relative
.header .header
height: 48px height: 48px

View File

@@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-45px.px-3 .calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-45px.px-3
span.text-base( span.text-base(
v-for="hour in hoursArray" v-for="hour in timeCoil"
:key="hour" :key="hour"
:class="currentHourStyle(hour)" :class="currentHourStyle(hour)"
) {{ hour }} ) {{ hour }}
@@ -11,7 +11,7 @@
export default { export default {
name: "CalendarClockColumn", name: "CalendarClockColumn",
props: { props: {
hoursArray: Array, timeCoil: Array,
currentTime: String, currentTime: String,
currentDate: Object, currentDate: Object,
dayEndTime: Number, dayEndTime: Number,
@@ -59,4 +59,6 @@ export default {
width: 80px width: 80px
height: 100% height: 100%
color: var(--font-dark-blue-color) color: var(--font-dark-blue-color)
position: sticky
left: 0
</style> </style>

View File

@@ -1,16 +1,17 @@
<template lang="pug"> <template lang="pug">
.calendar-column-wrapper.flex.flex-col .calendar-column-wrapper.flex.flex-col
.header.flex.items-center.justify-between.py-2.px-6 .header.flex.items-center.justify-between.py-2.px-6.top-0
.flex.items-center .flex.items-center
img.avatar-wrapper.mr-2(src="@/assets/images/team-member.svg" alt="Team member") img.avatar-wrapper.mr-2(src="@/assets/images/team-member.svg" alt="Team member")
span.owner-name.font-medium.text-base.mr-6 {{ ownerName }} span.owner-name.font-medium.text-base.mr-6 {{ ownerName }}
img.icon-wrapper.cursor-pointer(src="@/assets/icons/lock.svg") img.icon-wrapper.cursor-pointer(src="@/assets/icons/lock.svg")
base-doc-ok-button base-doc-ok-button
.px-1 .body
calendar-event-card( calendar-event-card(
v-for="event in dayEvents" v-for="event in dayEvents"
:key="event.id" :key="event.id"
:ownerEvent="event" :ownerEvent="event"
:style="eventCardPosition(event.start, event.end)"
) )
</template> </template>
@@ -23,6 +24,13 @@ export default {
props: { props: {
ownerData: Object, ownerData: Object,
dayEvents: Array, dayEvents: Array,
dayEndTime: Number,
dayStartTime: Number,
},
data() {
return {
pixelsPerHour: 62,
};
}, },
computed: { computed: {
ownerName() { ownerName() {
@@ -34,6 +42,33 @@ export default {
} }
return null; return null;
}, },
pixelsPerMinute() {
return this.pixelsPerHour / 60;
},
},
methods: {
eventCardPosition(startTime, endTime) {
let start = startTime
.slice(11, -4)
.split(":")
.map((elem) => parseInt(elem, 10));
let end = endTime.slice(11, -6);
let position =
(start[0] - this.dayStartTime) * this.pixelsPerHour +
start[1] * this.pixelsPerMinute;
if (
parseInt(start[0], 10) < this.dayStartTime ||
parseInt(end, 10) >= this.dayEndTime
) {
return {
top: "0px",
visibility: "hidden",
};
}
return {
top: `${position}px`,
};
},
}, },
}; };
</script> </script>
@@ -42,9 +77,22 @@ export default {
.calendar-column-wrapper .calendar-column-wrapper
position: absolute position: absolute
border-right: 1px solid var(--border-light-grey-color) border-right: 1px solid var(--border-light-grey-color)
&:nth-last-child(2) .header
border-right: none
&:nth-last-child(2)
border-right: none
.header .header
height: 48px height: 48px
position: sticky
z-index: 5
width: inherit
border-right: 1px solid var(--border-light-grey-color)
background-color: var(--default-white)
.body
position: relative
z-index: 3
.avatar-wrapper .avatar-wrapper
width: 32px width: 32px

View File

@@ -47,8 +47,8 @@ export default {
border-radius: 4px border-radius: 4px
background-color: var(--bg-event-yellow-color) background-color: var(--bg-event-yellow-color)
color: var(--font-black-color) color: var(--font-black-color)
position: relative position: absolute
z-index: 2 z-index: 3
.header .header
width: 100% width: 100%

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
.calendar-header-wrapper.flex.items-center.justify-between.py-3.pl-5.pr-6 .calendar-header-wrapper.flex.items-center.justify-between.py-3.pl-5.pr-6.top-0
.flex .flex
base-arrow-button.left-arrow.mr-4(@click="previousHandler") base-arrow-button.left-arrow.mr-4(@click="previousHandler")
base-arrow-button.right-arrow.mr-6(@click="nextHandler") base-arrow-button.right-arrow.mr-6(@click="nextHandler")
@@ -51,6 +51,8 @@ export default {
background-color: var(--default-white) background-color: var(--default-white)
height: 56px height: 56px
border-radius: 4px border-radius: 4px
position: sticky
z-index: 10
.left-arrow .left-arrow
transform: rotate(90deg) transform: rotate(90deg)

View File

@@ -1,5 +1,8 @@
<template lang="pug"> <template lang="pug">
.schedule.ml-2.w-full(:style="scheduleWidth") .schedule.ml-2(
:style="scheduleWidth"
ref="shedule"
)
calendar-header( calendar-header(
:current-date="currentDate" :current-date="currentDate"
:is-current-date="isCurrentDate" :is-current-date="isCurrentDate"
@@ -7,19 +10,23 @@
@next-date="nextDate" @next-date="nextDate"
@selected-layout="selectedLayout" @selected-layout="selectedLayout"
) )
.schedule-body.flex .schedule-body.flex(
)
div div
calendar-clock-column( calendar-clock-column(
:hours-array="hoursArray" :timeCoil="timeCoil"
:current-time="currentTime" :current-time="currentTime"
:is-current-date="isCurrentDate" :is-current-date="isCurrentDate"
:day-end-time="validateEndTime" :day-end-time="validateEndTime"
) )
calendar-background( calendar-background(
:current-date="currentDate" :current-date="currentDate"
:hours-array="hoursArray" :time-coil="timeCoil"
:events-data="eventsData" :events-data="eventsData"
:filtered-owners="filteredOwners"
:sidebar-width="sidebarWidth" :sidebar-width="sidebarWidth"
:day-start-time="validateStartTime"
:day-end-time="validateEndTime"
) )
.time-circle-indicator.left-74px( .time-circle-indicator.left-74px(
v-if="isShownIndicator" v-if="isShownIndicator"
@@ -67,12 +74,14 @@ export default {
data() { data() {
return { return {
currentTime: "", currentTime: "",
hoursArray: [], timeCoil: [],
timer: null, timer: null,
isCurrentDate: true, isCurrentDate: true,
isShownIndicator: true, isShownIndicator: true,
pixelsPerHour: 62, pixelsPerHour: 62,
columnHeaderHeight: 48, columnHeaderHeight: 48,
defaultColumnWidth: 470,
sheduleHeight: 0,
}; };
}, },
computed: { computed: {
@@ -92,6 +101,12 @@ export default {
return this.verifyTime(this.timeInformation.dayEndTime); return this.verifyTime(this.timeInformation.dayEndTime);
}, },
lineIndicatorLocation() { lineIndicatorLocation() {
if (this.filteredOwners.length > 3 && this.timeCoil.length - 1 > 13) {
return {
width: `${this.filteredOwners.length * this.defaultColumnWidth}px`,
top: `${this.calculateIndicatorLocation()}px`,
};
}
return { return {
top: `${this.calculateIndicatorLocation()}px`, top: `${this.calculateIndicatorLocation()}px`,
}; };
@@ -115,6 +130,37 @@ export default {
"--sidebar-width": this.sidebarWidth, "--sidebar-width": this.sidebarWidth,
}; };
}, },
filteredOwners() {
let filteredArray = [];
let ownerAbsence = {
id: null,
last_name: null,
first_name: null,
patronymic: null,
};
this.eventsData.forEach(({ employees }) => {
let findedElement = employees.find((elem) => elem.role === "owner");
let emptyDataPresence = this.findObjectInArray(
filteredArray,
ownerAbsence
);
if (!findedElement && !emptyDataPresence) {
filteredArray.push(ownerAbsence);
}
if (findedElement) {
let ownerPresence = this.findObjectInArray(
filteredArray,
findedElement.employee
);
if (!ownerPresence) {
filteredArray.push(findedElement.employee);
}
}
});
return filteredArray.sort(
(previous, subsequent) => Boolean(subsequent.id) - Boolean(previous.id)
);
},
}, },
methods: { methods: {
previousDate() { previousDate() {
@@ -133,7 +179,7 @@ export default {
) { ) {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.changeCurrentTime(); this.changeCurrentTime();
this.changeHoursArray(); this.changeTimeCoil();
}, 5000); }, 5000);
} }
}, },
@@ -144,20 +190,20 @@ export default {
changeCurrentTime() { changeCurrentTime() {
this.currentTime = moment().format("HH:mm:ss"); this.currentTime = moment().format("HH:mm:ss");
}, },
hoursArrayInitialization() { timeCoilInitialization() {
this.hoursArray = []; this.timeCoil = [];
for (let i = this.validateStartTime; i <= this.validateEndTime; i++) { for (let i = this.validateStartTime; i <= this.validateEndTime; i++) {
if ( if (
i === this.hours && i === this.hours &&
this.hours !== this.validateEndTime && this.hours !== this.validateEndTime &&
this.isCurrentDate this.isCurrentDate
) { ) {
this.hoursArray.push(this.hoursMinutes); this.timeCoil.push(this.hoursMinutes);
} else this.hoursArray.push(`${i}:00`); } else this.timeCoil.push(`${i}:00`);
} }
}, },
changeHoursArray() { changeTimeCoil() {
this.hoursArray = this.hoursArray.map((elem) => { this.timeCoil = this.timeCoil.map((elem) => {
if (this.convertTime(elem, 0, -3) === this.hours) { if (this.convertTime(elem, 0, -3) === this.hours) {
return this.hoursMinutes; return this.hoursMinutes;
} }
@@ -186,6 +232,11 @@ export default {
} }
return result; return result;
}, },
findObjectInArray(array, object) {
return array.find(
(item) => JSON.stringify(item) === JSON.stringify(object)
);
},
}, },
watch: { watch: {
currentTime() { currentTime() {
@@ -195,7 +246,7 @@ export default {
this.timer this.timer
) { ) {
this.stopTimer(); this.stopTimer();
this.hoursArrayInitialization(); this.timeCoilInitialization();
} }
}, },
currentDate: function () { currentDate: function () {
@@ -204,18 +255,18 @@ export default {
this.isShownIndicator = this.isCurrentDate; this.isShownIndicator = this.isCurrentDate;
if (this.timer) { if (this.timer) {
this.stopTimer(); this.stopTimer();
this.hoursArrayInitialization(); this.timeCoilInitialization();
} }
if (this.isCurrentDate) { if (this.isCurrentDate) {
this.changeCurrentTime(); this.changeCurrentTime();
this.hoursArrayInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
} }
}, },
}, },
mounted() { mounted() {
this.changeCurrentTime(); this.changeCurrentTime();
this.hoursArrayInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
}, },
beforeUnmount() { beforeUnmount() {
@@ -226,8 +277,12 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.schedule .schedule
position: relative
background-color: var(--default-white) background-color: var(--default-white)
width: calc(100% - (var(--sidebar-width) + 8px)) width: calc(100% - (var(--sidebar-width) + 8px))
height: calc(100vh - 56px - 8px)
overflow-y: auto
overflow-x: hidden
.time-line-indicator .time-line-indicator
width: calc(100% - 80px) width: calc(100% - 80px)

View File

@@ -1,56 +1,67 @@
<template lang="pug"> <template lang="pug">
.sidebar.flex.flex-col.bg-white(:class="openSidebar") .sidebar.flex.flex-col.bg-white(:class="openSidebar")
.sidebar-wrapper.h-full.my-13px(:style="sidebarWidth") .sidebar-wrapper.h-full.my-13px.flex.flex-col.justify-between(:style="sidebarWidth")
.sidebar-content.items-center.flex.flex-col.gap-y-8.px-4.py-19px .sidebar-content.items-center.flex.flex-col.gap-y-8.px-4.py-19px(v-if="!isOpen")
base-button-plus(:size="40" v-if="!isOpen") base-button-plus(:size="40")
.create-event.flex.items-center.justify-center(v-else)
base-create-button.font-medium.pl-15px.py-10.5px(text="Создать событие" :withIcon="true")
.flex.flex-col.items-center(v-if="!isOpen") .flex.flex-col.items-center(v-if="!isOpen")
base-button-plus(:class="buttonStyled" :size="24" :icon-size="10") base-button-plus(:class="buttonStyled" :size="24" :icon-size="10")
.flex.flex-col.gap-y-2.items-center.mt-4 .flex.flex-col.gap-y-2.items-center.mt-4
.event.flex.items-center.justify-center(v-for="event in events" :key="event.id") .event.flex.items-center.justify-center(v-for="event in events" :key="event.id")
.event-type(:style="{ background: event.color }") .event-type(:style="{ background: event.color }")
.flex.items-center.flex-col.gap-y-4(v-else) .flex.flex-col.items-center.gap-y-2.justify-center
base-button-plus.mb-2(:class="buttonStyled" :size="24" :icon-size="10")
.team-card(v-for="teammate in teamData" :key="teammate.id")
img.avatar-wrapper(:src="avatar" alt="Team member")
.sidebar-content.items-center.flex.flex-col.gap-y-8.px-4.py-19px(v-else)
.create-event.flex.items-center.justify-center
base-create-button.pl-15px.pb-2.pr-3.pt-2.items-center.h-10(
text-styled="createEvent"
:icon-size="10"
text="Создать событие"
:with-icon="true"
icon-position="right")
.flex.items-center.flex-col.gap-y-4
.events-wrapper.flex.items-center.justify-between .events-wrapper.flex.items-center.justify-between
.flex {{ "Виды событий" }} .flex {{ "Виды событий" }}
base-button-plus(:class="buttonStyled" :size="24" :icon-size="10") base-button-plus(:class="buttonStyled" :size="24" :icon-size="10")
.flex.flex-col.gap-y-2 .flex.flex-col.gap-y-2
.relative.flex.items-center.gap-x-3(v-for="event in events") .relative.flex.items-center.gap-x-3.h-8(v-for="event in events")
base-input.py-2.pl-6(:placeholder="event.name" :key="event.id" :backgroundInput="red" background-input="transparent" font-size-input="12px") input.custom-input.py-2.pl-6.h-full.not-italic.font-medium.text-xxs(
:placeholder="event.name"
:key="event.id")
.event-type(:style="{ background: event.color }") .event-type(:style="{ background: event.color }")
span.icon-edit.cursor-pointer span.icon-edit.cursor-pointer
.flex.flex-col.items-center.gap-y-2.justify-center(v-if="!isOpen") .flex.flex-col.gap-y-4
base-button-plus.mb-2(:class="buttonStyled" :size="24" :icon-size="10")
.team-card(v-for="teammate in team" :key="teammate.id")
img.avatar-wrapper(:src="teammate.avatar" alt="Team member")
.flex.flex-col.gap-y-4(v-else)
.events-wrapper.flex.items-center.justify-between .events-wrapper.flex.items-center.justify-between
.flex {{ "Команды" }} .flex {{ "Команды" }}
base-button-plus(:class="buttonStyled" :size="24" :icon-size="10") base-button-plus(:class="buttonStyled" :size="24" :icon-size="10")
.box-team.flex.flex-col.gap-y-2 .box-team.flex.flex-col.gap-y-2
.team-card.flex.items-center.justify-between(v-for="teammate in team" :key="teammate.id") .team-card.flex.items-center.justify-between.cursor-pointer(
v-for="teammate in teamData"
:key="teammate.id")
.flex.items-center .flex.items-center
img.avatar-wrapper(:src="teammate.avatar" alt="Team member") img.avatar-wrapper(:src="avatar" alt="Team member")
.flex.ml-2.not-italic.font-medium.text-xxs {{ changeLastName(teammate.last_name) + changeInitials(teammate.first_name, teammate.patronymic) }} .flex.ml-2.not-italic.font-medium.text-xxs {{ changeName(teammate.last_name, teammate.first_name, teammate.patronymic) }}
.span.icon-change-place.cursor-pointer span.icon-change-place.cursor-pointer.w-5
base-open-button.mt-148px(@click="changeSize" :style="{ transform: `rotate(${turnButton})` }") .button-wrapper.flex.justify-center.mb-23px
base-open-button(@click="changeSize" :style="{ transform: `rotate(${turnButton})`}")
</template> </template>
<script> <script>
import BaseButtonPlus from "../../../components/base/buttons/BaseButtonPlus.vue"; import BaseButtonPlus from "../../../components/base/buttons/BaseButtonPlus.vue";
import BaseOpenButton from "../../../components/base/buttons/BaseOpenButton.vue"; import BaseOpenButton from "../../../components/base/buttons/BaseOpenButton.vue";
import BaseCreateButton from "../../../components/base/buttons/BaseCreateButton.vue"; import BaseCreateButton from "../../../components/base/buttons/BaseCreateButton.vue";
import BaseInput from "../../../components/base/BaseInput.vue"; import img from "../../../assets/images/team-member.svg";
export default { export default {
name: "CalendarSidebar", name: "CalendarSidebar",
components: { components: {
BaseButtonPlus, BaseButtonPlus,
BaseOpenButton, BaseOpenButton,
BaseCreateButton, BaseCreateButton,
BaseInput,
}, },
props: { props: {
team: Array, teamData: Array,
}, },
data() { data() {
return { return {
@@ -65,6 +76,7 @@ export default {
isOpen: false, isOpen: false,
turnButton: "180deg", turnButton: "180deg",
maxLengthLastName: 13, maxLengthLastName: 13,
avatar: img,
}; };
}, },
computed: { computed: {
@@ -98,13 +110,15 @@ export default {
); );
this.turnButton = this.isOpen ? "0deg" : "180deg"; this.turnButton = this.isOpen ? "0deg" : "180deg";
}, },
changeLastName(lastName) { changeName(lastName, fitstName, patronymic) {
return lastName.length > this.maxLengthLastName return lastName.length > this.maxLengthLastName
? lastName.substr(0, this.maxLengthLastName) + "... " ? lastName.slice(0, this.maxLengthLastName) + "... "
: lastName + " "; : lastName +
}, " " +
changeInitials(firstName, patronymic) { fitstName.slice(0, 1) +
return firstName.substr(0, 1) + "." + patronymic.substr(0, 1) + "."; "." +
patronymic.slice(0, 1) +
".";
}, },
}, },
}; };
@@ -113,30 +127,37 @@ export default {
<style lang="sass" scoped> <style lang="sass" scoped>
.sidebar-wrapper .sidebar-wrapper
border-left: 2px solid var(--btn-blue-color-3) border-left: 2px solid var(--btn-blue-color-3)
.button-plus .button-plus
max-height: 40px max-height: 40px
background: var(--btn-blue-color) background: var(--btn-blue-color)
color: var(--default-white) color: var(--default-white)
.event .event
width: 32px width: 32px
height: 32px height: 32px
background: var(--bg-event-box-color) background: var(--bg-event-box-color)
border-radius: 4px border-radius: 4px
.event-type .event-type
width: 16px width: 16px
height: 16px height: 16px
border-radius: 2px border-radius: 2px
.avatar-wrapper .avatar-wrapper
width: 32px width: 32px
height: 32px height: 32px
.open-button .open-button
width: 40px width: 40px
height: 40px height: 40px
max-height: 40px max-height: 40px
.button-styled .button-styled
max-height: 24px max-height: 24px
background: var(--btn-blue-color-1) background: var(--btn-blue-color-1)
color: var(--btn-blue-color) color: var(--btn-blue-color)
.open-sidebar .open-sidebar
.sidebar-content .sidebar-content
align-items: flex-end align-items: flex-end
@@ -147,15 +168,43 @@ export default {
height: 16px height: 16px
top: 8px top: 8px
left: 8px left: 8px
.button-wrapper
justify-content: end
padding-right: 16px
.create-event .create-event
width: 200px width: 200px
height: 40px height: 40px
border-radius: 4px border-radius: 4px
.events-wrapper .events-wrapper
width: 200px width: 200px
.input-wrapper .input-wrapper
border: none border: none
background: var(--bg-event-box-color) background: var(--bg-event-box-color)
height: 32px height: 32px
width: 169px width: 169px
.team-card
border-radius:16px
&:hover
background: var(--font-dark-blue-color)
color: var(--default-white)
.button
width: 200px
.custom-input
border-radius: 4px
width: 169px
outline: none
background-color: var(--bg-event-box-color)
&::placeholder
color: var(--font-dark-blue-color)
&:focus
background-color: var(--font-dark-blue-color)
color: var(--default-white)
&::placeholder
color: var(--default-white)
</style> </style>

View File

@@ -32,6 +32,7 @@ module.exports = {
"13px": "13px", "13px": "13px",
"15px": "15px", "15px": "15px",
"19px": "19px", "19px": "19px",
"23px": "23px",
"45px": "45px", "45px": "45px",
"74px": "74px", "74px": "74px",
"148px": "148px", "148px": "148px",