From ff351be76e4f9e66e4f1baff51afa8beef9d76be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 2 Jun 2022 17:16:34 +0300 Subject: [PATCH] Fixed file group accept type issue.. --- app/View/Components/Form/Group/File.php | 10 ++++ app/View/Components/Form/Input/Ffile.php | 10 ++++ .../AkauntingDropzoneFileUpload.vue | 56 +++++++++---------- .../views/common/import/create.blade.php | 4 +- 4 files changed, 50 insertions(+), 30 deletions(-) diff --git a/app/View/Components/Form/Group/File.php b/app/View/Components/Form/Group/File.php index 804438123..4fadb4d42 100644 --- a/app/View/Components/Form/Group/File.php +++ b/app/View/Components/Form/Group/File.php @@ -21,6 +21,16 @@ class File extends Form */ public function render() { + if (! empty($this->options)) { + $options = []; + + foreach ($this->options as $option) { + $options[$option->id] = $option->name; + } + + $this->options = $options; + } + return view('components.form.group.file'); } } diff --git a/app/View/Components/Form/Input/Ffile.php b/app/View/Components/Form/Input/Ffile.php index 961ae4c82..576dc5e66 100644 --- a/app/View/Components/Form/Input/Ffile.php +++ b/app/View/Components/Form/Input/Ffile.php @@ -15,6 +15,16 @@ class Ffile extends Form */ public function render() { + if (! empty($this->options)) { + $options = []; + + foreach ($this->options as $option) { + $options[$option->id] = $option->name; + } + + $this->options = $options; + } + return view('components.form.input.file'); } } diff --git a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue index 92c375543..f6fc3a1fd 100644 --- a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue +++ b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue @@ -15,7 +15,7 @@ - + @@ -242,38 +242,38 @@ export default { async mounted() { this.initDropzone(); }, - + watch: { - attachments: function (attachments) { - attachments.forEach((attachment) => { - if(attachment.length != undefined) { - var mockFile = { - id: attachment[0].id, - name: attachment[0].name, - size: attachment[0].size, - type: attachment[0].type, - download: attachment[0].downloadPath, - dropzone: 'edit', - }; - this.dropzone.emit("addedfile", mockFile); - this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path); + attachments: function (attachments) { + attachments.forEach((attachment) => { + if (attachment.length != undefined) { + var mockFile = { + id: attachment[0].id, + name: attachment[0].name, + size: attachment[0].size, + type: attachment[0].type, + download: attachment[0].downloadPath, + dropzone: 'edit', + }; - // Make sure that there is no progress bar, etc... - this.dropzone.emit("complete", mockFile); + this.dropzone.emit("addedfile", mockFile); + this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path); - this.files.forEach(async (attachment) => { - if (attachment.download) { - attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download; - attachment.previewElement.querySelector("[data-dz-download]").classList.remove("hidden"); + // Make sure that there is no progress bar, etc... + this.dropzone.emit("complete", mockFile); + + this.files.forEach(async (attachment) => { + if (attachment.download) { + attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download; + attachment.previewElement.querySelector("[data-dz-download]").classList.remove("hidden"); + } + }); + + this.onMaxFilesReached(this); } - }); - - this.onMaxFilesReached(this); - } - }, this); - + }, this); + }, }, - }, } diff --git a/resources/views/common/import/create.blade.php b/resources/views/common/import/create.blade.php index daf2c21de..0a1107206 100644 --- a/resources/views/common/import/create.blade.php +++ b/resources/views/common/import/create.blade.php @@ -11,8 +11,8 @@
{!! trans('import.limitations', ['extensions' => strtoupper(config('excel.imports.extensions')), - 'row_limit' => config('excel.imports.row_limit') - ]) + 'row_limit' => config('excel.imports.row_limit') + ]) !!}