TT#31802 Customer wants to see AfterHours

What has been done:
- TT#31802, CallForwarding: As a Customer, I want to see a list of
  AfterHours
- TT#28061, CallForwarding: As a Customer, I want to add After Hours
- TT#31804, CallForwarding: As a Customer, I want to remove After Hours

Change-Id: I95c8c59eeed61f1c2efc5564125ccd2a74adc514
changes/04/20004/7
raxelsen 7 years ago
parent d04cbe3d1b
commit 5503be27a3

@ -1,32 +1,25 @@
<template>
<csc-page :title="$t('pages.callForward.titles.afterHours')">
<csc-call-forward-destinations timeset="After Hours" :destinations="destinations">
</csc-call-forward-destinations>
<csc-call-forward-timeset timesetName="After Hours" />
</csc-page>
</template>
<script>
import { mapState } from 'vuex'
import CscPage from '../../CscPage'
import CscCallForwardDestinations from './CscCallForwardDestinations'
import CscCallForwardTimeset from './CscCallForwardTimeset'
export default {
data () {
return {}
return {
}
},
components: {
CscPage,
CscCallForwardDestinations
},
created() {
this.$store.dispatch('callForward/loadAfterHoursEverybodyDestinations');
},
computed: {
...mapState('callForward', [
'destinations'
])
CscCallForwardTimeset
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import '../../../themes/quasar.variables.styl'
</style>

@ -18,7 +18,9 @@
CscCallForwardDestinations
},
created() {
this.$store.dispatch('callForward/loadAlwaysEverybodyDestinations');
this.$store.dispatch('callForward/loadEverybodyDestinations', {
timeset: null
});
},
computed: {
...mapState('callForward', [

@ -1,60 +1,12 @@
<template>
<csc-page :title="$t('pages.callForward.titles.companyHours')">
<div v-if="timesetIsCompatible && !timesetHasReverse && !timesetHasDuplicate && timesetExists">
<csc-call-forward-times :times="timesetTimes" ref="times"></csc-call-forward-times>
<csc-call-forward-destinations timeset="Company Hours" :destinations="destinations" />
</div>
<q-card flat>
<div v-if="timesetHasDuplicate">
<q-alert color="red"
v-model="showAlertDuplicate"
icon="date_range"
:actions="[{ label: $t('pages.callForward.times.resetCompanyHours'), handler: resetCompanyHours }]"
appear>
{{ $t('pages.callForward.times.companyHoursDuplicate') }}
</q-alert>
</div>
<div v-else-if="!timesetIsCompatible">
<q-alert color="red"
v-model="showAlertCompatible"
icon="date_range"
:actions="[{ label: $t('pages.callForward.times.resetCompanyHours'), handler: resetCompanyHours }]"
appear>
{{ $t('pages.callForward.times.companyHoursIncompatible') }}
</q-alert>
</div>
<div v-else-if="timesetHasReverse">
<q-alert color="red"
v-model="showAlertReverse"
icon="date_range"
:actions="[{ label: $t('pages.callForward.times.resetCompanyHours'), handler: resetCompanyHours }]"
appear>
{{ $t('pages.callForward.times.companyHoursReverse') }}
</q-alert>
</div>
<div v-show="showDefinedAlert">
<q-alert color="warning"
v-model="showAlertDefined"
icon="date_range"
:actions="[{ label: $t('pages.callForward.times.addCompanyHours'), handler: addCompanyHours }]"
appear>
{{ $t('pages.callForward.times.companyHoursNotDefined') }}
</q-alert>
</div>
<csc-add-time-form type="new" :title="$t('pages.callForward.times.addCompanyHours')" timeset="Company Hours" ref="addTimeNew"></csc-add-time-form>
</q-card>
<csc-call-forward-timeset timesetName="Company Hours" />
</csc-page>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
import { QAlert, QCard } from 'quasar-framework'
import CscPage from '../../CscPage'
import { startLoading, stopLoading,
showGlobalError, showToast } from '../../../helpers/ui'
import CscCallForwardDestinations from './CscCallForwardDestinations'
import CscCallForwardTimes from './CscCallForwardTimes'
import CscAddTimeForm from './CscAddTimeForm'
import CscCallForwardTimeset from './CscCallForwardTimeset'
export default {
data () {
return {
@ -62,126 +14,12 @@
},
components: {
CscPage,
CscCallForwardDestinations,
CscCallForwardTimes,
CscAddTimeForm,
QAlert,
QCard
},
created() {
this.$store.dispatch('callForward/loadCompanyHoursEverybodyDestinations');
this.$store.dispatch('callForward/loadTimesetTimes', {
timeset: 'Company Hours'
});
},
computed: {
...mapState('callForward', [
'destinations',
'timesetTimes',
'resetTimeState',
'addTimeState',
'timesetIsCompatible',
'timesetHasReverse',
'timesetHasDuplicate',
'timesetExists'
]),
...mapGetters('callForward', [
'resetTimeError',
'addTimeError',
'showDefinedAlert'
]),
showAlertDuplicate: {
get() {
return this.$store.state.callForward.showAlerts.duplicate;
},
set(value) {
return this.$store.commit('callForward/setShowAlertDuplicate', value);
}
},
showAlertCompatible: {
get() {
return this.$store.state.callForward.showAlerts.compatible;
},
set(value) {
return this.$store.commit('callForward/setShowAlertCompatible', value);
}
},
showAlertReverse: {
get() {
return this.$store.state.callForward.showAlerts.reverse;
},
set(value) {
return this.$store.commit('callForward/setShowAlertReverse', value);
}
},
showAlertDefined: {
get() {
return this.$store.state.callForward.showAlerts.defined;
},
set(value) {
return this.$store.commit('callForward/setShowAlertDefined', value);
}
}
},
methods: {
resetCompanyHours() {
this.$store.dispatch('callForward/resetTimesetByName', 'Company Hours');
},
addCompanyHours() {
this.$store.commit('callForward/setActiveTimeForm', true);
},
loadTimes() {
this.$store.dispatch('callForward/loadTimesetTimes', {
timeset: 'Company Hours'
});
this.$store.commit('callForward/resetAlerts');
}
},
watch: {
resetTimeState(state) {
if (state === 'requesting') {
startLoading();
}
else if (state === 'failed') {
stopLoading();
showGlobalError(this.resetTimeError);
}
else if (state === 'succeeded') {
stopLoading();
showToast(this.$t('pages.callForward.times.resetSuccessMessage'));
this.loadTimes();
}
},
addTimeState(state) {
if (state === 'requesting') {
this.$store.commit('callForward/setActiveTimeForm', true);
startLoading();
}
else if (state === 'failed') {
stopLoading();
showGlobalError(this.addTimeError);
}
else if (state === 'succeeded') {
this.$store.commit('callForward/setActiveTimeForm', false);
stopLoading();
if (this.$refs.times) {
this.$refs.times.resetTimes();
}
else {
this.$refs.addTimeNew.resetTimes();
}
this.loadTimes();
showToast(this.$t('pages.callForward.times.addTimeSuccessMessage'));
}
}
CscCallForwardTimeset
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import '../../../themes/quasar.variables.styl'
.times-card
.q-alert-container
padding 15px 0
</style>

@ -1,5 +1,5 @@
<template>
<div v-if="activeTimeForm" class="add-times">
<div class="add-times">
<div class="title" v-if="typeIsNew">
{{ title }}
</div>
@ -73,10 +73,9 @@
date
},
computed: {
...mapState('callForward', {
activeTimeForm: 'activeTimeForm',
addTimeState: 'addTimeState'
}),
...mapState('callForward', [
'addTimeState'
]),
typeIsNew() {
return this.type === 'new';
},
@ -120,7 +119,6 @@
},
disableForm() {
this.resetTimes();
this.$store.commit('callForward/resetAlerts');
this.$store.commit('callForward/setActiveTimeForm', false);
},
addTime() {
@ -151,6 +149,7 @@
.add-times
margin-right 30px
.title
color $primary
line-height $csc-subtitle-line-height

@ -62,15 +62,9 @@
},
methods: {
reloadDestinations(timeset) {
if (timeset === null) {
this.$store.dispatch('callForward/loadAlwaysEverybodyDestinations');
}
else if (timeset === 'Company Hours') {
this.$store.dispatch('callForward/loadCompanyHoursEverybodyDestinations');
}
else if (timeset === 'After Hours') {
this.$store.dispatch('callForward/loadAfterHoursEverybodyDestinations');
}
this.$store.dispatch('callForward/loadEverybodyDestinations', {
timeset: timeset
});
},
reloadTimes() {
this.$store.dispatch('callForward/loadTimesetTimes', {

@ -6,7 +6,7 @@
<q-card-main>
<csc-call-forward-time v-if="times.length > 0" v-for="(time, index) in times"
:time="time" :index="index" />
<csc-add-time-form type="existing" :title="$t('pages.callForward.times.addCompanyHours')" timeset="Company Hours" ref="addFormExisting" />
<csc-add-time-form v-if="activeTimeForm" type="existing" :title="$t('pages.callForward.times.addCompanyHours')" :timesetName="timesetName" ref="addFormExisting" />
</q-card-main>
<q-card-actions v-if="!activeTimeForm">
<q-field>
@ -30,7 +30,8 @@
export default {
name: 'csc-call-forward-times',
props: [
'times'
'times',
'timesetName'
],
data () {
return {
@ -48,9 +49,9 @@
QBtn
},
computed: {
...mapState('callForward', {
activeTimeForm: 'activeTimeForm'
})
...mapState('callForward', [
'activeTimeForm'
])
},
methods: {
resetTimes() {

@ -0,0 +1,198 @@
<template>
<div>
<div v-if="showTimesAndDestinations">
<csc-call-forward-times :times="timesetTimes" :timesetName="timesetName" ref="times"></csc-call-forward-times>
<csc-call-forward-destinations :timeset="timesetName" :destinations="destinations" />
</div>
<q-card flat>
<div v-if="timesetHasDuplicate">
<q-alert color="red"
v-model="showAlertDuplicate"
icon="date_range"
:actions="[{ label: labelReset, handler: resetTimeset }]"
appear>
{{ $t('pages.callForward.times.timesetDuplicate', { timeset: timesetName }) }}
</q-alert>
</div>
<div v-else-if="!timesetIsCompatible">
<q-alert color="red"
v-model="showAlertCompatible"
icon="date_range"
:actions="[{ label: labelReset, handler: resetTimeset }]"
appear>
{{ $t('pages.callForward.times.timesetIncompatible', { timeset: timesetName }) }}
</q-alert>
</div>
<div v-else-if="timesetHasReverse">
<q-alert color="red"
v-model="showAlertReverse"
icon="date_range"
:actions="[{ label: labelReset, handler: resetTimeset }]"
appear>
{{ $t('pages.callForward.times.timesetReverse', { timeset: timesetName }) }}
</q-alert>
</div>
<div v-show="showDefinedAlert">
<q-alert color="warning"
v-model="showAlertDefined"
icon="date_range"
:actions="[{ label: labelAdd, handler: addTimeset }]"
appear>
{{ $t('pages.callForward.times.timesetNotDefined', { timeset: timesetName }) }}
</q-alert>
</div>
<csc-add-time-form v-if="activeTimeForm" type="new" :title="getAddLabel" :timeset="timesetName" ref="addTimeNew"></csc-add-time-form>
</q-card>
</div>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
import { startLoading, stopLoading,
showGlobalError, showToast } from '../../../helpers/ui'
import { QAlert, QCard } from 'quasar-framework'
import CscCallForwardDestinations from './CscCallForwardDestinations'
import CscCallForwardTimes from './CscCallForwardTimes'
import CscAddTimeForm from './CscAddTimeForm'
export default {
name: 'csc-call-forward-timeset',
props: [
'timesetName'
],
data () {
return {
showAlertDuplicate: true,
showAlertCompatible: true,
showAlertReverse: true,
showAlertDefined: true
}
},
components: {
CscCallForwardDestinations,
CscCallForwardTimes,
CscAddTimeForm,
QAlert,
QCard
},
computed: {
...mapState('callForward', [
'destinations',
'timesetTimes',
'resetTimeState',
'addTimeState',
'timesetHasDuplicate',
'timesetIsCompatible',
'timesetHasReverse',
'timesetExists',
'activeTimeForm'
]),
...mapGetters('callForward', [
'resetTimeError',
'addTimeError',
'showDefinedAlert'
]),
labelReset() {
return this.$t('pages.callForward.times.resetTimeset', {
timeset: this.timesetName
});
},
labelAdd() {
return this.$t('pages.callForward.times.addTimeset', {
timeset: this.timesetName
});
},
showTimesAndDestinations() {
return this.timesetIsCompatible &&
!this.timesetHasReverse &&
!this.timesetHasDuplicate &&
this.timesetExists;
}
},
methods: {
resetTimeset() {
this.$store.dispatch('callForward/resetTimesetByName', this.timesetName);
},
addTimeset() {
this.$store.commit('callForward/setActiveTimeForm', true);
},
loadDestinations() {
this.$store.dispatch('callForward/loadEverybodyDestinations', {
timeset: this.timesetName
});
},
loadTimes() {
this.$store.dispatch('callForward/loadTimesetTimes', {
timeset: this.timesetName
});
this.resetAlerts();
},
loadAll() {
this.$store.commit('callForward/resetTimesetState');
this.loadTimes();
this.loadDestinations();
},
resetAlerts() {
this.showAlertDuplicate = true;
this.showAlertCompatible = true;
this.showAlertReverse = true;
this.showAlertDefined = true;
}
},
watch: {
'$route': {
handler: 'loadAll',
immediate: true
},
resetTimeState(state) {
if (state === 'requesting') {
startLoading();
}
else if (state === 'failed') {
stopLoading();
showGlobalError(this.resetTimeError);
}
else if (state === 'succeeded') {
stopLoading();
showToast(this.$t('pages.callForward.times.resetSuccessMessage'));
this.loadTimes();
}
},
addTimeState(state) {
if (state === 'requesting') {
this.$store.commit('callForward/setActiveTimeForm', true);
startLoading();
}
else if (state === 'failed') {
stopLoading();
showGlobalError(this.addTimeError);
}
else if (state === 'succeeded') {
this.$store.commit('callForward/setActiveTimeForm', false);
stopLoading();
if (this.$refs.times) {
this.$refs.times.resetTimes();
}
else {
this.$refs.addTimeNew.resetTimes();
}
this.loadTimes();
this.loadDestinations();
showToast(this.$t('pages.callForward.times.addTimeSuccessMessage'));
}
},
activeTimeForm(state) {
if (!state) {
this.resetAlerts();
}
}
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import '../../../themes/quasar.variables.styl'
.times-card
.q-alert-container
padding 15px 0
</style>

@ -76,7 +76,7 @@
QItemSide,
Dialog,
QBtn,
QTooltip
QTooltip
},
computed: {
...mapState('callForward', [

@ -170,10 +170,10 @@
"addTimeErrorMessage": "An error occured while trying to create the timeset. Please try again.",
"noTimeSet": "no time set",
"addTimeButton": "Add Time",
"companyHoursIncompatible": "The Company Hours timeset contains incompatible values. You can resolve this by resetting the company hours timeset.",
"companyHoursNotDefined": "The Company Hours timeset is not defined. You need to create one to be able to define call forward destinations.",
"companyHoursDuplicate": "More than one Company Hours timeset exists. You can resolve this by resetting the company hours timesets.",
"companyHoursReverse": "The Company Hours timeset contain reverse order of values. You can resolve this by resetting the company hours timeset.",
"timesetIncompatible": "The {timeset} timeset contains incompatible values. You can resolve this by resetting the {timeset} timeset.",
"timesetNotDefined": "The {timeset} timeset is not defined. You need to create one to be able to define call forward destinations.",
"timesetDuplicate": "More than one {timeset} timeset exists. You can resolve this by resetting the {timeset} timesets.",
"timesetReverse": "The {timeset} timeset contain reverse order of values. You can resolve this by resetting the {timeset} timeset.",
"weekday": "Weekday",
"from": "From",
"to": "To",
@ -184,8 +184,8 @@
"friday": "Friday",
"saturday": "Saturday",
"sunday": "Sunday",
"addCompanyHours": "Add Company Hours",
"resetCompanyHours": "Reset Company Hours",
"resetTimeset": "Reset {timeset}",
"addTimeset": "Add {timeset}",
"selectValidTime": "Select valid time"
}
},

@ -72,13 +72,7 @@ export default {
timesetHasReverse: false,
timesetHasDuplicate: false,
timesetId: null,
activeTimeForm: false,
showAlerts: {
duplicate: true,
compatible: true,
reverse: true,
defined: true
}
activeTimeForm: false
},
getters: {
hasFaxCapability(state, getters, rootState, rootGetters) {
@ -257,26 +251,15 @@ export default {
setActiveTimeForm(state, value) {
state.activeTimeForm = value;
},
resetAlerts(state) {
state.showAlerts.duplicate = true;
state.showAlerts.compatible = true;
state.showAlerts.reverse = true;
state.showAlerts.defined = true;
},
setShowAlertDuplicate(state, value) {
state.showAlerts.duplicate = value;
},
setShowAlertCompatible(state, value) {
state.showAlerts.compatible = value;
},
setShowAlertReverse(state, value) {
state.showAlerts.reverse = value;
},
setShowAlertDefined(state, value) {
state.showAlerts.defined = value;
},
resetAddTimeState(state) {
state.addTimeState = RequestState.button;
},
resetTimesetState(state) {
state.timesetIsCompatible = true;
state.timesetExists = true;
state.timesetHasReverse = false;
state.timesetHasDuplicate = false;
state.addTimeState = RequestState.button;
}
},
actions: {
@ -320,35 +303,13 @@ export default {
});
});
},
loadAlwaysEverybodyDestinations(context) {
return new Promise(()=>{
loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'),
timeset: null
}).then((result)=>{
context.commit('loadDestinations', result);
});
});
},
loadCompanyHoursEverybodyDestinations(context) {
return new Promise(()=>{
loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'),
timeset: 'Company Hours'
}).then((result)=>{
context.commit('loadDestinations', result);
});
});
},
loadAfterHoursEverybodyDestinations(context) {
return new Promise(()=>{
loadEverybodyDestinations({
loadEverybodyDestinations(context, options) {
loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'),
timeset: 'After Hours'
}).then((result)=>{
context.commit('loadDestinations', result);
});
});
timeset: options.timeset
}).then((result)=>{
context.commit('loadDestinations', result);
});
},
deleteDestinationFromDestinationset(context, options) {
let removedDestination = options.removeDestination;
@ -521,7 +482,7 @@ export default {
id: context.getters.getSubscriberId,
name: name
}).then(() => {
context.commit('resetAddTimeState');
context.commit('resetTimesetState');
context.commit('resetTimeSucceeded');
}).catch((err) => {
context.commit('resetTimeFailed', err.message);

Loading…
Cancel
Save