diff --git a/server.js b/server.js index e3ab194..46c392d 100644 --- a/server.js +++ b/server.js @@ -255,8 +255,8 @@ export function clientsServer() { results: [ { id: "6faa6bb6-1de6-422c-a401-1b35cd455303", - start: "2022-10-20T20:23:49Z", - end: "2022-10-20T21:23:53Z", + start: "2022-10-24T20:23:49Z", + end: "2022-10-24T21:23:53Z", kind: "call", subkind: null, description: "", @@ -296,10 +296,53 @@ export function clientsServer() { }, ], }, + { + id: "6faa6bb6-1de6-422c-a401-1b35cd455303", + start: "2022-10-24T15:23:49Z", + end: "2022-10-24T16:23:53Z", + kind: "call", + subkind: null, + description: "", + location: null, + members: [ + { + id: "f7648f9a-e824-4bb3-a260-2b32dae9bc74", + person: { + id: "98dd401c-2b7b-4d9a-9159-720c74d8b23v", + 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: "owner", + }, + ], + }, { id: "7faa7bb7-2de6-422c-a401-1b35cd455303", - start: "2022-10-20T10:00:00Z", - end: "2022-10-20T11:10:00Z", + start: "2022-10-23T10:00:00Z", + end: "2022-10-23T11:10:00Z", kind: "call", subkind: null, description: "", @@ -315,6 +358,16 @@ export function clientsServer() { }, role: null, }, + { + id: "a9239f9a-e824-4bb3-a260-2b32dae9bc76", + person: { + id: "15ff465c-2b7b-4d9a-9159-720c74d8b56d", + last_name: "Елесеевская", + first_name: "Татьяна", + patronymic: "Ивановна", + }, + role: "primary", + }, ], employees: [ { @@ -341,20 +394,20 @@ export function clientsServer() { }, { id: "2faa7bb2-2de6-422c-a401-1b35cd455223", - start: "2022-10-20T10:00:00Z", - end: "2022-10-20T11:10:00Z", + start: "2022-10-24T10:00:00Z", + end: "2022-10-24T11:10:00Z", kind: "call", subkind: null, description: "", location: null, members: [ { - id: "b0509f9a-e824-4bb3-a260-2b32dae9bc81", + id: "a9239f9a-e824-4bb3-a260-2b32dae9bc76", person: { - id: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", - last_name: "Гагарин", - first_name: "Юрий", - patronymic: "Алексеевич", + id: "15ff465c-2b7b-4d9a-9159-720c74d8b56d", + last_name: "Елесеевская", + first_name: "Татьяна", + patronymic: "Ивановна", }, role: null, }, @@ -383,26 +436,36 @@ export function clientsServer() { ], }, { - id: "6faa6bb2-1de4-425c-a401-1b35cd455303", - start: "2022-10-20T20:23:49Z", - end: "2022-10-20T21:23:53Z", + id: "2faa7bb2-2de6-422c-a401-1b35cd455223", + start: "2022-10-24T10:00:00Z", + end: "2022-10-24T11:10:00Z", kind: "call", subkind: null, description: "", location: null, members: [ { - id: "b0509f9a-e824-4bb3-a260-2b32dae9bc81", + id: "a9239f9a-e824-4bb3-a260-2b32dae9bc76", person: { - id: "14ff401c-2b7b-4d9a-9159-720c74d8b23c", - last_name: "Гагарин", - first_name: "Юрий", - patronymic: "Алексеевич", + id: "15ff465c-2b7b-4d9a-9159-720c74d8b56d", + last_name: "Елесеевская", + first_name: "Татьяна", + patronymic: "Ивановна", }, role: null, }, ], employees: [ + { + id: "f451a0c3-c734-4f73-91c2-d7a5674459e422", + employee: { + id: "dv841a15-e867-331f-a658-6325de7c311e", + last_name: "Коломойцев", + first_name: "Илья", + patronymic: "Петрович", + }, + role: "owner", + }, { id: "f941a0c6-c750-4f79-92c0-d7a19354e422", employee: { @@ -413,16 +476,6 @@ export function clientsServer() { }, role: null, }, - { - id: "f941a0c6-c750-4f79-92c0-d7a19354e422", - employee: { - id: "db831a14-e836-481f-a653-6325de7c311e", - last_name: "Жмыхов", - first_name: "Егор", - patronymic: "Сергеевич", - }, - role: null, - }, ], }, ], diff --git a/src/pages/calendar/components/CalendarBackground.vue b/src/pages/calendar/components/CalendarBackground.vue index 238cef4..8f8521b 100644 --- a/src/pages/calendar/components/CalendarBackground.vue +++ b/src/pages/calendar/components/CalendarBackground.vue @@ -8,6 +8,7 @@ :key="owner.id" :owner-data="owner" :style="calculateColumnPosition(index)" + :day-events="filterEventsByOwner(owner)" ) .header(:style="backgroundExtendedWidth") .body.flex.flex-col( @@ -29,6 +30,8 @@ export default { props: { hoursArray: Array, eventsData: Array, + currentDate: Object, + sidebarWidth: String, }, data() { return { @@ -91,11 +94,19 @@ export default { (previous, subsequent) => Boolean(subsequent.id) - Boolean(previous.id) ); }, + filteredEventsByDate() { + return this.eventsData.filter( + ({ start }) => + start.slice(0, 10) === this.currentDate.format("YYYY-MM-DD") + ); + }, }, methods: { calculateColumnPosition(elemIndex) { + let deductible = parseInt(this.sidebarWidth.slice(0, -2), 10) - 72; if (this.ownersArrayLength < 4) { - this.columnWidth = this.backgroundWidth / this.ownersArrayLength; + this.columnWidth = + (this.backgroundWidth - deductible) / this.ownersArrayLength; return { width: `${this.columnWidth}px`, height: `${this.backgroundHeight}px`, @@ -116,6 +127,18 @@ export default { (item) => JSON.stringify(item) === JSON.stringify(object) ); }, + filterEventsByOwner(owner) { + let filteredArray = []; + this.filteredEventsByDate.forEach((item) => { + let foundEvent = item.employees.find( + (elem) => + JSON.stringify(elem.employee) === JSON.stringify(owner) && + elem.role === "owner" + ); + if (foundEvent) filteredArray.push(item); + }); + return filteredArray; + }, }, mounted() { this.calculateBackgroundWidth(); diff --git a/src/pages/calendar/components/CalendarClockColumn.vue b/src/pages/calendar/components/CalendarClockColumn.vue index e56aa62..db06052 100644 --- a/src/pages/calendar/components/CalendarClockColumn.vue +++ b/src/pages/calendar/components/CalendarClockColumn.vue @@ -54,7 +54,7 @@ export default { diff --git a/src/pages/calendar/components/CalendarSchedule.vue b/src/pages/calendar/components/CalendarSchedule.vue index 36d4fb2..ccf047e 100644 --- a/src/pages/calendar/components/CalendarSchedule.vue +++ b/src/pages/calendar/components/CalendarSchedule.vue @@ -16,8 +16,10 @@ :day-end-time="validateEndTime" ) calendar-background( + :current-date="currentDate" :hours-array="hoursArray" :events-data="eventsData" + :sidebar-width="sidebarWidth" ) .time-circle-indicator.left-74px( v-if="isShownIndicator"