+
@@ -47,7 +49,9 @@
props: [
'device',
'loading',
- 'modelOptions'
+ 'modelOptions',
+ 'groupsAndSeatsOptions',
+ 'subscribers'
],
components: {
CscPbxDeviceConfig, QCard, QCardTitle, QCardMain, QCollapsible,
@@ -91,6 +95,15 @@
},
remove() {
this.$emit('remove', this.device);
+ },
+ loadGroupsAndSeats(){
+ this.$emit('loadGroupsAndSeats');
+ },
+ keysChanged(keys) {
+ this.$emit('deviceKeysChanged', {
+ device: this.device,
+ keys: keys
+ });
}
}
}
diff --git a/src/components/pages/PbxConfiguration/CscPbxDeviceConfig.vue b/src/components/pages/PbxConfiguration/CscPbxDeviceConfig.vue
index add66060..8f8fc4f2 100644
--- a/src/components/pages/PbxConfiguration/CscPbxDeviceConfig.vue
+++ b/src/components/pages/PbxConfiguration/CscPbxDeviceConfig.vue
@@ -4,22 +4,28 @@
-
-
{{ index + 1 }}
-
-
-
-
-
-
-
-
-
-
-
+
{{ index + 1 }}
+
+
+
+ Key {{ selectedKeyIndex + 1 }}
+
+
+
+
+
+
+
+
+
@@ -28,7 +34,7 @@
@@ -219,6 +368,27 @@
@import '../../../themes/quasar.variables';
$spotSize = 25px
+ .csc-pbx-device-config-key-overlay
+ .title
+ .q-icon
+ margin-right 8px
+ font-size 18px
+ font-weight 400
+ letter-spacing normal
+ line-height 1.8rem
+ margin-bottom 32px
+ text-align center
+
+
+ position absolute
+ top 0
+ left 0
+ right 0
+ bottom 0
+ background-color rgba(250,250,250,0.95)
+ z-index 10
+ padding 48px
+
.csc-pbx-device-key-details
padding 50px
position relative
@@ -227,6 +397,8 @@
position relative
.spot-modal-content
position relative
+ .actions
+ padding 32px
.csc-pbx-device-image
position relative
@@ -244,6 +416,9 @@
letter-spacing normal
line-height 1.8rem
+ .csc-pbx-device-loader
+ z-index 20
+
.csc-pbx-device-button-spot
border-radius: 50%;
width $spotSize
diff --git a/src/components/pages/PbxConfiguration/CscPbxDevices.vue b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
index 5d56b7f4..07d215e5 100644
--- a/src/components/pages/PbxConfiguration/CscPbxDevices.vue
+++ b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
@@ -9,7 +9,9 @@
+ :modelOptions="modelOptions" :loading="isDeviceLoading(device.id)"
+ :groupsAndSeatsOptions="groupsAndSeatsOptions" :subscribers="getGroupOrSeatById"
+ @loadGroupsAndSeats="loadGroupsAndSeats()" @deviceKeysChanged="deviceKeysChanged" />
{{ $t('pbxConfig.noDevices') }}
@@ -52,7 +54,11 @@
'listCurrentPage',
'listLastPage',
'isDeviceLoading',
- 'deviceRemoved'
+ 'deviceRemoved',
+ 'groupsAndSeatsOptions',
+ 'groupsAndSeats',
+ 'getGroupOrSeatById',
+ 'updatedDeviceKey'
])
},
methods: {
@@ -81,6 +87,12 @@
}
]
});
+ },
+ loadGroupsAndSeats() {
+ this.$store.dispatch('pbxConfig/getAllGroupsAndSeats');
+ },
+ deviceKeysChanged(data) {
+ this.$store.dispatch('pbxConfig/updateDeviceKeys', data);
}
},
watch: {
@@ -90,6 +102,13 @@
name: device.station_name
}));
}
+ },
+ updatedDeviceKey(data) {
+ if(data !== null) {
+ showToast(this.$t('pbxConfig.toasts.updatedDeviceKeys',{
+ name: data.device.station_name
+ }));
+ }
}
}
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 51e5f815..96e88b1b 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -292,11 +292,19 @@
"removedGroupToast": "Removed group {group}",
"addedSeatToast": "Added seat {seat}",
"removedSeatToast": "Removed seat {seat}",
- "removedDeviceToast": "Removed device {name}"
+ "removedDeviceToast": "Removed device {name}",
+ "updatedDeviceKeys": "Updated keys of device {name}"
},
"removeDevice": "Remove device",
"removeDeviceTitle": "Remove device",
- "removeDeviceText": "You are about to remove device {device}"
+ "removeDeviceText": "You are about to remove device {device}",
+ "keyEmptyLabel": "Unassigned",
+ "keyGroupLabel": "Group",
+ "keySeatLabel": "Seat",
+ "keyBothLabel": "Group/Seat",
+ "keyTypeShared": "Shared",
+ "keyTypeBLF": "Busy Lamp Field",
+ "keyTypePrivate": "Private"
},
"communication": {
"sendFax": "Send Fax",
diff --git a/src/store/pbx-config/actions.js b/src/store/pbx-config/actions.js
index d09d2536..a5bf1418 100644
--- a/src/store/pbx-config/actions.js
+++ b/src/store/pbx-config/actions.js
@@ -3,9 +3,9 @@
import _ from 'lodash';
import { assignNumbers } from '../../api/user';
import { addGroup, removeGroup, addSeat, removeSeat, setGroupName,
- setGroupExtension, setGroupHuntPolicy, setGroupHuntTimeout,
- updateGroupSeats, setSeatName, setSeatExtension, removeDevice,
- updateSeatGroups, getGroupList, getSeatList, getDeviceList, getDeviceFull } from '../../api/pbx-config'
+ setGroupExtension, setGroupHuntPolicy, setGroupHuntTimeout, updateDeviceKeys,
+ updateGroupSeats, setSeatName, setSeatExtension, removeDevice, getAllGroupsAndSeats,
+ updateSeatGroups, getGroupList, getSeatList, getDeviceList, getDevice } from '../../api/pbx-config'
export default {
listGroups(context, options) {
@@ -204,7 +204,10 @@ export default {
},
loadDevice(context, deviceId) {
context.commit('deviceRequesting', deviceId);
- getDeviceFull(deviceId).then((device)=>{
+ getDevice(deviceId, {
+ join: true,
+ joinLines: false,
+ }).then((device)=>{
context.commit('deviceSucceeded', device);
}).catch((err)=>{
context.commit('deviceFailed', deviceId, err.message);
@@ -218,5 +221,22 @@ export default {
}).catch((err)=>{
context.commit('deviceFailed', device.id, err.message);
});
+ },
+ getAllGroupsAndSeats(context) {
+ context.commit('groupsAndSeatsRequesting');
+ getAllGroupsAndSeats().then((list)=>{
+ context.commit('groupsAndSeatsSucceeded', list);
+ }).catch((err)=>{
+ context.commit('groupsAndSeatsError', err.message);
+ });
+ },
+ updateDeviceKeys(context, data) {
+ context.commit('updateDeviceKeyRequesting', data.device.id);
+ updateDeviceKeys(data.device.id, data.keys).then(()=>{
+ context.commit('updateDeviceKeySucceeded', data);
+ context.dispatch('loadDevice', data.device.id);
+ }).catch((err)=>{
+ context.commit('updateDeviceKeyFailed', data.device.id, err);
+ });
}
}
diff --git a/src/store/pbx-config/getters.js b/src/store/pbx-config/getters.js
index 5e423fb2..afc43ab3 100644
--- a/src/store/pbx-config/getters.js
+++ b/src/store/pbx-config/getters.js
@@ -2,6 +2,7 @@
import _ from 'lodash'
import { RequestState } from '../common'
+import { i18n } from '../../i18n';
export default {
groups(state) {
@@ -177,5 +178,39 @@ export default {
},
deviceRemoved(state) {
return state.deviceRemoved;
+ },
+ groupsAndSeats(state) {
+ return state.groupsAndSeats;
+ },
+ groupsAndSeatsOptions(state) {
+ let options = [
+ {
+ icon: 'clear',
+ label: i18n.t('pbxConfig.keyEmptyLabel'),
+ value: null
+ }
+ ];
+ state.groupsAndSeats.forEach((item)=>{
+ options.push({
+ icon: (item.is_pbx_group === true)? 'group' : 'person',
+ label: item.display_name,
+ value: item.id
+ });
+ });
+ return options;
+ },
+ getGroupOrSeatById(state) {
+ return (id)=>{
+ let groupOrSeat = null;
+ state.groupsAndSeats.forEach(($groupOrSeat)=>{
+ if(id === $groupOrSeat.id) {
+ groupOrSeat = $groupOrSeat;
+ }
+ });
+ return groupOrSeat;
+ };
+ },
+ updatedDeviceKey(state) {
+ return state.updatedDeviceKey;
}
}
diff --git a/src/store/pbx-config/mutations.js b/src/store/pbx-config/mutations.js
index c4199b61..49bd2cf9 100644
--- a/src/store/pbx-config/mutations.js
+++ b/src/store/pbx-config/mutations.js
@@ -201,5 +201,30 @@ export default {
},
lastUpdatedField(state, group) {
state.lastUpdatedField = group;
+ },
+ groupsAndSeatsRequesting(state) {
+ state.groupsAndSeatsState = RequestState.requesting;
+ state.groupsAndSeats = [];
+ },
+ groupsAndSeatsSucceeded(state, list) {
+ state.groupsAndSeatsState = RequestState.succeeded;
+ state.groupsAndSeats = list.items;
+ },
+ groupsAndSeatsError(state, error) {
+ state.groupsAndSeatsState = RequestState.failed;
+ state.groupsAndSeatsError = error;
+ },
+ updateDeviceKeyRequesting(state, deviceId) {
+ Vue.set(state.deviceStates, deviceId + "", RequestState.requesting);
+ state.updatedDeviceKey = null;
+ },
+ updateDeviceKeySucceeded(state, data) {
+ Vue.set(state.deviceStates, data.device.id + "", RequestState.succeeded);
+ state.updatedDeviceKey = data;
+ },
+ updateDeviceKeyFailed(state, deviceId, error) {
+ Vue.set(state.deviceStates, deviceId + "", RequestState.failed);
+ Vue.set(state.deviceErrors, deviceId + "", error);
+ state.updatedDeviceKey = null;
}
}
diff --git a/src/store/pbx-config/state.js b/src/store/pbx-config/state.js
index c8e8e9d9..d0cd5249 100644
--- a/src/store/pbx-config/state.js
+++ b/src/store/pbx-config/state.js
@@ -41,5 +41,9 @@ export default {
updateAliasNumbersState: RequestState.initiated,
updateAliasNumbersItem: null,
updateGroupsAndSeatsState: RequestState.initiated,
- updateGroupsAndSeatsItem: null
+ updateGroupsAndSeatsItem: null,
+ groupsAndSeats: [],
+ groupsAndSeatsState: RequestState.initiated,
+ groupsAndSeatsError: null,
+ updatedDeviceKey: null
}