mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
3a2ca34ac0
- pass arguments in an object - add primaryAction prop
37 lines
776 B
JavaScript
37 lines
776 B
JavaScript
import frappe from 'frappejs';
|
|
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;
|
|
this.$modal.show({
|
|
component: Form,
|
|
props: {
|
|
doctype: doc.doctype,
|
|
name: doc.name,
|
|
defaultValues,
|
|
},
|
|
events: {
|
|
onClose
|
|
},
|
|
modalProps: {
|
|
title: frappe._('Form Modal')
|
|
}
|
|
});
|
|
}
|
|
|
|
const close = () => this.$modal.hide();
|
|
|
|
return {
|
|
open,
|
|
close
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|