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

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

@ -8,7 +8,8 @@ import {
setDisplayName, setDisplayName,
setPbxExtension, setPbxGroupMemberIds, setPbxExtension, setPbxGroupMemberIds,
setPbxHuntPolicy, setPbxHuntPolicy,
setPbxHuntTimeout, setSubscriberNumbers setPbxHuntTimeout, setSubscriberNumbers,
setPbxHuntCancelMode
} from './subscriber' } from './subscriber'
import { import {
getAllSoundSets, getAllSoundSets,
@ -127,6 +128,7 @@ export function createGroup (group) {
pbx_extension: group.extension, pbx_extension: group.extension,
pbx_hunt_policy: group.huntPolicy, pbx_hunt_policy: group.huntPolicy,
pbx_hunt_timeout: group.huntTimeout, pbx_hunt_timeout: group.huntTimeout,
pbx_hunt_cancel_mode: group.huntCancelMode,
pbx_groupmember_ids: group.seats pbx_groupmember_ids: group.seats
}) })
}).then(($subscriberId) => { }).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) { export function setGroupNumbers (options) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setSubscriberNumbers({ setSubscriberNumbers({

@ -325,6 +325,10 @@ export function setPbxHuntTimeout (id, pbxHuntTimeout) {
return setField(id, 'pbx_hunt_timeout', 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) { export function setPbxGroupMemberIds (id, ids) {
return setField(id, 'pbx_groupmember_ids', ids) return setField(id, 'pbx_groupmember_ids', ids)
} }

@ -59,6 +59,18 @@
data-cy="group-hunt-timeout" data-cy="group-hunt-timeout"
@input="$v.data.huntTimeout.$touch" @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>
<div <div
class="col-3" class="col-3"
@ -157,6 +169,10 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
huntCancelModeOptions: {
type: Array,
default: () => []
},
aliasNumberOptions: { aliasNumberOptions: {
type: Array, type: Array,
default: () => [] default: () => []
@ -270,6 +286,7 @@ export default {
extension: this.data.extension, extension: this.data.extension,
huntPolicy: this.data.huntPolicy, huntPolicy: this.data.huntPolicy,
huntTimeout: this.data.huntTimeout, huntTimeout: this.data.huntTimeout,
huntCancelMode: this.data.huntCancelMode,
aliasNumbers: this.data.aliasNumbers, aliasNumbers: this.data.aliasNumbers,
seats: this.data.seats, seats: this.data.seats,
soundSet: this.data.soundSet soundSet: this.data.soundSet
@ -288,6 +305,7 @@ export default {
extension: '', extension: '',
huntPolicy: 'serial', huntPolicy: 'serial',
huntTimeout: 10, huntTimeout: 10,
huntCancelMode: 'cancel',
aliasNumbers: [], aliasNumbers: [],
seats: [], seats: [],
soundSet: null soundSet: null

@ -78,6 +78,7 @@
"Calls": "Calls", "Calls": "Calls",
"Calls, Faxes, VoiceMails": "Calls, Faxes, VoiceMails", "Calls, Faxes, VoiceMails": "Calls, Faxes, VoiceMails",
"Cancel": "Cancel", "Cancel": "Cancel",
"Cancel Mode": "Cancel Mode",
"Change Email": "Change Email", "Change Email": "Change Email",
"Change PIN": "Change PIN", "Change PIN": "Change PIN",
"Change Password": "Change Password", "Change Password": "Change Password",
@ -128,6 +129,7 @@
"Delete destination": "Delete destination", "Delete destination": "Delete destination",
"Delete forwarding": "Delete forwarding", "Delete forwarding": "Delete forwarding",
"Delete recording": "Delete recording", "Delete recording": "Delete recording",
"Delete registered device": "Delete registered device",
"Delete slot?": "Delete slot?", "Delete slot?": "Delete slot?",
"Delete voicemail after email notification is delivered": "Delete voicemail after email notification is delivered", "Delete voicemail after email notification is delivered": "Delete voicemail after email notification is delivered",
"Deliver Incoming Faxes": "Deliver Incoming Faxes", "Deliver Incoming Faxes": "Deliver Incoming Faxes",
@ -158,6 +160,7 @@
"Enter a number to dial": "Enter a number to dial", "Enter a number to dial": "Enter a number to dial",
"Expires": "Expires", "Expires": "Expires",
"Extension": "Extension", "Extension": "Extension",
"Extension Settings": "Extension Settings",
"Fax": "Fax", "Fax": "Fax",
"Fax Settings": "Fax Settings", "Fax Settings": "Fax Settings",
"Fax to Mail and Sendfax": "Fax to Mail and Sendfax", "Fax to Mail and Sendfax": "Fax to Mail and Sendfax",
@ -199,8 +202,10 @@
"Group Name": "Group Name", "Group Name": "Group Name",
"Group/Seat/Pilot": "Group/Seat/Pilot", "Group/Seat/Pilot": "Group/Seat/Pilot",
"Groups": "Groups", "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 number within own PBX": "Hide number within own PBX",
"Hide your number to the callee": "Hide your number to the callee", "Hide your number to the callee": "Hide your number to the callee",
"Hunt Cancel Mode": "Hunt Cancel Mode",
"Hunt Policy": "Hunt Policy", "Hunt Policy": "Hunt Policy",
"Hunt Timeout": "Hunt Timeout", "Hunt Timeout": "Hunt Timeout",
"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", "Only outgoing calls to listed numbers are allowed": "Only outgoing calls to listed numbers are allowed",
"Outgoing": "Outgoing", "Outgoing": "Outgoing",
"PBX Configuration": "PBX Configuration", "PBX Configuration": "PBX Configuration",
"Extension Settings": "Extension Settings",
"PIN": "PIN", "PIN": "PIN",
"Page Header": "Page Header", "Page Header": "Page Header",
"Page not found": "Page not found", "Page not found": "Page not found",
@ -473,6 +477,8 @@
"User Agent": "User Agent", "User Agent": "User Agent",
"User settings": "User settings", "User settings": "User settings",
"Username": "Username", "Username": "Username",
"Using Bye": "Using Bye",
"Using Cancel": "Using Cancel",
"View All Registered Devices": "View All Registered Devices", "View All Registered Devices": "View All Registered Devices",
"View Call List": "View Call List", "View Call List": "View Call List",
"View Voicebox Messages": "View Voicebox Messages", "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 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 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 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 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 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}", "You are about to remove call queue for {subscriber}": "You are about to remove call queue for {subscriber}",

@ -135,6 +135,27 @@
/> />
</template> </template>
</q-input> </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 <q-select
v-model="changes.aliasNumbers" v-model="changes.aliasNumbers"
emit-value emit-value
@ -296,7 +317,8 @@ export default {
'hasCallQueue', 'hasCallQueue',
'getGroupUpdateToastMessage', 'getGroupUpdateToastMessage',
'getSoundSetByGroupId', 'getSoundSetByGroupId',
'isGroupLoading' 'isGroupLoading',
'getHuntCancelModeOptions'
]), ]),
...mapGetters('callForwarding', [ ...mapGetters('callForwarding', [
'groups' 'groups'
@ -313,6 +335,9 @@ export default {
hasHuntTimeoutChanged () { hasHuntTimeoutChanged () {
return this.changes.huntTimeout !== this.groupSelected.pbx_hunt_timeout return this.changes.huntTimeout !== this.groupSelected.pbx_hunt_timeout
}, },
hasHuntCancelModeChanged () {
return this.changes.huntCancelMode !== this.groupSelected.pbx_hunt_cancel_mode
},
hasAliasNumbersChanged () { hasAliasNumbersChanged () {
const aliasNumbers = _.clone(this.changes.aliasNumbers) const aliasNumbers = _.clone(this.changes.aliasNumbers)
return !_.isEqual(aliasNumbers.sort(), this.getAliasNumberIds().sort()) return !_.isEqual(aliasNumbers.sort(), this.getAliasNumberIds().sort())
@ -374,6 +399,7 @@ export default {
'setGroupExtension', 'setGroupExtension',
'setGroupHuntPolicy', 'setGroupHuntPolicy',
'setGroupHuntTimeout', 'setGroupHuntTimeout',
'setGroupHuntCancelMode',
'setGroupSeats', 'setGroupSeats',
'setGroupNumbers', 'setGroupNumbers',
'setGroupSoundSet' 'setGroupSoundSet'
@ -395,6 +421,7 @@ export default {
extension: this.groupSelected.pbx_extension, extension: this.groupSelected.pbx_extension,
huntPolicy: this.groupSelected.pbx_hunt_policy, huntPolicy: this.groupSelected.pbx_hunt_policy,
huntTimeout: this.groupSelected.pbx_hunt_timeout, huntTimeout: this.groupSelected.pbx_hunt_timeout,
huntCancelMode: this.groupSelected.pbx_hunt_cancel_mode,
aliasNumbers: this.getAliasNumberIds(), aliasNumbers: this.getAliasNumberIds(),
seats: this.getSeatIds(), seats: this.getSeatIds(),
soundSet: this.getSoundSetId() soundSet: this.getSoundSetId()
@ -429,6 +456,9 @@ export default {
resetHuntTimeout () { resetHuntTimeout () {
this.changes.huntTimeout = this.groupSelected.pbx_hunt_timeout this.changes.huntTimeout = this.groupSelected.pbx_hunt_timeout
}, },
resetHuntCancelMode () {
this.changes.huntCancelMode = this.groupSelected.pbx_hunt_cancel_mode
},
resetAliasNumbers () { resetAliasNumbers () {
this.changes.aliasNumbers = this.getAliasNumberIds() this.changes.aliasNumbers = this.getAliasNumberIds()
}, },
@ -465,6 +495,12 @@ export default {
groupId: this.groupSelected.id, groupId: this.groupSelected.id,
groupHuntTimeout: this.changes.huntTimeout groupHuntTimeout: this.changes.huntTimeout
}) })
}
if (this.hasHuntCancelModeChanged) {
this.setGroupHuntCancelMode({
groupId: this.groupSelected.id,
groupHuntCancelMode: this.changes.huntCancelMode
})
} }
if (this.hasAliasNumbersChanged) { if (this.hasAliasNumbersChanged) {
this.setGroupNumbers({ this.setGroupNumbers({

@ -49,6 +49,7 @@
:alias-number-options="getNumberOptions" :alias-number-options="getNumberOptions"
:sound-set-options="getSoundSetOptions" :sound-set-options="getSoundSetOptions"
:hunt-policy-options="getHuntPolicyOptions" :hunt-policy-options="getHuntPolicyOptions"
:hunt-cancel-mode-options="getHuntCancelModeOptions"
@save="createGroup" @save="createGroup"
@cancel="disableGroupAddForm" @cancel="disableGroupAddForm"
/> />
@ -94,6 +95,7 @@
:seats="seatMapById" :seats="seatMapById"
:loading="isGroupLoading(group.id)" :loading="isGroupLoading(group.id)"
:hunt-policy-options="getHuntPolicyOptions" :hunt-policy-options="getHuntPolicyOptions"
:hunt-cancel-mode-options="getHuntCancelModeOptions"
:label-width="4" :label-width="4"
@remove="openGroupRemovalDialog(group.id)" @remove="openGroupRemovalDialog(group.id)"
/> />
@ -204,7 +206,8 @@ export default {
'getGroupRemoveDialogMessage', 'getGroupRemoveDialogMessage',
'getGroupCreationToastMessage', 'getGroupCreationToastMessage',
'getGroupRemovalToastMessage', 'getGroupRemovalToastMessage',
'getHuntPolicyOptions' 'getHuntPolicyOptions',
'getHuntCancelModeOptions'
]), ]),
hasFilters () { hasFilters () {
return Object.keys(this.filters).length > 0 return Object.keys(this.filters).length > 0

@ -13,7 +13,8 @@ import {
setGroupHuntTimeout, setGroupHuntTimeout,
setGroupNumbers, setGroupNumbers,
setGroupSeats, setGroupSeats,
setGroupSoundSet setGroupSoundSet,
setGroupHuntCancelMode
} from '../api/pbx-groups' } from '../api/pbx-groups'
import _ from 'lodash' import _ from 'lodash'
import Vue from 'vue' import Vue from 'vue'
@ -150,6 +151,18 @@ export default {
return (groupId) => { return (groupId) => {
return _.get(state, 'preferenceMapById.' + groupId + '.cloud_pbx_callqueue', false) 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: { mutations: {
@ -365,6 +378,20 @@ export default {
context.commit('groupUpdateFailed', err.message) 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) { setGroupNumbers (context, options) {
context.commit('groupUpdateRequesting', { context.commit('groupUpdateRequesting', {
groupId: options.groupId, groupId: options.groupId,

Loading…
Cancel
Save