What has been done: - TT#28055, CallForwarding: As a Customer, I want to see all call forwarding rules that apply "Always" (INCL all subtasks) - TT#28059, CallForwarding: As a Customer, I want to remove Destinations Change-Id: Id1e95dbaf1e55dba25f855ef9ad61352ededd5bbchanges/28/17928/12
parent
3eb81fa09f
commit
80c14dcb68
@ -1,19 +1,48 @@
|
||||
<template>
|
||||
<csc-page title="Always"></csc-page>
|
||||
<csc-page :title="$t('pages.callForward.titles.always')">
|
||||
<q-card class="dest-card">
|
||||
<csc-destinations :title="$t('pages.callForward.whenOnline')"
|
||||
:group="destinations.online"
|
||||
icon="signal_wifi_4_bar">
|
||||
</csc-destinations>
|
||||
<csc-destinations :title="$t('pages.callForward.whenBusy')"
|
||||
:group="destinations.busy"
|
||||
icon="record_voice_over">
|
||||
</csc-destinations>
|
||||
<csc-destinations :title="$t('pages.callForward.whenOffline')"
|
||||
:group="destinations.offline"
|
||||
icon="signal_wifi_off">
|
||||
</csc-destinations>
|
||||
</q-card>
|
||||
</csc-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CscPage from '../../CscPage'
|
||||
import CscPage from '../../CscPage'
|
||||
import CscDestinations from './CscDestinations'
|
||||
import { QCard } from 'quasar-framework'
|
||||
export default {
|
||||
mounted() {
|
||||
this.$store.dispatch('callForward/loadAlwaysEverybodyDestinations');
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CscPage
|
||||
QCard,
|
||||
CscPage,
|
||||
CscDestinations
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
computed: {
|
||||
destinations() {
|
||||
return this.$store.state.callForward.alwaysEverybodyDestinations;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="stylus">
|
||||
</style>
|
||||
|
@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div>
|
||||
<q-item highlight v-for="(destination, index) in destinations">
|
||||
<q-item-main>
|
||||
<div class="dest-row">
|
||||
<span v-if="index == 0"> {{ $t('pages.callForward.firstRing') }} </span>
|
||||
<span v-else-if="index > 0"> {{ $t('pages.callForward.thenRing') }} </span>
|
||||
<span class="dest-values"> {{ destination.destination | numberFormat }} </span>
|
||||
<span v-if="isNumber(destination.destination)">
|
||||
<span> {{ $t('pages.callForward.for') }} </span>
|
||||
<span class="dest-values">{{ destination.timeout }}</span>
|
||||
<span> {{ $t('pages.callForward.secs') }} </span>
|
||||
</span>
|
||||
</div>
|
||||
</q-item-main>
|
||||
<q-item-side right>
|
||||
<q-btn color="negative" flat icon="delete" @click="deleteDestination(index)">{{ $t('buttons.remove') }}</q-btn>
|
||||
</q-item-side>
|
||||
</q-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import numberFormat from '../../../filters/number-format'
|
||||
import _ from 'lodash'
|
||||
import { showToast } from '../../../helpers/ui'
|
||||
import { QItem, QItemSide, Dialog, Toast, QBtn, QItemMain } from 'quasar-framework'
|
||||
export default {
|
||||
name: 'csc-destination',
|
||||
props: [
|
||||
'destinations',
|
||||
'destinationsetId'
|
||||
],
|
||||
components: {
|
||||
QItem,
|
||||
QItemMain,
|
||||
QItemSide,
|
||||
Dialog,
|
||||
Toast,
|
||||
QBtn
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
isNumber(destination) {
|
||||
let dest = destination.split(/:|@/);
|
||||
return !isNaN(dest[1]);
|
||||
},
|
||||
deleteDestination(index) {
|
||||
let clonedDestinations = _.cloneDeep(this.destinations);
|
||||
let indexInt = parseInt(index);
|
||||
let store = this.$store;
|
||||
let removeDestination = numberFormat(this.destinations[index].destination);
|
||||
let self = this;
|
||||
let isLastDestination = this.destinations.length === 1;
|
||||
clonedDestinations.splice(indexInt, 1);
|
||||
Dialog.create({
|
||||
title: self.$t('pages.callForward.removeDialogTitle'),
|
||||
message: self.$t('pages.callForward.removeDialogText', {
|
||||
destination: removeDestination
|
||||
}),
|
||||
buttons: [
|
||||
self.$t('buttons.cancel'),
|
||||
{
|
||||
label: self.$t('buttons.remove'),
|
||||
color: 'negative',
|
||||
handler () {
|
||||
store.dispatch('callForward/deleteDestinationFromDestinationset', {
|
||||
id: self.destinationsetId,
|
||||
data: clonedDestinations,
|
||||
deleteDestinationset: isLastDestination }).then((result) => {
|
||||
store.dispatch('callForward/loadAlwaysEverybodyDestinations');
|
||||
showToast(self.$t('pages.callForward.removeSuccessMessage', {
|
||||
destination: removeDestination
|
||||
}));
|
||||
}).catch((err) => {
|
||||
showToast(self.$t('pages.callForward.removeErrorMessage'));
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '~variables'
|
||||
.dest-row
|
||||
display inline-block
|
||||
width 90%
|
||||
.dest-values
|
||||
font-weight 500
|
||||
</style>
|
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div>
|
||||
<q-card-title class="dest-title">
|
||||
<q-icon :name="icon" class="dest-icon" />
|
||||
{{ title }}
|
||||
</q-card-title>
|
||||
<q-card-main>
|
||||
<q-list no-border>
|
||||
<div v-if="group.length === 0">
|
||||
<q-item>
|
||||
<div class="dest-row">
|
||||
<span> {{ $t('pages.callForward.forwardToNowhere') }} </span>
|
||||
</div>
|
||||
</q-item>
|
||||
</div>
|
||||
<div v-else v-for="destinationset in group">
|
||||
<csc-destination :destinations="destinationset.destinations" :destinationset-id="destinationset.id">
|
||||
</csc-destination>
|
||||
</div>
|
||||
</q-list>
|
||||
</q-card-main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CscDestination from './CscDestination'
|
||||
import { QCardTitle, QCardMain, QList,
|
||||
QItem, QIcon } from 'quasar-framework'
|
||||
export default {
|
||||
name: 'csc-destinations',
|
||||
props: [
|
||||
'title',
|
||||
'icon',
|
||||
'group'
|
||||
],
|
||||
components: {
|
||||
QCardTitle,
|
||||
QCardMain,
|
||||
QList,
|
||||
QItem,
|
||||
QIcon,
|
||||
CscDestination
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '~variables'
|
||||
.dest-row
|
||||
inline-block
|
||||
.dest-title
|
||||
color $primary
|
||||
.dest-icon
|
||||
margin-right 5px
|
||||
</style>
|
@ -0,0 +1,40 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import CallForwardModule from '../../src/store/call-forward';
|
||||
import { assert } from 'chai';
|
||||
|
||||
describe('CallForward', function(){
|
||||
|
||||
it('should load always everybody destinations', function(){
|
||||
let state = {
|
||||
alwaysEverybodyDestinations: [
|
||||
]
|
||||
};
|
||||
let data = {
|
||||
busy: [],
|
||||
offline: [{
|
||||
destinations: [{
|
||||
"announcement_id": null,
|
||||
"destination": "sip:3333@192.168.178.23",
|
||||
"priority": 1,
|
||||
"simple_destination": "3333",
|
||||
"timeout": 60
|
||||
},
|
||||
{
|
||||
"announcement_id": null,
|
||||
"destination": "sip:2222@192.168.178.23",
|
||||
"priority": 1,
|
||||
"simple_destination": "2222",
|
||||
"timeout": 300
|
||||
}],
|
||||
id: 3,
|
||||
name: "csc_destinationset_1"
|
||||
}],
|
||||
online: []
|
||||
};
|
||||
CallForwardModule.mutations.loadAlwaysEverybodyDestinations(state, data);
|
||||
assert.deepEqual(state.alwaysEverybodyDestinations, data);
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in new issue