diff --git a/src/api/pbx-config.js b/src/api/pbx-config.js index 8c2874b2..3368485b 100644 --- a/src/api/pbx-config.js +++ b/src/api/pbx-config.js @@ -17,7 +17,10 @@ import { getSubscribers, getSubscriber, getSubscribersByCallQueueEnabled, - addNewCallQueueConfig + addNewCallQueueConfig, + setQueueLength, + setWrapUpTime, + getPreferences } from './subscriber'; import uuid from 'uuid'; import { getList, get, patchReplace } from './common' @@ -554,3 +557,33 @@ export function addCallQueueConfig(id, config) { }); }); } + +export function getConfig(id) { + return new Promise((resolve, reject)=>{ + let $subscriber = {}; + Promise.resolve().then(()=>{ + return getSubscriber(id); + }).then((subscriber) => { + $subscriber = subscriber; + return getPreferences(id); + }).then((prefs) => { + resolve({ + id: _.get($subscriber, 'id', null), + display_name: _.get($subscriber, 'display_name', null), + is_pbx_group: _.get($subscriber, 'is_pbx_group', null), + max_queue_length: _.get(prefs, 'max_queue_length', 5), + queue_wrap_up_time: _.get(prefs, 'queue_wrap_up_time', 10) + }); + }).catch((err)=>{ + reject(err); + }); + }); +} + +export function setQueueLengthConfig(id, queueLength) { + return setQueueLength(id, queueLength); +} + +export function setWrapUpTimeConfig(id, wrapUpTime) { + return setWrapUpTime(id, wrapUpTime); +} diff --git a/src/api/subscriber.js b/src/api/subscriber.js index 68ec473e..d909c0b7 100644 --- a/src/api/subscriber.js +++ b/src/api/subscriber.js @@ -336,3 +336,28 @@ export function getSubscribersByCallQueueEnabled() { export function addNewCallQueueConfig(id, config) { return Vue.http.put('api/subscriberpreferences/' + id, config); } + +export function editCallQueuePreference(id, config) { + return new Promise((resolve, reject)=>{ + let $prefs = Object.assign(config, { cloud_pbx_callqueue: true }); + Promise.resolve().then(()=>{ + return getPreferences(id); + }).then((result)=>{ + var prefs = Object.assign(result, $prefs); + delete prefs._links; + return Vue.http.put('api/subscriberpreferences/' + id, prefs); + }).then(()=>{ + resolve(); + }).catch((err)=>{ + reject(err); + }); + }); +} + +export function setQueueLength(id, queueLength) { + return editCallQueuePreference(id, { max_queue_length: queueLength }); +} + +export function setWrapUpTime(id, wrapUpTime) { + return editCallQueuePreference(id, { queue_wrap_up_time: wrapUpTime }); +} diff --git a/src/components/CscSendFax.vue b/src/components/CscSendFax.vue index 95c78d1f..e24f16a0 100644 --- a/src/components/CscSendFax.vue +++ b/src/components/CscSendFax.vue @@ -224,7 +224,6 @@ this.$refs.faxUpload.value = ''; }, processFile(event) { - console.log('processFile()'); let file = event.target.files[0]; let fileName = file ? file.name : ''; let fileNameSplit = fileName.split('.'); diff --git a/src/components/pages/CallBlocking/CscCallBlocking.vue b/src/components/pages/CallBlocking/CscCallBlocking.vue index faef9c70..17da7da1 100644 --- a/src/components/pages/CallBlocking/CscCallBlocking.vue +++ b/src/components/pages/CallBlocking/CscCallBlocking.vue @@ -267,7 +267,6 @@ this.$store.dispatch('callBlocking/addNumber' + this.suffix, number); }, saveNumber(data) { - console.log(data); this.$store.dispatch('callBlocking/editNumber' + this.suffix, data); }, removeNumberDialog(index) { diff --git a/src/components/pages/PbxConfiguration/CscPbxCallQueue.vue b/src/components/pages/PbxConfiguration/CscPbxCallQueue.vue index d3f486e3..a7940d01 100644 --- a/src/components/pages/PbxConfiguration/CscPbxCallQueue.vue +++ b/src/components/pages/PbxConfiguration/CscPbxCallQueue.vue @@ -53,7 +53,8 @@ v-if="expanded" > + :label="$t('pbxConfig.queueExtensionName')" + > + :label="$t('pbxConfig.queueLength')" + :error-label="queueLengthErrorMessage" + > + :label="$t('pbxConfig.wrapUpTime')" + :error-label="wrapUpTimeErrorMessage" + > @@ -94,10 +107,22 @@ /> + + +