From 1064711d991c9f2b74d9c0574aefdeaf07604c57 Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Thu, 14 Jun 2018 16:32:14 +0200 Subject: [PATCH] TT#37653 PBXConfig: As a Customer, I want to change the phone model of a PBXDevice Change-Id: I54b4ef7898718768362eb28382607ead1115ed76 --- src/api/pbx-config.js | 22 ++++++ .../pages/PbxConfiguration/CscPbxDevice.vue | 77 ++++++++++++++++--- .../PbxConfiguration/CscPbxDeviceAddForm.vue | 17 +++- .../PbxConfiguration/CscPbxDeviceConfig.vue | 6 +- .../pages/PbxConfiguration/CscPbxDevices.vue | 38 ++++++--- .../PbxConfiguration/CscPbxModelSelect.vue | 63 ++++++++++++--- src/locales/en.json | 1 + src/store/pbx-config/actions.js | 12 ++- src/store/pbx-config/mutations.js | 9 +++ 9 files changed, 209 insertions(+), 36 deletions(-) diff --git a/src/api/pbx-config.js b/src/api/pbx-config.js index 1eb034f0..8edb2436 100644 --- a/src/api/pbx-config.js +++ b/src/api/pbx-config.js @@ -471,3 +471,25 @@ export function setIdentifier(deviceId, identifier) { value: identifier }); } + +export function setProfile(deviceId, profileId) { + return new Promise((resolve, reject)=>{ + Promise.resolve().then(()=>{ + return patchReplace({ + path: 'api/pbxdevices/' + deviceId, + fieldPath: 'lines', + value: [] + }); + }).then(()=>{ + return patchReplace({ + path: 'api/pbxdevices/' + deviceId, + fieldPath: 'profile_id', + value: profileId + }); + }).then(()=>{ + resolve(); + }).catch((err)=>{ + reject(err); + }); + }); +} diff --git a/src/components/pages/PbxConfiguration/CscPbxDevice.vue b/src/components/pages/PbxConfiguration/CscPbxDevice.vue index 7b459823..c0ca2c4b 100644 --- a/src/components/pages/PbxConfiguration/CscPbxDevice.vue +++ b/src/components/pages/PbxConfiguration/CscPbxDevice.vue @@ -50,8 +50,19 @@ @keyup.enter="saveIdentifier" /> - -

{{ name }}

+ + import _ from 'lodash' - import { QCard, QCardTitle, QCardMain, QCollapsible, - QIcon, QField, QInput, QSelect, QBtn, QInnerLoading, QSpinnerMat, QCardMedia, - QItem, QItemMain, QItemSide, QItemTile, Platform } from 'quasar-framework' + import { + QCard, + QCardTitle, + QCardMain, + QCollapsible, + QIcon, + QField, + QInput, + QSelect, + QBtn, + QInnerLoading, + QSpinnerMat, + QCardMedia, + QItem, + QItemMain, + QItemSide, + QItemTile, + Platform + } from 'quasar-framework' import CscPbxDeviceConfig from './CscPbxDeviceConfig' + import CscPbxModelSelect from './CscPbxModelSelect' + export default { name: 'csc-pbx-device', props: [ @@ -115,12 +144,30 @@ 'loading', 'modelOptions', 'groupsAndSeatsOptions', - 'subscribers' + 'subscribers', + 'profiles', + 'modelImages' ], components: { - CscPbxDeviceConfig, QCard, QCardTitle, QCardMain, QCollapsible, - QIcon, QField, QInput, QSelect, QBtn, QInnerLoading, QSpinnerMat, QCardMedia, - QItem, QItemMain, QItemSide, QItemTile, Platform + CscPbxDeviceConfig, + CscPbxModelSelect, + QCard, + QCardTitle, + QCardMain, + QCollapsible, + QIcon, + QField, + QInput, + QSelect, + QBtn, + QInnerLoading, + QSpinnerMat, + QCardMedia, + QItem, + QItemMain, + QItemSide, + QItemTile, + Platform }, data () { return { @@ -212,6 +259,9 @@ } return buttons; }, + profileId() { + return _.get(this.device, 'profile.device_id', null); + } }, mounted() { this.$emit('loaded'); @@ -250,7 +300,14 @@ }, saveIdentifier() { this.$emit('save-identifier', this.deviceModel); - } + }, + selectProfile(profile) { + this.$emit('update-profile', { + profile: profile, + device: this.device + }); + }, + modelSelectOpened() {} }, watch: { device() { diff --git a/src/components/pages/PbxConfiguration/CscPbxDeviceAddForm.vue b/src/components/pages/PbxConfiguration/CscPbxDeviceAddForm.vue index 9c84fa28..19d664a5 100644 --- a/src/components/pages/PbxConfiguration/CscPbxDeviceAddForm.vue +++ b/src/components/pages/PbxConfiguration/CscPbxDeviceAddForm.vue @@ -71,8 +71,21 @@