diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index fef21486c..f577fc523 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -19,7 +19,7 @@ > - + {{ $t('Drop a file here to upload or') }} {{ $t('Required') }} - + + + + + + + + + + + + + + {{ nativeFiles[file.id].name }} + + + + + + + + + + + {{ $t('Skip Uploading') }} + + + + {{ $t('Add File/Photo') }} + {{ $t('Add another') }} + + + + {{ $t('Send All') }} + + + + @@ -94,7 +151,7 @@ const ignoreErrors = [ export default { components: { ...uploader, RequiredAsterisk }, mixins: [uniqIdsMixin], - props: ['label', 'error', 'helper', 'name', 'value', 'controlClass', 'endpoint', 'accept', 'validation', 'parent', 'config', 'multipleUpload'], + props: ['label', 'error', 'helper', 'name', 'value', 'controlClass', 'endpoint', 'accept', 'validation', 'parent', 'config', 'multipleUpload', 'screenType'], updated() { this.removeDefaultClasses(); }, @@ -209,6 +266,15 @@ export default { fileDataName() { return this.prefix + this.name + (this.row_id ? '.' + this.row_id : ''); }, + isConversationalForm() { + return this.screenType === 'conversational-forms'; + }, + showSingleUploadButton() { + return this.files.length === 0 || !this.multipleUpload; + }, + showMultiUploadButton() { + return this.files.length !== 0 && this.multipleUpload; + }, }, watch: { filesData: { @@ -336,6 +402,7 @@ export default { }, setRequestFiles() { _.set(window, `PM4ConfigOverrides.requestFiles["${this.fileDataName}"]`, this.files); + console.log("!!!!!! SET REQUEST FILES", this.valueToSend()); this.$emit('input', this.valueToSend()); }, valueToSend() { @@ -545,6 +612,7 @@ export default { this.$set(this.nativeFiles, id, rootFile); this.addToFiles(fileInfo); } else { + console.log("!!!!!! FILE UPLOADED", name); this.$emit('input', name); } }, @@ -608,6 +676,17 @@ export default { : null; } }, + getFileIconClass(file) { + return this.nativeFiles[file.id].fileType.includes('image/') + ? 'far fa-image' + : 'far fa-file'; + }, + emitConversationalFormSubmit($event) { + this.$emit('cf-submit', $event); + }, + cfSkipFileUpload() { + this.$emit('cf-skip-file-upload'); + } }, }; @@ -617,4 +696,58 @@ export default { color: red; font-size: 0.8em; } + +/* Conversational Forms Styling */ +.cf-single-upload-btn { + background-color: #EAF2FF; + border: 1px solid #81AFFF; + color: #81AFFF; + width: 100%; + padding: 12px 10px; + text-transform: capitalize; + margin: 0; +} +.cf-multi-upload-btn { + background: #fff; + color: #20242A; + border: 1px solid #D7DDE5; + font-size: 12px; + width: 57%; + padding: 7px; + border-radius: 8px; + margin: 0; + text-transform: capitalize; + margin-right: 30px; +} +.cf-file-upload-submit { + border-radius: 8px; + color: #fff; + font-size: 12px; + text-transform: capitalize; + padding: 7px; +} +.cf-filename { + width: 88%; + display: inline-block; + vertical-align: middle; +} +.cf-uploader-list { + margin-bottom: 14px; + max-height: 75px; + overflow:auto; +} +.cf-file-upload-list { + color: #20242A; + margin-bottom: 3px; + border-bottom: 1px solid #F3F5F7; +} +.cf-skip-btn { + background-color: #FFF; + border: 1px solid #D7DDE5; + color: #20242A; + width: 100%; + padding: 12px 10px; + box-shadow: 0px 12px 24px -12px #0000001F; +} + diff --git a/src/components/task.vue b/src/components/task.vue index 200c5f480..4e8f9e6f5 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -49,6 +49,7 @@ :watchers="screen.watchers" :data="requestData" :type="screen.type" + @update="onUpdate" @after-submit="afterSubmit" @submit="submit" />
{{ $t('Drop a file here to upload or') }}