2018-07-10 13:35:43 +00:00
|
|
|
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;
|
|
|
|
|
2018-07-10 13:35:43 +00:00
|
|
|
const open = (doc, options = {}) => {
|
|
|
|
const { defaultValues = null, onClose = null } = options;
|
2018-09-28 13:12:34 +00:00
|
|
|
id = this.$modal.show({
|
2018-07-15 11:39:40 +00:00
|
|
|
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
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-09-28 13:12:34 +00:00
|
|
|
const close = () => this.$modal.hide(id);
|
2018-07-10 13:35:43 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
open,
|
|
|
|
close
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|