From 5f1133a150235d37387e5526f764a1c61ef730fe Mon Sep 17 00:00:00 2001 From: raxelsen Date: Mon, 3 Sep 2018 16:25:00 +0200 Subject: [PATCH] TT#34950 Add attachment option to send fax feature What has been done: - TT#43261, Implement API method for sending fax attachment - TT#43260, Extend form to also include attachment selection - TT#43262, Implement method and state handling for attachment selection field - TT#43263, Implement UI flow for sending content or attachment, or both if possible Change-Id: I09b20005c1647f9773f9c7dcb2f141f8c9420d5b --- TESTDATA.md | 1 - src/api/communication.js | 18 ++- src/components/CscSendFax.vue | 236 +++++++++++++++++++++++++++++++--- src/locales/en.json | 8 +- src/main.js | 2 +- src/store/communication.js | 9 +- src/themes/app.variables.styl | 3 +- 7 files changed, 244 insertions(+), 33 deletions(-) diff --git a/TESTDATA.md b/TESTDATA.md index 5a4a74b3..eb97630a 100644 --- a/TESTDATA.md +++ b/TESTDATA.md @@ -67,7 +67,6 @@ For outgoing you need to use the api (also with E 164 number set to sms number f username: '' ` 1. Apply the exim configuration changes via `sudo ngcpcfg apply 'adjust exim4 / MTA configuration'` -1. For the rest of the prompts, press enter to choose the defaults 1. Go to Settings > Subscribers, find subscriber you want to use as caller, and click "Details" 1. Under "Master Data" click edit, and enter subscribers number also in the E164 field 1. Then go to "Preferences", and set "Fax2Mail and Sendfax" to active diff --git a/src/api/communication.js b/src/api/communication.js index 4523638f..0bd32031 100644 --- a/src/api/communication.js +++ b/src/api/communication.js @@ -1,14 +1,18 @@ +import _ from 'lodash'; import Vue from 'vue'; -export function createFax(options, subscriberId) { +export function createFax(options) { 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(() => { + var formData = new FormData(); + var fields = _.clone(options); + delete fields.file; + var json = JSON.stringify(fields); + formData.append('json', json); + if (options.file) { + formData.append('faxfile', options.file); + } + Vue.http.post('api/faxes/', formData).then(() => { resolve(); }).catch((err)=>{ reject(err); diff --git a/src/components/CscSendFax.vue b/src/components/CscSendFax.vue index a262f94d..c0398023 100644 --- a/src/components/CscSendFax.vue +++ b/src/components/CscSendFax.vue @@ -7,55 +7,139 @@
{{ $t('communication.sendFax') }}
- + + :float-label="$t('communication.label.destination')" + @input="$v.form.destination.$touch" + @blur="$v.form.destination.$touch" + :error="$v.form.destination.$error" + /> + :float-label="$t('communication.label.quality')" + /> - + + v-model="form.pageHeader" + :float-label="$t('communication.label.pageHeader')" + @input="$v.form.pageHeader.$touch" + @blur="$v.form.pageHeader.$touch" + :error="$v.form.pageHeader.$error" + /> - + + :float-label="$t('communication.label.content')" + @input="$v.form.data.$touch" + @blur="$v.form.data.$touch" + :error="$v.form.data.$error" + /> + + + + - {{ $t('communication.cancel') }} - {{ $t('communication.send') }} +
+ {{ fileErrorMessage }} +
+ + {{ $t('communication.cancel') }} + + + {{ $t('communication.send') }} +