Company post method development for logo dropzone
This commit is contained in:
parent
d145d41ae6
commit
7adb8c9663
@ -244,17 +244,17 @@ 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.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");
|
||||
}
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
if (this.preview == 'single' && attachments.length == 1) {
|
||||
|
29
resources/assets/js/mixins/spa-global.js
vendored
29
resources/assets/js/mixins/spa-global.js
vendored
@ -83,16 +83,32 @@ export default {
|
||||
onEditEvent(form_method, form_url, plus_data, form_list, form_id) {
|
||||
const formData = new FormData(this.$refs["form"]);
|
||||
const data = {};
|
||||
let file = {};
|
||||
|
||||
for (let [key, val] of formData.entries()) {
|
||||
Object.assign(data, {
|
||||
[key]: val,
|
||||
['type']: 'normal'
|
||||
});
|
||||
}
|
||||
|
||||
if (!plus_data || plus_data == undefined) {
|
||||
delete data.type;
|
||||
if(this.$refs.dropzoneWizard) {
|
||||
if(this.$refs.dropzoneWizard.dropzone.files.length) {
|
||||
file = this.$refs.dropzoneWizard.dropzone.files[0];
|
||||
} else {
|
||||
file = this.$refs.dropzoneWizard.files[0];
|
||||
}
|
||||
}
|
||||
|
||||
if(plus_data == 'logo') {
|
||||
Object.assign(data, {
|
||||
['logo']: file
|
||||
});
|
||||
}
|
||||
|
||||
if(plus_data == 'type') {
|
||||
Object.assign(data, {
|
||||
['type']: 'normal',
|
||||
});
|
||||
}
|
||||
|
||||
window.axios({
|
||||
@ -126,12 +142,13 @@ export default {
|
||||
for (let [key, val] of formData.entries()) {
|
||||
Object.assign(data, {
|
||||
[key]: val,
|
||||
['type']: 'normal'
|
||||
});
|
||||
}
|
||||
|
||||
if (!plus_data || plus_data == undefined) {
|
||||
delete data.type;
|
||||
if(plus_data == 'type') {
|
||||
Object.assign(data, {
|
||||
['type']: 'normal',
|
||||
});
|
||||
}
|
||||
|
||||
window.axios({
|
||||
|
@ -70,13 +70,12 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<base-input :label="translations.company.logo">
|
||||
<keep-alive>
|
||||
<akaunting-dropzone-file-upload
|
||||
ref="dropzoneWizard"
|
||||
preview-classes="single"
|
||||
:attachments="logo"
|
||||
>
|
||||
</akaunting-dropzone-file-upload>
|
||||
</keep-alive>
|
||||
</base-input>
|
||||
</div>
|
||||
</div>
|
||||
@ -173,8 +172,7 @@ export default {
|
||||
},
|
||||
|
||||
onEditSave() {
|
||||
this.onEditEvent("PATCH", url + "/wizard/company", "", "", "");
|
||||
|
||||
this.onEditEvent("PATCH", url + "/wizard/company", "logo", "", "");
|
||||
this.$router.push("/wizard/currencies");
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user