diff --git a/src/api/conversations.js b/src/api/conversations.js index 35130b37..c026fdb7 100644 --- a/src/api/conversations.js +++ b/src/api/conversations.js @@ -112,3 +112,29 @@ export async function deleteVoicemail (id) { const res = await Vue.http.delete('api/voicemails/' + id) return res.status >= 200 } + +export function getAllVoicemails (options) { + return new Promise((resolve, reject) => { + getList({ + resource: 'voicemails', + params: { subscriber_id: options.subscriberId, rows: options.rows } + }).then((result) => { + resolve(result) + }).catch((err) => { + reject(err) + }) + }) +} + +export function getAllCalls (options) { + return new Promise((resolve, reject) => { + getList({ + resource: 'conversations', + params: { subscriber_id: options.subscriberId, rows: options.rows, type: 'call' } + }).then((result) => { + resolve(result) + }).catch((err) => { + reject(err) + }) + }) +} diff --git a/src/components/CscMainMenuTop.vue b/src/components/CscMainMenuTop.vue index 72ec8f4d..ae879de1 100644 --- a/src/components/CscMainMenuTop.vue +++ b/src/components/CscMainMenuTop.vue @@ -57,6 +57,12 @@ export default { ]), items () { return [ + { + to: '/user/dashboard', + icon: 'fas fa-tachometer-alt', + label: this.$t('Dashboard'), + visible: true + }, { to: '/user/home', icon: 'call', diff --git a/src/components/pages/Dashboard/CscCardDashboard.vue b/src/components/pages/Dashboard/CscCardDashboard.vue new file mode 100644 index 00000000..bd8eecd2 --- /dev/null +++ b/src/components/pages/Dashboard/CscCardDashboard.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index aeb58fda..6ca297c6 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -56,6 +56,7 @@ "Call": "Call", "Call Blocking": "Call Blocking", "Call Forwarding": "Call Forwarding", + "Call List": "Call List", "Call Queue": "Call Queue", "Call Queues": "Call Queues", "Call Settings": "Call Settings", @@ -111,6 +112,7 @@ "Custom sound": "Custom sound", "Customer Details": "Customer Details", "Daily": "Daily", + "Dashboard": "Dashboard", "Default": "Default", "Default sound": "Default sound", "Default sound set for all seats and groups": "Default sound set for all seats and groups", @@ -234,6 +236,7 @@ "Name": "Name", "Name in Fax Header for Sendfax": "Name in Fax Header for Sendfax", "Never": "Never", + "New Messages": "New Messages", "New features": "New features", "New password": "New password", "New password retyped": "New password retyped", @@ -294,6 +297,7 @@ "Random Ringing": "Random Ringing", "Receive Reports": "Receive Reports", "Received from IP": "Received from IP", + "Recent Calls": "Recent Calls", "Recording successfully deleted": "Recording successfully deleted", "Recordings": "Recordings", "Recover password": "Recover password", @@ -428,8 +432,14 @@ "User Agent": "User Agent", "User settings": "User settings", "Username": "Username", + "Video Call": "Video Call", + "View All Registered Devices": "View All Registered Devices", + "View Call List": "View Call List", + "View Voicebox Messages": "View Voicebox Messages", + "Voice Call": "Voice Call", "Voice prompts language for voicemail, conference and application server": "Voice prompts language for voicemail, conference and application server", "Voicebox": "Voicebox", + "Voicebox Messages": "Voicebox Messages", "Voicemail": "Voicemail", "Voicemails": "Voicemails", "We": "We", diff --git a/src/layouts/CscLayoutConference.vue b/src/layouts/CscLayoutConference.vue index ce72e99c..cb5e829c 100644 --- a/src/layouts/CscLayoutConference.vue +++ b/src/layouts/CscLayoutConference.vue @@ -300,7 +300,7 @@ export default { ]), close () { if (!this.isJoined) { - this.$router.push({ path: '/user/home' }) + this.$router.push({ path: '/user/dashboard' }) this.$store.commit('conference/disposeLocalMedia') } else { this.$refs.confirmDialog.open() diff --git a/src/layouts/CscLayoutMain.vue b/src/layouts/CscLayoutMain.vue index 720a33ea..91fa8bcc 100644 --- a/src/layouts/CscLayoutMain.vue +++ b/src/layouts/CscLayoutMain.vue @@ -415,7 +415,7 @@ export default { }) } window.scrollTo(0, 0) - if (route.path === '/user/home') { + if (route.path === '/user/dashboard') { this.forwardHome() } } diff --git a/src/pages/CscPageConversations.vue b/src/pages/CscPageConversations.vue index 5574ff30..f37800df 100644 --- a/src/pages/CscPageConversations.vue +++ b/src/pages/CscPageConversations.vue @@ -125,12 +125,18 @@ export default { mixins: [ platformMixin ], + props: { + initialTab: { + type: String, + default: 'call-fax-voicemail' + } + }, data () { return { filter: undefined, topMargin: 0, deletionId: null, - selectedTab: 'call-fax-voicemail' + selectedTab: this.initialTab } }, computed: { diff --git a/src/pages/CscPageDashboard.vue b/src/pages/CscPageDashboard.vue new file mode 100644 index 00000000..6c9b7aae --- /dev/null +++ b/src/pages/CscPageDashboard.vue @@ -0,0 +1,113 @@ + + + diff --git a/src/pages/CscPageError404.vue b/src/pages/CscPageError404.vue index d8fd0d5a..b3955958 100644 --- a/src/pages/CscPageError404.vue +++ b/src/pages/CscPageError404.vue @@ -29,7 +29,7 @@ icon="home" text-color="dark" unelevated - to="/user/home" + to="/user/dashboard" /> diff --git a/src/router/routes.js b/src/router/routes.js index fd1c21f9..294cdf59 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -30,6 +30,7 @@ import CscPageCf from 'pages/CscPageCf' import CscPageCallSettings from 'pages/CscPageCallSettings' import CscPageRegisteredDevices from 'pages/CscPageRegisteredDevices' import CscPagePbxSettingsAutoAttendant from 'pages/CscPagePbxSettingsAutoAttendant' +import CscPageDashboard from 'pages/CscPageDashboard' const getToken = (route) => { return { @@ -44,6 +45,15 @@ export default function routes (app) { path: '/user', component: CscLayoutMain, children: [ + { + path: 'dashboard', + component: CscPageDashboard, + meta: { + get title () { + return i18n.t('Dashboard') + } + } + }, { path: 'home', component: CscPageHome, @@ -55,7 +65,9 @@ export default function routes (app) { }, { path: 'conversations', + name: 'CscConversations', component: CscPageConversations, + props: true, meta: { get title () { return i18n.t('Conversations') @@ -320,6 +332,7 @@ export default function routes (app) { }, { path: 'registered-devices', + name: 'RegisteredDevices', component: CscPageRegisteredDevices, meta: { get title () { @@ -403,7 +416,7 @@ export default function routes (app) { { path: '/', redirect: { - path: '/user/home' + path: '/user/dashboard' } }, { diff --git a/src/store/dashboard.js b/src/store/dashboard.js new file mode 100644 index 00000000..1bf0368d --- /dev/null +++ b/src/store/dashboard.js @@ -0,0 +1,39 @@ +import { + getAllVoicemails, + getAllCalls +} from '../api/conversations' +import { + getSubscriberRegistrations +} from '../api/subscriber' + +export default { + namespaced: true, + getters: { + getSubscriberId (state, getters, rootState, rootGetters) { + return parseInt(rootGetters['user/getSubscriberId']) + } + }, + actions: { + async getVoicemailsData (context) { + const res = await getAllVoicemails({ + subscriberId: context.getters.getSubscriberId, + rows: 5 + }) + return res + }, + async getCallsData (context) { + const res = await getAllCalls({ + subscriberId: context.getters.getSubscriberId, + rows: 5 + }) + return res + }, + async getRegisteredDevicesData (context) { + const res = await getSubscriberRegistrations({ + subscriber_id: context.getters.getSubscriberId, + rows: 5 + }) + return res + } + } +} diff --git a/src/store/index.js b/src/store/index.js index 7666cd02..b54564e7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -26,6 +26,7 @@ import CommunicationModule from './communication' import FaxModule from './fax' import VoiceboxModule from './voicebox' import ConferenceModule from './conference' +import DashboardModule from './dashboard' import RtcEnginePlugin from 'src/plugins/rtc-engine' import CallPlugin from 'src/plugins/call' @@ -69,7 +70,8 @@ export default function (/* { ssrContext } */) { pbxSoundSets: PbxSoundSetsModule, pbxMsConfigs: PbxMsConfigsModule, callForwarding: CallForwardingModule, - pbxAutoAttendants: PbxAutoAttendants + pbxAutoAttendants: PbxAutoAttendants, + dashboard: DashboardModule }, state: { diff --git a/src/store/user.js b/src/store/user.js index 14ba37f5..af2077bd 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -376,7 +376,7 @@ export default { } }, async forwardHome (context) { - if (context.rootState.route?.path === '/user/home' && !context.getters.isRtcEngineUiVisible) { + if (context.rootState.route?.path === '/user/dashboard' && !context.getters.isRtcEngineUiVisible) { await router.push({ path: '/user/conversations' }) } },