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
master
nidrissi-zouggari 3 months ago
parent 397d6bdbea
commit 6e1140713d

@ -49,7 +49,7 @@
:error-message="queueMaxLengthErrorMessage" :error-message="queueMaxLengthErrorMessage"
:disable="disableMaxQueueLength" :disable="disableMaxQueueLength"
@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"
@ -57,7 +57,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"
@ -72,7 +72,7 @@
:error-message="queueWrapUpTimeErrorMessage" :error-message="queueWrapUpTimeErrorMessage"
:disable="disableQueueWrapUpTime" :disable="disableQueueWrapUpTime"
@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"
@ -80,7 +80,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"
@ -144,7 +144,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'],
@ -263,13 +263,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,

@ -96,7 +96,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"
@ -89,6 +89,7 @@ import CscRemoveDialog from 'components/CscRemoveDialog'
import CscPbxCallQueue from 'components/pages/PbxConfiguration/CscPbxCallQueue' import CscPbxCallQueue from 'components/pages/PbxConfiguration/CscPbxCallQueue'
import CscPbxCallQueueAddForm from 'components/pages/PbxConfiguration/CscPbxCallQueueAddForm' import CscPbxCallQueueAddForm from 'components/pages/PbxConfiguration/CscPbxCallQueueAddForm'
import CscFade from 'components/transitions/CscFade' import CscFade from 'components/transitions/CscFade'
import { getSubscriberId } from 'src/auth'
import { import {
showGlobalError, showGlobalError,
showToast showToast
@ -194,7 +195,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.loadCallQueueList() this.loadCallQueueList({ subscriberId: getSubscriberId() })
}, },
methods: { methods: {
...mapActions('pbx', [ ...mapActions('pbx', [

@ -90,7 +90,7 @@ export default {
return { return {
callQueue: null, callQueue: null,
changes: null, changes: null,
cloud_pbx_callqueue: null, cloud_pbx_callqueue: false,
v$: useValidate() v$: useValidate()
} }
}, },

@ -7,6 +7,7 @@ import {
setCallQueueMaxLength, setCallQueueMaxLength,
setCallQueueWrapUpTime setCallQueueWrapUpTime
} from 'src/api/pbx-callqueues' } from 'src/api/pbx-callqueues'
import { getPreferences } from 'src/api/subscriber'
import { CreationState, RequestState } from 'src/store/common' import { CreationState, RequestState } from 'src/store/common'
export default { export default {
@ -191,16 +192,25 @@ export default {
}, },
collapseCallQueue (state) { collapseCallQueue (state) {
state.callQueueSelected = null state.callQueueSelected = null
},
setDefaultQueueWrapUpTime (state, value) {
state.defaultQueueWrapUpTime = value
} }
}, },
actions: { actions: {
async loadCallQueueList (context, options) { async loadCallQueueList (context, options) {
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', { listVisible }) context.commit('callQueueListRequesting', { listVisible })
try { try {
const callQueueList = await getCallQueueList() const callQueueList = await getCallQueueList()
context.commit('callQueueListSucceeded', callQueueList) context.commit('callQueueListSucceeded', callQueueList)
const subscriberPreferences = await getPreferences(subscriberId)
const wrapUpTime = _.get(subscriberPreferences, 'queue_wrap_up_time', 10)
context.commit('setDefaultQueueWrapUpTime', wrapUpTime)
if (selectedId !== null) { if (selectedId !== null) {
context.commit('expandCallQueue', callQueueList) context.commit('expandCallQueue', callQueueList)
context.commit('highlightCallQueue', callQueueList) context.commit('highlightCallQueue', callQueueList)

Loading…
Cancel
Save