MT#64519 Fix default value for Call Queue

Fix default value for CQ part:
If the subscriber has call queue activated, use their wrap-up time
as the default value; otherwise, set the default value to 10.

Change-Id: I1e11417690d4119ce396939721cbc96f6c5ef9b8
(cherry picked from commit 6e1140713d)
(cherry picked from commit 1c88d60911)
mr11.5.1
nidrissi-zouggari 3 months ago committed by Nouhaila Idrissi-Zouggari
parent dce65bf394
commit ff067889e7

@ -48,7 +48,7 @@
:error="v$.changes.max_queue_length.$errors.length > 0" :error="v$.changes.max_queue_length.$errors.length > 0"
:error-message="queueMaxLengthErrorMessage" :error-message="queueMaxLengthErrorMessage"
@update:model-value="v$.changes.max_queue_length.$touch()" @update:model-value="v$.changes.max_queue_length.$touch()"
@keyup.enter="save" @keyup.enter="saveMaxQueueLength"
> >
<template <template
v-if="hasMaxQueueLengthChanged" v-if="hasMaxQueueLengthChanged"
@ -56,7 +56,7 @@
> >
<csc-input-button-save <csc-input-button-save
v-if="v$.changes.max_queue_length.$errors.length <= 0" v-if="v$.changes.max_queue_length.$errors.length <= 0"
@click.stop="save" @click.stop="saveMaxQueueLength"
/> />
<csc-input-button-reset <csc-input-button-reset
@click.stop="resetMaxQueueLength" @click.stop="resetMaxQueueLength"
@ -70,7 +70,7 @@
:error="v$.changes.queue_wrap_up_time.$errors.length > 0" :error="v$.changes.queue_wrap_up_time.$errors.length > 0"
:error-message="queueWrapUpTimeErrorMessage" :error-message="queueWrapUpTimeErrorMessage"
@update:model-value="v$.changes.queue_wrap_up_time.$touch()" @update:model-value="v$.changes.queue_wrap_up_time.$touch()"
@keyup.enter="save" @keyup.enter="saveQueueWrapUpTime"
> >
<template <template
v-if="hasQueueWrapUpTimeChanged" v-if="hasQueueWrapUpTimeChanged"
@ -78,7 +78,7 @@
> >
<csc-input-button-save <csc-input-button-save
v-if="v$.changes.queue_wrap_up_time.$errors.length <= 0" v-if="v$.changes.queue_wrap_up_time.$errors.length <= 0"
@click.stop="save" @click.stop="saveQueueWrapUpTime"
/> />
<csc-input-button-reset <csc-input-button-reset
@click.stop="resetQueueWrapUpTime" @click.stop="resetQueueWrapUpTime"
@ -139,7 +139,7 @@ export default {
}, },
defaultQueueWrapUpTime: { defaultQueueWrapUpTime: {
type: Number, type: Number,
default: 300 default: 10
} }
}, },
emits: ['save-queue-wrap-up-time', 'save-max-queue-length', 'expand', 'collapse', 'remove'], emits: ['save-queue-wrap-up-time', 'save-max-queue-length', 'expand', 'collapse', 'remove'],
@ -251,13 +251,15 @@ export default {
queue_wrap_up_time: this.callQueue.queue_wrap_up_time || this.defaultQueueWrapUpTime queue_wrap_up_time: this.callQueue.queue_wrap_up_time || this.defaultQueueWrapUpTime
} }
}, },
save () { saveMaxQueueLength () {
if (this.hasMaxQueueLengthChanged && this.v$.changes.max_queue_length.$errors.length <= 0) { if (this.hasMaxQueueLengthChanged && this.v$.changes.max_queue_length.$errors.length <= 0) {
this.$emit('save-max-queue-length', { this.$emit('save-max-queue-length', {
callQueueId: this.callQueue.id, callQueueId: this.callQueue.id,
maxQueueLength: this.changes.max_queue_length maxQueueLength: this.changes.max_queue_length
}) })
} }
},
saveQueueWrapUpTime () {
if (this.hasQueueWrapUpTimeChanged && this.v$.changes.queue_wrap_up_time.$errors.length <= 0) { if (this.hasQueueWrapUpTimeChanged && this.v$.changes.queue_wrap_up_time.$errors.length <= 0) {
this.$emit('save-queue-wrap-up-time', { this.$emit('save-queue-wrap-up-time', {
callQueueId: this.callQueue.id, callQueueId: this.callQueue.id,

@ -95,7 +95,7 @@ export default {
}, },
defaultQueueWrapUpTime: { defaultQueueWrapUpTime: {
type: Number, type: Number,
default: 300 default: 10
} }
}, },
emits: ['submit', 'cancel', 'ready'], emits: ['submit', 'cancel', 'ready'],

@ -29,7 +29,7 @@
:options="getSubscriberOptions" :options="getSubscriberOptions"
:subscriber-options-loading="isSubscribersRequesting" :subscriber-options-loading="isSubscribersRequesting"
:default-max-queue-length="defaultMaxQueueLength" :default-max-queue-length="defaultMaxQueueLength"
:default-wrap-up-time="defaultQueueWrapUpTime" :default-queue-wrap-up-time="defaultQueueWrapUpTime"
@cancel="disableCallQueueAddForm" @cancel="disableCallQueueAddForm"
@submit="createCallQueue" @submit="createCallQueue"
@ready="loadSubscribers" @ready="loadSubscribers"
@ -86,6 +86,7 @@ import CscPbxCallQueueAddForm from 'components/pages/PbxConfiguration/CscPbxCall
import CscRemoveDialog from 'components/CscRemoveDialog' import CscRemoveDialog from 'components/CscRemoveDialog'
import CscListSpinner from 'components/CscListSpinner' import CscListSpinner from 'components/CscListSpinner'
import CscListActions from 'components/CscListActions' import CscListActions from 'components/CscListActions'
import { getSubscriberId } from 'src/auth'
import { import {
mapState, mapState,
mapActions, mapActions,
@ -177,7 +178,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.loadCallQueueList() this.loadCallQueueList({ subscriberId: getSubscriberId() })
}, },
methods: { methods: {
...mapActions('pbx', [ ...mapActions('pbx', [

@ -14,6 +14,7 @@ import {
import { import {
i18n i18n
} from 'src/boot/i18n' } from 'src/boot/i18n'
import { getPreferences } from 'src/api/subscriber'
export default { export default {
namespaced: true, namespaced: true,
@ -192,28 +193,32 @@ export default {
}, },
collapseCallQueue (state) { collapseCallQueue (state) {
state.callQueueSelected = null state.callQueueSelected = null
},
setDefaultQueueWrapUpTime (state, value) {
state.defaultQueueWrapUpTime = value
} }
}, },
actions: { actions: {
loadCallQueueList (context, options) { async loadCallQueueList (context, options) {
return new Promise((resolve) => { const subscriberId = _.get(options, 'subscriberId', null)
const listVisible = _.get(options, 'listVisible', false) const listVisible = _.get(options, 'listVisible', false)
const selectedId = _.get(options, 'selectedId', null) const selectedId = _.get(options, 'selectedId', null)
context.commit('callQueueListRequesting', { context.commit('callQueueListRequesting', { listVisible })
listVisible: listVisible try {
}) const callQueueList = await getCallQueueList()
getCallQueueList().then((callQueueList) => { context.commit('callQueueListSucceeded', callQueueList)
context.commit('callQueueListSucceeded', callQueueList)
if (selectedId !== null) { const subscriberPreferences = await getPreferences(subscriberId)
context.commit('expandCallQueue', callQueueList) const wrapUpTime = _.get(subscriberPreferences, 'queue_wrap_up_time', 10)
context.commit('highlightCallQueue', callQueueList) context.commit('setDefaultQueueWrapUpTime', wrapUpTime)
}
resolve() if (selectedId !== null) {
}).catch(() => { context.commit('expandCallQueue', callQueueList)
resolve() context.commit('highlightCallQueue', callQueueList)
context.commit('callQueueListSucceeded') }
}) } catch (err) {
}) context.commit('callQueueListFailed', err.message)
}
}, },
createCallQueue (context, callQueueData) { createCallQueue (context, callQueueData) {
context.commit('callQueueCreationRequesting', callQueueData) context.commit('callQueueCreationRequesting', callQueueData)

Loading…
Cancel
Save