- Add call forwarding type "Auto Attendant" - Add call forwarding type "Office Hours Announcement" - Add call forwarding type "Calling Card" - Add call forwarding type "Call Through" - Add call forwarding type "Local Subscriber" - Add "gridView" to call forwarding menu Change-Id: Ib64668e3caadfed2ec631d0242e0eef07aa7d819mr10.1.1
parent
d0a51c3ff9
commit
07a4dbd95f
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<span
|
||||
:class="cssClasses"
|
||||
>
|
||||
<q-icon
|
||||
:name="destinationIcon"
|
||||
/>
|
||||
{{ destinationLabel }}
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import destination from 'src/mixins/destination'
|
||||
|
||||
export default {
|
||||
name: 'CscCfDestination',
|
||||
mixins: [destination],
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
clickable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
destinationIcon () {
|
||||
if (this.icon) {
|
||||
return this.icon
|
||||
} else if (this.value?.destination) {
|
||||
return this.destinationIconBySipUri(this.value.destination)
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
destinationLabel () {
|
||||
if (this.label) {
|
||||
return this.label
|
||||
} else if (this.value?.destination) {
|
||||
return this.destinationFormattedBySipUri(this.value.destination)
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
cssClasses () {
|
||||
return [
|
||||
'q-pl-xs',
|
||||
'text-weight-bold',
|
||||
'text-no-wrap',
|
||||
...(this.clickable ? [
|
||||
'cursor-pointer',
|
||||
'text-primary'
|
||||
] : [])
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<csc-cf-destination
|
||||
:value="destination"
|
||||
:label="announcement ? announcement.label : ''"
|
||||
:clickable="true"
|
||||
>
|
||||
<q-popup-edit
|
||||
v-model="announcement"
|
||||
buttons
|
||||
anchor="top left"
|
||||
@before-show="$store.commit('callForwarding/popupShow', null)"
|
||||
@save="$emit('input', announcement)"
|
||||
>
|
||||
<q-select
|
||||
v-model="announcement"
|
||||
map-options
|
||||
:rules="[ checkAnnouncement ]"
|
||||
:options="announcements"
|
||||
:label="$t('Custom Announcements')"
|
||||
:disable="$attrs.loading"
|
||||
/>
|
||||
</q-popup-edit>
|
||||
</csc-cf-destination>
|
||||
</template>
|
||||
<script>
|
||||
import CscCfDestination from 'components/call-forwarding/CscCfDestination'
|
||||
import { showGlobalError } from 'src/helpers/ui'
|
||||
export default {
|
||||
name: 'CscCfDestinationCustomAnnouncement',
|
||||
components: { CscCfDestination },
|
||||
props: {
|
||||
destination: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
},
|
||||
announcements: {
|
||||
type: Array,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
announcement: this.$attrs.value
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$attrs.value' (value) {
|
||||
this.announcement = value
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkAnnouncement () {
|
||||
const fieldFilled = this.announcement
|
||||
if (!fieldFilled) {
|
||||
showGlobalError(this.$t('Please select an option'))
|
||||
}
|
||||
return fieldFilled
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<csc-cf-destination
|
||||
:value="destination"
|
||||
:label="destination.simple_destination === ' ' ? $t('Number') : destination.simple_destination"
|
||||
:clickable="true"
|
||||
>
|
||||
<q-popup-edit
|
||||
v-model="number"
|
||||
buttons
|
||||
@before-show="$store.commit('callForwarding/popupShow', null)"
|
||||
@save="$emit('input', $event)"
|
||||
>
|
||||
<csc-input
|
||||
v-model="number"
|
||||
dense
|
||||
>
|
||||
<template
|
||||
v-slot:prepend
|
||||
>
|
||||
<q-icon
|
||||
name="phone_forwarded"
|
||||
/>
|
||||
</template>
|
||||
</csc-input>
|
||||
</q-popup-edit>
|
||||
</csc-cf-destination>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CscCfDestination from 'components/call-forwarding/CscCfDestination'
|
||||
import CscInput from 'components/form/CscInput'
|
||||
export default {
|
||||
name: 'CscCfDestinationNumber',
|
||||
components: { CscInput, CscCfDestination },
|
||||
props: {
|
||||
destination: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
number: this.$attrs.value
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$attrs.value' (value) {
|
||||
this.number = value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,160 @@
|
||||
import sipUriParse from 'src/sip-uri-parse'
|
||||
import _ from 'lodash'
|
||||
|
||||
const DestinationType = {
|
||||
VoiceBox: 'VoiceBox',
|
||||
Conference: 'Conference',
|
||||
Fax2Mail: 'Fax2Mail',
|
||||
CallingCard: 'CallingCard',
|
||||
CallThrough: 'CallThrough',
|
||||
AutoAttendant: 'AutoAttendant',
|
||||
OfficeHoursAnnouncement: 'OfficeHoursAnnouncement',
|
||||
CustomAnnouncement: 'CustomAnnouncement',
|
||||
LocalSubscriber: 'LocalSubscriber',
|
||||
ManagerSecretary: 'ManagerSecretary',
|
||||
Application: 'Application',
|
||||
Number: 'Number'
|
||||
}
|
||||
|
||||
function parseSipUri (sipUri) {
|
||||
const parsedUri = sipUriParse(sipUri)
|
||||
const host = parsedUri.host
|
||||
const username = parsedUri.username
|
||||
let destinationType
|
||||
if (host.endsWith('voicebox.local')) {
|
||||
destinationType = DestinationType.VoiceBox
|
||||
} else if (host.endsWith('conference.local')) {
|
||||
destinationType = DestinationType.Conference
|
||||
} else if (host.endsWith('fax2mail.local')) {
|
||||
destinationType = DestinationType.Fax2Mail
|
||||
} else if (username === 'callingcard' && host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.CallingCard
|
||||
} else if (username === 'callthrough' && host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.CallThrough
|
||||
} else if (username === 'auto-attendant' && host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.AutoAttendant
|
||||
} else if (username === 'office-hours' && host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.OfficeHoursAnnouncement
|
||||
} else if (username === 'custom-hours' && host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.CustomAnnouncement
|
||||
} else if (username === 'localuser' && host.endsWith('local')) {
|
||||
destinationType = DestinationType.LocalSubscriber
|
||||
} else if (host.endsWith('managersecretary.local')) {
|
||||
destinationType = DestinationType.ManagerSecretary
|
||||
} else if (host.endsWith('app.local')) {
|
||||
destinationType = DestinationType.Application
|
||||
} else {
|
||||
destinationType = DestinationType.Number
|
||||
}
|
||||
return {
|
||||
destinationType,
|
||||
parsedUri
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
isDestinationType (sipUri, destinationType) {
|
||||
const parsedSipUri = parseSipUri(sipUri)
|
||||
return parsedSipUri.destinationType === destinationType
|
||||
},
|
||||
isDestinationTypeVoiceBox (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.VoiceBox)
|
||||
},
|
||||
isDestinationTypeConference (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.Conference)
|
||||
},
|
||||
isDestinationTypeFax2Mail (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.Fax2Mail)
|
||||
},
|
||||
isDestinationTypeCallingCard (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.CallingCard)
|
||||
},
|
||||
isDestinationTypeCallThrough (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.CallThrough)
|
||||
},
|
||||
isDestinationTypeAutoAttendant (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.AutoAttendant)
|
||||
},
|
||||
isDestinationTypeOfficeHoursAnnouncement (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.OfficeHoursAnnouncement)
|
||||
},
|
||||
isDestinationTypeCustomAnnouncement (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.CustomAnnouncement)
|
||||
},
|
||||
isDestinationTypeLocalSubscriber (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.LocalSubscriber)
|
||||
},
|
||||
isDestinationTypeManagerSecretary (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.ManagerSecretary)
|
||||
},
|
||||
isDestinationTypeApplication (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.Application)
|
||||
},
|
||||
isDestinationTypeNumber (sipUri) {
|
||||
return this.isDestinationType(sipUri, DestinationType.Number)
|
||||
},
|
||||
destinationIconBySipUri (sipUri) {
|
||||
const parsedSipUri = parseSipUri(sipUri)
|
||||
return this.destinationIconByType(parsedSipUri.destinationType)
|
||||
},
|
||||
destinationIconByType (destinationType) {
|
||||
switch (destinationType) {
|
||||
case DestinationType.VoiceBox:
|
||||
return 'voicemail'
|
||||
case DestinationType.Conference:
|
||||
return 'groups'
|
||||
case DestinationType.Fax2Mail:
|
||||
return 'email'
|
||||
case DestinationType.CallingCard:
|
||||
return 'credit_card'
|
||||
case DestinationType.CallThrough:
|
||||
return 'double_arrow'
|
||||
case DestinationType.AutoAttendant:
|
||||
return 'dialpad'
|
||||
case DestinationType.OfficeHoursAnnouncement:
|
||||
return 'schedule'
|
||||
case DestinationType.CustomAnnouncement:
|
||||
return 'music_note'
|
||||
case DestinationType.LocalSubscriber:
|
||||
return 'person_pin'
|
||||
case DestinationType.ManagerSecretary:
|
||||
return 'support_agent'
|
||||
case DestinationType.Application:
|
||||
return 'apps'
|
||||
case DestinationType.Number:
|
||||
return 'phone_forwarded'
|
||||
}
|
||||
},
|
||||
destinationFormattedBySipUri (sipUri) {
|
||||
const parsedSipUri = parseSipUri(sipUri)
|
||||
switch (parsedSipUri.destinationType) {
|
||||
case DestinationType.VoiceBox:
|
||||
return this.$t('Voicebox')
|
||||
case DestinationType.Conference:
|
||||
return this.$t('Conference')
|
||||
case DestinationType.Fax2Mail:
|
||||
return this.$t('Fax2Mail')
|
||||
case DestinationType.CallingCard:
|
||||
return this.$t('Calling Card')
|
||||
case DestinationType.CallThrough:
|
||||
return this.$t('Call Through')
|
||||
case DestinationType.AutoAttendant:
|
||||
return this.$t('Auto Attendant')
|
||||
case DestinationType.OfficeHoursAnnouncement:
|
||||
return this.$t('Office Hours Announcement')
|
||||
case DestinationType.CustomAnnouncement:
|
||||
return this.$t('Custom Announcement')
|
||||
case DestinationType.LocalSubscriber:
|
||||
return this.$t('Local Subscriber')
|
||||
case DestinationType.ManagerSecretary:
|
||||
return this.$t('Manager Secretary')
|
||||
case DestinationType.Application:
|
||||
return _.words(parsedSipUri.parsedUri.username).map(word => _.upperFirst(word)).join(' ')
|
||||
default:
|
||||
case DestinationType.Number:
|
||||
return parsedSipUri.parsedUri.username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue