MT#57783 HG master data: add new preference `pbx_hunt_cancel_mode`

Change-Id: Idc0c04f254b182f91f1889e9b3c4f4ff1ec3e327
mr12.0
Hugo Zigha 2 years ago committed by Hugo Zigha
parent 053682210a
commit a72696e878

@ -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({

@ -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)
}

@ -59,6 +59,18 @@
data-cy="group-hunt-timeout"
@input="$v.data.huntTimeout.$touch"
/>
<q-select
v-model="data.huntCancelMode"
radio
emit-value
map-options
hide-bottom-space
:disable="loading"
:readonly="loading"
:label="$t('Cancel Mode')"
:options="huntCancelModeOptions"
data-cy="group-hunt-cancel-mode"
/>
</div>
<div
class="col-3"
@ -157,6 +169,10 @@ export default {
type: Array,
default: () => []
},
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

@ -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}",

@ -135,6 +135,27 @@
/>
</template>
</q-input>
<q-select
v-model="changes.huntCancelMode"
emit-value
map-options
radio
:label="$t('Cancel Mode')"
:disable="isLoading"
:options="getHuntCancelModeOptions"
>
<template
v-if="hasHuntCancelModeChanged"
v-slot:append
>
<csc-input-button-save
@click.stop="save"
/>
<csc-input-button-reset
@click.stop="resetHuntCancelMode"
/>
</template>
</q-select>
<q-select
v-model="changes.aliasNumbers"
emit-value
@ -211,7 +232,7 @@
/>
</q-list>
</q-item>
<csc-call-forward-details
v-else
:id="id"/>
@ -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({

@ -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

@ -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,

Loading…
Cancel
Save