From 9c3f1e6b3f3c3745a2d1c009c4a40833b911224b Mon Sep 17 00:00:00 2001 From: Carlo Venusino Date: Mon, 4 May 2020 18:58:03 +0200 Subject: [PATCH] TT#79307 CF Busy group Change-Id: Ib563a6a4eb2b8cf65da8778cb919abb298b9bb04 --- .../NewCallForward/CscCallForwardGroup.vue | 14 +- .../NewCallForward/CscNewCallForward.vue | 49 ++++-- .../CscNewCallForwardAddDestinationForm.vue | 8 +- .../CscNewCallForwardDestination.vue | 12 +- ...NewCallForwardDestinationsetTypeSelect.vue | 44 +++++- src/locales/en.json | 10 +- src/store/new-call-forward.js | 149 ++++++++++++------ 7 files changed, 206 insertions(+), 80 deletions(-) diff --git a/src/components/pages/NewCallForward/CscCallForwardGroup.vue b/src/components/pages/NewCallForward/CscCallForwardGroup.vue index 74d315f9..e4d696cf 100644 --- a/src/components/pages/NewCallForward/CscCallForwardGroup.vue +++ b/src/components/pages/NewCallForward/CscCallForwardGroup.vue @@ -9,7 +9,7 @@
- {{ !(groupsCount < 2 && (group.name.includes('timeout') || group.name.includes('unconditional'))) ? groupTitle :"" }} + {{ groupTitle }}
@@ -36,7 +36,7 @@ :index="index" :groupId="group.id" :groupName="group.name" - :allCallsFwd="group.name == 'csc-unconditional' && index === 0" + :allCallsFwd="(['csc-unconditional', 'csc-busy', 'csc-offline'].includes(group.name) && index === 0)" :class="{ 'cf-destination-disabled': !isEnabled }" /> @@ -81,6 +81,7 @@
@@ -137,7 +138,7 @@ async mounted(){ try{ if(!this.inCreation){ - const isGroupEnabled = await this.$store.dispatch('newCallForward/isGroupEnabled', this.group.name); + const isGroupEnabled = await this.$store.dispatch('newCallForward/isGroupEnabled', {groupName: this.group.name, id: this.group.id}); this.isEnabled = isGroupEnabled; } @@ -172,6 +173,9 @@ case "csc-offline": title = `${this.$t('pages.newCallForward.titles.offlineGroup')}`; break; + case "csc-busy": + title = `${this.$t('pages.newCallForward.titles.busyGroup')}`; + break; } return title; } @@ -231,10 +235,6 @@ width 100% .csc-cf-group-cont position relative - .csc-cf-group-title - font-weight bold - .csc-cf-group-title - text-align right .csc-cf-destination-label text-align right .csc-cf-destination-value diff --git a/src/components/pages/NewCallForward/CscNewCallForward.vue b/src/components/pages/NewCallForward/CscNewCallForward.vue index c19674aa..b7c98537 100644 --- a/src/components/pages/NewCallForward/CscNewCallForward.vue +++ b/src/components/pages/NewCallForward/CscNewCallForward.vue @@ -2,6 +2,27 @@ +
+
+ {{ $t('pages.newCallForward.titles.timeoutGroup') }} +
+
+ +
+
+
+
@@ -20,10 +41,6 @@ class="col col-xs-12 col-md-6" > -
@@ -137,8 +155,8 @@ try{ await this.$store.dispatch('newCallForward/loadMappings'); await this.$store.dispatch('newCallForward/loadForwardGroups'); - let unconditionalGroup = await this.$store.dispatch('newCallForward/getForwardGroupByName', 'unconditional'); - this.toggleDefaultNumber = !unconditionalGroup || unconditionalGroup.destinations.length < 1; + let unconditionalGroups = await this.$store.dispatch('newCallForward/getForwardGroupByName', 'unconditional'); + this.toggleDefaultNumber = !unconditionalGroups; //|| unconditionalGroup.destinations.length < 1; } catch(err){ console.log(err) @@ -168,14 +186,14 @@ switch(selectedDestType){ case "unconditional":{ if(this.toggleDefaultNumber){ - const timeoutFwdGroup = await this.$store.dispatch('newCallForward/getForwardGroupByName', 'timeout'); - if(!timeoutFwdGroup){ + const tempTimeoutFwdGroup = await this.$store.dispatch('newCallForward/getForwardGroupById', 'temp-csc-timeout'); + if(!tempTimeoutFwdGroup){ await this.$store.dispatch('newCallForward/addTempGroup','timeout' ); } } else{ - const unconditionalFwdGroup = await this.$store.dispatch('newCallForward/getForwardGroupByName', 'unconditional'); - if(!unconditionalFwdGroup){ + const tempUnconditionalFwdGroup = await this.$store.dispatch('newCallForward/getForwardGroupById', 'temp-csc-unconditional'); + if(!tempUnconditionalFwdGroup){ await this.$store.dispatch('newCallForward/addTempGroup','unconditional' ); } } @@ -184,7 +202,10 @@ case "offline":{ await this.$store.dispatch('newCallForward/addTempGroup','offline' ); } - + break; + case "busy":{ + await this.$store.dispatch('newCallForward/addTempGroup','busy' ); + } break; } @@ -198,6 +219,9 @@ this.groupInCreation = true; await this.$store.dispatch('newCallForward/forwardAllCalls', !this.toggleDefaultNumber); this.groupInCreation = false; + }, + async resetSelectFwdGroup(){ + await this.$store.dispatch('newCallForward/setSelectedDestType', null); } } } @@ -208,6 +232,9 @@ .csc-cf-flat-btn color $primary float right + .csc-cf-group-title + text-align right + font-weight bold .csc-cf-destinations-cont margin-top 25px .csc-cf-field-toggle diff --git a/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue b/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue index ce91ff5a..81e33243 100644 --- a/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue +++ b/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue @@ -81,7 +81,8 @@ 'index', 'disable', 'loading', - 'groupName' + 'groupName', + 'groupId' ], validations: { number: { @@ -103,8 +104,9 @@ }, methods: { async save() { + const forwardGroupId = this.groupId; const forwardGroupName = this.groupName; - const forwardGroup = await this.$store.dispatch('newCallForward/getForwardGroupByName', forwardGroupName); + const forwardGroup = await this.$store.dispatch('newCallForward/getForwardGroupById', forwardGroupId); if (this.numberError || this.saveDisabled) { showGlobalError(this.$t('validationErrors.generic')); } @@ -115,7 +117,7 @@ destination: this.number }); } - else { // new destination + else { // new group await this.$store.dispatch('newCallForward/setDestinationInCreation', true); if(forwardGroup.id.toString().includes('temp-')){ // unexisting group forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :) diff --git a/src/components/pages/NewCallForward/CscNewCallForwardDestination.vue b/src/components/pages/NewCallForward/CscNewCallForwardDestination.vue index a68ad33b..85ccf2c2 100644 --- a/src/components/pages/NewCallForward/CscNewCallForwardDestination.vue +++ b/src/components/pages/NewCallForward/CscNewCallForwardDestination.vue @@ -29,7 +29,7 @@ {{ this.allCallsFwd ? $t('pages.newCallForward.allCallsForwardedTo') - : isVoiceMail() + : isVoiceMail() || isOfflineGroup() || isBusyGroup() ? $t('pages.newCallForward.destinationVoicemailLabel') : $t('pages.newCallForward.destinationNumberLabel') }} @@ -68,6 +68,7 @@ :index="this.destinationIndex" :destination="this.destinationNumber" :groupName="this.groupName" + :groupId="this.groupId" />
@@ -218,6 +219,15 @@ isVoiceMail(){ return this.destination.destination.includes('voicebox.local') }, + isBusyGroup(){ + return this.groupName.includes('busy'); + }, + isOfflineGroup(){ + return this.groupName.includes('offline'); + }, + isNotTimeoutOrUnconditional(){ + return this.destination.destination.includes('voicebox.local') + }, getDestName(){ return this.destination.simple_destination ? this.destination.simple_destination diff --git a/src/components/pages/NewCallForward/CscNewCallForwardDestinationsetTypeSelect.vue b/src/components/pages/NewCallForward/CscNewCallForwardDestinationsetTypeSelect.vue index e0c664b7..b0020711 100644 --- a/src/components/pages/NewCallForward/CscNewCallForwardDestinationsetTypeSelect.vue +++ b/src/components/pages/NewCallForward/CscNewCallForwardDestinationsetTypeSelect.vue @@ -4,20 +4,32 @@ >
- {{ $t('pages.newCallForward.uncoditionalLabel') }} + {{ $t('pages.newCallForward.unconditionalLabel') }}
- {{ $t('pages.newCallForward.offlinelLabel') }} + {{ $t('pages.newCallForward.offlineLabel') }} +
+
+ {{ $t('pages.newCallForward.busyLabel') }}