Merge pull request #2547 from EnesSacid-Buker/master

Add new modal function in Global.js
This commit is contained in:
Cüneyt Şentürk 2022-07-25 12:09:36 +03:00 committed by GitHub
commit cebe00c13a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -702,5 +702,54 @@ export default {
// always executed // always executed
}); });
}, },
onModalAddNew(url) {
let modal = {
show: true,
title: '',
html: '',
buttons:{}
};
Promise.resolve(window.axios.get(url)).then(response => {
if (response.data.success) {
modal.title = response.data.title;
modal.html = response.data.html;
modal.buttons = response.data.buttons;
this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-add-new-modal-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-lg" :show="modal.show" :buttons="modal.buttons" :title="modal.title" :message="modal.html" :is_component=true @submit="onSubmit" @cancel="onCancel"></akaunting-modal-add-new></div>',
mixins: [
Global
],
data: function () {
return {
form:{},
modal: modal,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
event.submit();
},
onCancel() {
this.modal.show = false;
this.modal.html = null;
},
}
})
})
}
})
.catch(e => {
this.errors.push(e);
})
},
} }
} }