From a72696e878f5824f8032b24b1d489b43bf48b24a Mon Sep 17 00:00:00 2001 From: Hugo Zigha Date: Tue, 18 Jul 2023 14:09:45 +0200 Subject: [PATCH] MT#57783 HG master data: add new preference `pbx_hunt_cancel_mode` Change-Id: Idc0c04f254b182f91f1889e9b3c4f4ff1ec3e327 --- src/api/pbx-groups.js | 21 +++++++++- src/api/subscriber.js | 4 ++ .../PbxConfiguration/CscPbxGroupAddForm.vue | 18 +++++++++ src/i18n/en.json | 9 ++++- src/pages/CscPagePbxGroupDetails.vue | 40 ++++++++++++++++++- src/pages/CscPagePbxGroups.vue | 5 ++- src/store/pbx-groups.js | 29 +++++++++++++- 7 files changed, 120 insertions(+), 6 deletions(-) diff --git a/src/api/pbx-groups.js b/src/api/pbx-groups.js index b5f44175..62485b83 100644 --- a/src/api/pbx-groups.js +++ b/src/api/pbx-groups.js @@ -8,7 +8,8 @@ import { setDisplayName, setPbxExtension, setPbxGroupMemberIds, setPbxHuntPolicy, - setPbxHuntTimeout, setSubscriberNumbers + setPbxHuntTimeout, setSubscriberNumbers, + setPbxHuntCancelMode } from './subscriber' import { getAllSoundSets, @@ -127,6 +128,7 @@ export function createGroup (group) { pbx_extension: group.extension, pbx_hunt_policy: group.huntPolicy, pbx_hunt_timeout: group.huntTimeout, + pbx_hunt_cancel_mode: group.huntCancelMode, pbx_groupmember_ids: group.seats }) }).then(($subscriberId) => { @@ -224,6 +226,23 @@ export function setGroupHuntTimeout (options) { }) } +export function setGroupHuntCancelMode (options) { + return new Promise((resolve, reject) => { + Promise.resolve().then(() => { + return setPbxHuntCancelMode(options.groupId, options.groupHuntCancelMode) + }).then(() => { + return getSubscriberAndPreferences(options.groupId) + }).then((result) => { + resolve({ + group: result.subscriber, + preferences: result.preferences + }) + }).catch((err) => { + reject(err) + }) + }) +} + export function setGroupNumbers (options) { return new Promise((resolve, reject) => { setSubscriberNumbers({ diff --git a/src/api/subscriber.js b/src/api/subscriber.js index 1f1aa62b..f561d18a 100644 --- a/src/api/subscriber.js +++ b/src/api/subscriber.js @@ -325,6 +325,10 @@ export function setPbxHuntTimeout (id, pbxHuntTimeout) { return setField(id, 'pbx_hunt_timeout', pbxHuntTimeout) } +export function setPbxHuntCancelMode (id, pbxHuntCancelMode) { + return setField(id, 'pbx_hunt_cancel_mode', pbxHuntCancelMode) +} + export function setPbxGroupMemberIds (id, ids) { return setField(id, 'pbx_groupmember_ids', ids) } diff --git a/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue b/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue index 3c0ba236..8513a8a7 100644 --- a/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue +++ b/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue @@ -59,6 +59,18 @@ data-cy="group-hunt-timeout" @input="$v.data.huntTimeout.$touch" /> +
[] }, + huntCancelModeOptions: { + type: Array, + default: () => [] + }, aliasNumberOptions: { type: Array, default: () => [] @@ -270,6 +286,7 @@ export default { extension: this.data.extension, huntPolicy: this.data.huntPolicy, huntTimeout: this.data.huntTimeout, + huntCancelMode: this.data.huntCancelMode, aliasNumbers: this.data.aliasNumbers, seats: this.data.seats, soundSet: this.data.soundSet @@ -288,6 +305,7 @@ export default { extension: '', huntPolicy: 'serial', huntTimeout: 10, + huntCancelMode: 'cancel', aliasNumbers: [], seats: [], soundSet: null diff --git a/src/i18n/en.json b/src/i18n/en.json index 7475d58f..28d78004 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -78,6 +78,7 @@ "Calls": "Calls", "Calls, Faxes, VoiceMails": "Calls, Faxes, VoiceMails", "Cancel": "Cancel", + "Cancel Mode": "Cancel Mode", "Change Email": "Change Email", "Change PIN": "Change PIN", "Change Password": "Change Password", @@ -128,6 +129,7 @@ "Delete destination": "Delete destination", "Delete forwarding": "Delete forwarding", "Delete recording": "Delete recording", + "Delete registered device": "Delete registered device", "Delete slot?": "Delete slot?", "Delete voicemail after email notification is delivered": "Delete voicemail after email notification is delivered", "Deliver Incoming Faxes": "Deliver Incoming Faxes", @@ -158,6 +160,7 @@ "Enter a number to dial": "Enter a number to dial", "Expires": "Expires", "Extension": "Extension", + "Extension Settings": "Extension Settings", "Fax": "Fax", "Fax Settings": "Fax Settings", "Fax to Mail and Sendfax": "Fax to Mail and Sendfax", @@ -199,8 +202,10 @@ "Group Name": "Group Name", "Group/Seat/Pilot": "Group/Seat/Pilot", "Groups": "Groups", + "Hide number to the callee within own PBX": "Hide number to the callee within own PBX", "Hide number within own PBX": "Hide number within own PBX", "Hide your number to the callee": "Hide your number to the callee", + "Hunt Cancel Mode": "Hunt Cancel Mode", "Hunt Policy": "Hunt Policy", "Hunt Timeout": "Hunt Timeout", "Hunt timeout": "Hunt timeout", @@ -296,7 +301,6 @@ "Only outgoing calls to listed numbers are allowed": "Only outgoing calls to listed numbers are allowed", "Outgoing": "Outgoing", "PBX Configuration": "PBX Configuration", - "Extension Settings": "Extension Settings", "PIN": "PIN", "Page Header": "Page Header", "Page not found": "Page not found", @@ -473,6 +477,8 @@ "User Agent": "User Agent", "User settings": "User settings", "Username": "Username", + "Using Bye": "Using Bye", + "Using Cancel": "Using Cancel", "View All Registered Devices": "View All Registered Devices", "View Call List": "View Call List", "View Voicebox Messages": "View Voicebox Messages", @@ -498,6 +504,7 @@ "You are about to delete slot {slot}": "You are about to delete slot {slot}", "You are about to delete this destination": "You are about to delete this destination", "You are about to delete this forwarding": "You are about to delete this forwarding", + "You are about to delete this registered device": "You are about to delete this registered device", "You are about to delete time range \"{from} - {to}\"": "You are about to delete time range \"{from} - {to}\"", "You are about to remove ACL: From email <{from_email}>": "You are about to remove ACL: From email <{from_email}>", "You are about to remove call queue for {subscriber}": "You are about to remove call queue for {subscriber}", diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index 126ad3dc..ef365b6d 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -135,6 +135,27 @@ /> + + + - + @@ -296,7 +317,8 @@ export default { 'hasCallQueue', 'getGroupUpdateToastMessage', 'getSoundSetByGroupId', - 'isGroupLoading' + 'isGroupLoading', + 'getHuntCancelModeOptions' ]), ...mapGetters('callForwarding', [ 'groups' @@ -313,6 +335,9 @@ export default { hasHuntTimeoutChanged () { return this.changes.huntTimeout !== this.groupSelected.pbx_hunt_timeout }, + hasHuntCancelModeChanged () { + return this.changes.huntCancelMode !== this.groupSelected.pbx_hunt_cancel_mode + }, hasAliasNumbersChanged () { const aliasNumbers = _.clone(this.changes.aliasNumbers) return !_.isEqual(aliasNumbers.sort(), this.getAliasNumberIds().sort()) @@ -374,6 +399,7 @@ export default { 'setGroupExtension', 'setGroupHuntPolicy', 'setGroupHuntTimeout', + 'setGroupHuntCancelMode', 'setGroupSeats', 'setGroupNumbers', 'setGroupSoundSet' @@ -395,6 +421,7 @@ export default { extension: this.groupSelected.pbx_extension, huntPolicy: this.groupSelected.pbx_hunt_policy, huntTimeout: this.groupSelected.pbx_hunt_timeout, + huntCancelMode: this.groupSelected.pbx_hunt_cancel_mode, aliasNumbers: this.getAliasNumberIds(), seats: this.getSeatIds(), soundSet: this.getSoundSetId() @@ -429,6 +456,9 @@ export default { resetHuntTimeout () { this.changes.huntTimeout = this.groupSelected.pbx_hunt_timeout }, + resetHuntCancelMode () { + this.changes.huntCancelMode = this.groupSelected.pbx_hunt_cancel_mode + }, resetAliasNumbers () { this.changes.aliasNumbers = this.getAliasNumberIds() }, @@ -465,6 +495,12 @@ export default { groupId: this.groupSelected.id, groupHuntTimeout: this.changes.huntTimeout }) + } + if (this.hasHuntCancelModeChanged) { + this.setGroupHuntCancelMode({ + groupId: this.groupSelected.id, + groupHuntCancelMode: this.changes.huntCancelMode + }) } if (this.hasAliasNumbersChanged) { this.setGroupNumbers({ diff --git a/src/pages/CscPagePbxGroups.vue b/src/pages/CscPagePbxGroups.vue index 96df5dc4..5efa00fb 100644 --- a/src/pages/CscPagePbxGroups.vue +++ b/src/pages/CscPagePbxGroups.vue @@ -49,6 +49,7 @@ :alias-number-options="getNumberOptions" :sound-set-options="getSoundSetOptions" :hunt-policy-options="getHuntPolicyOptions" + :hunt-cancel-mode-options="getHuntCancelModeOptions" @save="createGroup" @cancel="disableGroupAddForm" /> @@ -94,6 +95,7 @@ :seats="seatMapById" :loading="isGroupLoading(group.id)" :hunt-policy-options="getHuntPolicyOptions" + :hunt-cancel-mode-options="getHuntCancelModeOptions" :label-width="4" @remove="openGroupRemovalDialog(group.id)" /> @@ -204,7 +206,8 @@ export default { 'getGroupRemoveDialogMessage', 'getGroupCreationToastMessage', 'getGroupRemovalToastMessage', - 'getHuntPolicyOptions' + 'getHuntPolicyOptions', + 'getHuntCancelModeOptions' ]), hasFilters () { return Object.keys(this.filters).length > 0 diff --git a/src/store/pbx-groups.js b/src/store/pbx-groups.js index 266da2c1..29ed6d68 100644 --- a/src/store/pbx-groups.js +++ b/src/store/pbx-groups.js @@ -13,7 +13,8 @@ import { setGroupHuntTimeout, setGroupNumbers, setGroupSeats, - setGroupSoundSet + setGroupSoundSet, + setGroupHuntCancelMode } from '../api/pbx-groups' import _ from 'lodash' import Vue from 'vue' @@ -150,6 +151,18 @@ export default { return (groupId) => { return _.get(state, 'preferenceMapById.' + groupId + '.cloud_pbx_callqueue', false) } + }, + getHuntCancelModeOptions () { + return [ + { + label: i18n.t('Using Cancel'), + value: 'cancel' + }, + { + label: i18n.t('Using Bye'), + value: 'bye' + } + ] } }, mutations: { @@ -365,6 +378,20 @@ export default { context.commit('groupUpdateFailed', err.message) }) }, + setGroupHuntCancelMode (context, options) { + context.commit('groupUpdateRequesting', { + groupId: options.groupId, + groupField: i18n.t('Hunt Cancel Mode') + }) + setGroupHuntCancelMode({ + groupId: options.groupId, + groupHuntCancelMode: options.groupHuntCancelMode + }).then((result) => { + context.commit('groupUpdateSucceeded', result) + }).catch((err) => { + context.commit('groupUpdateFailed', err.message) + }) + }, setGroupNumbers (context, options) { context.commit('groupUpdateRequesting', { groupId: options.groupId,