1 dojo.require('openils.widget.AutoGrid');
2 dojo.require('dijit.form.FilteringSelect');
3 dojo.require('openils.PermaCrud');
8 openils.Util.hide('formula-list-div');
11 openils.Util.hide('formula-entry-div');
12 fListGrid.onPostCreate = function(fmObject) {
13 location.href = location.href + '/' + fmObject.id();
15 fieldmapper.standardRequest(
16 ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'],
18 params: [openils.User.authtoken],
19 onresponse: function (r) {
20 var form = openils.Util.readResponse(r);
21 formCache[form.id()] = form;
22 fListGrid.store.newItem(form.toStoreItem());
29 openils.Util.addOnLoad(draw);
31 /*function getFormulaId (rowIndex, item) {
33 var pcrud = new openils.PermaCrud;
34 var formulaName = pcrud.retrieve('acqdf', formulaId);
35 return formulaName.name();
40 function drawFormulaSummary() {
41 openils.Util.show('formula-entry-div');
42 dfeListGrid.overrideEditWidgets.formula = new
43 dijit.form.TextBox({style:'display:none', value: formulaId});
44 dfeListGrid.loadAll({order_by:{acqdfe : 'formula'}}, {formula : formulaId});
45 var pcrud = new openils.PermaCrud;
46 var formulaName = pcrud.retrieve('acqdf', formulaId);
47 dojo.byId('formula_head').innerHTML = formulaName.name();
50 function getItemCount(rowIndex, item) {
52 var form = formCache[this.grid.store.getValue(item, "id")];
54 dojo.forEach(form.entries(),
56 count = count + e.item_count();
62 function getFormulaName(rowIndex, item) {
64 return '<a href="' + location.href + '/' +
65 this.grid.store.getValue(item, 'id') + '">' +
66 this.grid.store.getValue(item, 'name') + '</a>';