pgsql/x-dragon-cohead.sql
[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\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\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                                             "xtype" : "FieldSet",
380                                             "legend" : "Standard Cost",
381                                             "style" : "width:320px",
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                         }
732                     ]
733                 },
734                 {
735                     "listeners" : {
736                         "|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}"
737                     },
738                     "region" : "center",
739                     "fitToframe" : true,
740                     "background" : true,
741                     "title" : "Item Parts",
742                     "xtype" : "GridPanel",
743                     "fitContainer" : true,
744                     "$ xns" : "Roo",
745                     "tableName" : "bomitem",
746                     "items" : [
747                         {
748                             "listeners" : {
749                                 "beforeedit" : "function (e)\n{\n    if(e.field != 'bomitem_qtyper'){\n        return false;\n    }\n    \n}",
750                                 "|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}",
751                                 "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}"
752                             },
753                             "autoExpandColumn" : "bomitem_item_id_item_descrip1",
754                             "xtype" : "EditorGrid",
755                             "loadMask" : true,
756                             "clicksToEdit" : 1,
757                             "$ xns" : "Roo.grid",
758                             "* prop" : "grid",
759                             "items" : [
760                                 {
761                                     "xtype" : "Toolbar",
762                                     "$ xns" : "Roo",
763                                     "* prop" : "toolbar",
764                                     "items" : [
765                                         {
766                                             "listeners" : {
767                                                 "render" : "function (_self)\n{\n    _this.partsBox = _self;\n}",
768                                                 "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            bomitem_qtyper : 1\n        }, \n        success : function(res) {\n            _this.partsBox.reset();\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n}"
769                                             },
770                                             "alwaysQuery" : true,
771                                             "triggerAction" : "all",
772                                             "fieldLabel" : "Item",
773                                             "forceSelection" : true,
774                                             "selectOnFocus" : true,
775                                             "pageSize" : 20,
776                                             "displayField" : "item_number",
777                                             "emptyText" : "Select item",
778                                             "minChars" : 2,
779                                             "valueField" : "id",
780                                             "xtype" : "ComboBox",
781                                             "allowBlank" : true,
782                                             "typeAhead" : true,
783                                             "editable" : true,
784                                             "width" : 200,
785                                             "$ xns" : "Roo.bootstrap",
786                                             "qtip" : "Select item",
787                                             "queryParam" : "query[number_or_name]",
788                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>",
789                                             "loadingText" : "Searching...",
790                                             "items" : [
791                                                 {
792                                                     "listeners" : {
793                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params.item_active = 1;\n    o.params['!item_type'] = 'K';\n}\n"
794                                                     },
795                                                     "xtype" : "Store",
796                                                     "remoteSort" : true,
797                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'item_number' }",
798                                                     "$ xns" : "Roo.data",
799                                                     "* prop" : "store",
800                                                     "items" : [
801                                                         {
802                                                             "$ url" : "baseURL + '/Roo/item.php'",
803                                                             "xtype" : "HttpProxy",
804                                                             "method" : "GET",
805                                                             "$ xns" : "Roo.data",
806                                                             "* prop" : "proxy"
807                                                         },
808                                                         {
809                                                             "id" : "id",
810                                                             "root" : "data",
811                                                             "xtype" : "JsonReader",
812                                                             "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"item_number\",\"type\":\"string\"}\n]",
813                                                             "$ xns" : "Roo.data",
814                                                             "* prop" : "reader",
815                                                             "totalProperty" : "total"
816                                                         }
817                                                     ]
818                                                 }
819                                             ]
820                                         },
821                                         {
822                                             "xtype" : "Fill",
823                                             "$ xns" : "Roo.Toolbar"
824                                         },
825                                         {
826                                             "listeners" : {
827                                                 "|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}"
828                                             },
829                                             "text" : "Remove",
830                                             "xtype" : "Button",
831                                             "cls" : "x-btn-text-icon",
832                                             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
833                                             "$ xns" : "Roo"
834                                         }
835                                     ]
836                                 },
837                                 {
838                                     "listeners" : {
839                                         "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}"
840                                     },
841                                     "xtype" : "Store",
842                                     "remoteSort" : true,
843                                     "$ sortInfo" : "{ field : 'bomitem_item_id_item_name', direction: 'ASC' }",
844                                     "$ xns" : "Roo.data",
845                                     "* prop" : "dataSource",
846                                     "items" : [
847                                         {
848                                             "$ url" : "baseURL + '/Roo/bomitem.php'",
849                                             "method" : "GET",
850                                             "xtype" : "HttpProxy",
851                                             "$ xns" : "Roo.data",
852                                             "* prop" : "proxy"
853                                         },
854                                         {
855                                             "id" : "bom_id",
856                                             "root" : "data",
857                                             "xtype" : "JsonReader",
858                                             "$ fields" : "[\n    {\n        'name': 'bomitem_id',\n        'type': 'int'\n    }\n]",
859                                             "$ xns" : "Roo.data",
860                                             "* prop" : "reader",
861                                             "totalProperty" : "total"
862                                         }
863                                     ]
864                                 },
865                                 {
866                                     "pageSize" : 50,
867                                     "xtype" : "PagingToolbar",
868                                     "emptyMsg" : "Nothing found",
869                                     "$ xns" : "Roo",
870                                     "displayMsg" : "Displaying parts {0} - {1} of {2}",
871                                     "displayInfo" : true,
872                                     "* prop" : "footer"
873                                 },
874                                 {
875                                     "xtype" : "ColumnModel",
876                                     "width" : 150,
877                                     "header" : "Name",
878                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
879                                     "$ xns" : "Roo.grid",
880                                     "* prop" : "colModel[]",
881                                     "dataIndex" : "bomitem_item_id_item_number"
882                                 },
883                                 {
884                                     "xtype" : "ColumnModel",
885                                     "width" : 150,
886                                     "header" : "Description",
887                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
888                                     "$ xns" : "Roo.grid",
889                                     "* prop" : "colModel[]",
890                                     "dataIndex" : "bomitem_item_id_item_descrip1"
891                                 },
892                                 {
893                                     "xtype" : "ColumnModel",
894                                     "String align" : "right",
895                                     "header" : "Qty",
896                                     "width" : 100,
897                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
898                                     "$ xns" : "Roo.grid",
899                                     "* prop" : "colModel[]",
900                                     "dataIndex" : "bomitem_qtyper",
901                                     "items" : [
902                                         {
903                                             "xtype" : "GridEditor",
904                                             "$ xns" : "Roo.grid",
905                                             "* prop" : "editor",
906                                             "items" : [
907                                                 {
908                                                     "Boolean allowBlank" : false,
909                                                     "String cls" : "align-right",
910                                                     "xtype" : "NumberField",
911                                                     "Number decimalPrecision" : 0,
912                                                     "$ xns" : "Roo.form",
913                                                     "* prop" : "field",
914                                                     "Number minValue" : 0
915                                                 }
916                                             ]
917                                         }
918                                     ]
919                                 }
920                             ]
921                         }
922                     ]
923                 },
924                 {
925                     "listeners" : {
926                         "|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}"
927                     },
928                     "fitToframe" : true,
929                     "background" : true,
930                     "region" : "center",
931                     "title" : "Reference Files",
932                     "xtype" : "GridPanel",
933                     "fitContainer" : true,
934                     "$ xns" : "Roo",
935                     "tableName" : "Images",
936                     "items" : [
937                         {
938                             "listeners" : {
939                                 "|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}",
940                                 "|render" : "function() { \n    _this.grid = this; \n\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
941                             },
942                             "autoExpandColumn" : "id",
943                             "xtype" : "Grid",
944                             "loadMask" : true,
945                             "$ xns" : "Roo.grid",
946                             "* prop" : "grid",
947                             "items" : [
948                                 {
949                                     "listeners" : {
950                                         "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}"
951                                     },
952                                     "xtype" : "Store",
953                                     "remoteSort" : true,
954                                     "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }",
955                                     "$ xns" : "Roo.data",
956                                     "* prop" : "dataSource",
957                                     "items" : [
958                                         {
959                                             "id" : "id",
960                                             "root" : "data",
961                                             "xtype" : "JsonReader",
962                                             "$ 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]",
963                                             "$ xns" : "Roo.data",
964                                             "* prop" : "reader",
965                                             "totalProperty" : "total"
966                                         },
967                                         {
968                                             "$ url" : "baseURL + '/Roo/Images.php'",
969                                             "method" : "GET",
970                                             "xtype" : "HttpProxy",
971                                             "$ xns" : "Roo.data",
972                                             "* prop" : "proxy"
973                                         }
974                                     ]
975                                 },
976                                 {
977                                     "pageSize" : 25,
978                                     "xtype" : "PagingToolbar",
979                                     "emptyMsg" : "No Images found",
980                                     "$ xns" : "Roo",
981                                     "displayInfo" : true,
982                                     "displayMsg" : "Displaying Images  {0} - {1} of {2}",
983                                     "* prop" : "footer"
984                                 },
985                                 {
986                                     "xtype" : "Toolbar",
987                                     "$ xns" : "Roo",
988                                     "* prop" : "toolbar",
989                                     "items" : [
990                                         {
991                                             "listeners" : {
992                                                 "|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}       "
993                                             },
994                                             "text" : "Add",
995                                             "xtype" : "Button",
996                                             "cls" : "x-btn-text-icon",
997                                             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
998                                             "$ xns" : "Roo.Toolbar"
999                                         },
1000                                         {
1001                                             "listeners" : {
1002                                                 "|click" : "function()\n{\n    Pman.genericDelete(_this, 'Images'); \n}\n        "
1003                                             },
1004                                             "text" : "Delete",
1005                                             "xtype" : "Button",
1006                                             "cls" : "x-btn-text-icon",
1007                                             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
1008                                             "$ xns" : "Roo.Toolbar"
1009                                         }
1010                                     ]
1011                                 },
1012                                 {
1013                                     "xtype" : "ColumnModel",
1014                                     "sortable" : true,
1015                                     "header" : "Created",
1016                                     "width" : 200,
1017                                     "$ 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     ",
1018                                     "$ xns" : "Roo.grid",
1019                                     "* prop" : "colModel[]",
1020                                     "dataIndex" : "created"
1021                                 },
1022                                 {
1023                                     "xtype" : "ColumnModel",
1024                                     "header" : "Image",
1025                                     "width" : 100,
1026                                     "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"100\">', baseURL, v, r.data.filename); }",
1027                                     "$ xns" : "Roo.grid",
1028                                     "* prop" : "colModel[]",
1029                                     "dataIndex" : "id"
1030                                 }
1031                             ]
1032                         }
1033                     ]
1034                 },
1035                 {
1036                     "listeners" : {
1037                         "|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}"
1038                     },
1039                     "fitToframe" : true,
1040                     "background" : true,
1041                     "region" : "center",
1042                     "title" : "Price List",
1043                     "xtype" : "GridPanel",
1044                     "fitContainer" : true,
1045                     "$ xns" : "Roo",
1046                     "tableName" : "ipshead",
1047                     "items" : [
1048                         {
1049                             "listeners" : {
1050                                 "beforeedit" : "function (e)\n{\n    if(e.field != 'ipshead_ipsitem_price'){\n        return false;\n    }\n    \n}",
1051                                 "|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}",
1052                                 "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}"
1053                             },
1054                             "autoExpandColumn" : "ipshead_descrip",
1055                             "xtype" : "EditorGrid",
1056                             "loadMask" : true,
1057                             "clicksToEdit" : 1,
1058                             "$ xns" : "Roo.grid",
1059                             "* prop" : "grid",
1060                             "items" : [
1061                                 {
1062                                     "listeners" : {
1063                                         "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}"
1064                                     },
1065                                     "xtype" : "Store",
1066                                     "remoteSort" : true,
1067                                     "$ sortInfo" : "{ field : 'ipshead_id', direction: 'ASC' }",
1068                                     "$ xns" : "Roo.data",
1069                                     "* prop" : "dataSource",
1070                                     "items" : [
1071                                         {
1072                                             "$ url" : "baseURL + '/Roo/ipshead.php'",
1073                                             "xtype" : "HttpProxy",
1074                                             "method" : "GET",
1075                                             "$ xns" : "Roo.data",
1076                                             "* prop" : "proxy"
1077                                         },
1078                                         {
1079                                             "id" : "ipshead_id",
1080                                             "root" : "data",
1081                                             "xtype" : "JsonReader",
1082                                             "$ fields" : "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    }\n]",
1083                                             "$ xns" : "Roo.data",
1084                                             "* prop" : "reader",
1085                                             "totalProperty" : "total"
1086                                         }
1087                                     ]
1088                                 },
1089                                 {
1090                                     "pageSize" : 50,
1091                                     "xtype" : "PagingToolbar",
1092                                     "emptyMsg" : "Nothing found",
1093                                     "$ xns" : "Roo",
1094                                     "displayMsg" : "Displaying records {0} - {1} of {2}",
1095                                     "displayInfo" : true,
1096                                     "* prop" : "footer"
1097                                 },
1098                                 {
1099                                     "xtype" : "ColumnModel",
1100                                     "header" : "Name",
1101                                     "width" : 150,
1102                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1103                                     "$ xns" : "Roo.grid",
1104                                     "* prop" : "colModel[]",
1105                                     "dataIndex" : "ipshead_name"
1106                                 },
1107                                 {
1108                                     "xtype" : "ColumnModel",
1109                                     "header" : "Description",
1110                                     "width" : 150,
1111                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1112                                     "$ xns" : "Roo.grid",
1113                                     "* prop" : "colModel[]",
1114                                     "dataIndex" : "ipshead_descrip"
1115                                 },
1116                                 {
1117                                     "xtype" : "ColumnModel",
1118                                     "header" : "Currency",
1119                                     "width" : 100,
1120                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1121                                     "$ xns" : "Roo.grid",
1122                                     "* prop" : "colModel[]",
1123                                     "dataIndex" : "ipshead_curr_id_curr_name"
1124                                 },
1125                                 {
1126                                     "align" : "right",
1127                                     "xtype" : "ColumnModel",
1128                                     "header" : "Price",
1129                                     "width" : 120,
1130                                     "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
1131                                     "$ xns" : "Roo.grid",
1132                                     "* prop" : "colModel[]",
1133                                     "dataIndex" : "ipshead_ipsitem_price",
1134                                     "items" : [
1135                                         {
1136                                             "xtype" : "GridEditor",
1137                                             "$ xns" : "Roo.grid",
1138                                             "* prop" : "editor",
1139                                             "items" : [
1140                                                 {
1141                                                     "xtype" : "NumberField",
1142                                                     "cls" : "align-right",
1143                                                     "decimalPrecision" : 2,
1144                                                     "$ xns" : "Roo.form",
1145                                                     "* prop" : "field"
1146                                                 }
1147                                             ]
1148                                         }
1149                                     ]
1150                                 }
1151                             ]
1152                         }
1153                     ]
1154                 },
1155                 {
1156                     "listeners" : {
1157                         "|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 false;\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 false;\n    }\n    \n    if (_this.itemsrcgrid) {\n        _this.itemsrcgrid.footer.onClick('first');\n    }\n}"
1158                     },
1159                     "fitToframe" : true,
1160                     "background" : true,
1161                     "region" : "center",
1162                     "title" : "Suppliers",
1163                     "xtype" : "GridPanel",
1164                     "fitContainer" : true,
1165                     "$ xns" : "Roo",
1166                     "tableName" : "itemsrc",
1167                     "items" : [
1168                         {
1169                             "listeners" : {
1170                                 "|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",
1171                                 "|render" : "function() \n{\n    _this.itemsrcgrid = this; \n    \n    if (_this.itemsrcpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
1172                                 "afteredit" : "function (e)\n{\n    e.record.commit();\n}"
1173                             },
1174                             "autoExpandColumn" : "itemsrc_comments",
1175                             "xtype" : "EditorGrid",
1176                             "loadMask" : true,
1177                             "clicksToEdit" : 1,
1178                             "$ xns" : "Roo.grid",
1179                             "* prop" : "grid",
1180                             "items" : [
1181                                 {
1182                                     "listeners" : {
1183                                         "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}",
1184                                         "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}"
1185                                     },
1186                                     "xtype" : "Store",
1187                                     "remoteSort" : true,
1188                                     "$ sortInfo" : "{ field : 'itemsrc_vend_id_vend_name', direction: 'ASC' }",
1189                                     "$ xns" : "Roo.data",
1190                                     "* prop" : "dataSource",
1191                                     "items" : [
1192                                         {
1193                                             "$ url" : "baseURL + '/Roo/itemsrc.php'",
1194                                             "method" : "GET",
1195                                             "xtype" : "HttpProxy",
1196                                             "$ xns" : "Roo.data",
1197                                             "* prop" : "proxy"
1198                                         },
1199                                         {
1200                                             "id" : "id",
1201                                             "root" : "data",
1202                                             "xtype" : "JsonReader",
1203                                             "$ xns" : "Roo.data",
1204                                             "$ 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]",
1205                                             "* prop" : "reader",
1206                                             "totalProperty" : "total"
1207                                         }
1208                                     ]
1209                                 },
1210                                 {
1211                                     "pageSize" : 25,
1212                                     "xtype" : "PagingToolbar",
1213                                     "emptyMsg" : "No itemsrc found",
1214                                     "$ xns" : "Roo",
1215                                     "displayInfo" : true,
1216                                     "displayMsg" : "Displaying itemsrc{0} - {1} of {2}",
1217                                     "* prop" : "footer"
1218                                 },
1219                                 {
1220                                     "xtype" : "Toolbar",
1221                                     "$ xns" : "Roo",
1222                                     "* prop" : "toolbar",
1223                                     "items" : [
1224                                         {
1225                                             "listeners" : {
1226                                                 "|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         itemsrc_vend_id : 0,\n         itemsrc_vend_id_vend_name : '',\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"
1227                                             },
1228                                             "text" : "Add",
1229                                             "xtype" : "Button",
1230                                             "cls" : "x-btn-text-icon",
1231                                             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1232                                             "$ xns" : "Roo.Toolbar"
1233                                         }
1234                                     ]
1235                                 },
1236                                 {
1237                                     "xtype" : "ColumnModel",
1238                                     "header" : "Vendor",
1239                                     "width" : 120,
1240                                     "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); }",
1241                                     "$ xns" : "Roo.grid",
1242                                     "* prop" : "colModel[]",
1243                                     "dataIndex" : "itemsrc_vend_id",
1244                                     "items" : [
1245                                         {
1246                                             "xtype" : "GridEditor",
1247                                             "$ xns" : "Roo.grid",
1248                                             "* prop" : "editor",
1249                                             "items" : [
1250                                                 {
1251                                                     "listWidth" : 400,
1252                                                     "triggerAction" : "all",
1253                                                     "forceSelection" : true,
1254                                                     "selectOnFocus" : true,
1255                                                     "pageSize" : 20,
1256                                                     "displayField" : "vend_name",
1257                                                     "emptyText" : "Select Vendor",
1258                                                     "hiddenName" : "itemsrc_vend_id",
1259                                                     "minChars" : 2,
1260                                                     "valueField" : "vend_id",
1261                                                     "xtype" : "ComboBox",
1262                                                     "allowBlank" : false,
1263                                                     "typeAhead" : true,
1264                                                     "editable" : true,
1265                                                     "width" : 300,
1266                                                     "$ xns" : "Roo.form",
1267                                                     "* prop" : "field",
1268                                                     "name" : "itemsrc_vend_id_vend_name",
1269                                                     "qtip" : "Select vendinfo",
1270                                                     "queryParam" : "q[search]",
1271                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
1272                                                     "loadingText" : "Searching...",
1273                                                     "items" : [
1274                                                         {
1275                                                             "listeners" : {
1276                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
1277                                                             },
1278                                                             "xtype" : "Store",
1279                                                             "remoteSort" : true,
1280                                                             "$ xns" : "Roo.data",
1281                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
1282                                                             "* prop" : "store",
1283                                                             "items" : [
1284                                                                 {
1285                                                                     "$ url" : "baseURL + '/Roo/vendinfo.php'",
1286                                                                     "method" : "GET",
1287                                                                     "xtype" : "HttpProxy",
1288                                                                     "$ xns" : "Roo.data",
1289                                                                     "* prop" : "proxy"
1290                                                                 },
1291                                                                 {
1292                                                                     "id" : "id",
1293                                                                     "root" : "data",
1294                                                                     "xtype" : "JsonReader",
1295                                                                     "$ xns" : "Roo.data",
1296                                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"vend_name\",\"type\":\"string\"}]",
1297                                                                     "* prop" : "reader",
1298                                                                     "totalProperty" : "total"
1299                                                                 }
1300                                                             ]
1301                                                         }
1302                                                     ]
1303                                                 }
1304                                             ]
1305                                         }
1306                                     ]
1307                                 },
1308                                 {
1309                                     "xtype" : "ColumnModel",
1310                                     "header" : "Vendor Ref#",
1311                                     "width" : 100,
1312                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1313                                     "$ xns" : "Roo.grid",
1314                                     "* prop" : "colModel[]",
1315                                     "dataIndex" : "itemsrc_vend_item_number",
1316                                     "items" : [
1317                                         {
1318                                             "xtype" : "GridEditor",
1319                                             "$ xns" : "Roo.grid",
1320                                             "* prop" : "editor",
1321                                             "items" : [
1322                                                 {
1323                                                     "xtype" : "TextField",
1324                                                     "$ xns" : "Roo.form",
1325                                                     "* prop" : "field"
1326                                                 }
1327                                             ]
1328                                         }
1329                                     ]
1330                                 },
1331                                 {
1332                                     "xtype" : "ColumnModel",
1333                                     "header" : "Comments",
1334                                     "width" : 200,
1335                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1336                                     "$ xns" : "Roo.grid",
1337                                     "* prop" : "colModel[]",
1338                                     "dataIndex" : "itemsrc_comments",
1339                                     "items" : [
1340                                         {
1341                                             "xtype" : "GridEditor",
1342                                             "$ xns" : "Roo.grid",
1343                                             "* prop" : "editor",
1344                                             "items" : [
1345                                                 {
1346                                                     "xtype" : "TextField",
1347                                                     "$ xns" : "Roo.form",
1348                                                     "* prop" : "field"
1349                                                 }
1350                                             ]
1351                                         }
1352                                     ]
1353                                 },
1354                                 {
1355                                     "xtype" : "ColumnModel",
1356                                     "header" : "UOM",
1357                                     "width" : 50,
1358                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1359                                     "$ xns" : "Roo.grid",
1360                                     "* prop" : "colModel[]",
1361                                     "dataIndex" : "itemsrc_vend_uom"
1362                                 },
1363                                 {
1364                                     "align" : "right",
1365                                     "xtype" : "ColumnModel",
1366                                     "header" : "Min Qty",
1367                                     "width" : 50,
1368                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1369                                     "$ xns" : "Roo.grid",
1370                                     "* prop" : "colModel[]",
1371                                     "dataIndex" : "itemsrc_minordqty",
1372                                     "items" : [
1373                                         {
1374                                             "xtype" : "GridEditor",
1375                                             "$ xns" : "Roo.grid",
1376                                             "* prop" : "editor",
1377                                             "items" : [
1378                                                 {
1379                                                     "minValue" : 0,
1380                                                     "xtype" : "NumberField",
1381                                                     "decimalPrecision" : 0,
1382                                                     "$ xns" : "Roo.form",
1383                                                     "* prop" : "field"
1384                                                 }
1385                                             ]
1386                                         }
1387                                     ]
1388                                 },
1389                                 {
1390                                     "align" : "right",
1391                                     "xtype" : "ColumnModel",
1392                                     "header" : "Lead time",
1393                                     "width" : 75,
1394                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1395                                     "$ xns" : "Roo.grid",
1396                                     "* prop" : "colModel[]",
1397                                     "dataIndex" : "itemsrc_leadtime",
1398                                     "items" : [
1399                                         {
1400                                             "xtype" : "GridEditor",
1401                                             "$ xns" : "Roo.grid",
1402                                             "* prop" : "editor",
1403                                             "items" : [
1404                                                 {
1405                                                     "minValue" : 0,
1406                                                     "xtype" : "NumberField",
1407                                                     "decimalPrecision" : 0,
1408                                                     "$ xns" : "Roo.form",
1409                                                     "* prop" : "field"
1410                                                 }
1411                                             ]
1412                                         }
1413                                     ]
1414                                 },
1415                                 {
1416                                     "xtype" : "ColumnModel",
1417                                     "header" : "Active",
1418                                     "width" : 50,
1419                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1420                                     "$ xns" : "Roo.grid",
1421                                     "* prop" : "colModel[]",
1422                                     "dataIndex" : "itemsrc_active"
1423                                 }
1424                             ]
1425                         }
1426                     ]
1427                 },
1428                 {
1429                     "listeners" : {
1430                         "|activate" : "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
1431                     },
1432                     "fitToframe" : true,
1433                     "background" : true,
1434                     "region" : "center",
1435                     "title" : "History",
1436                     "xtype" : "GridPanel",
1437                     "fitContainer" : true,
1438                     "$ xns" : "Roo",
1439                     "tableName" : "events",
1440                     "items" : [
1441                         {
1442                             "listeners" : {
1443                                 "|render" : "function() \n{\n    _this.hgrid = this; \n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
1444                             },
1445                             "autoExpandColumn" : "remarks",
1446                             "xtype" : "Grid",
1447                             "loadMask" : true,
1448                             "$ xns" : "Roo.grid",
1449                             "* prop" : "grid",
1450                             "items" : [
1451                                 {
1452                                     "listeners" : {
1453                                         "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}"
1454                                     },
1455                                     "xtype" : "Store",
1456                                     "remoteSort" : true,
1457                                     "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
1458                                     "$ xns" : "Roo.data",
1459                                     "* prop" : "dataSource",
1460                                     "items" : [
1461                                         {
1462                                             "$ url" : "baseURL + '/Roo/events.php'",
1463                                             "xtype" : "HttpProxy",
1464                                             "method" : "GET",
1465                                             "$ xns" : "Roo.data",
1466                                             "* prop" : "proxy"
1467                                         },
1468                                         {
1469                                             "id" : "id",
1470                                             "root" : "data",
1471                                             "xtype" : "JsonReader",
1472                                             "$ 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]",
1473                                             "$ xns" : "Roo.data",
1474                                             "* prop" : "reader",
1475                                             "totalProperty" : "total"
1476                                         }
1477                                     ]
1478                                 },
1479                                 {
1480                                     "pageSize" : 25,
1481                                     "xtype" : "PagingToolbar",
1482                                     "emptyMsg" : "No Events found",
1483                                     "$ xns" : "Roo",
1484                                     "displayMsg" : "Displaying events{0} - {1} of {2}",
1485                                     "displayInfo" : true,
1486                                     "* prop" : "footer"
1487                                 },
1488                                 {
1489                                     "xtype" : "ColumnModel",
1490                                     "header" : "Changed",
1491                                     "width" : 120,
1492                                     "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
1493                                     "$ xns" : "Roo.grid",
1494                                     "* prop" : "colModel[]",
1495                                     "dataIndex" : "event_when"
1496                                 },
1497                                 {
1498                                     "xtype" : "ColumnModel",
1499                                     "header" : "Action",
1500                                     "width" : 200,
1501                                     "$ renderer" : "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
1502                                     "$ xns" : "Roo.grid",
1503                                     "* prop" : "colModel[]",
1504                                     "dataIndex" : "action"
1505                                 },
1506                                 {
1507                                     "xtype" : "ColumnModel",
1508                                     "header" : "IP Address",
1509                                     "width" : 200,
1510                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1511                                     "$ xns" : "Roo.grid",
1512                                     "* prop" : "colModel[]",
1513                                     "dataIndex" : "ipaddr"
1514                                 },
1515                                 {
1516                                     "xtype" : "ColumnModel",
1517                                     "header" : "Who",
1518                                     "width" : 75,
1519                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1520                                     "$ xns" : "Roo.grid",
1521                                     "* prop" : "colModel[]",
1522                                     "dataIndex" : "person_id_name"
1523                                 },
1524                                 {
1525                                     "xtype" : "ColumnModel",
1526                                     "header" : "Notes",
1527                                     "width" : 200,
1528                                     "$ renderer" : "function(v) { return String.format('{0}', v); }",
1529                                     "$ xns" : "Roo.grid",
1530                                     "* prop" : "colModel[]",
1531                                     "dataIndex" : "remarks"
1532                                 }
1533                             ]
1534                         }
1535                     ]
1536                 },
1537                 {
1538                     "listeners" : {
1539                         "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
1540                     },
1541                     "text" : "Cancel",
1542                     "xtype" : "Button",
1543                     "$ xns" : "Roo",
1544                     "* prop" : "buttons[]"
1545                 },
1546                 {
1547                     "listeners" : {
1548                         "render" : "function (_self)\n{\n    _this.saveBtn = this;\n}",
1549                         "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n  //  _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
1550                     },
1551                     "text" : "Save",
1552                     "xtype" : "Button",
1553                     "$ xns" : "Roo",
1554                     "* prop" : "buttons[]"
1555                 }
1556             ]
1557         }
1558     ]
1559 }