TT#76155 CF: As a Customer, I want to remove phone numbers

Change-Id: Ie2bb101b5fac95244984098b54fcc2dcfaddd1e5
changes/09/38809/2
Carlo Venusino 6 years ago
parent 8554bf10cc
commit 5f3b320c60

@ -12,7 +12,7 @@
</div> </div>
<q-btn <q-btn
slot="actions" slot="actions"
icon="exit_to_app" :icon="titleIcon"
color="primary" color="primary"
flat flat
@click="confirm" @click="confirm"

@ -8,7 +8,6 @@
> >
{{ group.title }} {{ group.title }}
</div> </div>
<div <div
v-for="(destination, index) in group.destinations" v-for="(destination, index) in group.destinations"
:key="genKey()" :key="genKey()"
@ -17,9 +16,9 @@
:destination="destination" :destination="destination"
:index="index" :index="index"
:groupId="group.id" :groupId="group.id"
:groupName="group.name"
/> />
</div> </div>
<div class="row csc-cf-destination-cont"> <div class="row csc-cf-destination-cont">
<div class="col col-xs-12 col-md-4 text-right"></div> <div class="col col-xs-12 col-md-4 text-right"></div>
<div <div
@ -98,7 +97,6 @@
</div> </div>
</template> </template>
<script> <script>
import { import {
@ -174,8 +172,6 @@
text-align right text-align right
.csc-cf-destination-value .csc-cf-destination-value
text-align center text-align center
.csc-cf-destination-actions
text-align left
.csc-cf-destination-add-destination .csc-cf-destination-add-destination
padding-left 25px padding-left 25px
width 250px width 250px

@ -74,9 +74,7 @@
<script> <script>
import { import {
// mapState,
mapGetters, mapGetters,
// mapMutations
} from 'vuex' } from 'vuex'
import { import {
QSpinnerDots, QSpinnerDots,
@ -122,9 +120,6 @@
}, },
computed: { computed: {
// ...mapState('newCallForward', [
// 'forwardGroups'
// ]),
...mapGetters('newCallForward', [ ...mapGetters('newCallForward', [
'primaryNumber', 'primaryNumber',
'subscriberDisplayName', 'subscriberDisplayName',

@ -1,5 +1,8 @@
<template> <template>
<div class="row csc-cf-destination-cont"> <div
class="row csc-cf-destination-cont"
:class="removed"
>
<div class="col col-xs-12 col-md-4 text-right"> <div class="col col-xs-12 col-md-4 text-right">
{{ $t('pages.newCallForward.destinationTimeoutLabel') }} {{ $t('pages.newCallForward.destinationTimeoutLabel') }}
<span class='csc-cf-timeout'> <span class='csc-cf-timeout'>
@ -23,7 +26,7 @@
</span> </span>
{{ $t('pages.newCallForward.destinationNumberLabel') }} {{ $t('pages.newCallForward.destinationNumberLabel') }}
</div> </div>
<div class="col text-left csc-cf-dest-number-cont"> <div class="col text-left col-xs-12 col-md-2 csc-cf-dest-number-cont">
<div class='csc-cf-destination'> <div class='csc-cf-destination'>
{{ !this.destinationNumber || this.destinationNumber.length < 2 {{ !this.destinationNumber || this.destinationNumber.length < 2
@ -43,8 +46,20 @@
</q-popover> </q-popover>
</div> </div>
</div> </div>
<div class="col col-xs-12 col-md-5 "> <div class="col col-xs-12 col-md-5 csc-cf-destination-actions">
<!-- TODO add remove btn --> <q-icon
name="delete"
color="negative"
size="24px"
@click="showConfirmDialog"
/>
<csc-confirm-dialog
ref="confirmDialog"
title-icon="delete"
:title="$t('pages.newCallForward.cancelDialogTitle', {groupName: this.groupName})"
:message="$t('pages.newCallForward.cancelDialogText', {groupName: this.groupName, destination: this.destination.simple_destination})"
@confirm="deleteDestination"
/>
</div> </div>
</div> </div>
@ -52,8 +67,6 @@
<script> <script>
import { import {
// QField,
// QToggle,
QIcon, QIcon,
QBtn, QBtn,
QPopover, QPopover,
@ -62,7 +75,7 @@
QItem, QItem,
QItemMain QItemMain
} from 'quasar-framework' } from 'quasar-framework'
// import { mapGetters } from 'vuex' import CscConfirmDialog from "../../CscConfirmationDialog";
import CscNewCallForwardAddDestinationForm from './CscNewCallForwardAddDestinationForm' import CscNewCallForwardAddDestinationForm from './CscNewCallForwardAddDestinationForm'
export default { export default {
name: 'csc-new-call-forward-destination', name: 'csc-new-call-forward-destination',
@ -74,10 +87,12 @@
QList, QList,
QItem, QItem,
QItemMain, QItemMain,
CscConfirmDialog,
CscNewCallForwardAddDestinationForm CscNewCallForwardAddDestinationForm
}, },
props: [ props: [
'groupId', 'groupId',
'groupName',
'destination', 'destination',
'index' 'index'
], ],
@ -88,7 +103,13 @@
return { return {
destinationTimeout: 0, destinationTimeout: 0,
destinationNumber: null, destinationNumber: null,
destinationIndex: null destinationIndex: null,
isRemoved: false
}
},
computed: {
removed(){
return this.isRemoved ? "csc-cf-removed-destination" : "";
} }
}, },
methods: { methods: {
@ -106,6 +127,19 @@
timeout: this.destinationTimeout, timeout: this.destinationTimeout,
forwardGroupId: this.groupId forwardGroupId: this.groupId
}); });
},
showConfirmDialog(){
this.$refs.confirmDialog.open();
},
deleteDestination(){
this.isRemoved = true;
setTimeout(async ()=>{
await this.$store.dispatch('newCallForward/removeDestination', {
destination: this.destination,
forwardGroupId: this.groupId
});
await this.$store.dispatch('newCallForward/loadForwardGroups');
}, 1200);
} }
} }
} }
@ -130,7 +164,11 @@
padding 0 20px 0 20px padding 0 20px 0 20px
.csc-cf-dest-number-cont .csc-cf-dest-number-cont
padding-left 30px padding-left 30px
.csc-cf-destination-actions
text-align left
cursor pointer
.csc-cf-removed-destination
visibility hidden
opacity 0
transition visibility 0s 1s, opacity 1s linear
</style> </style>

@ -219,7 +219,9 @@
"destinationNumberLabel": "seconds forwarded to", "destinationNumberLabel": "seconds forwarded to",
"destinationLabel": "Destination", "destinationLabel": "Destination",
"addDestinationLabel": "Add destination", "addDestinationLabel": "Add destination",
"allCallsForwardedTo": "All calls forwarded to" "allCallsForwardedTo": "All calls forwarded to",
"cancelDialogTitle": "Delete from {groupName} forwarding",
"cancelDialogText": "You are about to delete {destination} from {groupName} call forwarding"
}, },
"callForward": { "callForward": {
"titles": { "titles": {

@ -86,15 +86,9 @@ export default {
destination.timeout = data.timeout; destination.timeout = data.timeout;
Vue.set(group.destinations, data.index, destination) Vue.set(group.destinations, data.index, destination)
}, },
// loadDestinationsets(state, destinationsets){
// state.destinationsets = destinationsets;
// },
loadForwardGroups(state, forwardGroups){ loadForwardGroups(state, forwardGroups){
state.forwardGroups = forwardGroups; state.forwardGroups = forwardGroups;
}, },
// loadDestinations(state, destinations){
// state.destinations = destinations;
// },
}, },
actions: { actions: {
async loadForwardGroups(context) { async loadForwardGroups(context) {
@ -106,9 +100,6 @@ export default {
console.log(err) console.log(err)
} }
}, },
// loadDestinations(context, destinations){
// context.commit('loadDestinations', destinations);
// },
async addForwardGroup(context, name) { async addForwardGroup(context, name) {
try{ try{
const destination = { const destination = {
@ -152,8 +143,25 @@ export default {
id: data.forwardGroupId, id: data.forwardGroupId,
data: [...group.destinations, destination] data: [...group.destinations, destination]
}); });
}
catch(err){
console.log(err);
}
},
async removeDestination(context, data){
try{
let group = context.state.forwardGroups.find((group)=>{
return group.id === data.forwardGroupId;
});
// context.commit('addDestination', group.id, destination); group.destinations = group.destinations.filter(($destination) => {
return $destination.destination !== data.destination.destination;
});
await addDestinationToDestinationset({
id: group.id,
data: group.destinations
});
} }
catch(err){ catch(err){
console.log(err); console.log(err);

Loading…
Cancel
Save