diff --git a/src/components/CscVoiceboxLanguage.vue b/src/components/CscVoiceboxLanguage.vue index df458321..41a3b907 100644 --- a/src/components/CscVoiceboxLanguage.vue +++ b/src/components/CscVoiceboxLanguage.vue @@ -2,7 +2,7 @@ diff --git a/src/components/pages/FaxSettings/CscFaxToMailSettings.vue b/src/components/pages/FaxSettings/CscFaxToMailSettings.vue index e1ef8d89..fd7a468b 100644 --- a/src/components/pages/FaxSettings/CscFaxToMailSettings.vue +++ b/src/components/pages/FaxSettings/CscFaxToMailSettings.vue @@ -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 diff --git a/src/components/pages/FaxSettings/CscMailToFaxSettings.vue b/src/components/pages/FaxSettings/CscMailToFaxSettings.vue index 27ff48c6..beeb47d5 100644 --- a/src/components/pages/FaxSettings/CscMailToFaxSettings.vue +++ b/src/components/pages/FaxSettings/CscMailToFaxSettings.vue @@ -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) { diff --git a/src/i18n/de.json b/src/i18n/de.json index 3435b4f5..07e02d93 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -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", diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index 19bb5dd0..c2ae5df5 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -234,7 +234,19 @@ + + + @@ -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' } ] }, diff --git a/src/pages/CscPagePbxSeatDetails.vue b/src/pages/CscPagePbxSeatDetails.vue index 045838fa..8d13356d 100644 --- a/src/pages/CscPagePbxSeatDetails.vue +++ b/src/pages/CscPagePbxSeatDetails.vue @@ -345,7 +345,19 @@ + + + @@ -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' } ] }, diff --git a/src/pages/CscPageVoicebox.vue b/src/pages/CscPageVoicebox.vue index 3bf7fcdb..63e0c8c9 100644 --- a/src/pages/CscPageVoicebox.vue +++ b/src/pages/CscPageVoicebox.vue @@ -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 + })" /> @@ -141,7 +147,7 @@ delete-term="revert" @init="unavailableGreetingInitAudio" @remove="unavailableGreetingDeletionConfirmation" - @upload="unavailableGreetingUpload" + @upload="selectFileUnavailableGreeting" @abort="unavailableGreetingUploadAbort" /> @@ -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 () { diff --git a/src/store/call-settings.js b/src/store/call-settings.js index dd51edd6..a1693846 100644 --- a/src/store/call-settings.js +++ b/src/store/call-settings.js @@ -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') diff --git a/src/store/fax.js b/src/store/fax.js index e951d6a9..05c1ee94 100644 --- a/src/store/fax.js +++ b/src/store/fax.js @@ -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 }) diff --git a/src/store/voicebox.js b/src/store/voicebox.js index bf08a410..12a337cb 100644 --- a/src/store/voicebox.js +++ b/src/store/voicebox.js @@ -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) {