mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
frappe.call
This commit is contained in:
parent
b9840722a2
commit
bfe679d48f
@ -19,7 +19,6 @@ module.exports = {
|
|||||||
|
|
||||||
frappe.registerMethod({
|
frappe.registerMethod({
|
||||||
method: 'general-ledger',
|
method: 'general-ledger',
|
||||||
type: 'get',
|
|
||||||
handler: async (args) => {
|
handler: async (args) => {
|
||||||
const generalLedger = new GeneralLedger();
|
const generalLedger = new GeneralLedger();
|
||||||
return await generalLedger.run(args);
|
return await generalLedger.run(args);
|
||||||
|
65
www/dist/js/bundle.js
vendored
65
www/dist/js/bundle.js
vendored
@ -4575,7 +4575,7 @@ if (typeof undefined === 'function' && undefined.amd) {
|
|||||||
}
|
}
|
||||||
}).call(commonjsGlobal);
|
}).call(commonjsGlobal);
|
||||||
|
|
||||||
//# sourceMappingURL=showdown.js.map
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var moment = createCommonjsModule(function (module, exports) {
|
var moment = createCommonjsModule(function (module, exports) {
|
||||||
@ -9160,19 +9160,12 @@ var frappejs = {
|
|||||||
this.views[view][name] = module;
|
this.views[view][name] = module;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerMethod({method, type, handler}) {
|
registerMethod({method, handler}) {
|
||||||
type = type.toLowerCase();
|
|
||||||
this.methods[method] = handler;
|
this.methods[method] = handler;
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
// add to router if client-server
|
// add to router if client-server
|
||||||
this.app[type](`/api/method/${method}`, this.asyncHandler(async function(request, response) {
|
this.app.post(`/api/method/${method}`, this.asyncHandler(async function(request, response) {
|
||||||
let args = {};
|
const data = await handler(request.body);
|
||||||
if (type==='get') {
|
|
||||||
args = request.query;
|
|
||||||
} else {
|
|
||||||
args = request.body;
|
|
||||||
}
|
|
||||||
const data = await handler(args);
|
|
||||||
response.json(data);
|
response.json(data);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -23053,7 +23046,7 @@ Popper.placements = placements;
|
|||||||
Popper.Defaults = Defaults;
|
Popper.Defaults = Defaults;
|
||||||
|
|
||||||
|
|
||||||
//# sourceMappingURL=popper.js.map
|
|
||||||
|
|
||||||
|
|
||||||
var popper = Object.freeze({
|
var popper = Object.freeze({
|
||||||
@ -26952,7 +26945,7 @@ exports.Tooltip = Tooltip;
|
|||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
})));
|
})));
|
||||||
//# sourceMappingURL=bootstrap.js.map
|
|
||||||
});
|
});
|
||||||
|
|
||||||
unwrapExports(bootstrap);
|
unwrapExports(bootstrap);
|
||||||
@ -39803,6 +39796,11 @@ var htmlmixed = createCommonjsModule(function (module, exports) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// const frappe = require('frappejs');
|
||||||
|
|
||||||
|
// eslint-disable-line
|
||||||
|
// eslint-disable-line
|
||||||
|
|
||||||
class CodeControl extends base {
|
class CodeControl extends base {
|
||||||
makeInput() {
|
makeInput() {
|
||||||
if (!this.options) {
|
if (!this.options) {
|
||||||
@ -48120,6 +48118,9 @@ DataTable.__version__ = packageJson.version;
|
|||||||
module.exports = DataTable;
|
module.exports = DataTable;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-line
|
||||||
|
|
||||||
|
|
||||||
var modal = class Modal extends observable {
|
var modal = class Modal extends observable {
|
||||||
constructor({ title, body, primary, secondary }) {
|
constructor({ title, body, primary, secondary }) {
|
||||||
super();
|
super();
|
||||||
@ -56644,7 +56645,7 @@ module.exports = installCompat;
|
|||||||
/***/ })
|
/***/ })
|
||||||
/******/ ]);
|
/******/ ]);
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=nunjucks.js.map
|
|
||||||
});
|
});
|
||||||
|
|
||||||
unwrapExports(nunjucks);
|
unwrapExports(nunjucks);
|
||||||
@ -56845,6 +56846,10 @@ var menu = class DeskMenu {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// const Search = require('./search');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const views = {};
|
const views = {};
|
||||||
views.Form = formpage;
|
views.Form = formpage;
|
||||||
views.List = listpage;
|
views.List = listpage;
|
||||||
@ -57566,29 +57571,26 @@ var client = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setCall() {
|
setCall() {
|
||||||
frappejs.call = async ({method, type='get', args}) => {
|
frappejs.call = async (method, args) => {
|
||||||
let url = `/api/method/${method}`;
|
let url = `/api/method/${method}`;
|
||||||
let request = {};
|
let response = await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
if (args) {
|
headers: {
|
||||||
if (type.toLowerCase()==='get') {
|
'Accept': 'application/json',
|
||||||
url += '?' + frappejs.getQueryString(args);
|
'Content-Type': 'application/json'
|
||||||
} else {
|
},
|
||||||
// POST / PUT / DELETE
|
body: JSON.stringify(args || {})
|
||||||
request.body = JSON.stringify(args);
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request.headers = { 'Accept': 'application/json' };
|
|
||||||
request.method = type.toUpperCase();
|
|
||||||
|
|
||||||
let response = await fetch(url, request);
|
|
||||||
|
|
||||||
return await response.json();
|
return await response.json();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// baseclass for report
|
||||||
|
// `url` url for report
|
||||||
|
// `getColumns` return columns
|
||||||
|
|
||||||
var reportpage = class ReportPage extends page {
|
var reportpage = class ReportPage extends page {
|
||||||
constructor({title, }) {
|
constructor({title, }) {
|
||||||
super({title: title, hasRoute: true});
|
super({title: title, hasRoute: true});
|
||||||
@ -57647,7 +57649,7 @@ var reportpage = class ReportPage extends page {
|
|||||||
const filterValues = this.getFilterValues();
|
const filterValues = this.getFilterValues();
|
||||||
if (filterValues === false) return;
|
if (filterValues === false) return;
|
||||||
|
|
||||||
let data = await frappejs.call({method: this.method, args: filterValues});
|
let data = await frappejs.call(this.method, filterValues);
|
||||||
this.datatable.refresh(data);
|
this.datatable.refresh(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58410,6 +58412,7 @@ var client$2 = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// start server
|
||||||
client.start({
|
client.start({
|
||||||
columns: 3,
|
columns: 3,
|
||||||
server: 'localhost:8000'
|
server: 'localhost:8000'
|
||||||
|
Loading…
Reference in New Issue
Block a user