From 86b5147e61365e00f48e64f898ffcbdc130687a9 Mon Sep 17 00:00:00 2001 From: Carlo Venusino Date: Thu, 27 Aug 2020 16:44:54 +0200 Subject: [PATCH] TT#88206 CSC: As a PbxAdmin, I want to toggle visibility of the number towards the callee for myself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit √ Can see a "PBXSettings" item in menu if user is allowed to √ Can go to separate page "PBXSettings" √ Can toggle the setting "clir_intrapbx" by a Quasar toggle button √ Can see a success toast for both cases (on/off) √ Can see a spinner until the settings are loaded Change-Id: I98a4328dbf5a23ae159009d22e3bc172306d5f62 --- src/api/pbx-seats.js | 15 ++- src/components/layouts/Default.vue | 2 + src/components/layouts/MainMenu.vue | 13 ++ .../pages/PbxSettings/CscPbxSettings.vue | 117 ++++++++++++++++++ src/locales/en.json | 6 + src/routes.js | 9 ++ src/store/pbx-seats.js | 8 +- src/store/user.js | 3 + 8 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 src/components/pages/PbxSettings/CscPbxSettings.vue diff --git a/src/api/pbx-seats.js b/src/api/pbx-seats.js index 45722f79..b5b082d5 100644 --- a/src/api/pbx-seats.js +++ b/src/api/pbx-seats.js @@ -8,7 +8,8 @@ import { setPbxWebPassword, setPbxGroupIds, setSubscriberNumbers, - setPreferenceIntraPbx + setPreferenceIntraPbx, + getPreferences } from "./subscriber"; import _ from "lodash"; import { @@ -296,3 +297,15 @@ export function setSeatSoundSet(options) { }); }); } + +/** + * @param seatId + */ +export async function getSeatPreferences(seatId) { + try { + return await getPreferences(seatId); + } + catch(err){ + return err; + } +} diff --git a/src/components/layouts/Default.vue b/src/components/layouts/Default.vue index d225f6dc..2ca7c847 100644 --- a/src/components/layouts/Default.vue +++ b/src/components/layouts/Default.vue @@ -141,6 +141,7 @@ :is-call-forward="isCallForward" :is-call-blocking="isCallBlocking" :is-pbx-admin="isPbxAdmin" + :is-pbx-enabled="isPbxEnabled" :is-pbx-configuration="isPbxConfiguration" /> @@ -308,6 +309,7 @@ 'hasUser', 'getUsername', 'isPbxAdmin', + 'isPbxEnabled', 'hasSmsCapability', 'hasFaxCapability', 'hasSendSmsFeature', diff --git a/src/components/layouts/MainMenu.vue b/src/components/layouts/MainMenu.vue index b7b9f61e..d8d88300 100644 --- a/src/components/layouts/MainMenu.vue +++ b/src/components/layouts/MainMenu.vue @@ -228,6 +228,18 @@ /> + + + + @@ -260,6 +272,7 @@ 'isCallForward', 'isCallBlocking', 'isPbxAdmin', + 'isPbxEnabled', 'isPbxConfiguration' ], computed: { diff --git a/src/components/pages/PbxSettings/CscPbxSettings.vue b/src/components/pages/PbxSettings/CscPbxSettings.vue new file mode 100644 index 00000000..12df6b72 --- /dev/null +++ b/src/components/pages/PbxSettings/CscPbxSettings.vue @@ -0,0 +1,117 @@ + + + + + + diff --git a/src/locales/en.json b/src/locales/en.json index db914371..b272c1b0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -109,6 +109,10 @@ "soundSets": "Sound Sets", "msConfigs": "Manager Secretary" }, + "pbxSettings": { + "title": "PBX Settings", + "subTitle": "Set your PBX settings" + }, "voicebox": { "title": "Voicebox", "subTitle": "Set your voicebox settings" @@ -579,6 +583,8 @@ "msConfigRemovalToast": "Removed manager secretary config for {msConfig} successfully", "noMsConfigs": "No manager secretary configuration created yet", "toggleIntraPbx": "Hide number within own PBX", + "selfPbxVisible": "Your number is visible to the callee within own PBX", + "selfPbxHidden": "Your number is hidden to the callee within own PBX", "intraPbx": "the visibility of the number within own PBX" }, "callBlocking": { diff --git a/src/routes.js b/src/routes.js index 06dcaaa0..70a42002 100644 --- a/src/routes.js +++ b/src/routes.js @@ -21,6 +21,7 @@ import PbxConfigurationDevices from './components/pages/PbxConfiguration/CscPbxD import PbxConfigurationCallQueues from './components/pages/PbxConfiguration/CscPbxCallQueues' import PbxConfigurationSoundSets from './components/pages/PbxConfiguration/CscPbxSoundSets' import PbxConfigurationMsConfigs from './components/pages/PbxConfiguration/CscPbxMsConfigs' +import PbxSettings from './components/pages/PbxSettings/CscPbxSettings' import Voicebox from './components/pages/Voicebox/Voicebox'; import Login from './components/Login' import CscUserSettings from './components/pages/CscUserSettings' @@ -162,6 +163,14 @@ export default [ subtitle: i18n.t('navigation.pbxConfiguration.msConfigs') } }, + { + path: 'pbx-settings', + component: PbxSettings, + meta: { + title: i18n.t('navigation.pbxSettings.title'), + subtitle: i18n.t('navigation.pbxSettings.subTitle') + } + }, { path: 'voicebox', component: Voicebox, diff --git a/src/store/pbx-seats.js b/src/store/pbx-seats.js index 5cbfd36e..2f7710b3 100644 --- a/src/store/pbx-seats.js +++ b/src/store/pbx-seats.js @@ -19,7 +19,8 @@ import { setSeatNumbers, setSeatSoundSet, setSeatIntraPbx, - setSeatWebPassword + setSeatWebPassword, + getSeatPreferences } from "../api/pbx-seats"; export default { @@ -248,6 +249,9 @@ export default { } }, actions: { + loadPreferences(context, seatId){ + return getSeatPreferences(seatId); + }, loadSeatListItems(context, options) { return new Promise((resolve, reject)=>{ let page = _.get(options, 'page', context.state.seatListCurrentPage); @@ -398,7 +402,7 @@ export default { async setIntraPbx(context, options) { context.commit('seatUpdateRequesting', { seatId: options.seatId, - seatField: i18n.t('pbxConfig.intraPbx') + seatField: options.message || i18n.t('pbxConfig.intraPbx') }); try{ const result = await setSeatIntraPbx(options.seatId, options.intraPbx); diff --git a/src/store/user.js b/src/store/user.js index 89ae16ac..ce36e2b0 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -68,6 +68,9 @@ export default { isPbxAdmin(state, getters) { return getters.isAdmin && state.capabilities !== null && state.capabilities.cloudpbx; }, + isPbxEnabled(state) { + return state.capabilities !== null && state.capabilities.cloudpbx; + }, hasSmsCapability(state) { return state.capabilities !== null && state.capabilities.sms === true;