MT#65048 Fix music on hold and DND guards in call settings

Implements the following logic for the route call-settings:

- Route is accessible if no sub profile is assigned, or if a sub profile
  is assigned and at least one of the "dnd" or "music_on_hold"
  preferences is enabled
- DND toggle is hidden when a sub profile is assigned and the "dnd"
  preference is off
- Music on hold toggle is hidden when a sub profile is assigned and
  the "music_on_hold" preference is off

Change-Id: I3da52cb142ed1b60bf5c90b873cf515bb1fd35ce
master
Debora Crescenzo 23 hours ago committed by Crescenzo Debora
parent ad7498f34e
commit 0155c58bd7

@ -14,10 +14,12 @@ export const PROFILE_ATTRIBUTE_MAP = {
blockOutList: 'block_out_list',
blockOutOverridePin: 'block_out_override_pin',
cloudPbxCallQueue: 'cloud_pbx_callqueue',
dnd: 'dnd',
language: 'language',
ncos: 'ncos',
ncosSet: 'ncos_set',
maxQueueLength: 'max_queue_length',
musicOnHold: 'music_on_hold',
queueWrapUpTime: 'queue_wrap_up_time',
reminder: 'reminder',
speedDial: 'speed_dial',
@ -49,7 +51,7 @@ export const PROFILE_ATTRIBUTES_MAP = {
callBlockingIncoming: ['block_in_clir', 'block_in_mode', 'block_in_list'],
callBlockingOutgoing: ['block_out_mode', 'block_out_list', 'ncos', 'ncos_set'],
callBlockingPrivacy: ['clir', 'clir_intrapbx'],
callSettings: ['music_on_hold', 'language'],
callSettings: ['music_on_hold', 'dnd'],
pbxExtensionSettings: ['auto_attendant', 'manager_secretary', 'conference_max_participants', 'conference_pin'],
pbxSettingsConference: ['conference_max_participants', 'conference_pin'],
pbxSettingsCallQueue: ['cloud_pbx_callqueue', 'max_queue_length', 'queue_wrap_up_time'],

@ -8,9 +8,9 @@
>
<q-item>
<q-item-section
v-if="showToggles"
>
<q-toggle
v-if="showMusicOnHold"
:model-value="musicOnHoldValue"
:disable="dataLoading"
:label="$t('Music on Hold')"
@ -21,6 +21,7 @@
@update:model-value="toggleMusicOnHold"
/>
<q-toggle
v-if="showDnd"
:model-value="dndValue"
:disable="dataLoading"
:label="$t('DND')"
@ -45,16 +46,10 @@
<script>
import CscPage from 'components/CscPage'
import CscSpinner from 'components/CscSpinner'
import { PROFILE_ATTRIBUTES_MAP } from 'src/constants'
import { PROFILE_ATTRIBUTE_MAP } from 'src/constants'
import { showGlobalError } from 'src/helpers/ui'
import {
mapWaitingActions,
mapWaitingGetters
} from 'vue-wait-vue3'
import {
mapGetters,
mapState
} from 'vuex'
import { mapWaitingActions, mapWaitingGetters } from 'vue-wait-vue3'
import { mapGetters, mapState } from 'vuex'
export default {
name: 'CscPageCallSettings',
components: {
@ -70,7 +65,7 @@ export default {
'dnd'
]),
...mapGetters('user', [
'hasSomeSubscriberProfileAttributes'
'hasSubscriberProfileAttribute'
]),
...mapWaitingGetters({
processingSubscriberPreferences: 'processing subscriberPreferences'
@ -78,8 +73,11 @@ export default {
dataLoading () {
return !this.subscriberPreferencesInitialized || this.processingSubscriberPreferences
},
showToggles () {
return this.hasSomeSubscriberProfileAttributes(PROFILE_ATTRIBUTES_MAP.callSettings)
showDnd () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.dnd)
},
showMusicOnHold () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.musicOnHold)
},
musicOnHoldValue () {
return this.musicOnHold || false

Loading…
Cancel
Save