TT#114750 Web fax sending page result in an error

Change-Id: I7b8ec557d45490ae05e660271214ed7cddbac0d5
mr9.4
Carlo Venusino 5 years ago
parent e9fa434146
commit 509065dbfa

@ -51,6 +51,7 @@
/> />
<csc-input-file <csc-input-file
accept=".pdf,.tiff,.txt,.ps" accept=".pdf,.tiff,.txt,.ps"
@isFileSelected="toggleFileSelected"
/> />
</q-card-section> </q-card-section>
<q-card-actions> <q-card-actions>
@ -71,70 +72,6 @@
/> />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
<!-- <q-field class="upload-field">-->
<!-- <label-->
<!-- for="fax-file-upload"-->
<!-- class="upload-label"-->
<!-- >-->
<!-- <div class="upload-label">-->
<!-- {{ $t('Fax File') }}-->
<!-- </div>-->
<!-- <q-btn-->
<!-- flat-->
<!-- color="white"-->
<!-- icon="cloud_upload"-->
<!-- class="upload-button"-->
<!-- @click="$refs.faxUpload.click()"-->
<!-- >-->
<!-- {{ $t('Select') }}-->
<!-- </q-btn>-->
<!-- <span class="upload-filename">-->
<!-- {{ selectedFile }}-->
<!-- </span>-->
<!-- <q-btn-->
<!-- v-if="selectedFile.length > 0"-->
<!-- flat-->
<!-- icon="cancel"-->
<!-- class="reset-button"-->
<!-- @click="resetFile"-->
<!-- />-->
<!-- </label>-->
<!-- <input-->
<!-- id="fax-file-upload"-->
<!-- ref="faxUpload"-->
<!-- dark-->
<!-- type="file"-->
<!-- accept=".pdf,.tiff,.txt,.ps"-->
<!-- :error="$v.form.file.$error"-->
<!-- @change="processFile($event)"-->
<!-- @input="$v.form.file.$touch"-->
<!-- @blur="$v.form.file.$touch"-->
<!-- >-->
<!-- </q-field>-->
<!-- <div-->
<!-- v-if="$v.form.file.$error"-->
<!-- id="csc-error-label"-->
<!-- >-->
<!-- {{ fileErrorMessage }}-->
<!-- </div>-->
<!-- <q-btn-->
<!-- flat-->
<!-- icon="clear"-->
<!-- color="default"-->
<!-- @mousedown.native="hideModal"-->
<!-- >-->
<!-- {{ $t('Cancel') }}-->
<!-- </q-btn>-->
<!-- <q-btn-->
<!-- flat-->
<!-- color="primary"-->
<!-- icon="insert drive file"-->
<!-- :disable="formDisabled"-->
<!-- @click="sendFax"-->
<!-- >-->
<!-- {{ $t('Send') }}-->
<!-- </q-btn>-->
</q-dialog> </q-dialog>
</template> </template>
@ -144,6 +81,7 @@ import {
showGlobalError showGlobalError
} from 'src/helpers/ui' } from 'src/helpers/ui'
import { import {
required,
requiredUnless, requiredUnless,
maxLength maxLength
} from 'vuelidate/lib/validators' } from 'vuelidate/lib/validators'
@ -163,12 +101,12 @@ export default {
}, },
data () { data () {
return { return {
selectedFile: '', selectedFile: false,
form: { form: {
destination: '', destination: null,
pageHeader: '', pageHeader: null,
data: null, data: null,
quality: this.$faxQualityOptionsDefault, quality: this.$faxQualityOptionsDefault.value,
file: {} file: {}
}, },
isMobile: this.$q.platform.is.mobile, isMobile: this.$q.platform.is.mobile,
@ -189,16 +127,19 @@ export default {
}) })
}, },
pageHeader: { pageHeader: {
required,
maxLength: maxLength(64) maxLength: maxLength(64)
} }
} }
}, },
computed: { computed: {
hasContentToSend () { hasContentToSend () {
return (!!this.form.data || !!this.form.file) || !this.$v.form.$anyDirty return !!this.form.data || this.selectedFile
}, },
formDisabled () { formDisabled () {
return !this.$v.form.$anyDirty || return !this.$v.form.$anyDirty ||
!this.form.pageHeader ||
!this.form.destination ||
this.destinationError || this.destinationError ||
this.$v.form.pageHeader.$error || this.$v.form.pageHeader.$error ||
!this.hasContentToSend !this.hasContentToSend
@ -232,23 +173,8 @@ export default {
} }
}, },
methods: { methods: {
resetFile () { toggleFileSelected (value) {
this.form.file = {} this.selectedFile = value
this.selectedFile = ''
this.$refs.faxUpload.value = ''
},
processFile (event) {
const file = event.target.files[0]
let fileName = file ? file.name : ''
const fileNameSplit = fileName.split('.')
const extension = fileNameSplit[1] ? fileNameSplit[1] : null
if (fileName.length > 22 && extension) {
fileName = `${fileName.substring(0, 14)}...${extension}`
} else if (fileName.length > 22 && !extension) {
fileName = `${fileName.substring(0, 17)}...`
}
this.form.file = file
this.selectedFile = fileName
}, },
sendFax () { sendFax () {
if (this.$v.form.$error || if (this.$v.form.$error ||

Loading…
Cancel
Save