diff --git a/package-lock.json b/package-lock.json index 60eca7bb..27e0a4ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "@vitejs/plugin-vue": "5.0.3", "@vitest/coverage-v8": "^1.1.3", "@vue/test-utils": "^2.0.0-0", + "deep-copy": "^1.4.2", "eslint": "^8.56.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-vue": "^9.20.0", diff --git a/package.json b/package.json index cff65bb3..6f28829d 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@vitejs/plugin-vue": "5.0.3", "@vitest/coverage-v8": "^1.1.3", "@vue/test-utils": "^2.0.0-0", + "deep-copy": "^1.4.2", "eslint": "^8.56.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-vue": "^9.20.0", diff --git a/src/modules/contacts/modules/timeline/api/TimelineAPI.js b/src/modules/contacts/modules/timeline/api/TimelineAPI.js index 4bd1eec9..6f9cbc1e 100644 --- a/src/modules/contacts/modules/timeline/api/TimelineAPI.js +++ b/src/modules/contacts/modules/timeline/api/TimelineAPI.js @@ -4,6 +4,7 @@ import applyTransform, { merge, notify, sanitize, snakeToCamel, starToSearch, mergeEach, } from '@webitel/ui-sdk/src/api/transformers'; +import deepCopy from 'deep-copy'; import { TimelineApiFactory } from 'webitel-sdk'; import getDefaultGetListResponse from '../../../../../app/api/defaults/getDefaultGetListResponse'; @@ -12,40 +13,52 @@ import instance from '../../../../../app/api/instance'; const timeline = new TimelineApiFactory(configuration, '', instance); -const getList = async (params) => { - const fieldsToSend = ['parentId', 'dateFrom', 'dateTo', 'type']; - const { - parentId, - dateFrom, - dateTo, - type, - } = applyTransform(params, [ - sanitize(fieldsToSend), - merge(getDefaultGetParams()), - ]); - try { - const response = await timeline.getTimeline( +const listHandler = (items) => { + let copy = deepCopy(items); + if(copy) { + return copy.map(day => ({ + ...day, + items: day.items.map(item => ({ + ...item, + type:!item.type ? 'chat' : item.type, + })) + })); + } return copy; +} + + const getList = async (params) => { + const fieldsToSend = ['parentId', 'dateFrom', 'dateTo', 'type']; + const { parentId, dateFrom, dateTo, - // type, - ); - const { days, next } = applyTransform(response.data, [ - snakeToCamel(), - merge(getDefaultGetListResponse()), - ]); - return { - items: applyTransform(days, [ - ]), - next, - }; - } catch (err) { - throw applyTransform(err, [ - notify, + type, + } = applyTransform(params, [ + sanitize(fieldsToSend), + merge(getDefaultGetParams()), ]); - } -}; + try { + const response = await timeline.getTimeline( + parentId, + dateFrom, + dateTo, + // type, + ); + const { days, next } = applyTransform(response.data, [ + snakeToCamel(), + merge(getDefaultGetListResponse()), + ]); + return { + items: applyTransform(days, [ + listHandler, + ]), + next, + }; + } catch (err) { + throw applyTransform(err, [ + notify, + ]); + } + }; -export default { - getList, -}; + export default { getList };; diff --git a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-counters.vue b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-counters.vue index 3e1eb246..e4993058 100644 --- a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-counters.vue +++ b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row-counters.vue @@ -31,6 +31,7 @@ const { t } = useI18n(); justify-content: flex-end; &__wrapper { + @extend %typo-body-2; display: flex; gap: var(--spacing-xs); } 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 d8816d0b..f0a72cf1 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 @@ -4,13 +4,12 @@ :timestamp="day.dayTimestamp" :calls-count="day.callsCount" :chats-count="day.chatsCount" - :last-day="lastDay" @toggle="opened = !opened" />
@@ -27,10 +26,6 @@ const props = defineProps({ day: { type: Object, }, - lastDay: { - type: Boolean, - default: false, - }, }); const opened = ref(false); diff --git a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row.vue b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row.vue index 155fa386..76be6130 100644 --- a/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row.vue +++ b/src/modules/contacts/modules/timeline/components/day-row/day-timeline-row.vue @@ -4,10 +4,9 @@ - - + + - {{ props.timestamp }} - - - - - - - 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 2d55d8ab..f36a5fde 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 @@ -1,7 +1,7 @@