Fixed file group accept type issue..

This commit is contained in:
Cüneyt Şentürk 2022-06-02 17:16:34 +03:00
parent 4c86ba6f07
commit ff351be76e
4 changed files with 50 additions and 30 deletions

View File

@ -21,6 +21,16 @@ class File extends Form
*/ */
public function render() 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'); return view('components.form.group.file');
} }
} }

View File

@ -15,6 +15,16 @@ class Ffile extends Form
*/ */
public function render() 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'); return view('components.form.input.file');
} }
} }

View File

@ -15,7 +15,7 @@
<span class="material-icons-outlined avatar hidden">file_present</span> <span class="material-icons-outlined avatar hidden">file_present</span>
<span class="material-icons-outlined avatar hidden" data-dz-thumbnail-pdf>picture_as_pdf</span> <span class="material-icons-outlined avatar hidden" data-dz-thumbnail-pdf>picture_as_pdf</span>
<span class="material-icons-outlined avatar hidden" data-dz-thumbnail-word>content_paste</span> <span class="material-icons-outlined avatar hidden" data-dz-thumbnail-word>content_paste</span>
<span class="material-icons-outlined avatar hidden" data-dz-thumbnail-excel>table_chart</span> <span class="material-icons-outlined avatar hidden" data-dz-thumbnail-excel>table_chart</span>
<span class="mb-1 text-sm ml-3 text-gray-500 hidden" data-dz-name>...</span> <span class="mb-1 text-sm ml-3 text-gray-500 hidden" data-dz-name>...</span>
</div> </div>
</div> </div>
@ -242,38 +242,38 @@ export default {
async mounted() { async mounted() {
this.initDropzone(); this.initDropzone();
}, },
watch: { watch: {
attachments: function (attachments) { attachments: function (attachments) {
attachments.forEach((attachment) => { attachments.forEach((attachment) => {
if(attachment.length != undefined) { if (attachment.length != undefined) {
var mockFile = { var mockFile = {
id: attachment[0].id, id: attachment[0].id,
name: attachment[0].name, name: attachment[0].name,
size: attachment[0].size, size: attachment[0].size,
type: attachment[0].type, type: attachment[0].type,
download: attachment[0].downloadPath, download: attachment[0].downloadPath,
dropzone: 'edit', dropzone: 'edit',
}; };
this.dropzone.emit("addedfile", mockFile);
this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path);
// Make sure that there is no progress bar, etc... this.dropzone.emit("addedfile", mockFile);
this.dropzone.emit("complete", mockFile); this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path);
this.files.forEach(async (attachment) => { // Make sure that there is no progress bar, etc...
if (attachment.download) { this.dropzone.emit("complete", mockFile);
attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download;
attachment.previewElement.querySelector("[data-dz-download]").classList.remove("hidden"); 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);
},
this.onMaxFilesReached(this);
}
}, this);
}, },
},
} }
</script> </script>

View File

@ -11,8 +11,8 @@
<div class="flex"> <div class="flex">
<div> <div>
{!! trans('import.limitations', ['extensions' => strtoupper(config('excel.imports.extensions')), {!! trans('import.limitations', ['extensions' => strtoupper(config('excel.imports.extensions')),
'row_limit' => config('excel.imports.row_limit') 'row_limit' => config('excel.imports.row_limit')
]) ])
!!} !!}
</div> </div>
</div> </div>