TT#82501 As a Customer, I want to be forced to input a initial number/destination in order to add conditions afterwards

AC:
If forwarding group is not persisted yet:
√ Can click "and condition" and sees the possible conditions like "call from ..."
√ Can click a condition
√ Can see a number input to save the initial destination
√ Can see information why all this is happening
√ Can see the origin condition popup (source list, time widget) again after saving the number

Change-Id: I78c44fe000f980335b4c49480cb43c6250fbe1ce
changes/27/40327/7
Carlo Venusino 5 years ago
parent 4f6f3f2f23
commit a21a007703

@ -12,6 +12,29 @@
{{groupTitle}} {{groupTitle}}
<span
class="csc-cf-destination-add-condition"
v-if="isTempGroup"
>
{{ $t('pages.newCallForward.conditionBtnLabelPrefix') }}
<span class="csc-cf-from-link">
{{ $t('pages.newCallForward.conditionBtnLabel') }}
</span>
<q-popover
ref="conditions"
@open="showConditions()"
@close="showFirstDestMenu()"
>
<csc-new-call-forward-condition-type-select
ref="addCondition"
:enabled="true"
:groupName="group.name"
:groupId="group.id"
/>
</q-popover>
</span>
<span <span
class="csc-cf-destination-add-condition" class="csc-cf-destination-add-condition"
v-if="!groupSourceset && !isTempGroup" v-if="!groupSourceset && !isTempGroup"
@ -35,7 +58,7 @@
<q-popover <q-popover
ref="onlineSourceset" ref="onlineSourceset"
class="csc-cf-number-form" class="csc-cf-number-form"
v-bind:class="{ 'csc-cf-popover-hide': toggleConditionFromForm }" v-bind:class="{ 'csc-cf-popover-hide': toggleConditionFromForm}"
@open="showSourcesetForm()" @open="showSourcesetForm()"
@close="resetToggleCondition()" @close="resetToggleCondition()"
> >
@ -105,6 +128,7 @@
> >
<csc-new-call-forward-destination <csc-new-call-forward-destination
:destination="getDestination(index)" :destination="getDestination(index)"
ref="destination"
:index="index" :index="index"
:groupId="group.id" :groupId="group.id"
:groupName="group.name" :groupName="group.name"
@ -166,6 +190,9 @@
import { import {
mapGetters, mapGetters,
} from 'vuex' } from 'vuex'
import {
showGlobalWarning
} from '../../../helpers/ui'
import { import {
QSpinnerDots, QSpinnerDots,
QToggle, QToggle,
@ -200,6 +227,7 @@
QItemSide, QItemSide,
CscConfirmDialog, CscConfirmDialog,
CscObjectSpinner, CscObjectSpinner,
showGlobalWarning,
CscNewCallForwardDestination, CscNewCallForwardDestination,
CscNewCallForwardAddDestinationForm, CscNewCallForwardAddDestinationForm,
CscNewCallForwardEditSources, CscNewCallForwardEditSources,
@ -215,7 +243,8 @@
toggleConditionFromForm: true, toggleConditionFromForm: true,
groupIsLoading: false, groupIsLoading: false,
sourceSet: null, sourceSet: null,
sources: [] sources: [],
firstDestinationInCreation: false
}; };
}, },
async mounted(){ async mounted(){
@ -236,7 +265,9 @@
'getOwnPhoneTimeout', 'getOwnPhoneTimeout',
'groupsCount', 'groupsCount',
'getMappings', 'getMappings',
'getGroupsLoaders' 'getGroupsLoaders',
'getSourcesets',
'getFirstDestinationInCreation'
]), ]),
showAddDestBtn(){ showAddDestBtn(){
const destinations = this.group.destinations; const destinations = this.group.destinations;
@ -273,15 +304,24 @@
}, },
isTempGroup(){ isTempGroup(){
return this.group.id.toString().includes('temp-'); return this.group.id.toString().includes('temp-');
},
isFirstDestInCreation(){
return this.group.id.toString() === this.getFirstDestinationInCreation;
} }
}, },
watch: { watch: {
group: function () { getSourcesets: function () {
this.updateSourcesetNames(); this.updateSourcesetNames();
}, },
getGroupsLoaders: function(){ getGroupsLoaders: function(){
const groupLoaders = this.getGroupsLoaders; const groupLoaders = this.getGroupsLoaders;
this.groupIsLoading = groupLoaders.includes(this.group.id); this.groupIsLoading = groupLoaders.includes(this.group.id);
},
getFirstDestinationInCreation: function(){
if(this.getFirstDestinationInCreation === this.group.id.toString()){
this.toggleConditionFromForm = false;
this.$refs.onlineSourceset.open();
}
} }
}, },
methods: { methods: {
@ -306,18 +346,24 @@
break; break;
} }
}, },
showFirstDestMenu(){
const firstDestinationCmp = this.$refs.destination[0];
firstDestinationCmp.firstDestinationInCreation = true;
firstDestinationCmp.$refs.destTypeForm.open();
showGlobalWarning(`${this.$t('pages.newCallForward.mandatoryDestinationLabel')}`, 5000)
},
async showConditionForm(){ async showConditionForm(){
switch(this.$refs.addCondition.action){ this.toggleConditionFromForm = false;
case 'addFromCondition': this.$refs.onlineSourceset.open();
this.toggleConditionFromForm = false;
this.$refs.onlineSourceset.open();
break;
}
}, },
showDestTypeForm(){ showDestTypeForm(){
this.toggleNumberForm = true; this.toggleNumberForm = true;
this.$refs.selectDestinationType.add(); this.$refs.selectDestinationType.add();
}, },
getDestName(index){
return "destination" + index;
},
getDestination(index){ getDestination(index){
let destination = {...this.group.destinations[index]} let destination = {...this.group.destinations[index]}
if(index === 0){ if(index === 0){
@ -359,6 +405,7 @@
return $mapping.destinationset_id == this.group.id; return $mapping.destinationset_id == this.group.id;
}); });
sourceSet = groupMapping[0] && groupMapping[0].sourceset_id ? await this.$store.dispatch('newCallForward/getSourcesetById', groupMapping[0].sourceset_id) : null; sourceSet = groupMapping[0] && groupMapping[0].sourceset_id ? await this.$store.dispatch('newCallForward/getSourcesetById', groupMapping[0].sourceset_id) : null;
if(sourceSet){ if(sourceSet){
this.sourceSet = sourceSet; this.sourceSet = sourceSet;
this.sources = this.sourceSet.sources; this.sources = this.sourceSet.sources;
@ -369,10 +416,16 @@
this.$refs.confirmDialog.open(); this.$refs.confirmDialog.open();
}, },
async confirmDeleteGroup(){ async confirmDeleteGroup(){
await this.$store.dispatch('newCallForward/addGroupLoader', this.group.id); try{
await this.$store.dispatch('newCallForward/deleteForwardGroup', this.group); await this.$store.dispatch('newCallForward/addGroupLoader', this.group.id);
await this.$store.dispatch('newCallForward/loadForwardGroups'); await this.$store.dispatch('newCallForward/deleteForwardGroup', this.group);
await this.$store.dispatch('newCallForward/removeGroupLoader', this.group.id); await this.$store.dispatch('newCallForward/loadForwardGroups');
await this.$store.dispatch('newCallForward/removeGroupLoader', this.group.id);
}
catch(e){
console.log(e)
}
} }
} }
} }

@ -115,10 +115,17 @@
else { // new group else { // new group
if(forwardGroup.id.toString().includes('temp-')){ // unexisting group if(forwardGroup.id.toString().includes('temp-')){ // unexisting group
forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :) forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :)
await this.$store.dispatch('newCallForward/addForwardGroup', { const newGroupId = await this.$store.dispatch('newCallForward/addForwardGroup', {
name: forwardGroupName, name: forwardGroupName,
destination: this.number destination: this.number
}); });
await this.$store.dispatch('newCallForward/loadForwardGroups');
if(this.destinationIndex === 0){
await this.$store.dispatch('newCallForward/setFirstDestinationInCreation', newGroupId);
}
} }
else{ // existing group else{ // existing group

@ -124,9 +124,11 @@
id: forwardGroupId, id: forwardGroupId,
sourceSetId: sourceSetId sourceSetId: sourceSetId
}); });
await this.$store.dispatch('newCallForward/removeGroupLoader', forwardGroupId);
await this.$store.dispatch('newCallForward/loadForwardGroups');
await this.$store.dispatch('newCallForward/loadSourcesets'); await this.$store.dispatch('newCallForward/loadSourcesets');
await this.$store.dispatch('newCallForward/loadMappings');
await this.$store.dispatch('newCallForward/loadForwardGroups');
await this.$store.dispatch('newCallForward/removeGroupLoader', forwardGroupId);
} }
catch(err){ catch(err){
console.log(err) console.log(err)

@ -141,7 +141,8 @@
destinationNumber: null, destinationNumber: null,
destinationIndex: null, destinationIndex: null,
removeInProgress: false, removeInProgress: false,
toggleNumberForm: true toggleNumberForm: true,
firstDestinationInCreation: false
} }
}, },
computed: { computed: {
@ -174,12 +175,18 @@
case 'voicemail': case 'voicemail':
await this.$store.dispatch('newCallForward/addGroupLoader', this.groupId); await this.$store.dispatch('newCallForward/addGroupLoader', this.groupId);
if(this.groupId.toString().includes('temp-')){ // unexisting group if(this.groupId.toString().includes('temp-')){ // unexisting group
await this.$store.dispatch('newCallForward/addForwardGroup', { const newGroupId = await this.$store.dispatch('newCallForward/addForwardGroup', {
name: this.groupName, name: this.groupName,
destination: 'voicebox' destination: 'voicebox'
}); });
await this.$store.dispatch('newCallForward/loadForwardGroups'); await this.$store.dispatch('newCallForward/loadForwardGroups');
if(this.firstDestinationInCreation){
await this.$store.dispatch('newCallForward/setFirstDestinationInCreation', newGroupId);
this.firstDestinationInCreation = false;
}
} }
else{ else{
await this.$store.dispatch('newCallForward/addVoiceMail', this.groupId); await this.$store.dispatch('newCallForward/addVoiceMail', this.groupId);

@ -22,7 +22,7 @@ export function showGlobalError(message) {
setTimeout(()=>{ alert.dismiss(); }, 2000); setTimeout(()=>{ alert.dismiss(); }, 2000);
} }
export function showGlobalWarning(message) { export function showGlobalWarning(message, timeout) {
const alert = Alert.create({ const alert = Alert.create({
html: message, html: message,
position: 'top-center', position: 'top-center',
@ -30,7 +30,7 @@ export function showGlobalWarning(message) {
leave: 'fadeOut', leave: 'fadeOut',
color: 'warning' color: 'warning'
}); });
setTimeout(()=>{ alert.dismiss(); }, 2000); setTimeout(()=>{ alert.dismiss(); }, timeout || 2000);
} }
export function showPermanentGlobalWarning(message) { export function showPermanentGlobalWarning(message) {

@ -240,7 +240,8 @@
"fromLabelShort": " call from ", "fromLabelShort": " call from ",
"offlineLabel": "If offline", "offlineLabel": "If offline",
"busyLabel": "If busy", "busyLabel": "If busy",
"sourcesetName": "List name" "sourcesetName": "List name",
"mandatoryDestinationLabel": "Please add a destination to the group before adding conditions"
}, },
"callForward": { "callForward": {
"titles": { "titles": {

@ -48,12 +48,16 @@ export default {
sourceSets: [], sourceSets: [],
forwardGroups: [], forwardGroups: [],
groupsLoaders: [], groupsLoaders: [],
selectedDestType: null selectedDestType: null,
firstDestinationInCreation: null
}, },
getters: { getters: {
getGroupsLoaders(state){ getGroupsLoaders(state){
return state.groupsLoaders; return state.groupsLoaders;
}, },
getFirstDestinationInCreation(state){
return state.firstDestinationInCreation
},
primaryNumber(state, getters, rootState, rootGetters) { primaryNumber(state, getters, rootState, rootGetters) {
const subscriber = rootGetters['user/getSubscriber']; const subscriber = rootGetters['user/getSubscriber'];
if(subscriber !== null) { if(subscriber !== null) {
@ -177,6 +181,9 @@ export default {
}, },
removeGroupLoader(state, groupId){ removeGroupLoader(state, groupId){
state.groupsLoaders = state.groupsLoaders.filter($groupId => $groupId !== groupId); state.groupsLoaders = state.groupsLoaders.filter($groupId => $groupId !== groupId);
},
setFirstDestinationInCreation(state, groupId){
state.firstDestinationInCreation = groupId;
} }
}, },
actions: { actions: {
@ -618,5 +625,8 @@ export default {
async removeSourceFromSourceset(context, data){ async removeSourceFromSourceset(context, data){
await addSourceToSourceset(data) await addSourceToSourceset(data)
}, },
setFirstDestinationInCreation(context, groupId){
context.commit('setFirstDestinationInCreation', groupId);
}
} }
}; };

Loading…
Cancel
Save