Pman.Dialog.XtupleItem.bjs
[Pman.Xtuple] / Pman.Dialog.XtupleItem.bjs
1 {
2     "name" : "Pman.Dialog.XtupleItem",
3     "parent" : "",
4     "title" : "",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleItem.bjs",
6     "permname" : "",
7     "modOrder" : "001",
8     "items" : [
9         {
10             "listeners" : {
11                 "show" : "function (_self)\n{\n     _this.dialog.layout.getRegion('center').showPanel(0);\n}"
12             },
13             "modal" : true,
14             "collapsible" : false,
15             "title" : "Edit / Create item",
16             "xtype" : "LayoutDialog",
17             "width" : 800,
18             "$ xns" : "Roo",
19             "closable" : false,
20             "resizable" : false,
21             "height" : 550,
22             "items" : [
23                 {
24                     "alwaysShowTabs" : true,
25                     "xtype" : "LayoutRegion",
26                     "tabPosition" : "top",
27                     "$ xns" : "Roo",
28                     "* prop" : "center"
29                 },
30                 {
31                     "region" : "center",
32                     "xtype" : "ContentPanel",
33                     "title" : "Detail",
34                     "$ xns" : "Roo",
35                     "items" : [
36                         {
37                             "listeners" : {
38                                 "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       _this.form.findField('item_number').el.dom.readOnly = true;\n       _this.form.findField('item_type').disabled = true; \n       \n       if(_this.data.item_id * 1 > 0){\n            \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : _this.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n       }\n       // if it's new..\n       _this.form.findField('item_number').el.dom.readOnly = false;\n       _this.form.findField('item_type').disabled = false; \n       _this.form.findField('item_salesaccnt').setValue('');\n       \n       _this.form.findField('item_type').showHide();\n       \n       return;\n    }\n    if (action.type == 'load') {\n       _this.form.findField('item_type').showHide();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        var id = _this.form.findField('item_id').getValue() * 1;\n        if (id < 1) {\n        \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : action.result.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n        }\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
39                                 "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
40                             },
41                             "$ url" : "baseURL + '/Roo/item.php'",
42                             "style" : "margin:10px;",
43                             "method" : "POST",
44                             "xtype" : "Form",
45                             "labelWidth" : 120,
46                             "$ xns" : "Roo.form",
47                             "items" : [
48                                 {
49                                     "fieldLabel" : "SKU",
50                                     "xtype" : "TextField",
51                                     "allowBlank" : false,
52                                     "width" : 200,
53                                     "$ xns" : "Roo.form",
54                                     "name" : "item_number"
55                                 },
56                                 {
57                                     "fieldLabel" : "Description",
58                                     "xtype" : "TextField",
59                                     "width" : 400,
60                                     "$ xns" : "Roo.form",
61                                     "name" : "item_descrip1"
62                                 },
63                                 {
64                                     "fieldLabel" : "Description (2)",
65                                     "xtype" : "TextField",
66                                     "width" : 400,
67                                     "$ xns" : "Roo.form",
68                                     "name" : "item_descrip2"
69                                 },
70                                 {
71                                     "xtype" : "Column",
72                                     "labelWidth" : 120,
73                                     "$ xns" : "Roo.form",
74                                     "items" : [
75                                         {
76                                             "listeners" : {
77                                                 "beforeselect" : "function (combo, record, index)\n{\n    (function() { combo.showHide(); }).defer(100);\n}"
78                                             },
79                                             "listWidth" : 200,
80                                             "triggerAction" : "all",
81                                             "fieldLabel" : "Type",
82                                             "displayField" : "fname",
83                                             "emptyText" : "Select Type",
84                                             "hiddenName" : "item_type",
85                                             "valueField" : "ftype",
86                                             "xtype" : "ComboBox",
87                                             "allowBlank" : false,
88                                             "$ showHide" : "function() {\n\n    var it = this.getValue();\n    \n    var options = [ \n        'item_itemcost_id_itemcost_curr_id',\n        'item_itemcost_id_itemcost_actcost',\n        'item_itemsite_id_itemsite_reorderlevel',\n        'item_itemsite_id_itemsite_leadtime',\n        'item_itemsite_id_itemsite_location_id',\n        'item_itemsite_id_itemsite_loccntrl',\n        'item_itemsite_id_itemsite_stocked',\n        'item_itemsite_id_itemsite_perishable',\n        \n        'item_itemsite_id_itemsite_safetystock',\n        'item_itemsite_id_itemsite_controlmethod',\n        'item_itemsite_id_itemsite_plancode_id',\n        'item_itemsite_id_itemsite_costcat_id',\n        'item_itemsite_id_itemsite_active',\n        'item_itemsite_id_itemsite_sold'\n        \n    ];\n    \n    var r_req = [ \n        'item_listprice'\n    ];\n    \n    var state = true;\n    \n    _this.standardCostFieldSet.show();\n    _this.itemsiteFieldSet.show();\n    _this.form.findField('_update_related').setValue(1);\n    \n    switch(it) {\n        case 'K':\n            state = false;\n\n            _this.form.findField('item_listprice').allowBlank = false;\n            _this.form.findField('item_listprice').actionMode = 'fieldEl';\n            _this.form.findField('item_listprice').hideMode = 'display';\n            _this.form.findField('item_listprice').show();\n                        \n            break;\n            \n        case 'R': // refrence\n            options = options.concat(r_req);\n            state = false;\n            _this.standardCostFieldSet.hide();\n            break;\n            \n        case 'P': // purchased..\n            options = options.concat(r_req);\n            // must have\n            break;\n    }\n    \n    Roo.each(options, function(n) {\n        var ff = _this.form.findField(n);\n        ff.allowBlank = !state;\n        ff.actionMode = 'fieldEl';\n        ff.hideMode = 'display';\n        state ? ff.show() : ff.hide(); \n        \n    });\n    \n    \n    if(!state){\n        _this.standardCostFieldSet.hide();\n        _this.itemsiteFieldSet.hide();\n        _this.form.findField('_update_related').setValue(0);\n    }\n    \n  \n           \n}\n",
89                                             "editable" : false,
90                                             "width" : 200,
91                                             "$ xns" : "Roo.form",
92                                             "mode" : "local",
93                                             "name" : "item_type_name",
94                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
95                                             "items" : [
96                                                 {
97                                                     "xtype" : "SimpleStore",
98                                                     "$ data" : "[ \n    [ 'P', \"Purchased (eg. a standard product)\"],\n    [ 'R' , \"Reference (Non-Product)\"],\n    [ 'K', \"Kit (made up of products)\"]  \n]\n",
99                                                     "$ fields" : "[  'ftype', 'fname']",
100                                                     "$ xns" : "Roo.data",
101                                                     "* prop" : "store"
102                                                 }
103                                             ]
104                                         },
105                                         {
106                                             "listWidth" : 400,
107                                             "triggerAction" : "all",
108                                             "fieldLabel" : "Class",
109                                             "forceSelection" : true,
110                                             "selectOnFocus" : true,
111                                             "pageSize" : 20,
112                                             "displayField" : "classcode_code",
113                                             "emptyText" : "Select classcode",
114                                             "hiddenName" : "item_classcode_id",
115                                             "minChars" : 2,
116                                             "valueField" : "classcode_id",
117                                             "xtype" : "ComboBox",
118                                             "allowBlank" : false,
119                                             "typeAhead" : true,
120                                             "editable" : false,
121                                             "width" : 200,
122                                             "$ xns" : "Roo.form",
123                                             "name" : "item_classcode_id_classcode_code",
124                                             "qtip" : "Select classcode",
125                                             "queryParam" : "",
126                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>",
127                                             "loadingText" : "Searching...",
128                                             "items" : [
129                                                 {
130                                                     "listeners" : {
131                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
132                                                     },
133                                                     "xtype" : "Store",
134                                                     "remoteSort" : true,
135                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
136                                                     "$ xns" : "Roo.data",
137                                                     "* prop" : "store",
138                                                     "items" : [
139                                                         {
140                                                             "$ url" : "baseURL + '/Roo/classcode.php'",
141                                                             "xtype" : "HttpProxy",
142                                                             "method" : "GET",
143                                                             "$ xns" : "Roo.data",
144                                                             "* prop" : "proxy"
145                                                         },
146                                                         {
147                                                             "id" : "id",
148                                                             "root" : "data",
149                                                             "xtype" : "JsonReader",
150                                                             "$ xns" : "Roo.data",
151                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"classcode_code\",\"type\":\"string\"}]",
152                                                             "* prop" : "reader",
153                                                             "totalProperty" : "total"
154                                                         }
155                                                     ]
156                                                 }
157                                             ]
158                                         },
159                                         {
160                                             "listWidth" : 400,
161                                             "triggerAction" : "all",
162                                             "fieldLabel" : "Invoice UOM",
163                                             "forceSelection" : true,
164                                             "selectOnFocus" : true,
165                                             "pageSize" : 20,
166                                             "displayField" : "uom_descrip",
167                                             "emptyText" : "Select uom",
168                                             "hiddenName" : "item_inv_uom_id",
169                                             "minChars" : 2,
170                                             "valueField" : "uom_id",
171                                             "xtype" : "ComboBox",
172                                             "allowBlank" : false,
173                                             "typeAhead" : true,
174                                             "editable" : false,
175                                             "width" : 200,
176                                             "$ xns" : "Roo.form",
177                                             "name" : "item_inv_uom_id_uom_descrip",
178                                             "qtip" : "Select classcode",
179                                             "queryParam" : "",
180                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
181                                             "loadingText" : "Searching...",
182                                             "items" : [
183                                                 {
184                                                     "listeners" : {
185                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
186                                                     },
187                                                     "xtype" : "Store",
188                                                     "remoteSort" : true,
189                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
190                                                     "$ xns" : "Roo.data",
191                                                     "* prop" : "store",
192                                                     "items" : [
193                                                         {
194                                                             "$ url" : "baseURL + '/Roo/uom.php'",
195                                                             "xtype" : "HttpProxy",
196                                                             "method" : "GET",
197                                                             "$ xns" : "Roo.data",
198                                                             "* prop" : "proxy"
199                                                         },
200                                                         {
201                                                             "id" : "id",
202                                                             "root" : "data",
203                                                             "xtype" : "JsonReader",
204                                                             "$ xns" : "Roo.data",
205                                                             "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
206                                                             "* prop" : "reader",
207                                                             "totalProperty" : "total"
208                                                         }
209                                                     ]
210                                                 }
211                                             ]
212                                         },
213                                         {
214                                             "listWidth" : 400,
215                                             "triggerAction" : "all",
216                                             "fieldLabel" : "Price UOM",
217                                             "forceSelection" : true,
218                                             "selectOnFocus" : true,
219                                             "pageSize" : 20,
220                                             "displayField" : "uom_descrip",
221                                             "emptyText" : "Select uom",
222                                             "hiddenName" : "item_price_uom_id",
223                                             "minChars" : 2,
224                                             "valueField" : "uom_id",
225                                             "xtype" : "ComboBox",
226                                             "allowBlank" : false,
227                                             "typeAhead" : true,
228                                             "editable" : false,
229                                             "width" : 200,
230                                             "$ xns" : "Roo.form",
231                                             "name" : "item_price_uom_id_uom_descrip",
232                                             "qtip" : "Select classcode",
233                                             "queryParam" : "",
234                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
235                                             "loadingText" : "Searching...",
236                                             "items" : [
237                                                 {
238                                                     "listeners" : {
239                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
240                                                     },
241                                                     "xtype" : "Store",
242                                                     "remoteSort" : true,
243                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
244                                                     "$ xns" : "Roo.data",
245                                                     "* prop" : "store",
246                                                     "items" : [
247                                                         {
248                                                             "$ url" : "baseURL + '/Roo/uom.php'",
249                                                             "method" : "GET",
250                                                             "xtype" : "HttpProxy",
251                                                             "$ xns" : "Roo.data",
252                                                             "* prop" : "proxy"
253                                                         },
254                                                         {
255                                                             "id" : "id",
256                                                             "root" : "data",
257                                                             "xtype" : "JsonReader",
258                                                             "$ xns" : "Roo.data",
259                                                             "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
260                                                             "* prop" : "reader",
261                                                             "totalProperty" : "total"
262                                                         }
263                                                     ]
264                                                 }
265                                             ]
266                                         },
267                                         {
268                                             "fieldLabel" : "Weight",
269                                             "xtype" : "NumberField",
270                                             "allowBlank" : false,
271                                             "allowDecimals" : true,
272                                             "decimalPrecision" : 2,
273                                             "width" : 200,
274                                             "$ xns" : "Roo.form",
275                                             "name" : "item_prodweight"
276                                         },
277                                         {
278                                             "fieldLabel" : "Item comments",
279                                             "xtype" : "TextArea",
280                                             "width" : 200,
281                                             "$ xns" : "Roo.form",
282                                             "name" : "item_comments",
283                                             "height" : 100
284                                         },
285                                         {
286                                             "fieldLabel" : "Item sold",
287                                             "inputValue" : true,
288                                             "xtype" : "Checkbox",
289                                             "valueOff" : 0,
290                                             "width" : 75,
291                                             "$ xns" : "Roo.form",
292                                             "name" : "item_sold"
293                                         },
294                                         {
295                                             "fieldLabel" : "Item active",
296                                             "inputValue" : true,
297                                             "xtype" : "Checkbox",
298                                             "valueOff" : 0,
299                                             "width" : 75,
300                                             "$ xns" : "Roo.form",
301                                             "name" : "item_active"
302                                         },
303                                         {
304                                             "listeners" : {
305                                                 "add" : "function (combo)\n{\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});\n}",
306                                                 "edit" : "function (combo, record)\n{\n    var s = _this.form.findField('item_prodcat_id').getValue() * 1;\n    if(s < 1){\n        Roo.MessageBox.alert('Error','Please select a account assignment');\n        return;\n    }\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : s});\n}"
307                                             },
308                                             "alwaysQuery" : true,
309                                             "listWidth" : 400,
310                                             "triggerAction" : "all",
311                                             "fieldLabel" : "Product Category",
312                                             "forceSelection" : true,
313                                             "selectOnFocus" : true,
314                                             "pageSize" : 20,
315                                             "displayField" : "prodcat_code",
316                                             "emptyText" : "Select Category",
317                                             "hiddenName" : "item_prodcat_id",
318                                             "minChars" : 2,
319                                             "valueField" : "prodcat_id",
320                                             "xtype" : "ComboBox",
321                                             "allowBlank" : false,
322                                             "typeAhead" : true,
323                                             "editable" : false,
324                                             "width" : 200,
325                                             "$ xns" : "Roo.form",
326                                             "name" : "item_prodcat_id_prodcat_code",
327                                             "qtip" : "Select prodcat",
328                                             "queryParam" : "",
329                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>",
330                                             "loadingText" : "Searching...",
331                                             "items" : [
332                                                 {
333                                                     "listeners" : {
334                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
335                                                     },
336                                                     "xtype" : "Store",
337                                                     "remoteSort" : true,
338                                                     "$ xns" : "Roo.data",
339                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
340                                                     "* prop" : "store",
341                                                     "items" : [
342                                                         {
343                                                             "$ url" : "baseURL + '/Roo/prodcat.php'",
344                                                             "method" : "GET",
345                                                             "xtype" : "HttpProxy",
346                                                             "$ xns" : "Roo.data",
347                                                             "* prop" : "proxy"
348                                                         },
349                                                         {
350                                                             "id" : "id",
351                                                             "root" : "data",
352                                                             "xtype" : "JsonReader",
353                                                             "$ xns" : "Roo.data",
354                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"prodcat_code\",\"type\":\"string\"}]",
355                                                             "* prop" : "reader",
356                                                             "totalProperty" : "total"
357                                                         }
358                                                     ]
359                                                 }
360                                             ]
361                                         },
362                                         {
363                                             "fieldLabel" : "Sales Account",
364                                             "xtype" : "DisplayField",
365                                             "$ xns" : "Roo.form",
366                                             "name" : "item_salesaccnt"
367                                         },
368                                         {
369                                             "fieldLabel" : "Item listprice",
370                                             "xtype" : "NumberField",
371                                             "width" : 200,
372                                             "$ xns" : "Roo.form",
373                                             "name" : "item_listprice"
374                                         },
375                                         {
376                                             "listeners" : {
377                                                 "render" : "function (_self)\n{\n    _this.standardCostFieldSet = _self;\n}"
378                                             },
379                                             "legend" : "Standard Cost",
380                                             "style" : "width:320px",
381                                             "xtype" : "FieldSet",
382                                             "$ xns" : "Roo.form",
383                                             "items" : [
384                                                 {
385                                                     "listWidth" : 400,
386                                                     "triggerAction" : "all",
387                                                     "fieldLabel" : "Currency",
388                                                     "forceSelection" : true,
389                                                     "selectOnFocus" : true,
390                                                     "pageSize" : 20,
391                                                     "displayField" : "curr_name",
392                                                     "emptyText" : "Select Currency",
393                                                     "hiddenName" : "item_itemcost_id_itemcost_curr_id",
394                                                     "minChars" : 2,
395                                                     "valueField" : "curr_id",
396                                                     "xtype" : "ComboBox",
397                                                     "allowBlank" : false,
398                                                     "typeAhead" : true,
399                                                     "editable" : false,
400                                                     "width" : 200,
401                                                     "$ xns" : "Roo.form",
402                                                     "name" : "curr_name",
403                                                     "qtip" : "Select Currency",
404                                                     "queryParam" : "query[curr_name]",
405                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
406                                                     "loadingText" : "Searching...",
407                                                     "items" : [
408                                                         {
409                                                             "listeners" : {
410                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
411                                                             },
412                                                             "xtype" : "Store",
413                                                             "remoteSort" : true,
414                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'curr_symbol' }",
415                                                             "$ xns" : "Roo.data",
416                                                             "* prop" : "store",
417                                                             "items" : [
418                                                                 {
419                                                                     "$ url" : "baseURL + '/Roo/curr_symbol.php'",
420                                                                     "method" : "GET",
421                                                                     "xtype" : "HttpProxy",
422                                                                     "$ xns" : "Roo.data",
423                                                                     "* prop" : "proxy"
424                                                                 },
425                                                                 {
426                                                                     "id" : "curr_id",
427                                                                     "root" : "data",
428                                                                     "xtype" : "JsonReader",
429                                                                     "$ xns" : "Roo.data",
430                                                                     "$ fields" : "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]",
431                                                                     "* prop" : "reader",
432                                                                     "totalProperty" : "total"
433                                                                 }
434                                                             ]
435                                                         }
436                                                     ]
437                                                 },
438                                                 {
439                                                     "fieldLabel" : "Value",
440                                                     "xtype" : "NumberField",
441                                                     "allowBlank" : false,
442                                                     "width" : 200,
443                                                     "$ xns" : "Roo.form",
444                                                     "name" : "item_itemcost_id_itemcost_actcost"
445                                                 }
446                                             ]
447                                         }
448                                     ]
449                                 },
450                                 {
451                                     "xtype" : "Column",
452                                     "$ xns" : "Roo.form",
453                                     "items" : [
454                                         {
455                                             "listeners" : {
456                                                 "render" : "function (_self)\n{\n    _this.itemsiteFieldSet = _self;\n}"
457                                             },
458                                             "xtype" : "FieldSet",
459                                             "legend" : "Itemsite Settings",
460                                             "$ xns" : "Roo.form",
461                                             "String/Object/Function style" : "width:335px;",
462                                             "Number labelWidth" : 120,
463                                             "items" : [
464                                                 {
465                                                     "fieldLabel" : "Reorder Level",
466                                                     "xtype" : "NumberField",
467                                                     "allowBlank" : false,
468                                                     "width" : 200,
469                                                     "$ xns" : "Roo.form",
470                                                     "name" : "item_itemsite_id_itemsite_reorderlevel"
471                                                 },
472                                                 {
473                                                     "fieldLabel" : "Stock Safety Level",
474                                                     "xtype" : "NumberField",
475                                                     "allowBlank" : false,
476                                                     "width" : 200,
477                                                     "$ xns" : "Roo.form",
478                                                     "name" : "item_itemsite_id_itemsite_safetystock"
479                                                 },
480                                                 {
481                                                     "fieldLabel" : "Lead time (Days)",
482                                                     "xtype" : "NumberField",
483                                                     "allowBlank" : false,
484                                                     "width" : 200,
485                                                     "$ xns" : "Roo.form",
486                                                     "name" : "item_itemsite_id_itemsite_leadtime"
487                                                 },
488                                                 {
489                                                     "listWidth" : 200,
490                                                     "triggerAction" : "all",
491                                                     "fieldLabel" : "Control Method",
492                                                     "displayField" : "fname",
493                                                     "hiddenName" : "item_itemsite_id_itemsite_controlmethod",
494                                                     "valueField" : "ftype",
495                                                     "xtype" : "ComboBox",
496                                                     "allowBlank" : false,
497                                                     "editable" : false,
498                                                     "width" : 200,
499                                                     "$ xns" : "Roo.form",
500                                                     "mode" : "local",
501                                                     "name" : "item_itemsite_id_itemsite_controlmethod_name",
502                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
503                                                     "items" : [
504                                                         {
505                                                             "xtype" : "SimpleStore",
506                                                             "$ data" : "[ \n    [ 'N', \"None\"],\n    [ 'R' , \"Regular\"]\n]\n",
507                                                             "$ fields" : "[  'ftype', 'fname']",
508                                                             "$ xns" : "Roo.data",
509                                                             "* prop" : "store"
510                                                         }
511                                                     ]
512                                                 },
513                                                 {
514                                                     "listWidth" : 400,
515                                                     "triggerAction" : "all",
516                                                     "fieldLabel" : "Planner Code",
517                                                     "forceSelection" : true,
518                                                     "selectOnFocus" : true,
519                                                     "pageSize" : 20,
520                                                     "displayField" : "plancode_name",
521                                                     "emptyText" : "Select plancode",
522                                                     "hiddenName" : "item_itemsite_id_itemsite_plancode_id",
523                                                     "minChars" : 2,
524                                                     "valueField" : "plancode_id",
525                                                     "xtype" : "ComboBox",
526                                                     "allowBlank" : false,
527                                                     "typeAhead" : true,
528                                                     "editable" : false,
529                                                     "width" : 200,
530                                                     "$ xns" : "Roo.form",
531                                                     "name" : "plancode_name",
532                                                     "qtip" : "Select plancode",
533                                                     "queryParam" : "",
534                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>",
535                                                     "loadingText" : "Searching...",
536                                                     "items" : [
537                                                         {
538                                                             "listeners" : {
539                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
540                                                             },
541                                                             "xtype" : "Store",
542                                                             "remoteSort" : true,
543                                                             "$ xns" : "Roo.data",
544                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
545                                                             "* prop" : "store",
546                                                             "items" : [
547                                                                 {
548                                                                     "$ url" : "baseURL + '/Roo/plancode.php'",
549                                                                     "method" : "GET",
550                                                                     "xtype" : "HttpProxy",
551                                                                     "$ xns" : "Roo.data",
552                                                                     "* prop" : "proxy"
553                                                                 },
554                                                                 {
555                                                                     "id" : "id",
556                                                                     "root" : "data",
557                                                                     "xtype" : "JsonReader",
558                                                                     "$ xns" : "Roo.data",
559                                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"plancode_code\",\"type\":\"string\"}]",
560                                                                     "* prop" : "reader",
561                                                                     "totalProperty" : "total"
562                                                                 }
563                                                             ]
564                                                         }
565                                                     ]
566                                                 },
567                                                 {
568                                                     "listWidth" : 400,
569                                                     "triggerAction" : "all",
570                                                     "fieldLabel" : "Costcat",
571                                                     "forceSelection" : true,
572                                                     "selectOnFocus" : true,
573                                                     "pageSize" : 20,
574                                                     "displayField" : "costcat_code",
575                                                     "emptyText" : "Select costcat",
576                                                     "hiddenName" : "item_itemsite_id_itemsite_costcat_id",
577                                                     "minChars" : 2,
578                                                     "valueField" : "costcat_id",
579                                                     "xtype" : "ComboBox",
580                                                     "allowBlank" : false,
581                                                     "typeAhead" : true,
582                                                     "editable" : false,
583                                                     "width" : 200,
584                                                     "$ xns" : "Roo.form",
585                                                     "name" : "costcat_code",
586                                                     "qtip" : "Select costcat",
587                                                     "queryParam" : "",
588                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>",
589                                                     "loadingText" : "Searching...",
590                                                     "items" : [
591                                                         {
592                                                             "listeners" : {
593                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
594                                                             },
595                                                             "xtype" : "Store",
596                                                             "remoteSort" : true,
597                                                             "$ xns" : "Roo.data",
598                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
599                                                             "* prop" : "store",
600                                                             "items" : [
601                                                                 {
602                                                                     "$ url" : "baseURL + '/Roo/costcat.php'",
603                                                                     "method" : "GET",
604                                                                     "xtype" : "HttpProxy",
605                                                                     "$ xns" : "Roo.data",
606                                                                     "* prop" : "proxy"
607                                                                 },
608                                                                 {
609                                                                     "id" : "id",
610                                                                     "root" : "data",
611                                                                     "xtype" : "JsonReader",
612                                                                     "$ xns" : "Roo.data",
613                                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"costcat_code\",\"type\":\"string\"}]",
614                                                                     "* prop" : "reader",
615                                                                     "totalProperty" : "total"
616                                                                 }
617                                                             ]
618                                                         }
619                                                     ]
620                                                 },
621                                                 {
622                                                     "fieldLabel" : "Active",
623                                                     "inputValue" : true,
624                                                     "xtype" : "Checkbox",
625                                                     "valueOff" : 0,
626                                                     "width" : 75,
627                                                     "$ xns" : "Roo.form",
628                                                     "name" : "item_itemsite_id_itemsite_active"
629                                                 },
630                                                 {
631                                                     "fieldLabel" : "Sold",
632                                                     "inputValue" : true,
633                                                     "xtype" : "Checkbox",
634                                                     "valueOff" : 0,
635                                                     "width" : 75,
636                                                     "$ xns" : "Roo.form",
637                                                     "name" : "item_itemsite_id_itemsite_sold"
638                                                 },
639                                                 {
640                                                     "fieldLabel" : "Stocked",
641                                                     "inputValue" : true,
642                                                     "xtype" : "Checkbox",
643                                                     "valueOff" : 0,
644                                                     "width" : 75,
645                                                     "$ xns" : "Roo.form",
646                                                     "name" : "item_itemsite_id_itemsite_stocked"
647                                                 },
648                                                 {
649                                                     "fieldLabel" : "Perishable",
650                                                     "inputValue" : true,
651                                                     "xtype" : "Checkbox",
652                                                     "valueOff" : 0,
653                                                     "width" : 75,
654                                                     "$ xns" : "Roo.form",
655                                                     "name" : "item_itemsite_id_itemsite_perishable"
656                                                 },
657                                                 {
658                                                     "fieldLabel" : "Multi Location",
659                                                     "inputValue" : true,
660                                                     "xtype" : "Checkbox",
661                                                     "valueOff" : 0,
662                                                     "width" : 100,
663                                                     "$ xns" : "Roo.form",
664                                                     "name" : "item_itemsite_id_itemsite_loccntrl"
665                                                 },
666                                                 {
667                                                     "listWidth" : 400,
668                                                     "triggerAction" : "all",
669                                                     "fieldLabel" : "Default Location",
670                                                     "forceSelection" : true,
671                                                     "selectOnFocus" : true,
672                                                     "pageSize" : 200,
673                                                     "displayField" : "location_name",
674                                                     "emptyText" : "Default Location",
675                                                     "hiddenName" : "item_itemsite_id_itemsite_location_id",
676                                                     "minChars" : 2,
677                                                     "valueField" : "location_id",
678                                                     "xtype" : "ComboBox",
679                                                     "allowBlank" : false,
680                                                     "typeAhead" : false,
681                                                     "editable" : true,
682                                                     "width" : 200,
683                                                     "$ xns" : "Roo.form",
684                                                     "name" : "location_name",
685                                                     "qtip" : "Select terms",
686                                                     "queryParam" : "query[location_name]",
687                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>",
688                                                     "loadingText" : "Searching...",
689                                                     "items" : [
690                                                         {
691                                                             "listeners" : {
692                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n     o.params.location_netable = 1;\n     o.params._notinternalcompany = 1;\n     o.params.location_restrict = 0;\n}\n"
693                                                             },
694                                                             "xtype" : "Store",
695                                                             "remoteSort" : true,
696                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'location_name' }",
697                                                             "$ xns" : "Roo.data",
698                                                             "* prop" : "store",
699                                                             "items" : [
700                                                                 {
701                                                                     "$ url" : "baseURL + '/Roo/location.php'",
702                                                                     "xtype" : "HttpProxy",
703                                                                     "method" : "GET",
704                                                                     "$ xns" : "Roo.data",
705                                                                     "* prop" : "proxy"
706                                                                 },
707                                                                 {
708                                                                     "id" : "location_id",
709                                                                     "root" : "data",
710                                                                     "xtype" : "JsonReader",
711                                                                     "$ fields" : "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
712                                                                     "$ xns" : "Roo.data",
713                                                                     "* prop" : "reader",
714                                                                     "totalProperty" : "total"
715                                                                 }
716                                                             ]
717                                                         }
718                                                     ]
719                                                 }
720                                             ]
721                                         }
722                                     ]
723                                 },
724                                 {
725                                     "xtype" : "Hidden",
726                                     "width" : 75,
727                                     "$ xns" : "Roo.form",
728                                     "name" : "item_id"
729                                 },
730                                 {
731                                     "value" : 1,
732                                     "xtype" : "Hidden",
733                                     "width" : 75,
734                                     "$ xns" : "Roo.form",
735                                     "name" : "_update_related"
736                                 }
737                             ]
738                         }
739                     ]
740                 },
741                 {
742                     "listeners" : {
743                         "|activate" : "function() {\n    _this.partspanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding parts\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(!type.length || type != 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add parts to non-kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.partsgrid) {\n        _this.partsgrid.footer.onClick('first');\n    \n     }\n}"
744                     },
745                     "fitToframe" : true,
746                     "background" : true,
747                     "region" : "center",
748                     "title" : "Item Parts",
749                     "xtype" : "GridPanel",
750                     "fitContainer" : true,
751                     "$ xns" : "Roo",
752                     "tableName" : "bomitem",
753                     "items" : [
754                         {
755                             "listeners" : {
756                                 "beforeedit" : "function (e)\n{\n    if(e.field != 'bomitem_qtyper'){\n        return false;\n    }\n    \n}",
757                                 "|render" : "function() \n{\n    _this.partsgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.partspanel.active) {\n       this.footer.onClick('first');\n    }\n}",
758                                 "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/bomitem.php',\n        mask : 'Saving',\n        params : {\n            bomitem_id : e.record.data.bomitem_id,\n            bomitem_qtyper : e.value\n        },\n        success : function() {\n            e.record.set('bomitem_qtyper', e.value);\n        }\n    \n    });\n        \n         \n        \n        \n}"
759                             },
760                             "autoExpandColumn" : "bomitem_item_id_item_descrip1",
761                             "xtype" : "EditorGrid",
762                             "loadMask" : true,
763                             "clicksToEdit" : 1,
764                             "$ xns" : "Roo.grid",
765                             "* prop" : "grid",
766                             "items" : [
767                                 {
768                                     "xtype" : "Toolbar",
769                                     "$ xns" : "Roo",
770                                     "* prop" : "toolbar",
771                                     "items" : [
772                                         {
773                                             "listeners" : {
774                                                 "render" : "function (_self)\n{\n    _this.partsBox = _self;\n}",
775                                                 "select" : "function (combo, record, index)\n{\n    var item_id = _this.form.findField('item_id').getValue() * 1;\n    \n    if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){\n        return;\n    }\n    \n    var err = false;\n\n    _this.partsgrid.ds.each(function(d){\n        if(record.data.item_id == d.data.bomitem_item_id){\n            err = true;\n        }\n    });\n\n    if(err){\n        Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');\n        _this.partsBox.reset();\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            bomitem_parent_item_id : item_id,\n            bomitem_item_id : record.data.item_id\n        }, \n        success : function(res) {\n            _this.partsBox.reset();\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n}"
776                                             },
777                                             "alwaysQuery" : true,
778                                             "triggerAction" : "all",
779                                             "fieldLabel" : "Item",
780                                             "forceSelection" : true,
781                                             "selectOnFocus" : true,
782                                             "pageSize" : 20,
783                                             "displayField" : "item_number",
784                                             "emptyText" : "Select item",
785                                             "minChars" : 2,
786                                             "valueField" : "id",
787                                             "xtype" : "ComboBox",
788                                             "allowBlank" : true,
789                                             "typeAhead" : true,
790                                             "editable" : true,
791                                             "width" : 200,
792                                             "$ xns" : "Roo.bootstrap",
793                                             "qtip" : "Select item",
794                                             "queryParam" : "query[number_or_name]",
795                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>",
796                                             "loadingText" : "Searching...",
797                                             "items" : [
798                                                 {
799                                                     "listeners" : {
800                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params.item_active = 1;\n    o.params['!item_type'] = 'K';\n}\n"
801                                                     },
802                                                     "xtype" : "Store",
803                                                     "remoteSort" : true,
804                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'item_number' }",
805                                                     "$ xns" : "Roo.data",
806                                                     "* prop" : "store",
807                                                     "items" : [
808                                                         {
809                                                             "$ url" : "baseURL + '/Roo/item.php'",
810                                                             "xtype" : "HttpProxy",
811                                                             "method" : "GET",
812                                                             "$ xns" : "Roo.data",
813                                                             "* prop" : "proxy"
814                                                         },
815                                                         {
816                                                             "id" : "id",
817                                                             "root" : "data",
818                                                             "xtype" : "JsonReader",
819                                                             "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"item_number\",\"type\":\"string\"}\n]",
820                                                             "$ xns" : "Roo.data",
821                                                             "* prop" : "reader",
822                                                             "totalProperty" : "total"
823                                                         }
824                                                     ]
825                                                 }
826                                             ]
827                                         },
828                                         {
829                                             "xtype" : "Fill",
830                                             "$ xns" : "Roo.Toolbar"
831                                         },
832                                         {
833                                             "listeners" : {
834                                                 "|click" : "function ()\n{\n    var sel = _this.partsgrid.getSelectionModel().getSelectedCell();\n    \n    if(!sel || !sel.length){\n        Roo.MessageBox.alert(\"Error\", \"Please select a item from below list\");\n        return;\n    }\n    \n    var d = _this.partsgrid.ds.getAt(sel[0]);      \n  \n    if(d.data.bomitem_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Invaild selection\");\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            _delete : d.data.bomitem_id\n        }, \n        success : function(res) {\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n   \n}"
835                                             },
836                                             "text" : "Remove",
837                                             "xtype" : "Button",
838                                             "cls" : "x-btn-text-icon",
839                                             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
840                                             "$ xns" : "Roo"
841                                         }
842                                     ]
843                                 },
844                                 {
845                                     "listeners" : {
846                                         "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params.bom_parent_item_id = id;\n}"
847                                     },
848                                     "xtype" : "Store",
849                                     "remoteSort" : true,
850                                     "$ sortInfo" : "{ field : 'bomitem_item_id_item_name', direction: 'ASC' }",
851                                     "$ xns" : "Roo.data",
852                                     "* prop" : "dataSource",
853                                     "items" : [
854                                         {
855                                             "$ url" : "baseURL + '/Roo/bomitem.php'",
856                                             "method" : "GET",
857                                             "xtype" : "HttpProxy",
858                                             "$ xns" : "Roo.data",
859                                             "* prop" : "proxy"
860                                         },
861                                         {
862                                             "id" : "bom_id",
863                                             "root" : "data",
864                                             "xtype" : "JsonReader",
865                                             "$ fields" : "[\n    {\n        'name': 'bomitem_id',\n        'type': 'int'\n    }\n]",
866                                             "$ xns" : "Roo.data",
867                                             "* prop" : "reader",
868                                             "totalProperty" : "total"
869                                         }
870                                     ]
871                                 },
872                                 {
873                                     "pageSize" : 50,
874                                     "xtype" : "PagingToolbar",
875                                     "emptyMsg" : "Nothing found",
876                                     "$ xns" : "Roo",
877                                     "displayMsg" : "Displaying parts {0} - {1} of {2}",
878                                     "displayInfo" : true,
879                                     "* prop" : "footer"
880                                 },
881                                 {
882                                     "xtype" : "ColumnModel",
883                                     "width" : 150,
884                                     "header" : "Name",
885                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
886                                     "$ xns" : "Roo.grid",
887                                     "* prop" : "colModel[]",
888                                     "dataIndex" : "bomitem_item_id_item_number"
889                                 },
890                                 {
891                                     "xtype" : "ColumnModel",
892                                     "width" : 150,
893                                     "header" : "Description",
894                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
895                                     "$ xns" : "Roo.grid",
896                                     "* prop" : "colModel[]",
897                                     "dataIndex" : "bomitem_item_id_item_descrip1"
898                                 },
899                                 {
900                                     "xtype" : "ColumnModel",
901                                     "String align" : "right",
902                                     "header" : "Qty",
903                                     "width" : 100,
904                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
905                                     "$ xns" : "Roo.grid",
906                                     "* prop" : "colModel[]",
907                                     "dataIndex" : "bomitem_qtyper",
908                                     "items" : [
909                                         {
910                                             "xtype" : "GridEditor",
911                                             "$ xns" : "Roo.grid",
912                                             "* prop" : "editor",
913                                             "items" : [
914                                                 {
915                                                     "Boolean allowBlank" : false,
916                                                     "String cls" : "align-right",
917                                                     "xtype" : "NumberField",
918                                                     "Number decimalPrecision" : 0,
919                                                     "$ xns" : "Roo.form",
920                                                     "* prop" : "field",
921                                                     "Number minValue" : 0
922                                                 }
923                                             ]
924                                         }
925                                     ]
926                                 }
927                             ]
928                         }
929                     ]
930                 },
931                 {
932                     "listeners" : {
933                         "|activate" : "function() {\n    _this.panel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    \n     }\n}"
934                     },
935                     "background" : true,
936                     "region" : "center",
937                     "fitToframe" : true,
938                     "title" : "Reference Files",
939                     "xtype" : "GridPanel",
940                     "fitContainer" : true,
941                     "$ xns" : "Roo",
942                     "tableName" : "Images",
943                     "items" : [
944                         {
945                             "listeners" : {
946                                 "|rowdblclick" : "function (_self, rowIndex, e)\n{\n  \n   var s =  _self.getDataSource().getAt(rowIndex);\n   new Pman.Download({\n        url : baseURL + '/Images/Download/' + s.data.id\n    });\n   \n}",
947                                 "|render" : "function() { \n    _this.grid = this; \n\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
948                             },
949                             "autoExpandColumn" : "id",
950                             "xtype" : "Grid",
951                             "loadMask" : true,
952                             "$ xns" : "Roo.grid",
953                             "* prop" : "grid",
954                             "items" : [
955                                 {
956                                     "listeners" : {
957                                         "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var id = _this.form.findField('item_id').getValue();\n    \n    if(id * 1 < 1){\n        return false;\n    }\n    \n    o.params.onid = id;\n    o.params.ontable = 'item';\n    \n}"
958                                     },
959                                     "xtype" : "Store",
960                                     "remoteSort" : true,
961                                     "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }",
962                                     "$ xns" : "Roo.data",
963                                     "* prop" : "dataSource",
964                                     "items" : [
965                                         {
966                                             "id" : "id",
967                                             "root" : "data",
968                                             "xtype" : "JsonReader",
969                                             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    }\n]",
970                                             "$ xns" : "Roo.data",
971                                             "* prop" : "reader",
972                                             "totalProperty" : "total"
973                                         },
974                                         {
975                                             "$ url" : "baseURL + '/Roo/Images.php'",
976                                             "method" : "GET",
977                                             "xtype" : "HttpProxy",
978                                             "$ xns" : "Roo.data",
979                                             "* prop" : "proxy"
980                                         }
981                                     ]
982                                 },
983                                 {
984                                     "pageSize" : 25,
985                                     "xtype" : "PagingToolbar",
986                                     "emptyMsg" : "No Images found",
987                                     "$ xns" : "Roo",
988                                     "displayInfo" : true,
989                                     "displayMsg" : "Displaying Images  {0} - {1} of {2}",
990                                     "* prop" : "footer"
991                                 },
992                                 {
993                                     "xtype" : "Toolbar",
994                                     "$ xns" : "Roo",
995                                     "* prop" : "toolbar",
996                                     "items" : [
997                                         {
998                                             "listeners" : {
999                                                 "|click" : "function()\n{\n    Pman.Dialog.Image.show({\n        id : 0, \n        ontable: 'item',\n        onid: _this.form.findField('item_id').getValue() * 1,\n        imgtype : ''\n    }, function(data){\n        if (!data) { return; } \n        _this.grid.footer.onClick('first');\n    }); \n\n}       "
1000                                             },
1001                                             "text" : "Add",
1002                                             "xtype" : "Button",
1003                                             "cls" : "x-btn-text-icon",
1004                                             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1005                                             "$ xns" : "Roo.Toolbar"
1006                                         },
1007                                         {
1008                                             "listeners" : {
1009                                                 "|click" : "function()\n{\n    Pman.genericDelete(_this, 'Images'); \n}\n        "
1010                                             },
1011                                             "text" : "Delete",
1012                                             "xtype" : "Button",
1013                                             "cls" : "x-btn-text-icon",
1014                                             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
1015                                             "$ xns" : "Roo.Toolbar"
1016                                         }
1017                                     ]
1018                                 },
1019                                 {
1020                                     "xtype" : "ColumnModel",
1021                                     "sortable" : true,
1022                                     "header" : "Created",
1023                                     "width" : 200,
1024                                     "$ renderer" : "function(v,x,r) {\n       return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',\n            v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n    r.data.width, r.data.height\n    ); \n}\n     ",
1025                                     "$ xns" : "Roo.grid",
1026                                     "* prop" : "colModel[]",
1027                                     "dataIndex" : "created"
1028                                 },
1029                                 {
1030                                     "xtype" : "ColumnModel",
1031                                     "header" : "Image",
1032                                     "width" : 100,
1033                                     "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"100\">', baseURL, v, r.data.filename); }",
1034                                     "$ xns" : "Roo.grid",
1035                                     "* prop" : "colModel[]",
1036                                     "dataIndex" : "id"
1037                                 }
1038                             ]
1039                         }
1040                     ]
1041                 },
1042                 {
1043                     "listeners" : {
1044                         "|activate" : "function() {\n    _this.lpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.lgrid) {\n        _this.lgrid.footer.onClick('first');\n    \n     }\n}"
1045                     },
1046                     "background" : true,
1047                     "region" : "center",
1048                     "fitToframe" : true,
1049                     "title" : "Price List",
1050                     "xtype" : "GridPanel",
1051                     "fitContainer" : true,
1052                     "$ xns" : "Roo",
1053                     "tableName" : "ipshead",
1054                     "items" : [
1055                         {
1056                             "listeners" : {
1057                                 "beforeedit" : "function (e)\n{\n    if(e.field != 'ipshead_ipsitem_price'){\n        return false;\n    }\n    \n}",
1058                                 "|render" : "function() \n{\n    _this.lgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.lpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
1059                                 "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if(id < 1){\n        return false;\n    }\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/ipsiteminfo',\n        mask : 'Saving',\n        params : {\n            ipsitem_ipshead_id : e.record.data.ipshead_id,\n            ipsitem_item_id : id,\n            ipsitem_price : e.record.data.ipshead_ipsitem_price,\n            ipsitem_id : e.record.data.ipshead_ipsitem_id\n        }\n    \n    });\n        \n         \n        \n        \n}"
1060                             },
1061                             "autoExpandColumn" : "ipshead_descrip",
1062                             "xtype" : "EditorGrid",
1063                             "loadMask" : true,
1064                             "clicksToEdit" : 1,
1065                             "$ xns" : "Roo.grid",
1066                             "* prop" : "grid",
1067                             "items" : [
1068                                 {
1069                                     "listeners" : {
1070                                         "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params._with_item = id;\n}"
1071                                     },
1072                                     "xtype" : "Store",
1073                                     "remoteSort" : true,
1074                                     "$ sortInfo" : "{ field : 'ipshead_id', direction: 'ASC' }",
1075                                     "$ xns" : "Roo.data",
1076                                     "* prop" : "dataSource",
1077                                     "items" : [
1078                                         {
1079                                             "$ url" : "baseURL + '/Roo/ipshead.php'",
1080                                             "xtype" : "HttpProxy",
1081                                             "method" : "GET",
1082                                             "$ xns" : "Roo.data",
1083                                             "* prop" : "proxy"
1084                                         },
1085                                         {
1086                                             "id" : "ipshead_id",
1087                                             "root" : "data",
1088                                             "xtype" : "JsonReader",
1089                                             "$ fields" : "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    }\n]",
1090                                             "$ xns" : "Roo.data",
1091                                             "* prop" : "reader",
1092                                             "totalProperty" : "total"
1093                                         }
1094                                     ]
1095                                 },
1096                                 {
1097                                     "pageSize" : 50,
1098                                     "xtype" : "PagingToolbar",
1099                                     "emptyMsg" : "Nothing found",
1100                                     "$ xns" : "Roo",
1101                                     "displayMsg" : "Displaying records {0} - {1} of {2}",
1102                                     "displayInfo" : true,
1103                                     "* prop" : "footer"
1104                                 },
1105                                 {
1106                                     "xtype" : "ColumnModel",
1107                                     "header" : "Name",
1108                                     "width" : 150,
1109                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1110                                     "$ xns" : "Roo.grid",
1111                                     "* prop" : "colModel[]",
1112                                     "dataIndex" : "ipshead_name"
1113                                 },
1114                                 {
1115                                     "xtype" : "ColumnModel",
1116                                     "header" : "Description",
1117                                     "width" : 150,
1118                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1119                                     "$ xns" : "Roo.grid",
1120                                     "* prop" : "colModel[]",
1121                                     "dataIndex" : "ipshead_descrip"
1122                                 },
1123                                 {
1124                                     "xtype" : "ColumnModel",
1125                                     "header" : "Currency",
1126                                     "width" : 100,
1127                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1128                                     "$ xns" : "Roo.grid",
1129                                     "* prop" : "colModel[]",
1130                                     "dataIndex" : "ipshead_curr_id_curr_name"
1131                                 },
1132                                 {
1133                                     "align" : "right",
1134                                     "xtype" : "ColumnModel",
1135                                     "header" : "Price",
1136                                     "width" : 120,
1137                                     "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
1138                                     "$ xns" : "Roo.grid",
1139                                     "* prop" : "colModel[]",
1140                                     "dataIndex" : "ipshead_ipsitem_price",
1141                                     "items" : [
1142                                         {
1143                                             "xtype" : "GridEditor",
1144                                             "$ xns" : "Roo.grid",
1145                                             "* prop" : "editor",
1146                                             "items" : [
1147                                                 {
1148                                                     "xtype" : "NumberField",
1149                                                     "cls" : "align-right",
1150                                                     "decimalPrecision" : 2,
1151                                                     "$ xns" : "Roo.form",
1152                                                     "* prop" : "field"
1153                                                 }
1154                                             ]
1155                                         }
1156                                     ]
1157                                 }
1158                             ]
1159                         }
1160                     ]
1161                 },
1162                 {
1163                     "listeners" : {
1164                         "|activate" : "function() {\n    _this.itemsrcpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding suppliers\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(type == 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add suppliers to kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.itemsrcgrid) {\n        _this.itemsrcgrid.footer.onClick('first');\n    }\n}"
1165                     },
1166                     "background" : true,
1167                     "region" : "center",
1168                     "fitToframe" : true,
1169                     "title" : "Suppliers",
1170                     "xtype" : "GridPanel",
1171                     "fitContainer" : true,
1172                     "$ xns" : "Roo",
1173                     "tableName" : "itemsrc",
1174                     "items" : [
1175                         {
1176                             "listeners" : {
1177                                 "|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",
1178                                 "|render" : "function() \n{\n    _this.itemsrcgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    \n}",
1179                                 "afteredit" : "function (e)\n{\n    e.record.commit();\n}"
1180                             },
1181                             "autoExpandColumn" : "itemsrc_comments",
1182                             "xtype" : "EditorGrid",
1183                             "loadMask" : true,
1184                             "clicksToEdit" : 1,
1185                             "$ xns" : "Roo.grid",
1186                             "* prop" : "grid",
1187                             "items" : [
1188                                 {
1189                                     "listeners" : {
1190                                         "update" : "function (_self, record, operation)\n{\n    Roo.log(operation);\n      Roo.log(record);\n   \n    if (operation != 'commit') {\n        return;\n    }\n    if (record.data.itemsrc_vend_id * 1 < 1) {\n        return; // do not save.\n    }\n    if (record.data.itemsrc_id * 1 < 0) {\n        return; // do not save. -- updating at present...\n    }\n    \n    var p = Roo.apply({}, record.data);\n    record.set('itemsrc_id', -1);    \n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Itemsrc',\n        params : p,\n        method : 'POST',\n        success: function(res) {\n            if (record.data.itemsrc_id *1  < 1) { \n                record.set('itemsrc_id', res.data.itemsrc_id);\n            }\n        }\n    });\n    \n    \n}",
1191                                         "beforeload" : "function (_self, o)\n{\n    \n    var id = 1 * _this.form.findField('item_id').getValue();\n    if (!id) {\n        this.removeAll();\n        return false;\n    }\n    o.params.itemsrc_item_id = id;\n}"
1192                                     },
1193                                     "xtype" : "Store",
1194                                     "remoteSort" : true,
1195                                     "$ sortInfo" : "{ field : 'itemsrc_vend_id_vend_name', direction: 'ASC' }",
1196                                     "$ xns" : "Roo.data",
1197                                     "* prop" : "dataSource",
1198                                     "items" : [
1199                                         {
1200                                             "$ url" : "baseURL + '/Roo/itemsrc.php'",
1201                                             "method" : "GET",
1202                                             "xtype" : "HttpProxy",
1203                                             "$ xns" : "Roo.data",
1204                                             "* prop" : "proxy"
1205                                         },
1206                                         {
1207                                             "id" : "id",
1208                                             "root" : "data",
1209                                             "xtype" : "JsonReader",
1210                                             "$ xns" : "Roo.data",
1211                                             "$ fields" : "[\n    {\n        'name': 'itemsrc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_uom',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_invvendoruomratio',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_minordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_multordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_leadtime',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_ranking',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_active',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_manuf_name',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_default',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_upccode',\n        'type': 'string'\n    }\n]",
1212                                             "* prop" : "reader",
1213                                             "totalProperty" : "total"
1214                                         }
1215                                     ]
1216                                 },
1217                                 {
1218                                     "pageSize" : 25,
1219                                     "xtype" : "PagingToolbar",
1220                                     "emptyMsg" : "No itemsrc found",
1221                                     "$ xns" : "Roo",
1222                                     "displayInfo" : true,
1223                                     "displayMsg" : "Displaying itemsrc{0} - {1} of {2}",
1224                                     "* prop" : "footer"
1225                                 },
1226                                 {
1227                                     "xtype" : "Toolbar",
1228                                     "$ xns" : "Roo",
1229                                     "* prop" : "toolbar",
1230                                     "items" : [
1231                                         {
1232                                             "listeners" : {
1233                                                 "|click" : "function()\n{\n     \n    Roo.log(\"add presed\");\n     \n    // work out last \n    var grid = _this.itemsrcgrid;\n     \n    // uses form defaults or last row value.\n    var nr = grid.ds.reader.newRow({\n             itemsrc_id : 0,\n        itemsrc_item_id : _this.form.findField('item_id').getValue(),\n\n         itemsrc_vend_id : 0,\n         itemsrc_vend_item_number : '',\n         itemsrc_vend_item_descrip : '',\n         itemsrc_comments           : '',\n         itemsrc_vend_uom  :           'EA',\n         itemsrc_invvendoruomratio : 1.0,\n         itemsrc_minordqty        : 0,\n         itemsrc_multordqty        : 0,\n         itemsrc_leadtime         :  30,\n         itemsrc_ranking         :   0,\n         itemsrc_active          :   true,\n         itemsrc_manuf_name       :  '',\n         itemsrc_manuf_item_number : '',\n         itemsrc_manuf_item_descrip: '',\n         itemsrc_default          : true,\n         itemsrc_upccode    : ''\n                        \n    });\n    grid.stopEditing();\n    grid.ds.insert(0, nr); \n    grid.startEditing(0, 0); // type..\n\n}\n \n"
1234                                             },
1235                                             "text" : "Add",
1236                                             "xtype" : "Button",
1237                                             "cls" : "x-btn-text-icon",
1238                                             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1239                                             "$ xns" : "Roo.Toolbar"
1240                                         }
1241                                     ]
1242                                 },
1243                                 {
1244                                     "xtype" : "ColumnModel",
1245                                     "header" : "Vendor",
1246                                     "width" : 120,
1247                                     "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); }",
1248                                     "$ xns" : "Roo.grid",
1249                                     "* prop" : "colModel[]",
1250                                     "dataIndex" : "itemsrc_vend_id",
1251                                     "items" : [
1252                                         {
1253                                             "xtype" : "GridEditor",
1254                                             "$ xns" : "Roo.grid",
1255                                             "* prop" : "editor",
1256                                             "items" : [
1257                                                 {
1258                                                     "listWidth" : 400,
1259                                                     "triggerAction" : "all",
1260                                                     "forceSelection" : true,
1261                                                     "selectOnFocus" : true,
1262                                                     "pageSize" : 20,
1263                                                     "displayField" : "vend_name",
1264                                                     "emptyText" : "Select Vendor",
1265                                                     "hiddenName" : "itemsrc_vend_id",
1266                                                     "minChars" : 2,
1267                                                     "valueField" : "vend_id",
1268                                                     "xtype" : "ComboBox",
1269                                                     "allowBlank" : false,
1270                                                     "typeAhead" : true,
1271                                                     "editable" : true,
1272                                                     "width" : 300,
1273                                                     "$ xns" : "Roo.form",
1274                                                     "* prop" : "field",
1275                                                     "name" : "itemsrc_vend_id_vend_name",
1276                                                     "qtip" : "Select vendinfo",
1277                                                     "queryParam" : "q[search]",
1278                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
1279                                                     "loadingText" : "Searching...",
1280                                                     "items" : [
1281                                                         {
1282                                                             "listeners" : {
1283                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
1284                                                             },
1285                                                             "xtype" : "Store",
1286                                                             "remoteSort" : true,
1287                                                             "$ xns" : "Roo.data",
1288                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
1289                                                             "* prop" : "store",
1290                                                             "items" : [
1291                                                                 {
1292                                                                     "$ url" : "baseURL + '/Roo/vendinfo.php'",
1293                                                                     "method" : "GET",
1294                                                                     "xtype" : "HttpProxy",
1295                                                                     "$ xns" : "Roo.data",
1296                                                                     "* prop" : "proxy"
1297                                                                 },
1298                                                                 {
1299                                                                     "id" : "id",
1300                                                                     "root" : "data",
1301                                                                     "xtype" : "JsonReader",
1302                                                                     "$ xns" : "Roo.data",
1303                                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"vend_name\",\"type\":\"string\"}]",
1304                                                                     "* prop" : "reader",
1305                                                                     "totalProperty" : "total"
1306                                                                 }
1307                                                             ]
1308                                                         }
1309                                                     ]
1310                                                 }
1311                                             ]
1312                                         }
1313                                     ]
1314                                 },
1315                                 {
1316                                     "xtype" : "ColumnModel",
1317                                     "header" : "Vendor Ref#",
1318                                     "width" : 100,
1319                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1320                                     "$ xns" : "Roo.grid",
1321                                     "* prop" : "colModel[]",
1322                                     "dataIndex" : "itemsrc_vend_item_number",
1323                                     "items" : [
1324                                         {
1325                                             "xtype" : "GridEditor",
1326                                             "$ xns" : "Roo.grid",
1327                                             "* prop" : "editor",
1328                                             "items" : [
1329                                                 {
1330                                                     "xtype" : "TextField",
1331                                                     "$ xns" : "Roo.form",
1332                                                     "* prop" : "field"
1333                                                 }
1334                                             ]
1335                                         }
1336                                     ]
1337                                 },
1338                                 {
1339                                     "xtype" : "ColumnModel",
1340                                     "header" : "Comments",
1341                                     "width" : 200,
1342                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1343                                     "$ xns" : "Roo.grid",
1344                                     "* prop" : "colModel[]",
1345                                     "dataIndex" : "itemsrc_comments",
1346                                     "items" : [
1347                                         {
1348                                             "xtype" : "GridEditor",
1349                                             "$ xns" : "Roo.grid",
1350                                             "* prop" : "editor",
1351                                             "items" : [
1352                                                 {
1353                                                     "xtype" : "TextField",
1354                                                     "$ xns" : "Roo.form",
1355                                                     "* prop" : "field"
1356                                                 }
1357                                             ]
1358                                         }
1359                                     ]
1360                                 },
1361                                 {
1362                                     "xtype" : "ColumnModel",
1363                                     "header" : "UOM",
1364                                     "width" : 50,
1365                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1366                                     "$ xns" : "Roo.grid",
1367                                     "* prop" : "colModel[]",
1368                                     "dataIndex" : "itemsrc_vend_uom"
1369                                 },
1370                                 {
1371                                     "align" : "right",
1372                                     "xtype" : "ColumnModel",
1373                                     "header" : "Min Qty",
1374                                     "width" : 50,
1375                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1376                                     "$ xns" : "Roo.grid",
1377                                     "* prop" : "colModel[]",
1378                                     "dataIndex" : "itemsrc_minordqty",
1379                                     "items" : [
1380                                         {
1381                                             "xtype" : "GridEditor",
1382                                             "$ xns" : "Roo.grid",
1383                                             "* prop" : "editor",
1384                                             "items" : [
1385                                                 {
1386                                                     "minValue" : 0,
1387                                                     "xtype" : "NumberField",
1388                                                     "decimalPrecision" : 0,
1389                                                     "$ xns" : "Roo.form",
1390                                                     "* prop" : "field"
1391                                                 }
1392                                             ]
1393                                         }
1394                                     ]
1395                                 },
1396                                 {
1397                                     "align" : "right",
1398                                     "xtype" : "ColumnModel",
1399                                     "header" : "Lead time",
1400                                     "width" : 75,
1401                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1402                                     "$ xns" : "Roo.grid",
1403                                     "* prop" : "colModel[]",
1404                                     "dataIndex" : "itemsrc_leadtime",
1405                                     "items" : [
1406                                         {
1407                                             "xtype" : "GridEditor",
1408                                             "$ xns" : "Roo.grid",
1409                                             "* prop" : "editor",
1410                                             "items" : [
1411                                                 {
1412                                                     "minValue" : 0,
1413                                                     "xtype" : "NumberField",
1414                                                     "decimalPrecision" : 0,
1415                                                     "$ xns" : "Roo.form",
1416                                                     "* prop" : "field"
1417                                                 }
1418                                             ]
1419                                         }
1420                                     ]
1421                                 },
1422                                 {
1423                                     "xtype" : "ColumnModel",
1424                                     "header" : "Active",
1425                                     "width" : 50,
1426                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1427                                     "$ xns" : "Roo.grid",
1428                                     "* prop" : "colModel[]",
1429                                     "dataIndex" : "itemsrc_active"
1430                                 }
1431                             ]
1432                         }
1433                     ]
1434                 },
1435                 {
1436                     "listeners" : {
1437                         "|activate" : "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
1438                     },
1439                     "background" : true,
1440                     "region" : "center",
1441                     "fitToframe" : true,
1442                     "title" : "History",
1443                     "xtype" : "GridPanel",
1444                     "fitContainer" : true,
1445                     "$ xns" : "Roo",
1446                     "tableName" : "events",
1447                     "items" : [
1448                         {
1449                             "listeners" : {
1450                                 "|render" : "function() \n{\n    _this.hgrid = this; \n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
1451                             },
1452                             "autoExpandColumn" : "remarks",
1453                             "xtype" : "Grid",
1454                             "loadMask" : true,
1455                             "$ xns" : "Roo.grid",
1456                             "* prop" : "grid",
1457                             "items" : [
1458                                 {
1459                                     "listeners" : {
1460                                         "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.on_table = 'item';\n    options.params.on_id = _this.form.findField('item_id').getValue();\n}"
1461                                     },
1462                                     "xtype" : "Store",
1463                                     "remoteSort" : true,
1464                                     "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
1465                                     "$ xns" : "Roo.data",
1466                                     "* prop" : "dataSource",
1467                                     "items" : [
1468                                         {
1469                                             "$ url" : "baseURL + '/Roo/events.php'",
1470                                             "xtype" : "HttpProxy",
1471                                             "method" : "GET",
1472                                             "$ xns" : "Roo.data",
1473                                             "* prop" : "proxy"
1474                                         },
1475                                         {
1476                                             "id" : "id",
1477                                             "root" : "data",
1478                                             "xtype" : "JsonReader",
1479                                             "$ fields" : "[\n    {\n        'name': 'event_when',\n        'type': 'date'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    }\n]",
1480                                             "$ xns" : "Roo.data",
1481                                             "* prop" : "reader",
1482                                             "totalProperty" : "total"
1483                                         }
1484                                     ]
1485                                 },
1486                                 {
1487                                     "pageSize" : 25,
1488                                     "xtype" : "PagingToolbar",
1489                                     "emptyMsg" : "No Events found",
1490                                     "$ xns" : "Roo",
1491                                     "displayMsg" : "Displaying events{0} - {1} of {2}",
1492                                     "displayInfo" : true,
1493                                     "* prop" : "footer"
1494                                 },
1495                                 {
1496                                     "xtype" : "ColumnModel",
1497                                     "header" : "Changed",
1498                                     "width" : 120,
1499                                     "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
1500                                     "$ xns" : "Roo.grid",
1501                                     "* prop" : "colModel[]",
1502                                     "dataIndex" : "event_when"
1503                                 },
1504                                 {
1505                                     "xtype" : "ColumnModel",
1506                                     "header" : "Action",
1507                                     "width" : 200,
1508                                     "$ renderer" : "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
1509                                     "$ xns" : "Roo.grid",
1510                                     "* prop" : "colModel[]",
1511                                     "dataIndex" : "action"
1512                                 },
1513                                 {
1514                                     "xtype" : "ColumnModel",
1515                                     "header" : "IP Address",
1516                                     "width" : 200,
1517                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1518                                     "$ xns" : "Roo.grid",
1519                                     "* prop" : "colModel[]",
1520                                     "dataIndex" : "ipaddr"
1521                                 },
1522                                 {
1523                                     "xtype" : "ColumnModel",
1524                                     "header" : "Who",
1525                                     "width" : 75,
1526                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1527                                     "$ xns" : "Roo.grid",
1528                                     "* prop" : "colModel[]",
1529                                     "dataIndex" : "person_id_name"
1530                                 },
1531                                 {
1532                                     "xtype" : "ColumnModel",
1533                                     "header" : "Notes",
1534                                     "width" : 200,
1535                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1536                                     "$ xns" : "Roo.grid",
1537                                     "* prop" : "colModel[]",
1538                                     "dataIndex" : "remarks"
1539                                 }
1540                             ]
1541                         }
1542                     ]
1543                 },
1544                 {
1545                     "listeners" : {
1546                         "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
1547                     },
1548                     "text" : "Cancel",
1549                     "xtype" : "Button",
1550                     "$ xns" : "Roo",
1551                     "* prop" : "buttons[]"
1552                 },
1553                 {
1554                     "listeners" : {
1555                         "render" : "function (_self)\n{\n    _this.saveBtn = this;\n}",
1556                         "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n  //  _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
1557                     },
1558                     "text" : "Save",
1559                     "xtype" : "Button",
1560                     "$ xns" : "Roo",
1561                     "* prop" : "buttons[]"
1562                 }
1563             ]
1564         }
1565     ]
1566 }