Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtuplePriceLists.bjs
1 {
2     "id": "roo-file-56",
3     "name": "Pman.Tab.XtuplePriceLists",
4     "parent": "Pman.Tab.XtupleManage",
5     "title": "Pman.Tab.XtuplePriceLists",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePriceLists.bjs",
7     "items": [
8         {
9             "background": true,
10             "fitContainer": true,
11             "fitToFrame": true,
12             "region": "center",
13             "title": "Price List",
14             "xtype": "NestedLayoutPanel",
15             "|xns": "Roo",
16             "items": [
17                 {
18                     "|xns": "Roo",
19                     "xtype": "BorderLayout",
20                     "*prop": "layout",
21                     "items": [
22                         {
23                             "*prop": "center",
24                             "xtype": "LayoutRegion",
25                             "|xns": "Roo"
26                         },
27                         {
28                             "*prop": "east",
29                             "split": true,
30                             "width": 350,
31                             "xtype": "LayoutRegion",
32                             "|xns": "Roo"
33                         },
34                         {
35                             "listeners": {
36                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
37                             },
38                             "background": true,
39                             "fitContainer": true,
40                             "fitToframe": true,
41                             "region": "center",
42                             "tableName": "ipshead",
43                             "title": "Price Lists",
44                             "xtype": "GridPanel",
45                             "|xns": "Roo",
46                             "items": [
47                                 {
48                                     "listeners": {
49                                         "|render": "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.XtuplePriceList\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
50                                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
51                                     },
52                                     "*prop": "grid",
53                                     "autoExpandColumn": "ipshead_descrip",
54                                     "loadMask": true,
55                                     "xtype": "Grid",
56                                     "|xns": "Roo.grid",
57                                     "items": [
58                                         {
59                                             "listeners": {
60                                                 "afterselectionchange": "function (_self)\n{\n    _this.igrid.footer.onClick('first');\n}"
61                                             },
62                                             "*prop": "sm",
63                                             "singleSelect": true,
64                                             "xtype": "RowSelectionModel",
65                                             "|xns": "Roo.grid"
66                                         },
67                                         {
68                                             "*prop": "dataSource",
69                                             "xtype": "Store",
70                                             "remoteSort": true,
71                                             "|sortInfo": "{ field : 'ipshead_name', direction: 'ASC' }",
72                                             "|xns": "Roo.data",
73                                             "items": [
74                                                 {
75                                                     "*prop": "proxy",
76                                                     "xtype": "HttpProxy",
77                                                     "method": "GET",
78                                                     "|url": "baseURL + '/Roo/ipshead.php'",
79                                                     "|xns": "Roo.data"
80                                                 },
81                                                 {
82                                                     "|xns": "Roo.data",
83                                                     "xtype": "JsonReader",
84                                                     "totalProperty": "total",
85                                                     "root": "data",
86                                                     "*prop": "reader",
87                                                     "id": "id",
88                                                     "|fields": "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_updated',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_abbr',\n        'type': 'string'\n    }\n]"
89                                                 }
90                                             ]
91                                         },
92                                         {
93                                             "*prop": "footer",
94                                             "displayInfo": true,
95                                             "displayMsg": "Displaying ipshead{0} - {1} of {2}",
96                                             "emptyMsg": "No ipshead found",
97                                             "pageSize": 25,
98                                             "xtype": "PagingToolbar",
99                                             "|xns": "Roo"
100                                         },
101                                         {
102                                             "*prop": "toolbar",
103                                             "xtype": "Toolbar",
104                                             "|xns": "Roo",
105                                             "items": [
106                                                 {
107                                                     "listeners": {
108                                                         "click": "function (_self, e)\n{\n   new Pman.Download({\n        method: 'GET',\n        url : baseURL + '/Roo/Ipsiteminfo',\n        params : {\n            _pricegrid : 1\n        }\n   });\n}"
109                                                     },
110                                                     "text": "Download Price Matrix",
111                                                     "xtype": "Button",
112                                                     "|xns": "Roo.Toolbar"
113                                                 },
114                                                 {
115                                                     "listeners": {
116                                                         "click": "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Pricing'\n        \n       },\n       function (data) {\n            var msg = [];\n            if (data.deleted) {\n                msg.push(\"Deleted \" + data.deleted + \" Price(s)\");\n            }\n            if (data.updated) {\n                msg.push(\"Updated \" + data.updated + \" Price(s)\");\n            }            \n            if (data.inserted) {\n                msg.push(\"Added \" + data.inserted + \" Price(s)\");\n            }\n            if (!msg.length) {\n                msg.push(\"No data changed\");\n            }\n            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n}"
117                                                     },
118                                                     "text": "Upload Price Matrix",
119                                                     "xtype": "Button",
120                                                     "|xns": "Roo.Toolbar"
121                                                 },
122                                                 {
123                                                     "|xns": "Roo.Toolbar",
124                                                     "xtype": "Fill"
125                                                 },
126                                                 {
127                                                     "text": "Add",
128                                                     "xtype": "Button",
129                                                     "cls": "x-btn-text-icon",
130                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
131                                                     "listeners": {
132                                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
133                                                     },
134                                                     "|xns": "Roo.Toolbar"
135                                                 },
136                                                 {
137                                                     "text": "Delete",
138                                                     "cls": "x-btn-text-icon",
139                                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
140                                                     "xtype": "Button",
141                                                     "listeners": {
142                                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'ipshead'); \n}\n        "
143                                                     },
144                                                     "|xns": "Roo.Toolbar"
145                                                 }
146                                             ]
147                                         },
148                                         {
149                                             "*prop": "colModel[]",
150                                             "dataIndex": "ipshead_curr_id_curr_name",
151                                             "header": "Ipshead curr",
152                                             "sortable": true,
153                                             "width": 75,
154                                             "xtype": "ColumnModel",
155                                             "|renderer": "function(v) { return String.format('{0}', v); }",
156                                             "|xns": "Roo.grid"
157                                         },
158                                         {
159                                             "*prop": "colModel[]",
160                                             "dataIndex": "ipshead_name",
161                                             "header": "Ipshead name",
162                                             "sortable": true,
163                                             "width": 200,
164                                             "xtype": "ColumnModel",
165                                             "|renderer": "function(v) { return String.format('{0}', v); }",
166                                             "|xns": "Roo.grid"
167                                         },
168                                         {
169                                             "xtype": "ColumnModel",
170                                             "header": "Ipshead descrip",
171                                             "width": 200,
172                                             "dataIndex": "ipshead_descrip",
173                                             "|renderer": "function(v) { return String.format('{0}', v); }",
174                                             "|xns": "Roo.grid",
175                                             "*prop": "colModel[]"
176                                         },
177                                         {
178                                             "xtype": "ColumnModel",
179                                             "header": "Ipshead effective",
180                                             "width": 75,
181                                             "dataIndex": "ipshead_effective",
182                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
183                                             "|xns": "Roo.grid",
184                                             "*prop": "colModel[]"
185                                         },
186                                         {
187                                             "*prop": "colModel[]",
188                                             "dataIndex": "ipshead_expires",
189                                             "header": "Ipshead expires",
190                                             "width": 75,
191                                             "xtype": "ColumnModel",
192                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
193                                             "|xns": "Roo.grid"
194                                         },
195                                         {
196                                             "xtype": "ColumnModel",
197                                             "header": "Ipshead updated",
198                                             "width": 75,
199                                             "dataIndex": "ipshead_updated",
200                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
201                                             "|xns": "Roo.grid",
202                                             "*prop": "colModel[]"
203                                         }
204                                     ]
205                                 }
206                             ]
207                         },
208                         {
209                             "listeners": {
210                                 "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       // _this.igrid.footer.onClick('first');\n    }\n}"
211                             },
212                             "background": true,
213                             "fitContainer": true,
214                             "fitToframe": true,
215                             "region": "east",
216                             "tableName": "item",
217                             "title": "Products",
218                             "xtype": "GridPanel",
219                             "|xns": "Roo",
220                             "items": [
221                                 {
222                                     "listeners": {
223                                         "|render": "function() \n{\n    _this.igrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.ipanel.active) {\n       //this.footer.onClick('first');\n    }\n}",
224                                         "afteredit": "function (e)\n{\n    if(e.value == e.originalValue){\n        return false;       \n    }\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        Roo.MessageBox.alert('Error','Please select a price list');\n        return false;       \n    }\n    \n    new Pman.Request({\n        url : baseURL +'/Roo/Item',\n        method : 'POST',\n        marks : 'Posting',\n        params : {\n             update_ipshead : 1,\n             ipshead_id : p.data.ipshead_id,\n             item_id : e.record.data.item_id,\n             _price : e.value,\n         },\n         success : function() {\n            _this.igrid.footer.onClick('refresh');\n        }\n         \n     });\n    \n}",
225                                         "beforeedit": "function (e)\n{\n    if(e.field != 'ipshead_price'){\n        return false;\n    }\n\n}"
226                                     },
227                                     "*prop": "grid",
228                                     "autoExpandColumn": "item_number",
229                                     "clicksToEdit": 1,
230                                     "loadMask": true,
231                                     "xtype": "EditorGrid",
232                                     "|xns": "Roo.grid",
233                                     "items": [
234                                         {
235                                             "listeners": {
236                                                 "beforeload": "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    \n    //o.params.item_active = 1;\n    o.params._ipshead_price = 1;\n    o.params._ipshead_id = p.data.ipshead_id;\n\n}"
237                                             },
238                                             "*prop": "dataSource",
239                                             "remoteSort": true,
240                                             "xtype": "Store",
241                                             "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
242                                             "|xns": "Roo.data",
243                                             "items": [
244                                                 {
245                                                     "*prop": "proxy",
246                                                     "xtype": "HttpProxy",
247                                                     "method": "GET",
248                                                     "|url": "baseURL + '/Roo/item.php'",
249                                                     "|xns": "Roo.data"
250                                                 },
251                                                 {
252                                                     "*prop": "reader",
253                                                     "id": "id",
254                                                     "root": "data",
255                                                     "totalProperty": "total",
256                                                     "xtype": "JsonReader",
257                                                     "|fields": "[\n    {\n        'name': 'item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_number',\n        'type': 'string'\n    }\n]",
258                                                     "|xns": "Roo.data"
259                                                 }
260                                             ]
261                                         },
262                                         {
263                                             "*prop": "footer",
264                                             "displayInfo": true,
265                                             "displayMsg": "",
266                                             "emptyMsg": "",
267                                             "pageSize": 25,
268                                             "xtype": "PagingToolbar",
269                                             "|xns": "Roo"
270                                         },
271                                         {
272                                             "*prop": "colModel[]",
273                                             "dataIndex": "item_number",
274                                             "header": "Number",
275                                             "width": 150,
276                                             "xtype": "ColumnModel",
277                                             "|renderer": "function(v) { return String.format('{0}', v); }",
278                                             "|xns": "Roo.grid"
279                                         },
280                                         {
281                                             "*prop": "colModel[]",
282                                             "align": "right",
283                                             "dataIndex": "ipshead_price",
284                                             "header": "Price",
285                                             "width": 100,
286                                             "xtype": "ColumnModel",
287                                             "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
288                                             "|xns": "Roo.grid",
289                                             "items": [
290                                                 {
291                                                     "|xns": "Roo.grid",
292                                                     "xtype": "GridEditor",
293                                                     "*prop": "editor",
294                                                     "items": [
295                                                         {
296                                                             "*prop": "field",
297                                                             "decimalPrecision": 2,
298                                                             "minValue": 1,
299                                                             "style": "text-align:right",
300                                                             "xtype": "NumberField",
301                                                             "|xns": "Roo.form"
302                                                         }
303                                                     ]
304                                                 }
305                                             ]
306                                         }
307                                     ]
308                                 }
309                             ]
310                         }
311                     ]
312                 }
313             ]
314         }
315     ],
316     "permname": "",
317     "modOrder": "001"
318 }