From 1a36b0539079a4b79de15b82fbb667d09e38b769 Mon Sep 17 00:00:00 2001 From: Lera24 Date: Wed, 24 Apr 2024 18:20:25 +0300 Subject: [PATCH] fix:components layout and some computeds[WTEL-4418] --- .../call-task-timeline-actions.vue | 50 ++++++----- .../day-row/day-timeline-row-section.vue | 2 +- .../task-row/call-task-timeline-row.vue | 82 +++++++++++-------- .../components/task-row/task-timeline-row.vue | 8 +- .../timeline/components/timeline-header.vue | 23 +++--- .../utils/timeline-row-duration.vue | 1 + .../components/utils/timeline-row.vue | 10 --- .../task-row/chat-task-timeline-row.vue | 4 +- 8 files changed, 97 insertions(+), 83 deletions(-) diff --git a/src/modules/contacts/modules/timeline/components/call-task-actions/call-task-timeline-actions.vue b/src/modules/contacts/modules/timeline/components/call-task-actions/call-task-timeline-actions.vue index 28b78b9d..3811cfd3 100644 --- a/src/modules/contacts/modules/timeline/components/call-task-actions/call-task-timeline-actions.vue +++ b/src/modules/contacts/modules/timeline/components/call-task-actions/call-task-timeline-actions.vue @@ -1,23 +1,26 @@ + + diff --git a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-section.vue b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-section.vue index cebc59f3..0fa98df3 100644 --- a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-section.vue +++ b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-section.vue @@ -10,7 +10,7 @@
diff --git a/src/modules/contacts/modules/timeline/components/task-row/call-task-timeline-row.vue b/src/modules/contacts/modules/timeline/components/task-row/call-task-timeline-row.vue index 8fc09489..ae559cd5 100644 --- a/src/modules/contacts/modules/timeline/components/task-row/call-task-timeline-row.vue +++ b/src/modules/contacts/modules/timeline/components/task-row/call-task-timeline-row.vue @@ -23,36 +23,39 @@ - + + + + @@ -71,7 +74,7 @@ import TimelineTaskStatus from '../utils/timeline-task-status.vue'; import CallTaskTimelineActions from '../call-task-actions/call-task-timeline-actions.vue'; const props = defineProps({ - item: { + task: { type: Object, required: true, }, @@ -86,10 +89,9 @@ const { flowScheme, queue, id, -} = toRefs(props.item); +} = toRefs(props.task); const openHiddenUsers = ref(false); -const hiddenUsers = computed(() => participants.value.filter((participant, idx) => idx)); const taskType = computed(() => { if (type.value === WebitelContactsTimelineEventType.Chat) { @@ -113,23 +115,35 @@ const taskStatus = computed(() => taskType.value.includes(TimelinePinTypeEnum.CA const taskInitiator = computed(() => { switch (taskType.value) { case TimelinePinTypeEnum.CALL_INBOUND_ON_IVR: - return flowScheme.value.name; + return flowScheme.value; case TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE: - return queue.value.name; + return queue.value; default: - return participants.value[0].name; + return participants.value[0]; } }); + +const hiddenUsers = computed(() => participants.value.filter(participant => participant.id !== taskInitiator.value.id)); diff --git a/src/modules/contacts/modules/timeline/components/task-row/task-timeline-row.vue b/src/modules/contacts/modules/timeline/components/task-row/task-timeline-row.vue index b0e65b88..6915d117 100644 --- a/src/modules/contacts/modules/timeline/components/task-row/task-timeline-row.vue +++ b/src/modules/contacts/modules/timeline/components/task-row/task-timeline-row.vue @@ -1,7 +1,7 @@ @@ -12,17 +12,17 @@ import CallTaskTimelineRow from './call-task-timeline-row.vue'; import { WebitelContactsTimelineEventType } from 'webitel-sdk'; const props = defineProps({ - item: { + task: { type: Object, required: true, }, }); const component = computed(() => { - switch (props.item.type) { + switch (props.task.type) { case WebitelContactsTimelineEventType.Chat: return ChatTaskTimelineRow; case WebitelContactsTimelineEventType.Call: return CallTaskTimelineRow; - default: throw new Error(`Unknown item type, ${props.item.type}!`); + default: throw new Error(`Unknown item type, ${props.task.type}!`); } }); diff --git a/src/modules/contacts/modules/timeline/components/timeline-header.vue b/src/modules/contacts/modules/timeline/components/timeline-header.vue index 638317a7..06b80daa 100644 --- a/src/modules/contacts/modules/timeline/components/timeline-header.vue +++ b/src/modules/contacts/modules/timeline/components/timeline-header.vue @@ -50,20 +50,19 @@ const taskCounters = computed(() => { }) }); -const dateFrom = computed(() => props.list[props.list.length - 1]?.dayTimestamp); -const dateTo = computed(() => props.list[0]?.dayTimestamp); - -const displayedDateFrom = computed(() => dateFrom.value || (new Date().setMonth(new Date().getMonth() - 1))); -const displayedDateTo = computed(() => dateTo.value || (new Date().getTime())); +const durationTimeline = computed(() => { + const formatDate = (date) => { + const fullDate = new Date(+date); + const mouth = d(fullDate, { month: 'long' }); + const year = d(fullDate, { year: 'numeric' }); + return `${mouth} ${year}`; + } -const durationTimeline = computed(() => `${formatDate(displayedDateFrom.value)} - ${formatDate(displayedDateTo.value)}`); + const from = props.list.at(-1)?.dayTimestamp || (new Date().setMonth(new Date().getMonth() - 1)); + const to = props.list.at(1)?.dayTimestamp || new Date().getTime(); -function formatDate(date) { - const fullDate = new Date(+date); - const mouth = d(fullDate, { month: 'long' }); - const year = d(fullDate, { year: 'numeric' }); - return `${mouth} ${year}`; -} + return `${formatDate(from)} - ${formatDate(to)}` +})