Merge pull request #48 from dderbentsov/UC-20
WIP Настроила высоту колонок с учетом скролла
This commit is contained in:
40
server.js
40
server.js
@@ -35,6 +35,46 @@ export function clientsServer() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
this.get("/registry/event/", () => ({
|
||||||
|
count: 1,
|
||||||
|
next: null,
|
||||||
|
previous: null,
|
||||||
|
results: [
|
||||||
|
{
|
||||||
|
id: "6faa6bb6-1de6-422c-a401-1b35cd455303",
|
||||||
|
start: "2022-10-20T20:23:49Z",
|
||||||
|
end: "2022-10-20T21:23:53Z",
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
employees: [
|
||||||
|
{
|
||||||
|
id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
|
||||||
|
employee: {
|
||||||
|
id: "db831a14-e836-481f-a653-6325de7c311e",
|
||||||
|
last_name: "Жмыхов",
|
||||||
|
first_name: "Егор",
|
||||||
|
patronymic: "Сергеевич",
|
||||||
|
},
|
||||||
|
role: "owner",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}));
|
||||||
this.passthrough("http://45.84.227.122:8080/**");
|
this.passthrough("http://45.84.227.122:8080/**");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
calendar-schedule(
|
calendar-schedule(
|
||||||
:current-date="currentDate"
|
:current-date="currentDate"
|
||||||
:time-information="timeInformation"
|
:time-information="timeInformation"
|
||||||
|
:column-information="columnInformation"
|
||||||
@previous-date="switchPreviousDate"
|
@previous-date="switchPreviousDate"
|
||||||
@next-date="switchNextDate"
|
@next-date="switchNextDate"
|
||||||
@selected-layout="changeCalendarLayout"
|
@selected-layout="changeCalendarLayout"
|
||||||
@@ -24,6 +25,14 @@ export default {
|
|||||||
dayEndTime: "18:00",
|
dayEndTime: "18:00",
|
||||||
},
|
},
|
||||||
eventsData: [],
|
eventsData: [],
|
||||||
|
columnInformation: {
|
||||||
|
owners: [
|
||||||
|
"Захарова А.О.",
|
||||||
|
"Константинопольская Ю.В.",
|
||||||
|
"Коломойцев И.К.",
|
||||||
|
"Зайцев В.С.",
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -40,7 +49,7 @@ export default {
|
|||||||
this.eventsData = res.results;
|
this.eventsData = res.results;
|
||||||
},
|
},
|
||||||
fetchEventsData() {
|
fetchEventsData() {
|
||||||
fetch("http://45.84.227.122:8080/registry/event/")
|
fetch("/registry/event/")
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((res) => this.saveEventsData(res));
|
.then((res) => this.saveEventsData(res));
|
||||||
},
|
},
|
||||||
@@ -53,5 +62,5 @@ export default {
|
|||||||
|
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.calendar-container
|
.calendar-container
|
||||||
width: 100%
|
width: calc(100% - 80px)
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,78 +1,82 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.calendar-background-wrapper.flex.flex-col
|
.calendar-background-wrapper.flex.flex-col(
|
||||||
.header.flex.items-center.justify-between.py-2.px-6
|
ref="backgroundWrapper"
|
||||||
.body.flex.flex-col
|
)
|
||||||
|
calendar-column(
|
||||||
|
v-for="(owner, index) in columnInformation.owners"
|
||||||
|
:key="owner"
|
||||||
|
:column-information="owner"
|
||||||
|
:style="calculateColumnPosition(index)"
|
||||||
|
)
|
||||||
|
.header(:style="backgroundExtendedWidth")
|
||||||
|
.body.flex.flex-col(
|
||||||
|
:style="backgroundExtendedWidth"
|
||||||
|
)
|
||||||
.line-wrapper
|
.line-wrapper
|
||||||
.line.flex.items-center(
|
.line.flex.items-center(
|
||||||
v-for="hour in hoursArray"
|
v-for="hour in hoursArray"
|
||||||
:key="hour"
|
:key="hour"
|
||||||
)
|
)
|
||||||
.middle-line
|
.middle-line
|
||||||
.time-circle-indicator.-left-6px(
|
|
||||||
v-if="isShownIndicator"
|
|
||||||
:style="circleIndicatorLocation"
|
|
||||||
)
|
|
||||||
span.time-line-indicator.block(
|
|
||||||
v-if="isShownIndicator"
|
|
||||||
:style="lineIndicatorLocation"
|
|
||||||
)
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as moment from "moment/moment";
|
import CalendarColumn from "./CalendarColumn.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarBackground",
|
name: "CalendarBackground",
|
||||||
|
components: { CalendarColumn },
|
||||||
props: {
|
props: {
|
||||||
hoursArray: Array,
|
hoursArray: Array,
|
||||||
currentTime: String,
|
columnInformation: Object,
|
||||||
currentDate: Object,
|
|
||||||
dayStartTime: Number,
|
|
||||||
dayEndTime: Number,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShownIndicator: true,
|
backgroundWidth: 0,
|
||||||
|
columnWidth: 0,
|
||||||
|
defaultColumnWidth: 470,
|
||||||
pixelsPerHour: 62,
|
pixelsPerHour: 62,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
lineIndicatorLocation() {
|
ownersArrayLength() {
|
||||||
|
return this.columnInformation.owners.length;
|
||||||
|
},
|
||||||
|
backgroundExtendedWidth() {
|
||||||
|
if (this.ownersArrayLength > 3) {
|
||||||
|
return {
|
||||||
|
width: `${this.defaultColumnWidth * this.ownersArrayLength}px`,
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
top: `${this.calculateIndicatorLocation()}px`,
|
width: "auto",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
circleIndicatorLocation() {
|
backgroundHeight() {
|
||||||
return {
|
return (this.hoursArray.length - 1) * this.pixelsPerHour + 48;
|
||||||
top: `${this.calculateIndicatorLocation() - 6}px`,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
scheduleSize() {
|
|
||||||
return (this.dayEndTime - this.dayStartTime) * this.pixelsPerHour;
|
|
||||||
},
|
|
||||||
pixelsPerMinute() {
|
|
||||||
return this.pixelsPerHour / 60;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calculateIndicatorLocation() {
|
calculateColumnPosition(elemIndex) {
|
||||||
let newTime = this.currentTime
|
if (this.ownersArrayLength < 4) {
|
||||||
.split(":")
|
this.columnWidth = this.backgroundWidth / this.ownersArrayLength;
|
||||||
.map((elem) => parseInt(elem, 10));
|
return {
|
||||||
let result =
|
width: `${this.columnWidth}px`,
|
||||||
(newTime[0] - this.dayStartTime) * this.pixelsPerHour +
|
height: `${this.backgroundHeight}px`,
|
||||||
newTime[1] * this.pixelsPerMinute;
|
left: `${elemIndex * this.columnWidth}px`,
|
||||||
if (result > this.scheduleSize || result < 0) {
|
};
|
||||||
this.isShownIndicator = false;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return result;
|
return {
|
||||||
|
width: `${this.defaultColumnWidth}px`,
|
||||||
|
height: `${this.backgroundHeight}px`,
|
||||||
|
left: `${elemIndex * this.defaultColumnWidth}px`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
calculateBackgroundWidth() {
|
||||||
|
this.backgroundWidth = this.$refs.backgroundWrapper.offsetWidth;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
mounted() {
|
||||||
currentDate: function () {
|
this.calculateBackgroundWidth();
|
||||||
this.isShownIndicator =
|
|
||||||
this.currentDate.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY");
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -80,6 +84,8 @@ export default {
|
|||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.calendar-background-wrapper
|
.calendar-background-wrapper
|
||||||
width: 100%
|
width: 100%
|
||||||
|
position: relative
|
||||||
|
overflow-x: scroll
|
||||||
|
|
||||||
.header
|
.header
|
||||||
height: 48px
|
height: 48px
|
||||||
@@ -99,16 +105,4 @@ export default {
|
|||||||
.middle-line
|
.middle-line
|
||||||
border-top: 1px dashed var(--border-light-grey-color)
|
border-top: 1px dashed var(--border-light-grey-color)
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.time-line-indicator
|
|
||||||
width: 100%
|
|
||||||
border-top: 1px solid var(--time-indicator-color)
|
|
||||||
position: absolute
|
|
||||||
|
|
||||||
.time-circle-indicator
|
|
||||||
width: 12px
|
|
||||||
height: 12px
|
|
||||||
background-color: var(--time-indicator-color)
|
|
||||||
border-radius: 50%
|
|
||||||
position: absolute
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-12.px-3
|
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-12.px-3
|
||||||
span.font-medium.text-base(
|
span.text-base(
|
||||||
v-for="hour in hoursArray"
|
v-for="hour in hoursArray"
|
||||||
:key="hour"
|
:key="hour"
|
||||||
:class="currentHourStyle(hour)"
|
:class="currentHourStyle(hour)"
|
||||||
@@ -42,6 +42,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
"current-time": false,
|
"current-time": false,
|
||||||
|
"font-medium": true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
convertTime(str, startIndex, endIndex) {
|
convertTime(str, startIndex, endIndex) {
|
||||||
|
|||||||
41
src/pages/calendar/components/CalendarColumn.vue
Normal file
41
src/pages/calendar/components/CalendarColumn.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
.calendar-column-wrapper.flex.flex-col
|
||||||
|
.header.flex.items-center.justify-between.py-2.px-6
|
||||||
|
.flex.items-center
|
||||||
|
img.avatar-wrapper.mr-2(src="@/assets/images/team-member.svg" alt="Team member")
|
||||||
|
span.owner-name.font-medium.text-base.mr-6 {{ columnInformation }}
|
||||||
|
img.icon-wrapper.cursor-pointer(src="@/assets/icons/lock.svg")
|
||||||
|
base-doc-ok-button
|
||||||
|
div
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseDocOkButton from "@/components/base/buttons/BaseDocOkButton.vue";
|
||||||
|
export default {
|
||||||
|
name: "CalendarColumn",
|
||||||
|
components: { BaseDocOkButton },
|
||||||
|
props: {
|
||||||
|
columnInformation: String,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.calendar-column-wrapper
|
||||||
|
position: absolute
|
||||||
|
border-right: 1px solid var(--border-light-grey-color)
|
||||||
|
|
||||||
|
.header
|
||||||
|
height: 48px
|
||||||
|
|
||||||
|
.avatar-wrapper
|
||||||
|
width: 32px
|
||||||
|
height: 32px
|
||||||
|
|
||||||
|
.icon-wrapper
|
||||||
|
width: 24px
|
||||||
|
height: 24px
|
||||||
|
|
||||||
|
.owner-name
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
</style>
|
||||||
@@ -8,19 +8,25 @@
|
|||||||
@selected-layout="selectedLayout"
|
@selected-layout="selectedLayout"
|
||||||
)
|
)
|
||||||
.schedule-body.flex
|
.schedule-body.flex
|
||||||
calendar-clock-column(
|
div
|
||||||
:hours-array="hoursArray"
|
calendar-clock-column(
|
||||||
:current-time="currentTime"
|
:hours-array="hoursArray"
|
||||||
:is-current-date="isCurrentDate"
|
:current-time="currentTime"
|
||||||
:day-end-time="validateEndTime"
|
:is-current-date="isCurrentDate"
|
||||||
)
|
:day-end-time="validateEndTime"
|
||||||
|
)
|
||||||
calendar-background(
|
calendar-background(
|
||||||
:hours-array="hoursArray"
|
:hours-array="hoursArray"
|
||||||
:current-time="currentTime"
|
:column-information="columnInformation"
|
||||||
:current-date="currentDate"
|
|
||||||
:day-start-time="validateStartTime"
|
|
||||||
:day-end-time="validateEndTime"
|
|
||||||
)
|
)
|
||||||
|
.time-circle-indicator.left-74px(
|
||||||
|
v-if="isShownIndicator"
|
||||||
|
:style="circleIndicatorLocation"
|
||||||
|
)
|
||||||
|
span.time-line-indicator.block.left-20(
|
||||||
|
v-if="isShownIndicator"
|
||||||
|
:style="lineIndicatorLocation"
|
||||||
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -30,7 +36,11 @@ import CalendarBackground from "./CalendarBackground.vue";
|
|||||||
import CalendarClockColumn from "./CalendarClockColumn.vue";
|
import CalendarClockColumn from "./CalendarClockColumn.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarSchedule",
|
name: "CalendarSchedule",
|
||||||
components: { CalendarHeader, CalendarBackground, CalendarClockColumn },
|
components: {
|
||||||
|
CalendarHeader,
|
||||||
|
CalendarBackground,
|
||||||
|
CalendarClockColumn,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
currentDate: {
|
currentDate: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -44,6 +54,12 @@ export default {
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columnInformation: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -51,6 +67,9 @@ export default {
|
|||||||
hoursArray: [],
|
hoursArray: [],
|
||||||
timer: null,
|
timer: null,
|
||||||
isCurrentDate: true,
|
isCurrentDate: true,
|
||||||
|
isShownIndicator: true,
|
||||||
|
pixelsPerHour: 62,
|
||||||
|
columnHeaderHeight: 48,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -69,6 +88,25 @@ export default {
|
|||||||
validateEndTime() {
|
validateEndTime() {
|
||||||
return this.verifyTime(this.timeInformation.dayEndTime);
|
return this.verifyTime(this.timeInformation.dayEndTime);
|
||||||
},
|
},
|
||||||
|
lineIndicatorLocation() {
|
||||||
|
return {
|
||||||
|
top: `${this.calculateIndicatorLocation()}px`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
circleIndicatorLocation() {
|
||||||
|
return {
|
||||||
|
top: `${this.calculateIndicatorLocation() - 6}px`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
pixelsPerMinute() {
|
||||||
|
return this.pixelsPerHour / 60;
|
||||||
|
},
|
||||||
|
scheduleSize() {
|
||||||
|
return (
|
||||||
|
(this.validateEndTime - this.validateStartTime) * this.pixelsPerHour +
|
||||||
|
this.columnHeaderHeight
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
previousDate() {
|
previousDate() {
|
||||||
@@ -126,6 +164,20 @@ export default {
|
|||||||
convertTime(str, startIndex, endIndex) {
|
convertTime(str, startIndex, endIndex) {
|
||||||
return parseInt(str.slice(startIndex, endIndex), 10);
|
return parseInt(str.slice(startIndex, endIndex), 10);
|
||||||
},
|
},
|
||||||
|
calculateIndicatorLocation() {
|
||||||
|
let newTime = this.currentTime
|
||||||
|
.split(":")
|
||||||
|
.map((elem) => parseInt(elem, 10));
|
||||||
|
let result =
|
||||||
|
(newTime[0] - this.validateStartTime) * this.pixelsPerHour +
|
||||||
|
newTime[1] * this.pixelsPerMinute +
|
||||||
|
this.columnHeaderHeight;
|
||||||
|
if (result > this.scheduleSize || result < 0) {
|
||||||
|
this.isShownIndicator = false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentTime() {
|
currentTime() {
|
||||||
@@ -141,6 +193,7 @@ export default {
|
|||||||
currentDate: function () {
|
currentDate: function () {
|
||||||
this.isCurrentDate =
|
this.isCurrentDate =
|
||||||
this.currentDate.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY");
|
this.currentDate.format("DD.MM.YYYY") === moment().format("DD.MM.YYYY");
|
||||||
|
this.isShownIndicator = this.isCurrentDate;
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
this.stopTimer();
|
this.stopTimer();
|
||||||
this.hoursArrayInitialization();
|
this.hoursArrayInitialization();
|
||||||
@@ -166,4 +219,20 @@ export default {
|
|||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
.schedule
|
.schedule
|
||||||
background-color: var(--default-white)
|
background-color: var(--default-white)
|
||||||
|
width: calc(100% - 8px)
|
||||||
|
|
||||||
|
.time-line-indicator
|
||||||
|
width: calc(100% - 80px)
|
||||||
|
border-top: 1px solid var(--time-indicator-color)
|
||||||
|
position: absolute
|
||||||
|
|
||||||
|
.time-circle-indicator
|
||||||
|
width: 12px
|
||||||
|
height: 12px
|
||||||
|
background-color: var(--time-indicator-color)
|
||||||
|
border-radius: 50%
|
||||||
|
position: absolute
|
||||||
|
|
||||||
|
.schedule-body
|
||||||
|
position: relative
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = {
|
|||||||
"6px": "6px",
|
"6px": "6px",
|
||||||
"10px": "10px",
|
"10px": "10px",
|
||||||
"3px": "3px",
|
"3px": "3px",
|
||||||
|
"74px": "74px",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user