-
- {{ $t('pages.newCallForward.destinationTimeoutLabel') }}
-
- {{this.destinationTimeout}}
-
-
-
-
- {{ $t('pages.newCallForward.destinationNumberLabel') }}
-
-
+
+
+ {{ $t('pages.newCallForward.destinationTimeoutLabel') }}
+
+ {{this.destinationTimeout}}
+
+
+
+
+ {{ $t('pages.newCallForward.destinationNumberLabel') }}
+
+
-
- {{this.destinationNumber}}
-
-
-
-
-
-
-
-
+
+ {{ !this.destinationNumber || this.destinationNumber.length < 2
+ ? $t('pages.newCallForward.destinationLabel')
+ : this.destinationNumber}}
+
+
+
+
+
+
+
+
+
@@ -122,15 +114,23 @@
diff --git a/src/components/pages/NewCallForward/CscNewCallForwardInput.vue b/src/components/pages/NewCallForward/CscNewCallForwardInput.vue
index ff72e173..0b8f7c22 100644
--- a/src/components/pages/NewCallForward/CscNewCallForwardInput.vue
+++ b/src/components/pages/NewCallForward/CscNewCallForwardInput.vue
@@ -26,7 +26,9 @@
QField,
QInput
} from 'quasar-framework'
- import { isPhone } from '../../../helpers/validation'
+ import {
+ userInfoAndEmpty
+ } from '../../../helpers/validation'
import {
maxLength,
required
@@ -41,7 +43,7 @@
},
mounted(){
if(this.prefilled){
- this.inputValue = this.prefilled;
+ this.inputValue = this.prefilled === " " ? "" : this.prefilled;
}
},
@@ -53,7 +55,7 @@
},
validations: {
inputValue: {
- isPhone,
+ userInfoAndEmpty,
maxLength: maxLength(64),
required
}
@@ -75,7 +77,7 @@
maxLength: this.$v.inputValue.$params.maxLength.max
});
}
- else if (!this.$v.inputValue.isPhone) {
+ else if (!this.$v.inputValue.userInfoAndEmpty) {
return this.$t('validationErrors.inputValidNumber');
}
},
diff --git a/src/filters/number.js b/src/filters/number.js
index 3180c3cd..34ef5ff6 100644
--- a/src/filters/number.js
+++ b/src/filters/number.js
@@ -1,6 +1,12 @@
export default function(number, extension) {
- let constructedNumber = "" + number.cc + number.ac + number.sn;
+ let constructedNumber = "";
+ if(number !== null && number.is_devid && number.is_devid === true) {
+ constructedNumber = "" + number.devid_alias;
+ }
+ else if (number !== null) {
+ constructedNumber = "" + number.cc + number.ac + number.sn;
+ }
if (extension) {
return constructedNumber.replace(new RegExp(extension + '$'), '');
}
diff --git a/src/locales/en.json b/src/locales/en.json
index a0bbb2fe..0118ae71 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -216,7 +216,10 @@
"numberLabel": "Number",
"voiceMailLabel": "Voicemail",
"destinationTimeoutLabel": "Then after ",
- "destinationNumberLabel": "seconds forwarded to"
+ "destinationNumberLabel": "seconds forwarded to",
+ "destinationLabel": "Destination",
+ "addDestinationLabel": "Add destination",
+ "allCallsForwardedTo": "All calls forwarded to"
},
"callForward": {
"titles": {
diff --git a/src/store/new-call-forward.js b/src/store/new-call-forward.js
index 33ff502a..8bc573ba 100644
--- a/src/store/new-call-forward.js
+++ b/src/store/new-call-forward.js
@@ -4,6 +4,7 @@ import Vue from 'vue'
// import _ from 'lodash';
// import { RequestState } from './common'
// import { i18n } from '../i18n';
+
import {
// getSourcesets,
getDestinationsets,
@@ -31,111 +32,156 @@ import {
// updateOwnPhoneTimeout
} from '../api/call-forward';
+const ForwardGroup = {
+ unconditional: 'unconditional'
+};
+
export default {
namespaced: true,
state: {
- destinationsets:[],
- destinations: [],
+ forwardGroups: []
},
getters: {
+ primaryNumber(state, getters, rootState, rootGetters) {
+ let subscriber = rootGetters['user/getSubscriber'];
+
+ if(subscriber !== null) {
+ return subscriber.primary_number;
+ }
+ else {
+ return null;
+ }
+ },
subscriberDisplayName(state, getters, rootState, rootGetters) {
return rootGetters['user/getUsername'];
},
- destinations(state) {
- return state.destinations;
- },
- destinationsets(state){
- return state.destinationsets;
+ // destinations(state) {
+ // return state.destinations;
+ // },
+ forwardGroups(state){
+ return state.forwardGroups;
}
},
mutations: {
- addDestination(state, destination){
- state.destinations.push(destination);
+ addDestination(state, forwardGroupId, destination){
+ let group = state.forwardGroups.find((group)=>{
+ return group.id === forwardGroupId;
+ });
+ group.destinations.push(destination);
},
editDestination(state, data){
- let destination = state.destinations.slice(data.index, data.index+1)[0];
+ let group = state.forwardGroups.find((group)=>{
+ return group.id === data.forwardGroupId;
+ });
+ let destination = group.destinations.slice(data.index, data.index+1)[0];
destination.simple_destination = data.destination;
destination.destination = data.destination;
- Vue.set(state.destinations, data.index, destination)
+ Vue.set(group.destinations, data.index, destination)
},
editTimeout(state, data){
- let destination = state.destinations.slice(data.index, data.index+1)[0];
+ let group = state.forwardGroups.find((group)=>{
+ return group.id === data.forwardGroupId;
+ });
+ let destination = group.destinations.slice(data.index, data.index+1)[0];
destination.timeout = data.timeout;
- Vue.set(state.destinations, data.index, destination)
+ Vue.set(group.destinations, data.index, destination)
},
- loadDestinationsets(state, destinationsets){
- state.destinationsets = destinationsets;
+ // loadDestinationsets(state, destinationsets){
+ // state.destinationsets = destinationsets;
+ // },
+ loadForwardGroups(state, forwardGroups){
+ state.forwardGroups = forwardGroups;
},
- loadDestinations(state, destinations){
- state.destinations = destinations;
- }
+ // loadDestinations(state, destinations){
+ // state.destinations = destinations;
+ // },
},
actions: {
- async loadDestinationsets(context) {
+ async loadForwardGroups(context) {
try{
- const destinationsets = await getDestinationsets(localStorage.getItem('subscriberId'));
- context.commit('loadDestinationsets', destinationsets);
+ const forwardGroups = await getDestinationsets(localStorage.getItem('subscriberId'));
+ context.commit('loadForwardGroups', forwardGroups);
}
catch(err){
console.log(err)
}
},
- loadDestinations(context, destinations){
- context.commit('loadDestinations', destinations);
- },
- async addDestinationSet(context, name) {
+ // loadDestinations(context, destinations){
+ // context.commit('loadDestinations', destinations);
+ // },
+ async addForwardGroup(context, name) {
try{
- const newDestinationset = await addNewDestinationsetWithName(name);
- return newDestinationset;
+ const destination = {
+ "announcement_id": null,
+ "simple_destination": " ",
+ "destination": " ",
+ "priority": 1,
+ "timeout": 20
+ };
+ const newForwardGroupId = await addNewDestinationsetWithName(ForwardGroup[name]);
+ await addDestinationToDestinationset({
+ id: newForwardGroupId,
+ data: [destination]
+ });
+ return newForwardGroupId;
}
catch(err){
console.log(err)
}
},
- getDestinationSetByName(context, name){
- let destinationsets = context.getters.destinationsets;
- destinationsets = destinationsets.filter(($destinationset) => {
- return $destinationset.name === name;
+ getForwardGroupByName(context, name){
+ let forwardGroups = context.getters.forwardGroups;
+ forwardGroups = forwardGroups.filter(($forwardGroup) => {
+ return $forwardGroup.name === name;
});
- return destinationsets.length > 0 ? destinationsets[0] : null;
+ return forwardGroups.length > 0 ? forwardGroups[0] : null;
},
async addDestination(context, data){
try{
+ let group = context.state.forwardGroups.find((group)=>{
+ return group.id === data.forwardGroupId;
+ });
const destination = {
"announcement_id": null,
"simple_destination": data.destination,
"destination": data.destination,
"priority": 1,
- "timeout": 10
+ "timeout": 20
};
await addDestinationToDestinationset({
- id: data.destinationSetId,
- data: [...context.state.destinations, destination]
+ id: data.forwardGroupId,
+ data: [...group.destinations, destination]
});
- context.commit('addDestination', destination);
+ // context.commit('addDestination', group.id, destination);
}
catch(err){
console.log(err);
}
},
async editDestination(context, data){
- let destination = context.state.destinations.slice(data.index, data.index+1)[0];
+ let group = context.state.forwardGroups.find((group)=>{
+ return group.id === data.forwardGroupId;
+ });
+ let destination = group.destinations.slice(data.index, data.index+1)[0];
destination.simple_destination = data.destination;
destination.destination = data.destination;
context.commit('editDestination', data);
await addDestinationToDestinationset({
- id: data.destinationSetId,
- data: context.state.destinations
+ id: data.forwardGroupId,
+ data: group.destinations
});
},
async editTimeout(context, data){
- let destination = context.state.destinations.slice(data.index, data.index+1)[0];
+ let group = context.state.forwardGroups.find((group)=>{
+ return group.id === data.forwardGroupId;
+ });
+ let destination = group.destinations.slice(data.index, data.index+1)[0];
destination.timeout = data.timeout;
context.commit('editTimeout', data);
await addDestinationToDestinationset({
- id: data.destinationSetId,
- data: context.state.destinations
+ id: group.id,
+ data: group.destinations
});
}
}
diff --git a/src/themes/app.common.styl b/src/themes/app.common.styl
index 218fadad..4fd6b36a 100644
--- a/src/themes/app.common.styl
+++ b/src/themes/app.common.styl
@@ -308,3 +308,11 @@ input.q-input-target
position relative
left 50% !important
transform translateX(-50%)
+
+.csc-text-action
+ color $primary
+ cursor pointer
+ font-weight bold
+
+.csc-cf-row
+ margin-bottom $flex-gutter-sm