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 @@
- {{ timesScope.weekDay }}
- {{ timesScope.month }}
+ {{ weekDay }}
+ {{ month }}
- {{ 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 @@
-
+
@@ -9,8 +9,8 @@
{{ time }}
-
- {{ weekDay }}
+
+
@@ -99,6 +99,7 @@ import TimelineRowDuration from '../utils/timeline-row-duration.vue';
import TimelineRowInfo from '../utils/timeline-row-info.vue';
import TimelineRowInitiator from '../utils/timeline-row-initiator.vue';
import TimelineRow from '../utils/timeline-row.vue';
+import TimelineTaskStatus from '../utils/timeline-task-status.vue';
const props = defineProps({
item: {
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 b48fddbb..615d5f90 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
@@ -9,6 +9,7 @@
import { computed } from 'vue';
import ChatTaskTimelineRow from './chat-task-timeline-row.vue';
import CallTaskTimelineRow from './call-task-timeline-row.vue';
+import { WebitelContactsTimelineEventType } from 'webitel-sdk';
const props = defineProps({
item: {
@@ -19,10 +20,8 @@ const props = defineProps({
const component = computed(() => {
switch (props.item.type) {
- case 'chat': // TODO Yehor enum
- return ChatTaskTimelineRow;
- case 'call': // TODO Yehor enum
- return CallTaskTimelineRow;
+ case WebitelContactsTimelineEventType.Chat: return ChatTaskTimelineRow;
+ case WebitelContactsTimelineEventType.Call: return CallTaskTimelineRow;
// default:
// return throw new Error(`Unknown item type, ${props.item.type}!`);
}
diff --git a/src/modules/contacts/modules/timeline/components/the-timeline.vue b/src/modules/contacts/modules/timeline/components/the-timeline.vue
index 43f79737..ec5238f9 100644
--- a/src/modules/contacts/modules/timeline/components/the-timeline.vue
+++ b/src/modules/contacts/modules/timeline/components/the-timeline.vue
@@ -18,10 +18,9 @@
/>
diff --git a/src/modules/contacts/modules/timeline/components/timeline-header.vue b/src/modules/contacts/modules/timeline/components/timeline-header.vue
index da102e47..6bf310e3 100644
--- a/src/modules/contacts/modules/timeline/components/timeline-header.vue
+++ b/src/modules/contacts/modules/timeline/components/timeline-header.vue
@@ -32,7 +32,7 @@ const props = defineProps({
},
});
-const { t } = useI18n();
+const { d, t } = useI18n();
const store = useStore();
const { filtersNamespace } = useTableFilters(props.namespace);
@@ -54,16 +54,16 @@ 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)));////Math.floor
+const displayedDateFrom = computed(() => dateFrom.value || (new Date().setMonth(new Date().getMonth() - 1)));
const displayedDateTo = computed(() => dateTo.value || (new Date().getTime()));
const durationTimeline = computed(() => `${formatDate(displayedDateFrom.value)} - ${formatDate(displayedDateTo.value)}`);
-function formatDate(date) { ///i18n
+function formatDate(date) {
const fullDate = new Date(+date);
- const mouth = fullDate.toLocaleString('en', { month: 'short' }).toLowerCase();
- const year = fullDate.toLocaleString('en', { year: 'numeric' });
- return t(`contacts.timeline.mouth.${mouth}`) + ' ' + year;
+ const mouth = d(fullDate, { month: 'long' });
+ const year = d(fullDate, { year: 'numeric' });
+ return `${mouth} ${year}`;
}
diff --git a/src/modules/contacts/modules/timeline/components/utils/timeline-pin.vue b/src/modules/contacts/modules/timeline/components/utils/timeline-pin.vue
index ae937c27..8673231a 100644
--- a/src/modules/contacts/modules/timeline/components/utils/timeline-pin.vue
+++ b/src/modules/contacts/modules/timeline/components/utils/timeline-pin.vue
@@ -1,11 +1,12 @@
{{ text }}
-
@@ -13,6 +14,7 @@
diff --git a/src/modules/contacts/modules/timeline/components/utils/timeline-row-info.vue b/src/modules/contacts/modules/timeline/components/utils/timeline-row-info.vue
index 2bfcef28..a75a3e18 100644
--- a/src/modules/contacts/modules/timeline/components/utils/timeline-row-info.vue
+++ b/src/modules/contacts/modules/timeline/components/utils/timeline-row-info.vue
@@ -22,6 +22,7 @@
diff --git a/src/modules/contacts/modules/timeline/components/utils/timeline-separator.vue b/src/modules/contacts/modules/timeline/components/utils/timeline-separator.vue
new file mode 100644
index 00000000..63ce5638
--- /dev/null
+++ b/src/modules/contacts/modules/timeline/components/utils/timeline-separator.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
diff --git a/src/modules/contacts/modules/timeline/components/event-status-detail.vue b/src/modules/contacts/modules/timeline/components/utils/timeline-task-status.vue
similarity index 61%
rename from src/modules/contacts/modules/timeline/components/event-status-detail.vue
rename to src/modules/contacts/modules/timeline/components/utils/timeline-task-status.vue
index 8308437e..df247825 100644
--- a/src/modules/contacts/modules/timeline/components/event-status-detail.vue
+++ b/src/modules/contacts/modules/timeline/components/utils/timeline-task-status.vue
@@ -1,14 +1,11 @@
-
-
{{ eventTime }}
-
+
{{ t(`contacts.timeline.status.${ status }`) }}
-