MT#58738 add possibility to configure fax and voicebox for seats/groups

Add the posibility to configure the voicebox and the fax on behalf of a seat/group

Change-Id: I6854acbb651eccc92146fe9f0d61362f5fe70ea0
mr13.0
Nouhaila Idrissi Zouggari 2 years ago
parent f11e89813e
commit 99fa8dded6

@ -2,7 +2,7 @@
<q-item>
<q-item-section>
<q-select
:model-value="selectedLanguage"
:model-value="value"
emit-value
map-options
:disable="loading"
@ -55,20 +55,6 @@ export default {
type: Boolean,
default: false
}
},
data () {
return {
selectedLanguage: null
}
},
watch: {
value (newLanguage) {
if (this.defaultLanguageOption && newLanguage === undefined) {
this.selectedLanguage = this.defaultLanguageOption.value
} else {
this.selectedLanguage = newLanguage
}
}
}
}
</script>

@ -159,6 +159,12 @@ export default {
CscSpinner,
CscInputSaveable
},
props: {
id: {
type: String,
default: ''
}
},
data () {
return {
faxToMailSettings: {},
@ -195,7 +201,7 @@ export default {
}),
async loadFaxServerSettings () {
try {
await this.loadFaxSettingsAction()
await this.loadFaxSettingsAction(this.id)
this.updateDataFromStore()
} catch (err) {
showGlobalError(err?.message)
@ -206,7 +212,7 @@ export default {
},
async setChangedData (field, value) {
try {
await this.faxServerSettingsUpdateAction({ field, value })
await this.faxServerSettingsUpdateAction({ field, value, id: this.id })
this.updateDataFromStore()
} catch (err) {
showGlobalError(err?.message)
@ -219,7 +225,8 @@ export default {
try {
await this.faxServerSettingsUpdateAction({
field: 'destinations',
value: destinationItems
value: destinationItems,
id: this.id
})
beforeUpdateUI()
this.updateDataFromStore()
@ -245,7 +252,8 @@ export default {
const destinationItems = this.faxToMailSettings.destinations.filter(d => d.destination !== destinationId)
this.faxServerSettingsUpdateAction({
field: 'destinations',
value: destinationItems
value: destinationItems,
id: this.id
}).then(() => {
if (this.expandedDestinationId === destinationId) {
this.expandedDestinationId = null

@ -233,6 +233,12 @@ export default {
CscInputSaveable,
CscSpinner
},
props: {
id: {
type: String,
default: ''
}
},
data () {
return {
mailToFaxSettingsModel: {},
@ -272,7 +278,7 @@ export default {
}
},
mounted () {
this.loadMailToFaxSettings()
this.loadMailToFaxSettings(this.id)
},
methods: {
...mapWaitingActions('fax', {
@ -281,7 +287,7 @@ export default {
}),
async loadMailToFaxSettings () {
try {
await this.loadMailToFaxSettingsAction()
await this.loadMailToFaxSettingsAction(this.id)
this.updateDataFromStore()
} catch (err) {
if (String(err.code) === '403') {
@ -304,7 +310,7 @@ export default {
if (field === 'secret_key') {
value = value === '' ? null : value
}
await this.mailToFaxSettingsUpdateAction({ field, value })
await this.mailToFaxSettingsUpdateAction({ field, value, id: this.id })
beforeUpdateUI()
this.updateDataFromStore()
} catch (err) {

@ -173,7 +173,7 @@
"Extension Settings": "Erweiterungseinstellungen",
"Fax": "Fax",
"Fax Settings": "Faxeinstellungen",
"Fax to Mail and Sendfax": "„Fax To Mail“ und „Sendfax“",
"Fax to Mail and Sendfax": "„Fax to Mail“ und „Sendfax“",
"Fax2Mail": "Fax2Mail",
"Faxes": "Faxe",
"File": "Datei",

@ -234,7 +234,19 @@
</q-item>
<csc-call-forward-details
v-else
v-if="selectedTab === 'callForwards'"
:id="id"
/>
<csc-page-voicebox
v-if="selectedTab === 'voicebox'"
:id="id"
/>
<csc-fax-to-mail-settings
v-if="selectedTab === 'fax2mail'"
:id="id"
/>
<csc-mail-to-fax-settings
v-if="selectedTab === 'mail2fax'"
:id="id"
/>
</csc-page-sticky-tabs>
@ -261,6 +273,9 @@ import CscPageStickyTabs from 'components/CscPageStickyTabs'
import CscInputButtonSave from 'components/form/CscInputButtonSave'
import CscInputButtonReset from 'components/form/CscInputButtonReset'
import CscCallForwardDetails from 'components/pages/CallForward/CscCallForwardDetails.vue'
import CscFaxToMailSettings from 'components/pages/FaxSettings/CscFaxToMailSettings'
import CscPageVoicebox from 'src/pages/CscPageVoicebox.vue'
import CscMailToFaxSettings from 'components/pages/FaxSettings/CscMailToFaxSettings'
import useValidate from '@vuelidate/core'
export default {
name: 'CscPagePbxGroupDetails',
@ -268,7 +283,10 @@ export default {
CscInputButtonReset,
CscInputButtonSave,
CscPageStickyTabs,
CscCallForwardDetails
CscCallForwardDetails,
CscPageVoicebox,
CscFaxToMailSettings,
CscMailToFaxSettings
},
props: {
initialTab: {
@ -297,6 +315,21 @@ export default {
label: this.$t('Call Forwards'),
value: 'callForwards',
icon: 'forward_to_inbox'
},
{
label: this.$t('Voicebox'),
value: 'voicebox',
icon: 'voicemail'
},
{
label: this.$t('Fax to mail and sendfax'),
value: 'fax2mail',
icon: 'perm_phone_msg'
},
{
label: this.$t('Mail to Fax'),
value: 'mail2fax',
icon: 'forward_to_inbox'
}
]
},

@ -345,7 +345,19 @@
</q-item>
<csc-call-forward-details
v-else
v-if="selectedTab === 'callForwards'"
:id="id"
/>
<csc-page-voicebox
v-if="selectedTab === 'voicebox'"
:id="id"
/>
<csc-fax-to-mail-settings
v-if="selectedTab === 'fax2mail'"
:id="id"
/>
<csc-mail-to-fax-settings
v-if="selectedTab === 'mail2fax'"
:id="id"
/>
</csc-page-sticky-tabs>
@ -371,6 +383,9 @@ import CscInputButtonSave from 'components/form/CscInputButtonSave'
import CscInputButtonReset from 'components/form/CscInputButtonReset'
import CscChangePasswordDialog from 'src/components/CscChangePasswordDialog'
import CscCallForwardDetails from 'components/pages/CallForward/CscCallForwardDetails.vue'
import CscFaxToMailSettings from 'components/pages/FaxSettings/CscFaxToMailSettings'
import CscMailToFaxSettings from 'components/pages/FaxSettings/CscMailToFaxSettings'
import CscPageVoicebox from 'src/pages/CscPageVoicebox.vue'
import { inRange } from 'src/helpers/validation'
import numberFilter from '../filters/number'
import useValidate from '@vuelidate/core'
@ -385,7 +400,10 @@ export default {
CscInputButtonSave,
CscInputButtonReset,
CscChangePasswordDialog,
CscCallForwardDetails
CscCallForwardDetails,
CscPageVoicebox,
CscFaxToMailSettings,
CscMailToFaxSettings
},
props: {
initialTab: {
@ -417,6 +435,21 @@ export default {
label: this.$t('Call Forwards'),
value: 'callForwards',
icon: 'forward_to_inbox'
},
{
label: this.$t('Voicebox'),
value: 'voicebox',
icon: 'voicemail'
},
{
label: this.$t('Fax to mail and sendfax'),
value: 'fax2mail',
icon: 'perm_phone_msg'
},
{
label: this.$t('Mail to Fax'),
value: 'mail2fax',
icon: 'forward_to_inbox'
}
]
},

@ -66,7 +66,10 @@
data-cy="voicebox-attach-file"
checked-icon="attach_file"
unchecked-icon="attach_file"
@update:model-value="attachToggleAction(!attachValue)"
@update:model-value="attachToggleAction({
attachValue: !attachValue,
subscriberId: id
})"
/>
</q-item-section>
<q-item-section
@ -88,7 +91,10 @@
data-cy="voicebox-delete-file"
checked-icon="delete"
unchecked-icon="delete"
@update:model-value="deleteToggleAction(!deleteValue)"
@update:model-value="deleteToggleAction({
deleteValue: !deleteValue,
subscriberId: id
})"
/>
</q-item-section>
<q-item-section
@ -118,7 +124,7 @@
delete-term="revert"
@init="busyGreetingInitAudio"
@remove="busyGreetingDeletionConfirmation"
@upload="busyGreetingUpload"
@upload="selectFileBusyGreeting"
@abort="busyGreetingUploadAbort"
/>
</q-item-section>
@ -141,7 +147,7 @@
delete-term="revert"
@init="unavailableGreetingInitAudio"
@remove="unavailableGreetingDeletionConfirmation"
@upload="unavailableGreetingUpload"
@upload="selectFileUnavailableGreeting"
@abort="unavailableGreetingUploadAbort"
/>
</q-item-section>
@ -182,6 +188,12 @@ export default {
CscInputSaveable,
CscSoundFileUpload
},
props: {
id: {
type: String,
default: ''
}
},
data () {
return {
formData: {
@ -322,8 +334,8 @@ export default {
async mounted () {
await Promise.all([
this.loadPreferencesDefsAction(),
this.loadSubscriberPreferencesAction(),
this.settingsLoadAction()
this.loadSubscriberPreferencesAction(this.id),
this.settingsLoadAction(this.id)
])
this.formData.pin = this.pinValue
this.formData.email = this.emailValue
@ -357,12 +369,35 @@ export default {
}),
async selectLanguage (language) {
try {
await this.setLanguage(language)
await this.setLanguage({
language: language,
subscriberId: this.id
})
showToast(this.$t('Language changed successfully'))
} catch (err) {
showGlobalError(err?.message || this.$t('Unknown error'))
}
},
async selectFileBusyGreeting (file) {
try {
await this.busyGreetingUpload({
file: file,
subscriberId: this.id
})
} catch (err) {
showGlobalError(err?.message || this.$t('Unknown error'))
}
},
async selectFileUnavailableGreeting (file) {
try {
await this.unavailableGreetingUpload({
file: file,
subscriberId: this.id
})
} catch (err) {
showGlobalError(err?.message || this.$t('Unknown error'))
}
},
pinInput () {
this.pinInitialize()
this.v$.formData.pin.$touch()
@ -374,7 +409,10 @@ export default {
pinUpdate (newPin) {
this.v$.formData.pin.$touch()
if (this.pinHasChanged && !this.pinHasError) {
this.pinUpdateAction(newPin)
this.pinUpdateAction({
pin: newPin,
subscriberId: this.id
})
}
},
emailInput () {
@ -388,7 +426,10 @@ export default {
emailUpdate (newEmail) {
this.v$.formData.email.$touch()
if (this.emailHasChanged && !this.emailHasError) {
this.emailUpdateAction(newEmail)
this.emailUpdateAction({
email: newEmail,
subscriberId: this.id
})
}
},
busyGreetingInitAudio () {

@ -46,8 +46,9 @@ export default {
}
},
actions: {
async loadSubscriberPreferencesAction (context) {
const subscriberPreferences = await getPreferences(context.getters.subscriberId)
async loadSubscriberPreferencesAction (context, id) {
const subscriberId = id ?? context.getters.subscriberId
const subscriberPreferences = await getPreferences(subscriberId)
context.commit('subscriberPreferencesSucceeded', subscriberPreferences)
},
async fieldUpdateAction (context, options) {
@ -64,13 +65,13 @@ export default {
async setMusicOnHold (context, value) {
await context.dispatch('fieldUpdateAction', { field: 'music_on_hold', value })
},
async setLanguage (context, value) {
const subscriberId = context.getters.subscriberId
if (value) {
await setPreference(subscriberId, 'language', value)
async setLanguage (context, options) {
const subscriberId = options.subscriberId ?? context.getters.subscriberId
if (options.language) {
await setPreference(subscriberId, 'language', options.language)
context.commit('subscriberPreferencesUpdate', {
field: 'language',
value: value
value: options.language
})
} else {
await removePreference(subscriberId, 'language')

@ -34,15 +34,17 @@ export default {
}
},
actions: {
async loadFaxSettingsAction (context) {
const faxServerSettings = await getFaxServerSettings(context.getters.subscriberId)
async loadFaxSettingsAction (context, id) {
const subscriberId = id ?? context.getters.subscriberId
const faxServerSettings = await getFaxServerSettings(subscriberId)
context.commit('settingsSucceeded', {
faxServerSettings
})
},
async faxServerSettingsUpdateAction (context, options) {
const subscriberId = options.id ?? context.getters.subscriberId
const faxServerSettings = await setFaxServerField({
subscriberId: context.getters.subscriberId,
subscriberId: subscriberId,
field: options.field,
value: options.value
})
@ -52,15 +54,17 @@ export default {
context.commit('user/updateFaxActiveCapabilityState', faxServerSettings.active, { root: true })
},
async loadMailToFaxSettingsAction (context) {
const mailToFaxSettings = await getMailToFaxSettings(context.getters.subscriberId)
async loadMailToFaxSettingsAction (context, id) {
const subscriberId = id ?? context.getters.subscriberId
const mailToFaxSettings = await getMailToFaxSettings(subscriberId)
context.commit('settingsSucceeded', {
mailToFaxSettings
})
},
async mailToFaxSettingsUpdateAction (context, options) {
const subscriberId = options.id ?? context.getters.subscriberId
const mailToFaxSettings = await setMailToFaxSettingField({
subscriberId: context.getters.subscriberId,
subscriberId: subscriberId,
field: options.field,
value: options.value
})

@ -322,16 +322,17 @@ export default {
}
},
actions: {
async settingsLoadAction (context) {
async settingsLoadAction (context, id) {
const subscriberId = id ?? context.getters.subscriberId
context.commit('settingsRequesting')
const res = await Promise.all([
getVoiceboxSettings(context.getters.subscriberId),
getVoiceboxSettings(subscriberId),
getVoiceboxGreetingByType({
id: context.getters.subscriberId,
id: subscriberId,
type: 'busy'
}),
getVoiceboxGreetingByType({
id: context.getters.subscriberId,
id: subscriberId,
type: 'unavail'
})
])
@ -342,52 +343,63 @@ export default {
})
},
async updateAction (context, options) {
let subscriberId
if (options.subscriberId) {
subscriberId = options.subscriberId
} else {
subscriberId = context.getters.subscriberId
}
try {
context.commit(options.property + 'UpdateRequesting')
await setVoiceboxSettings[options.property]({
subscriberId: context.getters.subscriberId,
subscriberId: subscriberId,
value: options.value
})
context.commit('settingsSucceeded', {
settings: await getVoiceboxSettings(context.getters.subscriberId)
settings: await getVoiceboxSettings(subscriberId)
})
context.commit(options.property + 'UpdateSucceeded')
} catch (err) {
context.commit(options.property + 'UpdateFailed', err.message)
}
},
async pinUpdateAction (context, pin) {
async pinUpdateAction (context, options) {
await context.dispatch('updateAction', {
property: 'pin',
value: pin
value: options.pin,
subscriberId: options.subscriberId
})
},
async emailUpdateAction (context, email) {
async emailUpdateAction (context, options) {
await context.dispatch('updateAction', {
property: 'email',
value: email
value: options.email,
subscriberId: options.subscriberId
})
},
async attachToggleAction (context, attachValue) {
async attachToggleAction (context, options) {
await context.dispatch('updateAction', {
property: 'attach',
value: attachValue
value: options.attachValue,
subscriberId: options.subscriberId
})
},
async deleteToggleAction (context, deleteValue) {
async deleteToggleAction (context, options) {
await context.dispatch('updateAction', {
property: 'delete',
value: deleteValue
value: options.deleteValue,
subscriberId: options.subscriberId
})
},
async greetingUpload (context, options) {
const subscriberId = options.subscriberId ?? context.getters.subscriberId
try {
context.commit(options.type + 'GreetingUploadRequesting')
const cancelToken = apiCreateCancelObject()
context.commit('updateUploadCancelActions', options.greeting, cancelToken.cancel)
await uploadGreeting({
data: {
subscriber_id: context.getters.subscriberId,
subscriber_id: subscriberId,
dir: options.greeting,
file: options.file
},
@ -397,7 +409,7 @@ export default {
cancelToken: cancelToken.token
})
const greetings = await getVoiceboxGreetingByType({
id: context.getters.subscriberId,
id: subscriberId,
type: options.greeting
})
context.commit(options.type + 'GreetingUploadSucceeded', greetings.items[0].id)
@ -436,11 +448,12 @@ export default {
context.commit(options.type + 'GreetingDeletionFailed', err.message)
}
},
async busyGreetingUpload (context, file) {
async busyGreetingUpload (context, options) {
await context.dispatch('greetingUpload', {
type: 'busy',
greeting: 'busy',
file: file
file: options.file,
subscriberId: options.subscriberId
})
},
async busyGreetingUploadAbort (context) {
@ -459,11 +472,12 @@ export default {
id: context.state.busyGreetingId
})
},
async unavailableGreetingUpload (context, file) {
async unavailableGreetingUpload (context, options) {
await context.dispatch('greetingUpload', {
type: 'unavailable',
greeting: 'unavail',
file: file
file: options.file,
subscriberId: options.subscriberId
})
},
async unavailableGreetingUploadAbort (context) {

Loading…
Cancel
Save