2018-07-10 13:35:43 +00:00
|
|
|
import Form from '../components/Form/Form';
|
|
|
|
|
|
|
|
export default function installFormModal(Vue) {
|
|
|
|
|
|
|
|
Vue.mixin({
|
|
|
|
computed: {
|
|
|
|
$formModal() {
|
|
|
|
const open = (doc, options = {}) => {
|
|
|
|
const { defaultValues = null, onClose = null } = options;
|
2018-07-15 11:39:40 +00:00
|
|
|
this.$modal.show({
|
|
|
|
component: Form,
|
|
|
|
props: {
|
|
|
|
doctype: doc.doctype,
|
|
|
|
name: doc.name,
|
|
|
|
defaultValues,
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
onClose
|
|
|
|
},
|
|
|
|
modalProps: {
|
2018-07-16 11:20:24 +00:00
|
|
|
noHeader: true
|
2018-07-15 11:39:40 +00:00
|
|
|
}
|
2018-07-10 13:35:43 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const close = () => this.$modal.hide();
|
|
|
|
|
|
|
|
return {
|
|
|
|
open,
|
|
|
|
close
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|