From d145d41ae668f044bb558db929e4a1083bc25e5a Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Tue, 25 May 2021 22:19:49 +0300 Subject: [PATCH] Code refactoring --- resources/assets/js/components/AkauntingDate.vue | 7 +++---- .../js/components/AkauntingDropzoneFileUpload.vue | 14 +++++++------- resources/assets/js/views/wizard/Company.vue | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/resources/assets/js/components/AkauntingDate.vue b/resources/assets/js/components/AkauntingDate.vue index ba38d145f..95e0e3168 100644 --- a/resources/assets/js/components/AkauntingDate.vue +++ b/resources/assets/js/components/AkauntingDate.vue @@ -127,11 +127,10 @@ export default { this.$emit('change', this.real_model); } }, - watch: { - real_model: function(val) { - this.real_model = val; - this.$emit('interface', this.real_model); + watch: { + value: function(val) { + this.real_model = val; } } } diff --git a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue index 3fe8e0017..fb83759da 100644 --- a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue +++ b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue @@ -235,7 +235,8 @@ export default { watch: { attachments: function (attachments) { attachments.forEach((attachment) => { - var mockFile = { + if(attachment.length != undefined) { + var mockFile = { id: attachment[0].id, name: attachment[0].name, size: attachment[0].size, @@ -243,17 +244,13 @@ export default { download: attachment[0].downloadPath, dropzone: 'edit', }; - - this.dropzone.emit("addedfile", mockFile); + 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("complete", mockFile); - }, this); - - - this.files.forEach(async (attachment) => { + 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("d-none"); @@ -265,6 +262,9 @@ export default { document.querySelector("#dropzone-" + this._uid).classList.add("dz-max-files-reached"); }); } + } + }, this); + }, }, } diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index 7f429e6cb..e6724b540 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -53,7 +53,7 @@ altInput: true, altFormat: 'j F', }" - v-model="company.financial_start" + v-model="real_date" >
@@ -133,7 +133,6 @@ export default { }, mounted() { setTimeout(() => { - debugger; if (this.company != undefined) { let logo_arr = [ { @@ -163,6 +162,7 @@ export default { }, ]; this.logo.push(logo_arr); + this.real_date = company.financial_start; }, },