From 793e634d46d1d72f4e7badd41c96f52f9c8774e2 Mon Sep 17 00:00:00 2001 From: Sergii Leonenko Date: Fri, 26 Feb 2021 22:19:01 +0200 Subject: [PATCH] TT#112013 CF - Fix date range data creation and interpretation AC: Can see the data converted properly after saving Can see the data rendered properly after fetching it again Change-Id: I98259176b0dcbcfd76030305905e4e8c454df004 --- src/api/call-forwarding.js | 26 +- .../CscCfGroupConditionDateRange.vue | 98 ++- .../CscCfGroupConditionOfficeHours.vue | 2 - src/css/app.styl | 3 + src/filters/time-set.js | 15 +- src/helpers/kamailio-timesets-converter.js | 468 ++++++++++- src/i18n/de.json | 4 +- src/i18n/en.json | 4 +- src/i18n/es.json | 4 +- src/i18n/fr.json | 4 +- src/i18n/it.json | 4 +- t/unit/kamailio-timesets-converter.js | 373 --------- .../kamailio-timesets-converter.spec.js | 778 +++++++++++++++--- 13 files changed, 1211 insertions(+), 572 deletions(-) delete mode 100644 t/unit/kamailio-timesets-converter.js diff --git a/src/api/call-forwarding.js b/src/api/call-forwarding.js index d0836dfb..6abe9550 100644 --- a/src/api/call-forwarding.js +++ b/src/api/call-forwarding.js @@ -162,41 +162,23 @@ export async function cfDeleteTimeSet (timesetId) { }) } -export async function cfCreateTimeSetDateRange (subscriberId, date) { +export async function cfCreateTimeSetDateRange (subscriberId, times) { return post({ resource: 'cftimesets', body: { subscriber_id: subscriberId, name: 'csc-date-range-' + v4(), - times: [ - { - minute: null, - month: date.from.month + '-' + date.to.month, - hour: null, - mday: date.from.date + '-' + date.to.date, - year: date.from.year + '-' + date.to.year, - wday: null - } - ] + times: times } }) } -export async function cfUpdateTimeSetDateRange (timeSetId, date) { +export async function cfUpdateTimeSetDateRange (timeSetId, times) { return patchReplace({ resource: 'cftimesets', resourceId: timeSetId, fieldPath: 'times', - value: [ - { - minute: null, - month: date.from.month + '-' + date.to.month, - hour: null, - mday: date.from.date + '-' + date.to.date, - year: date.from.year + '-' + date.to.year, - wday: null - } - ] + value: times }) } diff --git a/src/components/call-forwarding/CscCfGroupConditionDateRange.vue b/src/components/call-forwarding/CscCfGroupConditionDateRange.vue index 910115db..d33fa9db 100644 --- a/src/components/call-forwarding/CscCfGroupConditionDateRange.vue +++ b/src/components/call-forwarding/CscCfGroupConditionDateRange.vue @@ -6,14 +6,32 @@ v-bind="$attrs" v-on="$listeners" > - + +