diff --git a/server.js b/server.js
index 344db13..ff1f748 100644
--- a/server.js
+++ b/server.js
@@ -132,7 +132,7 @@ export function clientsServer() {
dataClients,
}));
this.get("/registry/event/", () => ({
- count: 1,
+ count: 4,
next: null,
previous: null,
results: [
@@ -157,6 +157,16 @@ export function clientsServer() {
},
],
employees: [
+ {
+ id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
+ employee: {
+ id: "db541a67-e836-481f-a653-6325de7c567e",
+ last_name: "Захарова",
+ first_name: "Ольга",
+ patronymic: "Александровна",
+ },
+ role: null,
+ },
{
id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
employee: {
@@ -169,6 +179,135 @@ export function clientsServer() {
},
],
},
+ {
+ id: "7faa7bb7-2de6-422c-a401-1b35cd455303",
+ start: "2022-10-20T10:00:00Z",
+ end: "2022-10-20T11: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,
+ },
+ ],
+ 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",
+ start: "2022-10-20T10:00:00Z",
+ end: "2022-10-20T11: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,
+ },
+ ],
+ employees: [
+ {
+ id: "f941a0c6-c734-4f79-92c2-d7a5674459e422",
+ employee: {
+ id: "db831a15-e876-481f-a658-6325de7c311e",
+ last_name: "Константинопольская",
+ first_name: "Юлия",
+ patronymic: "Викторовна",
+ },
+ role: "owner",
+ },
+ {
+ id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
+ employee: {
+ id: "db541a67-e836-481f-a653-6325de7c567e",
+ last_name: "Захарова",
+ first_name: "Ольга",
+ patronymic: "Александровна",
+ },
+ role: null,
+ },
+ ],
+ },
+ {
+ id: "6faa6bb2-1de4-425c-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: "db541a67-e836-481f-a653-6325de7c567e",
+ last_name: "Захарова",
+ first_name: "Ольга",
+ patronymic: "Александровна",
+ },
+ role: null,
+ },
+ {
+ id: "f941a0c6-c750-4f79-92c0-d7a19354e422",
+ employee: {
+ id: "db831a14-e836-481f-a653-6325de7c311e",
+ last_name: "Жмыхов",
+ first_name: "Егор",
+ patronymic: "Сергеевич",
+ },
+ role: null,
+ },
+ ],
+ },
],
}));
this.passthrough("http://45.84.227.122:8080/**");
diff --git a/src/pages/calendar/TheCalendar.vue b/src/pages/calendar/TheCalendar.vue
index 63c4728..88e5e96 100644
--- a/src/pages/calendar/TheCalendar.vue
+++ b/src/pages/calendar/TheCalendar.vue
@@ -4,7 +4,7 @@
calendar-schedule(
:current-date="currentDate"
:time-information="timeInformation"
- :column-information="columnInformation"
+ :events-data="eventsData"
@previous-date="switchPreviousDate"
@next-date="switchNextDate"
@selected-layout="changeCalendarLayout"
@@ -27,14 +27,6 @@ export default {
dayEndTime: "18:00",
},
eventsData: [],
- columnInformation: {
- owners: [
- "Захарова А.О.",
- "Константинопольская Ю.В.",
- "Коломойцев И.К.",
- "Зайцев В.С.",
- ],
- },
};
},
methods: {
@@ -64,5 +56,5 @@ export default {
diff --git a/src/pages/calendar/components/CalendarBackground.vue b/src/pages/calendar/components/CalendarBackground.vue
index ae7dcf8..238cef4 100644
--- a/src/pages/calendar/components/CalendarBackground.vue
+++ b/src/pages/calendar/components/CalendarBackground.vue
@@ -1,11 +1,12 @@
.calendar-background-wrapper.flex.flex-col(
ref="backgroundWrapper"
+ :class="scrollPresence"
)
calendar-column(
- v-for="(owner, index) in columnInformation.owners"
- :key="owner"
- :column-information="owner"
+ v-for="(owner, index) in filteredOwners"
+ :key="owner.id"
+ :owner-data="owner"
:style="calculateColumnPosition(index)"
)
.header(:style="backgroundExtendedWidth")
@@ -27,7 +28,7 @@ export default {
components: { CalendarColumn },
props: {
hoursArray: Array,
- columnInformation: Object,
+ eventsData: Array,
},
data() {
return {
@@ -39,7 +40,7 @@ export default {
},
computed: {
ownersArrayLength() {
- return this.columnInformation.owners.length;
+ return this.filteredOwners.length;
},
backgroundExtendedWidth() {
if (this.ownersArrayLength > 3) {
@@ -54,6 +55,42 @@ export default {
backgroundHeight() {
return (this.hoursArray.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)
+ );
+ },
},
methods: {
calculateColumnPosition(elemIndex) {
@@ -74,6 +111,11 @@ export default {
calculateBackgroundWidth() {
this.backgroundWidth = this.$refs.backgroundWrapper.offsetWidth;
},
+ findObjectInArray(array, object) {
+ return array.find(
+ (item) => JSON.stringify(item) === JSON.stringify(object)
+ );
+ },
},
mounted() {
this.calculateBackgroundWidth();
@@ -82,10 +124,12 @@ export default {