From d3211cb5a0407fc5b50475d405e637a7fb8a56d6 Mon Sep 17 00:00:00 2001 From: raxelsen Date: Wed, 4 Apr 2018 17:54:45 +0200 Subject: [PATCH] TT#20311 Customer wants to send a fax What has been done: - TT#34863, Global: Implement vuex store actions, mutations and getters - TT#34864, Global: Implement vue components - TT#34862, Global: Implement api requests Change-Id: Ib547cc125271222d005ca131113086739ae3220f --- README.md | 9 +++ src/api/communication.js | 17 +++++ src/components/CscSendFax.vue | 115 +++++++++++++++++++++++++++++ src/components/layouts/Default.vue | 39 +++++++++- src/locales/en.json | 18 +++++ src/store/communication.js | 52 +++++++++++++ src/store/index.js | 4 +- src/store/user.js | 2 +- 8 files changed, 251 insertions(+), 5 deletions(-) create mode 100644 src/api/communication.js create mode 100644 src/components/CscSendFax.vue create mode 100644 src/store/communication.js diff --git a/README.md b/README.md index 91826803..d5d3be15 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,15 @@ Now you can log in to csc with one of the normal subscriber you just created. UR `https:///csc` +### Send Fax + +You need to first enable faxserver and activate it for the subscriber, to be able to send a fax via the "action button menu". + +1. By default, vagrant-ngcp has faxserver enabled by default in the config, so currently we do not need to make any changes here. Otherwise, it would be enabled via /etc/ngcp-config/config.yml by setting "faxserver: enable:" to "yes" and applying the changes with ngcpcfg apply 'enable faxserver'"" +1. Log in to ngcp-panel with administrator credentials +1. Go to Settings > Subscribers > Details > Preferences > Fax Features > Fax2Mail and SendFax, and set Active to "yes" +1. Additionally, the visibility of the fax option in "action button menu" is reliant on store state "sendFax: true" in src/store/user.js. This means it can be toggled off in the code as well if neeeded + ### How to add new npm package 1. Remove the package if you've already installed it diff --git a/src/api/communication.js b/src/api/communication.js new file mode 100644 index 00000000..2c574f0b --- /dev/null +++ b/src/api/communication.js @@ -0,0 +1,17 @@ + +import Vue from 'vue'; + +export function createFax(options, subscriberId) { + return new Promise((resolve, reject) => { + let headers = { + 'Content-Type': 'application/json', + }; + let mergedParams = Object.assign(options, subscriberId); + let payload = JSON.stringify(mergedParams); + Vue.http.post('/api/faxes/', payload, { headers: headers }).then(() => { + resolve(); + }).catch((err)=>{ + reject(err); + }); + }); +} diff --git a/src/components/CscSendFax.vue b/src/components/CscSendFax.vue new file mode 100644 index 00000000..a262f94d --- /dev/null +++ b/src/components/CscSendFax.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/components/layouts/Default.vue b/src/components/layouts/Default.vue index b9250b22..d7c658c5 100644 --- a/src/components/layouts/Default.vue +++ b/src/components/layouts/Default.vue @@ -91,7 +91,7 @@ - + {{ $t('sendFax') }} @@ -105,14 +105,22 @@ +