MT#57195 move clir_intrapbx setting to privacy page

Change-Id: I66999152568cea3e50886b351f3514fe78beca6d
mr11.4
Georges Francisco 3 years ago committed by Marco Capetta
parent 21f9d8a7a8
commit 7395ef044e

@ -115,7 +115,7 @@ export default {
to: '/user/call-blocking/privacy', to: '/user/call-blocking/privacy',
icon: 'fas fa-user-secret', icon: 'fas fa-user-secret',
label: this.$t('Privacy'), label: this.$t('Privacy'),
visible: this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.callBlockingPrivacy) visible: this.hasSubscriberProfileAttributes(PROFILE_ATTRIBUTES_MAP.callBlockingPrivacy)
}, },
{ {
to: '/user/speeddial', to: '/user/speeddial',
@ -198,12 +198,13 @@ export default {
label: this.$t('Extension Settings'), label: this.$t('Extension Settings'),
visible: this.isPbxEnabled && this.hasSubscriberProfileAttributes(PROFILE_ATTRIBUTES_MAP.pbxSettings), visible: this.isPbxEnabled && this.hasSubscriberProfileAttributes(PROFILE_ATTRIBUTES_MAP.pbxSettings),
children: [ children: [
{ // Just hide the page to re-use later
to: '/user/extension-settings/general', // {
icon: 'settings', // to: '/user/extension-settings/general',
label: this.$t('General'), // icon: 'settings',
visible: this.isPbxEnabled && this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir_intrapbx) // label: this.$t('General'),
}, // visible: this.isPbxEnabled
// },
{ {
to: '/user/extension-settings/call-queues', to: '/user/extension-settings/call-queues',
icon: 'filter_none', icon: 'filter_none',

@ -10,10 +10,10 @@ export const PROFILE_ATTRIBUTE_MAP = {
reminder: 'reminder', reminder: 'reminder',
speedDial: 'speed_dial', speedDial: 'speed_dial',
voiceMail: 'voice_mail', voiceMail: 'voice_mail',
callBlockingPrivacy: 'clir', clir: 'clir',
clir_intrapbx: 'clir_intrapbx',
faxServer: 'fax_server', faxServer: 'fax_server',
cscCalls: 'csc_calls', cscCalls: 'csc_calls',
clir_intrapbx: 'clir_intrapbx',
manager_secretary: 'manager_secretary', manager_secretary: 'manager_secretary',
auto_attendant: 'auto_attendant', auto_attendant: 'auto_attendant',
soundSet: 'contract_sound_set', soundSet: 'contract_sound_set',
@ -27,7 +27,8 @@ export const PROFILE_ATTRIBUTE_MAP = {
export const PROFILE_ATTRIBUTES_MAP = { export const PROFILE_ATTRIBUTES_MAP = {
callBlockingIncoming: ['block_in_clir', 'block_in_mode', 'block_in_list'], callBlockingIncoming: ['block_in_clir', 'block_in_mode', 'block_in_list'],
callBlockingOutgoing: ['block_out_mode', 'block_out_list'], callBlockingOutgoing: ['block_out_mode', 'block_out_list'],
callBlockingPrivacy: ['clir', 'clir_intrapbx'],
callSettings: ['music_on_hold', 'language'], callSettings: ['music_on_hold', 'language'],
pbxSettings: ['clir_intrapbx', 'auto_attendant', 'cloud_pbx_callqueue', 'max_queue_length', 'queue_wrap_up_time', 'manager_secretary'], pbxSettings: ['auto_attendant', 'cloud_pbx_callqueue', 'max_queue_length', 'queue_wrap_up_time', 'manager_secretary'],
pbxSettingsCallQueue: ['cloud_pbx_callqueue', 'max_queue_length', 'queue_wrap_up_time'] pbxSettingsCallQueue: ['cloud_pbx_callqueue', 'max_queue_length', 'queue_wrap_up_time']
} }

@ -7,7 +7,7 @@
class="col col-xs-12 col-md-4" class="col col-xs-12 col-md-4"
> >
<q-item <q-item
v-if="hasSubscriberProfileAttribute('clir')" v-if="showClir"
> >
<q-item-section> <q-item-section>
<q-toggle <q-toggle
@ -29,21 +29,46 @@
/> />
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item
v-if="showClirIntrapbx"
>
<q-item-section>
<q-toggle
v-model="clirIntrapbx"
:disabled="isLoading"
:label="$t('Hide number to the callee within own PBX')"
checked-icon="visibility_off"
unchecked-icon="visibility"
@input="changeIntraPbx"
/>
</q-item-section>
<q-item-section
side
>
<csc-spinner
v-if="isLoading"
/>
</q-item-section>
</q-item>
</q-list> </q-list>
</csc-page> </csc-page>
</template> </template>
<script> <script>
import { mapGetters, mapActions, mapState } from 'vuex'
import { import {
mapGetters, showGlobalError,
mapState
} from 'vuex'
import {
showToast showToast
} from 'src/helpers/ui' } from 'src/helpers/ui'
import {
RequestState
} from 'src/store/common'
import CscPage from 'components/CscPage' import CscPage from 'components/CscPage'
import CscSpinner from 'components/CscSpinner' import CscSpinner from 'components/CscSpinner'
import { getSubscriberId } from 'src/auth'
import { PROFILE_ATTRIBUTE_MAP } from 'src/constants'
export default { export default {
name: 'CscPageCallBlockingPrivacy', name: 'CscPageCallBlockingPrivacy',
components: { components: {
@ -51,7 +76,10 @@ export default {
CscPage CscPage
}, },
data () { data () {
return {} return {
clirIntrapbx: false,
isLoading: false
}
}, },
computed: { computed: {
fieldIcon () { fieldIcon () {
@ -64,6 +92,9 @@ export default {
...mapState('callBlocking', [ ...mapState('callBlocking', [
'privacy' 'privacy'
]), ]),
...mapGetters('pbxSeats', [
'getIntraPbx'
]),
...mapGetters('callBlocking', [ ...mapGetters('callBlocking', [
'privacy', 'privacy',
'privacyError', 'privacyError',
@ -73,7 +104,17 @@ export default {
]), ]),
...mapGetters('user', [ ...mapGetters('user', [
'hasSubscriberProfileAttribute' 'hasSubscriberProfileAttribute'
]) ]),
...mapState('pbxSeats', [
'seatUpdateState',
'seatUpdateError'
]),
showClir () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir)
},
showClirIntrapbx () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir_intrapbx)
},
}, },
watch: { watch: {
privacyUpdated (updated) { privacyUpdated (updated) {
@ -82,12 +123,46 @@ export default {
} else if (updated && !this.privacy) { } else if (updated && !this.privacy) {
showToast(this.$t('Your number is visible to the callee')) showToast(this.$t('Your number is visible to the callee'))
} }
},
seatUpdateState (state) {
switch (state) {
case RequestState.requesting:
this.requestInProgress(true)
break
case RequestState.succeeded :
showToast(this.clirIntrapbx ? this.$t('Your number is hidden to the callee within own PBX') : this.$t('Your number is visible to the callee within own PBX'))
this.requestInProgress(false)
break
case RequestState.failed :
showGlobalError(this.seatUpdateError, 5000)
this.requestInProgress(false)
break
}
} }
}, },
mounted () { async mounted () {
this.requestInProgress(true)
const preferences = await this.loadPreferences(getSubscriberId())
this.clirIntrapbx = preferences.clir_intrapbx
this.requestInProgress(false)
this.$store.dispatch('callBlocking/loadPrivacy') this.$store.dispatch('callBlocking/loadPrivacy')
}, },
methods: { methods: {
...mapActions('pbxSeats', [
'setIntraPbx',
'loadPreferences'
]),
changeIntraPbx () {
const msg = this.clirIntrapbx ? this.$t('Your number is hidden to the callee within own PBX') : this.$t('Your number is visible to the callee within own PBX')
this.setIntraPbx({
seatId: getSubscriberId(),
intraPbx: this.clirIntrapbx,
message: msg
})
},
requestInProgress (loading) {
this.isLoading = loading
},
toggle () { toggle () {
this.$store.dispatch('callBlocking/updatePrivacy', !this.privacy) this.$store.dispatch('callBlocking/updatePrivacy', !this.privacy)
} }

@ -21,7 +21,8 @@ import CscPagePbxCallQueues from 'src/pages/CscPagePbxCallQueues'
import CscPagePbxSoundSets from 'src/pages/CscPagePbxSoundSets' import CscPagePbxSoundSets from 'src/pages/CscPagePbxSoundSets'
import CscPagePbxMsConfigs from 'src/pages/CscPagePbxMsConfigs' import CscPagePbxMsConfigs from 'src/pages/CscPagePbxMsConfigs'
import CscPagePbxAutoAttendant from 'src/pages/CscPagePbxAutoAttendant' import CscPagePbxAutoAttendant from 'src/pages/CscPagePbxAutoAttendant'
import CscPagePbxSettings from 'src/pages/CscPagePbxSettings' // Just hide the page to re-use later
// import CscPagePbxSettings from 'src/pages/CscPagePbxSettings'
import CscPageVoicebox from 'src/pages/CscPageVoicebox' import CscPageVoicebox from 'src/pages/CscPageVoicebox'
import CscPageFaxSettings from 'src/pages/CscPageFaxSettings' import CscPageFaxSettings from 'src/pages/CscPageFaxSettings'
import CscPageUserSettings from 'src/pages/CscPageUserSettings' import CscPageUserSettings from 'src/pages/CscPageUserSettings'
@ -128,7 +129,7 @@ export default function routes (app) {
get subtitle () { get subtitle () {
return i18n.t('Privacy') return i18n.t('Privacy')
}, },
profileAttribute: PROFILE_ATTRIBUTE_MAP.callBlockingPrivacy profileAttributes: PROFILE_ATTRIBUTES_MAP.callBlockingPrivacy
} }
}, },
{ {
@ -354,19 +355,19 @@ export default function routes (app) {
profileAttributes: PROFILE_ATTRIBUTES_MAP.callSettings profileAttributes: PROFILE_ATTRIBUTES_MAP.callSettings
} }
}, },
{ // Just hide the page to re-use later
path: 'extension-settings/general', // {
component: CscPagePbxSettings, // path: 'extension-settings/general',
meta: { // component: CscPagePbxSettings,
get title () { // meta: {
return i18n.t('Extension Settings') // get title () {
}, // return i18n.t('Extension Settings')
get subtitle () { // },
return i18n.t('Set your Extension settings') // get subtitle () {
}, // return i18n.t('Set your Extension settings')
profileAttributes: PROFILE_ATTRIBUTE_MAP.clir_intrapbx // },
} // }
}, // },
{ {
path: 'extension-settings/call-queues', path: 'extension-settings/call-queues',
component: CscPagePbxSettingsCallQueues, component: CscPagePbxSettingsCallQueues,

Loading…
Cancel
Save