2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/ui/plugins/formModal.js

38 lines
758 B
JavaScript
Raw Normal View History

import Form from '../components/Form/Form';
export default function installFormModal(Vue) {
Vue.mixin({
computed: {
$formModal() {
2018-09-28 13:12:34 +00:00
let id;
const open = (doc, options = {}) => {
const { defaultValues = null, onClose = () => {} } = options;
2018-09-28 13:12:34 +00:00
id = this.$modal.show({
component: Form,
props: {
doctype: doc.doctype,
name: doc.name,
defaultValues,
},
events: {
onClose
},
modalProps: {
noHeader: true
}
});
}
2018-09-28 13:12:34 +00:00
const close = () => this.$modal.hide(id);
return {
open,
close
}
}
}
})
}