MT#65337 Add DND toggle for selected PBX seat preferences

* Shows DND in the admin seat preferences view using the
    selected seat’s subscriber preferences and updates dnd
    against that seat, not the admin subscriber

Change-Id: Id3e9b1109e486d408ff540ab8882fe28dec2ab0d
(cherry picked from commit f9353d5477)
mr26.1
Giancarlo Errigo Mattos 1 month ago committed by Giancarlo Mattos
parent 8f28ebbb79
commit 8a01ffcf6e

@ -361,6 +361,14 @@
:disable="isLoading"
@update:model-value="changeMusicOnHold"
/>
<q-toggle
v-if="showDnd"
v-model="changes.dnd"
class="q-pa-sm"
:label="$t('DND')"
:disable="isLoading"
@update:model-value="changeDnd"
/>
<q-toggle
v-if="showPlayAnnounceBeforeCF"
v-model="changes.announcementCfu"
@ -543,6 +551,7 @@ export default {
'getNcosBySeatId',
'hasCallQueue',
'getMusicOnHold',
'getDnd',
'getDefaultNcos',
'getDefaultNcosSet',
'getConferenceMaxParticipants',
@ -675,6 +684,9 @@ export default {
showMusicOnHold () {
return this.hasSomeSubscriberProfileAttributes([PROFILE_ATTRIBUTES_MAP.callSettings])
},
showDnd () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.dnd)
},
showNcos () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.ncos)
},
@ -800,6 +812,7 @@ export default {
'setIntraPbx',
'setClir',
'setMusicOnHold',
'setDnd',
'setSeatSoundSet',
'loadSeatListItems',
'loadPreferences',
@ -886,6 +899,7 @@ export default {
cstaClient: this.getCstaClient(this.seatSelected.id),
cstaController: this.getCstaController(this.seatSelected.id),
musicOnHold: this.getMusicOnHold(this.seatSelected.id),
dnd: this.getDnd(this.seatSelected.id),
groups: this.getGroupIds(),
soundSet: this.getSoundSetId(),
cliNumber: this.getCliNumberId(),
@ -1021,6 +1035,12 @@ export default {
this.changes.musicOnHold = !this.changes.musicOnHold
}
},
changeDnd () {
this.setDnd({
seatId: this.seatSelected.id,
dnd: this.changes.dnd
})
},
changeAnnouncementCfu () {
this.setAnnouncementCfu({
seatId: this.seatSelected.id,

@ -33,6 +33,7 @@ import {
setSeatWebPassword,
setSeatWebUsername
} from 'src/api/pbx-seats'
import { setPreference } from 'src/api/subscriber'
import { getSubscriberId } from 'src/auth'
import { CreationState, RequestState } from 'src/store/common'
@ -146,6 +147,11 @@ export default {
return state?.preferenceMapById[id]?.music_on_hold || false
}
},
getDnd (state) {
return (id) => {
return state?.preferenceMapById[id]?.dnd || false
}
},
getAnnouncementCallSetup (state) {
return (id) => {
const seatPreferences = state.preferenceMapById[id]
@ -612,6 +618,18 @@ export default {
context.commit('seatUpdateFailed', err.message)
}
},
async setDnd (context, options) {
context.commit('seatUpdateRequesting', {
seatId: options.seatId,
seatField: options.message || i18n.global.t('DND')
})
try {
await setPreference(options.seatId, 'dnd', options.dnd)
context.commit('seatUpdateSucceeded')
} catch (err) {
context.commit('seatUpdateFailed', err.message)
}
},
async setCli (context, options) {
context.commit('seatUpdateRequesting', {
seatId: options.seatId,

Loading…
Cancel
Save