mirror of
https://github.com/frappe/books.git
synced 2024-12-27 04:32:41 +00:00
38 lines
758 B
JavaScript
38 lines
758 B
JavaScript
import Form from '../components/Form/Form';
|
|
|
|
export default function installFormModal(Vue) {
|
|
|
|
Vue.mixin({
|
|
computed: {
|
|
$formModal() {
|
|
let id;
|
|
|
|
const open = (doc, options = {}) => {
|
|
const { defaultValues = null, onClose = () => {} } = options;
|
|
id = this.$modal.show({
|
|
component: Form,
|
|
props: {
|
|
doctype: doc.doctype,
|
|
name: doc.name,
|
|
defaultValues,
|
|
},
|
|
events: {
|
|
onClose
|
|
},
|
|
modalProps: {
|
|
noHeader: true
|
|
}
|
|
});
|
|
}
|
|
|
|
const close = () => this.$modal.hide(id);
|
|
|
|
return {
|
|
open,
|
|
close
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|