TT#88205 CSC: As a PbxAdmin, I want to toggle visibility of the number towards the callee for each PbxSeat

√ Can toggle the setting "clir_intrapbx" by a Quasar toggle button
√ Can see a success toast for both cases (on/off)

Change-Id: I4c29d2cc59dade6b925403d9454bf589ef5ac674
mr9.0.1
Carlo Venusino 5 years ago
parent e5b8339f7e
commit 38e158ea14

@ -7,7 +7,8 @@ import {
setPbxExtension, setPbxExtension,
setPbxWebPassword, setPbxWebPassword,
setPbxGroupIds, setPbxGroupIds,
setSubscriberNumbers setSubscriberNumbers,
setPreferenceIntraPbx
} from "./subscriber"; } from "./subscriber";
import _ from "lodash"; import _ from "lodash";
import { import {
@ -120,6 +121,7 @@ export function createSeat(seat) {
}); });
}).then(($subscriberId)=>{ }).then(($subscriberId)=>{
subscriberId = $subscriberId; subscriberId = $subscriberId;
setSeatIntraPbx(subscriberId, seat.clirIntrapbx);
if(seat.soundSet !== null && seat.soundSet !== void(0)) { if(seat.soundSet !== null && seat.soundSet !== void(0)) {
return getSoundSet(seat.soundSet); return getSoundSet(seat.soundSet);
} }
@ -212,6 +214,14 @@ export function setSeatWebPassword(options) {
}); });
} }
/**
* @param seatId
* @param clirIntrapbx
*/
export function setSeatIntraPbx(seatId, clirIntrapbx) {
return setPreferenceIntraPbx(seatId, clirIntrapbx);
}
/** /**
* @param options * @param options
* @param options.seatId * @param options.seatId

@ -310,6 +310,10 @@ export function setPbxGroupIds(id, ids) {
return setField(id, 'pbx_group_ids', ids); return setField(id, 'pbx_group_ids', ids);
} }
export function setPreferenceIntraPbx(id, value) {
return setPreference(id, 'clir_intrapbx', value);
}
export function getSubscribers(options) { export function getSubscribers(options) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
options = options || {}; options = options || {};

@ -234,6 +234,16 @@
/> />
</csc-fade> </csc-fade>
</q-field> </q-field>
<q-field
:labelWidth="labelWidth"
:label="$t('pbxConfig.toggleIntraPbx')"
dark
>
<q-toggle
v-model="changes.clirIntrapbx"
@change="changeIntraPbx"
/>
</q-field>
<q-field <q-field
v-if="hasCallQueue" v-if="hasCallQueue"
:labelWidth="labelWidth" :labelWidth="labelWidth"
@ -268,7 +278,8 @@
QItemTile, QItemTile,
QTransition, QTransition,
QList, QList,
QSlideTransition QSlideTransition,
QToggle
} from 'quasar-framework' } from 'quasar-framework'
import CscListItem from "../../CscListItem"; import CscListItem from "../../CscListItem";
import CscListItemTitle from "../../CscListItemTitle"; import CscListItemTitle from "../../CscListItemTitle";
@ -284,6 +295,7 @@
name: 'csc-pbx-seat', name: 'csc-pbx-seat',
props: [ props: [
'seat', 'seat',
'intraPbx',
'groups', 'groups',
'soundSet', 'soundSet',
'expanded', 'expanded',
@ -320,6 +332,7 @@
QItemTile, QItemTile,
QTransition, QTransition,
QList, QList,
QToggle,
CscFormSaveButton, CscFormSaveButton,
CscFormResetButton, CscFormResetButton,
CscChangePasswordDialog CscChangePasswordDialog
@ -370,6 +383,7 @@
extension: this.seat.pbx_extension, extension: this.seat.pbx_extension,
aliasNumbers: this.getAliasNumberIds(), aliasNumbers: this.getAliasNumberIds(),
webPassword: this.seat.webpassword, webPassword: this.seat.webpassword,
clirIntrapbx: this.intraPbx,
groups: this.getGroupIds(), groups: this.getGroupIds(),
soundSet: this.getSoundSetId() soundSet: this.getSoundSetId()
}; };
@ -458,6 +472,12 @@
seatWebPassword: data.password seatWebPassword: data.password
}); });
this.$refs.changePasswordDialog.close(); this.$refs.changePasswordDialog.close();
},
changeIntraPbx(){
this.$emit('save-intra-pbx', {
seatId: this.seat.id,
intraPbx: this.changes.clirIntrapbx
});
} }
}, },
watch: { watch: {

@ -70,6 +70,14 @@
:options="soundSetOptions" :options="soundSetOptions"
/> />
</q-field> </q-field>
<q-field>
<q-toggle
v-model="data.clirIntrapbx"
dense
:label="$t('pbxConfig.toggleIntraPbx')"
:disable="loading"
/>
</q-field>
<div class="csc-form-actions row justify-center"> <div class="csc-form-actions row justify-center">
<q-btn <q-btn
flat flat
@ -111,6 +119,7 @@
QField, QField,
QInput, QInput,
QSelect, QSelect,
QToggle,
QIcon, QIcon,
QTooltip QTooltip
} from 'quasar-framework' } from 'quasar-framework'
@ -133,6 +142,7 @@
QField, QField,
QInput, QInput,
QSelect, QSelect,
QToggle,
QIcon, QIcon,
QTooltip QTooltip
}, },
@ -214,7 +224,8 @@
webPassword: this.data.webPassword, webPassword: this.data.webPassword,
aliasNumbers: this.data.aliasNumbers, aliasNumbers: this.data.aliasNumbers,
groups: this.data.groups, groups: this.data.groups,
soundSet: this.data.soundSet soundSet: this.data.soundSet,
clirIntrapbx: this.data.clirIntrapbx
} }
} }
}, },
@ -226,7 +237,8 @@
webPassword: '', webPassword: '',
aliasNumbers: [], aliasNumbers: [],
groups: [], groups: [],
soundSet: null soundSet: null,
clirIntrapbx: false
} }
}, },
cancel() { cancel() {

@ -57,6 +57,7 @@
:key="seat.id" :key="seat.id"
:odd="(index % 2) === 0" :odd="(index % 2) === 0"
:seat="seat" :seat="seat"
:intra-pbx="getIntraPbx(seat.id)"
:groups="groupMapById" :groups="groupMapById"
:expanded="isSeatExpanded(seat.id)" :expanded="isSeatExpanded(seat.id)"
:loading="isSeatLoading(seat.id)" :loading="isSeatLoading(seat.id)"
@ -74,6 +75,7 @@
@save-alias-numbers="setSeatNumbers" @save-alias-numbers="setSeatNumbers"
@save-groups="setSeatGroups" @save-groups="setSeatGroups"
@save-sound-set="setSeatSoundSet" @save-sound-set="setSeatSoundSet"
@save-intra-pbx="setIntraPbx"
@jump-to-call-queue="jumpToCallQueue" @jump-to-call-queue="jumpToCallQueue"
/> />
</csc-fade> </csc-fade>
@ -193,6 +195,7 @@
'isSeatRemoving', 'isSeatRemoving',
'isSeatExpanded', 'isSeatExpanded',
'isSeatLoading', 'isSeatLoading',
'getIntraPbx',
'getSoundSetBySeatId', 'getSoundSetBySeatId',
'getSeatCreatingName', 'getSeatCreatingName',
'getSeatUpdatingField', 'getSeatUpdatingField',
@ -213,7 +216,8 @@
'setSeatExtension', 'setSeatExtension',
'setSeatGroups', 'setSeatGroups',
'setSeatNumbers', 'setSeatNumbers',
'setSeatSoundSet' 'setSeatSoundSet',
'setIntraPbx'
]), ]),
...mapMutations('pbxSeats', [ ...mapMutations('pbxSeats', [
'enableSeatAddForm', 'enableSeatAddForm',

@ -577,7 +577,9 @@
"msConfigCreationToast": "Created manager secretary config for {msConfig} successfully", "msConfigCreationToast": "Created manager secretary config for {msConfig} successfully",
"msConfigUpdateToast": "Updated {field} for manager secretary config {msConfig} successfully", "msConfigUpdateToast": "Updated {field} for manager secretary config {msConfig} successfully",
"msConfigRemovalToast": "Removed manager secretary config for {msConfig} successfully", "msConfigRemovalToast": "Removed manager secretary config for {msConfig} successfully",
"noMsConfigs": "No manager secretary configuration created yet" "noMsConfigs": "No manager secretary configuration created yet",
"toggleIntraPbx": "Hide number within own PBX",
"intraPbx": "the visibility of the number within own PBX"
}, },
"callBlocking": { "callBlocking": {
"privacyEnabledToast": "Your number is hidden to the callee", "privacyEnabledToast": "Your number is hidden to the callee",

@ -18,6 +18,7 @@ import {
setSeatGroups, setSeatGroups,
setSeatNumbers, setSeatNumbers,
setSeatSoundSet, setSeatSoundSet,
setSeatIntraPbx,
setSeatWebPassword setSeatWebPassword
} from "../api/pbx-seats"; } from "../api/pbx-seats";
@ -89,6 +90,12 @@ export default {
return null; return null;
} }
}, },
getIntraPbx(state) {
return (id)=>{
const seatPreferences = state.preferenceMapById[id];
return seatPreferences && seatPreferences.clir_intrapbx ? state.preferenceMapById[id].clir_intrapbx : false;
};
},
getSeatCreatingName(state) { getSeatCreatingName(state) {
return _.get(state, 'seatCreating.name', ''); return _.get(state, 'seatCreating.name', '');
}, },
@ -387,6 +394,19 @@ export default {
}).catch((err)=>{ }).catch((err)=>{
context.commit('seatUpdateFailed', err.message); context.commit('seatUpdateFailed', err.message);
}); });
},
async setIntraPbx(context, options) {
context.commit('seatUpdateRequesting', {
seatId: options.seatId,
seatField: i18n.t('pbxConfig.intraPbx')
});
try{
const result = await setSeatIntraPbx(options.seatId, options.intraPbx);
context.commit('seatUpdateSucceeded', result);
}
catch(err){
context.commit('seatUpdateFailed', err.message);
}
} }
} }
}; };

Loading…
Cancel
Save