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

@ -10,10 +10,10 @@ export const PROFILE_ATTRIBUTE_MAP = {
reminder: 'reminder',
speedDial: 'speed_dial',
voiceMail: 'voice_mail',
callBlockingPrivacy: 'clir',
clir: 'clir',
clir_intrapbx: 'clir_intrapbx',
faxServer: 'fax_server',
cscCalls: 'csc_calls',
clir_intrapbx: 'clir_intrapbx',
manager_secretary: 'manager_secretary',
auto_attendant: 'auto_attendant',
soundSet: 'contract_sound_set',
@ -27,7 +27,8 @@ export const PROFILE_ATTRIBUTE_MAP = {
export const PROFILE_ATTRIBUTES_MAP = {
callBlockingIncoming: ['block_in_clir', 'block_in_mode', 'block_in_list'],
callBlockingOutgoing: ['block_out_mode', 'block_out_list'],
callBlockingPrivacy: ['clir', 'clir_intrapbx'],
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']
}

@ -7,7 +7,7 @@
class="col col-xs-12 col-md-4"
>
<q-item
v-if="hasSubscriberProfileAttribute('clir')"
v-if="showClir"
>
<q-item-section>
<q-toggle
@ -29,21 +29,46 @@
/>
</q-item-section>
</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>
</csc-page>
</template>
<script>
import { mapGetters, mapActions, mapState } from 'vuex'
import {
mapGetters,
mapState
} from 'vuex'
import {
showGlobalError,
showToast
} from 'src/helpers/ui'
import {
RequestState
} from 'src/store/common'
import CscPage from 'components/CscPage'
import CscSpinner from 'components/CscSpinner'
import { getSubscriberId } from 'src/auth'
import { PROFILE_ATTRIBUTE_MAP } from 'src/constants'
export default {
name: 'CscPageCallBlockingPrivacy',
components: {
@ -51,7 +76,10 @@ export default {
CscPage
},
data () {
return {}
return {
clirIntrapbx: false,
isLoading: false
}
},
computed: {
fieldIcon () {
@ -64,6 +92,9 @@ export default {
...mapState('callBlocking', [
'privacy'
]),
...mapGetters('pbxSeats', [
'getIntraPbx'
]),
...mapGetters('callBlocking', [
'privacy',
'privacyError',
@ -73,7 +104,17 @@ export default {
]),
...mapGetters('user', [
'hasSubscriberProfileAttribute'
])
]),
...mapState('pbxSeats', [
'seatUpdateState',
'seatUpdateError'
]),
showClir () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir)
},
showClirIntrapbx () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir_intrapbx)
},
},
watch: {
privacyUpdated (updated) {
@ -82,12 +123,46 @@ export default {
} else if (updated && !this.privacy) {
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')
},
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 () {
this.$store.dispatch('callBlocking/updatePrivacy', !this.privacy)
}

@ -21,7 +21,8 @@ import CscPagePbxCallQueues from 'src/pages/CscPagePbxCallQueues'
import CscPagePbxSoundSets from 'src/pages/CscPagePbxSoundSets'
import CscPagePbxMsConfigs from 'src/pages/CscPagePbxMsConfigs'
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 CscPageFaxSettings from 'src/pages/CscPageFaxSettings'
import CscPageUserSettings from 'src/pages/CscPageUserSettings'
@ -128,7 +129,7 @@ export default function routes (app) {
get subtitle () {
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
}
},
{
path: 'extension-settings/general',
component: CscPagePbxSettings,
meta: {
get title () {
return i18n.t('Extension Settings')
},
get subtitle () {
return i18n.t('Set your Extension settings')
},
profileAttributes: PROFILE_ATTRIBUTE_MAP.clir_intrapbx
}
},
// Just hide the page to re-use later
// {
// path: 'extension-settings/general',
// component: CscPagePbxSettings,
// meta: {
// get title () {
// return i18n.t('Extension Settings')
// },
// get subtitle () {
// return i18n.t('Set your Extension settings')
// },
// }
// },
{
path: 'extension-settings/call-queues',
component: CscPagePbxSettingsCallQueues,

Loading…
Cancel
Save