|
|
|
@ -11,7 +11,9 @@
|
|
|
|
|
:items-list="voicemailItems"
|
|
|
|
|
:route-to="{ name: 'CscConversations', params: { initialTab: 'voicemail' } }"
|
|
|
|
|
:loading="$wait.is('getVoicemailsData')"
|
|
|
|
|
:no-items-message="$t('No new messages')"
|
|
|
|
|
:error="voicemailsError"
|
|
|
|
|
@action="downloadVoicemail"
|
|
|
|
|
/>
|
|
|
|
|
<csc-card-dashboard
|
|
|
|
|
:title="$t('Call List')"
|
|
|
|
@ -20,6 +22,7 @@
|
|
|
|
|
:button-title="$t('View Call List')"
|
|
|
|
|
:items-list="callItems"
|
|
|
|
|
:route-to="{ name: 'CscConversations', params: { initialTab: 'call' } }"
|
|
|
|
|
:no-items-message="$t('No calls yet')"
|
|
|
|
|
:loading="$wait.is('getCallsData')"
|
|
|
|
|
:error="callsError"
|
|
|
|
|
/>
|
|
|
|
@ -30,6 +33,7 @@
|
|
|
|
|
:button-title="$t('View All Registered Devices')"
|
|
|
|
|
:items-list="registeredDevicesItems"
|
|
|
|
|
:route-to="{ name: 'RegisteredDevices', params: { initialTab: 'null' } }"
|
|
|
|
|
:no-items-message="$t('No devices registered')"
|
|
|
|
|
:loading="$wait.is('getRegisteredDevicesData')"
|
|
|
|
|
:error="registeredDevicesError"
|
|
|
|
|
/>
|
|
|
|
@ -43,6 +47,14 @@ import { mapWaitingActions } from 'vue-wait'
|
|
|
|
|
import {
|
|
|
|
|
showGlobalError
|
|
|
|
|
} from 'src/helpers/ui'
|
|
|
|
|
import {
|
|
|
|
|
date
|
|
|
|
|
} from 'quasar'
|
|
|
|
|
import { INTERNAL_DATE_FORMAT_DASH_HOUR } from 'src/constants'
|
|
|
|
|
import {
|
|
|
|
|
callIconColor,
|
|
|
|
|
callIcon
|
|
|
|
|
} from 'src/helpers/call-utils'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'CscPageDashboard',
|
|
|
|
|
components: {
|
|
|
|
@ -77,36 +89,78 @@ export default {
|
|
|
|
|
this.getVoicemailsData(),
|
|
|
|
|
this.getRegisteredDevicesData()
|
|
|
|
|
])
|
|
|
|
|
this.checkResponses('calls', values[0])
|
|
|
|
|
this.checkResponses('voicemails', values[1])
|
|
|
|
|
this.checkResponses('registered-devices', values[2])
|
|
|
|
|
this.manageCallsData(values[0])
|
|
|
|
|
this.manageVoicemailsData(values[1])
|
|
|
|
|
this.manageDevicesData(values[2])
|
|
|
|
|
},
|
|
|
|
|
checkResponses (type, response) {
|
|
|
|
|
if (type === 'calls') {
|
|
|
|
|
if (response.status === 'rejected') {
|
|
|
|
|
this.callsError = true
|
|
|
|
|
showGlobalError(response?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.callsCount = response.value.totalCount
|
|
|
|
|
this.callItems = response.value.items
|
|
|
|
|
}
|
|
|
|
|
} else if (type === 'voicemails') {
|
|
|
|
|
if (response.status === 'rejected') {
|
|
|
|
|
this.voicemailsError = true
|
|
|
|
|
showGlobalError(response?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.voicemailsCount = response.value.totalCount
|
|
|
|
|
this.voicemailItems = response.value.items
|
|
|
|
|
}
|
|
|
|
|
} else if (type === 'registered-devices') {
|
|
|
|
|
if (response.status === 'rejected') {
|
|
|
|
|
this.registeredDevicesError = true
|
|
|
|
|
showGlobalError(response?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.registeredDevicesCount = response.value.totalCount
|
|
|
|
|
this.registeredDevicesItems = response.value.items
|
|
|
|
|
}
|
|
|
|
|
manageCallsData (calls) {
|
|
|
|
|
if (calls.status === 'rejected') {
|
|
|
|
|
this.callsError = true
|
|
|
|
|
showGlobalError(calls?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.callsCount = calls.value.totalCount
|
|
|
|
|
this.callItems = calls.value.items.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
icon: { name: callIcon(item), color: callIconColor(item) },
|
|
|
|
|
clickable_icon: false,
|
|
|
|
|
title: this.checkTitleToShow(item),
|
|
|
|
|
sub_title: date.formatDate(item.start_time, INTERNAL_DATE_FORMAT_DASH_HOUR),
|
|
|
|
|
extra_text: item.duration.split('.')[0]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
manageVoicemailsData (voicemails) {
|
|
|
|
|
if (voicemails.status === 'rejected') {
|
|
|
|
|
this.voicemailsError = true
|
|
|
|
|
showGlobalError(voicemails?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.voicemailsCount = voicemails.value.totalCount
|
|
|
|
|
this.voicemailItems = voicemails.value.items.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
icon: { name: 'download', color: 'primary' },
|
|
|
|
|
clickable_icon: true,
|
|
|
|
|
title: item.caller,
|
|
|
|
|
sub_title: date.formatDate(item.start_time, INTERNAL_DATE_FORMAT_DASH_HOUR),
|
|
|
|
|
extra_text: new Date(item.duration * 1000).toISOString().substr(11, 8)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
manageDevicesData (devices) {
|
|
|
|
|
if (devices.status === 'rejected') {
|
|
|
|
|
this.registeredDevicesError = true
|
|
|
|
|
showGlobalError(devices?.reason?.data?.message)
|
|
|
|
|
} else {
|
|
|
|
|
this.registeredDevicesCount = devices.value.totalCount
|
|
|
|
|
this.registeredDevicesItems = devices.value.items.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
icon: { name: 'devices', color: 'primary' },
|
|
|
|
|
clickable_icon: false,
|
|
|
|
|
title: item.user_agent,
|
|
|
|
|
sub_title: date.formatDate(item.expires, INTERNAL_DATE_FORMAT_DASH_HOUR),
|
|
|
|
|
extra_text: ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
checkTitleToShow (call) {
|
|
|
|
|
if (call.call_type === 'cfu' || call.call_type === 'cfna' ||
|
|
|
|
|
call.call_type === 'cfb' || call.call_type === 'cft') {
|
|
|
|
|
return 'vmu' + call.caller
|
|
|
|
|
} else if (call.direction === 'out') {
|
|
|
|
|
return call.callee
|
|
|
|
|
} else if (call.direction === 'in') {
|
|
|
|
|
return call.caller
|
|
|
|
|
} else {
|
|
|
|
|
return call.caller
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
downloadVoicemail (id) {
|
|
|
|
|
this.$store.dispatch('conversations/downloadVoiceMail', id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|