Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendorEdit.bjs
1 {
2     "id": "roo-file-39",
3     "name": "Pman.Dialog.XtupleVendorEdit",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleVendorEdit.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    this.layout.getRegion('center').showPanel(0);\n}"
11             },
12             "closable": false,
13             "collapsible": false,
14             "height": 550,
15             "modal": true,
16             "resizable": false,
17             "title": "Edit / Create Vendor",
18             "width": 600,
19             "xtype": "LayoutDialog",
20             "|xns": "Roo",
21             "items": [
22                 {
23                     "*prop": "center",
24                     "tabPosition": "top",
25                     "xtype": "LayoutRegion",
26                     "|xns": "Roo"
27                 },
28                 {
29                     "region": "center",
30                     "title": "Details",
31                     "xtype": "ContentPanel",
32                     "|xns": "Roo",
33                     "items": [
34                         {
35                             "listeners": {
36                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        if(_this.data.vend_id){\n            _this.dialog.el.mask(\"Loading\");\n            this.load({ method: 'GET', params: { '_id' : _this.data.vend_id }});     \n        }\n       \n       return;\n    }\n    if (action.type == 'load') {\n        _this.data = action.result.data;\n        _this.form.findField('addr_view').sync();\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\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",
37                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
38                             },
39                             "method": "POST",
40                             "style": "margin:10px;",
41                             "xtype": "Form",
42                             "|url": "baseURL + '/Roo/vendinfo.php'",
43                             "|xns": "Roo.form",
44                             "items": [
45                                 {
46                                     "legend": "Basic Details",
47                                     "style": "width:450px",
48                                     "xtype": "FieldSet",
49                                     "|xns": "Roo.form",
50                                     "items": [
51                                         {
52                                             "listeners": {
53                                                 "keyup": "function (_self, e)\n{\n    if (!(_this.form.findField('vend_id').getValue() * 1)) {\n    \n        _this.form.findField('vend_number').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());\n    \n    }\n}"
54                                             },
55                                             "allowBlank": false,
56                                             "fieldLabel": "Name",
57                                             "name": "vend_name",
58                                             "width": 200,
59                                             "xtype": "TextField",
60                                             "|xns": "Roo.form"
61                                         },
62                                         {
63                                             "allowBlank": false,
64                                             "fieldLabel": "Vendor #",
65                                             "name": "vend_number",
66                                             "readOnly": true,
67                                             "width": 200,
68                                             "xtype": "TextField",
69                                             "|xns": "Roo.form"
70                                         },
71                                         {
72                                             "allowBlank": true,
73                                             "fieldLabel": "Ship Via",
74                                             "name": "vend_shipvia",
75                                             "width": 200,
76                                             "xtype": "TextField",
77                                             "|xns": "Roo.form"
78                                         },
79                                         {
80                                             "allowBlank": false,
81                                             "alwaysQuery": true,
82                                             "displayField": "curr_symbol",
83                                             "editable": false,
84                                             "emptyText": "Select Currency",
85                                             "fieldLabel": "Currency",
86                                             "forceSelection": true,
87                                             "hiddenName": "vend_curr_id",
88                                             "listWidth": 400,
89                                             "loadingText": "Searching...",
90                                             "minChars": 2,
91                                             "name": "vend_curr_id_curr_symbol",
92                                             "pageSize": 20,
93                                             "qtip": "Select Currency",
94                                             "queryParam": "query[curr_symbol]",
95                                             "selectOnFocus": true,
96                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_symbol}</b> </div>",
97                                             "triggerAction": "all",
98                                             "typeAhead": true,
99                                             "valueField": "curr_id",
100                                             "width": 200,
101                                             "xtype": "ComboBox",
102                                             "|xns": "Roo.form",
103                                             "items": [
104                                                 {
105                                                     "listeners": {
106                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n}\n"
107                                                     },
108                                                     "*prop": "store",
109                                                     "remoteSort": true,
110                                                     "xtype": "Store",
111                                                     "|sortInfo": "{ direction : 'ASC', field: 'curr_symbol' }",
112                                                     "|xns": "Roo.data",
113                                                     "items": [
114                                                         {
115                                                             "*prop": "proxy",
116                                                             "xtype": "HttpProxy",
117                                                             "method": "GET",
118                                                             "|xns": "Roo.data",
119                                                             "|url": "baseURL + '/Roo/curr_symbol.php'"
120                                                         },
121                                                         {
122                                                             "*prop": "reader",
123                                                             "xtype": "JsonReader",
124                                                             "|xns": "Roo.data",
125                                                             "id": "curr_id",
126                                                             "root": "data",
127                                                             "totalProperty": "total",
128                                                             "|fields": "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]"
129                                                         }
130                                                     ]
131                                                 }
132                                             ]
133                                         },
134                                         {
135                                             "allowBlank": false,
136                                             "alwaysQuery": true,
137                                             "displayField": "terms_descrip",
138                                             "editable": false,
139                                             "emptyText": "Select Terms",
140                                             "fieldLabel": "Terms",
141                                             "forceSelection": true,
142                                             "hiddenName": "vend_terms_id",
143                                             "listWidth": 400,
144                                             "loadingText": "Searching...",
145                                             "minChars": 2,
146                                             "name": "vend_terms_id_terms_descrip",
147                                             "pageSize": 20,
148                                             "qtip": "Select Terms",
149                                             "queryParam": "query[terms_descrip]",
150                                             "selectOnFocus": true,
151                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>",
152                                             "triggerAction": "all",
153                                             "typeAhead": true,
154                                             "valueField": "terms_id",
155                                             "width": 200,
156                                             "xtype": "ComboBox",
157                                             "|xns": "Roo.form",
158                                             "items": [
159                                                 {
160                                                     "listeners": {
161                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n}\n"
162                                                     },
163                                                     "*prop": "store",
164                                                     "remoteSort": true,
165                                                     "xtype": "Store",
166                                                     "|sortInfo": "{ direction : 'ASC', field: 'terms_descrip' }",
167                                                     "|xns": "Roo.data",
168                                                     "items": [
169                                                         {
170                                                             "*prop": "proxy",
171                                                             "xtype": "HttpProxy",
172                                                             "method": "GET",
173                                                             "|xns": "Roo.data",
174                                                             "|url": "baseURL + '/Roo/terms.php'"
175                                                         },
176                                                         {
177                                                             "*prop": "reader",
178                                                             "xtype": "JsonReader",
179                                                             "|xns": "Roo.data",
180                                                             "id": "terms_id",
181                                                             "root": "data",
182                                                             "totalProperty": "total",
183                                                             "|fields": "[{\"name\":\"terms_id\",\"type\":\"int\"},\"terms_descrip\"]"
184                                                         }
185                                                     ]
186                                                 }
187                                             ]
188                                         },
189                                         {
190                                             "allowBlank": false,
191                                             "alwaysQuery": true,
192                                             "displayField": "taxzone_descrip",
193                                             "editable": false,
194                                             "emptyText": "Select Taxzone",
195                                             "fieldLabel": "Tax Zone",
196                                             "forceSelection": true,
197                                             "hiddenName": "vend_taxzone_id",
198                                             "listWidth": 400,
199                                             "loadingText": "Searching...",
200                                             "minChars": 2,
201                                             "name": "vend_taxzone_id_taxzone_descrip",
202                                             "pageSize": 20,
203                                             "qtip": "Select Taxzone",
204                                             "queryParam": "query[taxzone_descrip]",
205                                             "selectOnFocus": true,
206                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>",
207                                             "triggerAction": "all",
208                                             "typeAhead": true,
209                                             "valueField": "taxzone_id",
210                                             "width": 200,
211                                             "xtype": "ComboBox",
212                                             "|xns": "Roo.form",
213                                             "items": [
214                                                 {
215                                                     "listeners": {
216                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n}\n"
217                                                     },
218                                                     "*prop": "store",
219                                                     "remoteSort": true,
220                                                     "xtype": "Store",
221                                                     "|sortInfo": "{ direction : 'ASC', field: 'taxzone_descrip' }",
222                                                     "|xns": "Roo.data",
223                                                     "items": [
224                                                         {
225                                                             "*prop": "proxy",
226                                                             "xtype": "HttpProxy",
227                                                             "method": "GET",
228                                                             "|xns": "Roo.data",
229                                                             "|url": "baseURL + '/Roo/taxzone.php'"
230                                                         },
231                                                         {
232                                                             "*prop": "reader",
233                                                             "xtype": "JsonReader",
234                                                             "|xns": "Roo.data",
235                                                             "id": "taxzone_id",
236                                                             "root": "data",
237                                                             "totalProperty": "total",
238                                                             "|fields": "[{\"name\":\"taxzone_id\",\"type\":\"int\"},\"taxzone_descrip\"]"
239                                                         }
240                                                     ]
241                                                 }
242                                             ]
243                                         },
244                                         {
245                                             "listeners": {
246                                                 "add": "function (combo)\n{\n    Pman.Dialog.XtupleVendTypeEdit.show({vendtype_id : 0}, function(res){\n        _this.form.findField('vend_vendtype_id').setFromData(res);\n    \n    });\n}",
247                                                 "edit": "function (combo, record)\n{\n    var s = _this.form.findField('vend_vendtype_id').getValue() * 1;\n    if(s < 1){\n        Roo.MessageBox.alert('Error','Please select a type');\n        return;\n    }\n\n    Pman.Dialog.XtupleVendTypeEdit.show({vendtype_id : s}, function(res){\n\n        _this.form.findField('vend_vendtype_id').setFromData(res);\n    \n    });\n}"
248                                             },
249                                             "allowBlank": false,
250                                             "alwaysQuery": true,
251                                             "displayField": "vendtype_descrip",
252                                             "editable": false,
253                                             "emptyText": "Select Vendor Type",
254                                             "fieldLabel": "Type",
255                                             "forceSelection": true,
256                                             "hiddenName": "vend_vendtype_id",
257                                             "listWidth": 400,
258                                             "loadingText": "Searching...",
259                                             "minChars": 2,
260                                             "name": "vend_vendtype_id_vendtype_descrip",
261                                             "pageSize": 20,
262                                             "qtip": "Select Vendor Type",
263                                             "queryParam": "query[vendtype_descrip]",
264                                             "selectOnFocus": true,
265                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{vendtype_descrip}</b> </div>",
266                                             "triggerAction": "all",
267                                             "typeAhead": true,
268                                             "valueField": "vendtype_id",
269                                             "width": 200,
270                                             "xtype": "ComboBox",
271                                             "|xns": "Roo.form",
272                                             "items": [
273                                                 {
274                                                     "listeners": {
275                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n}\n"
276                                                     },
277                                                     "*prop": "store",
278                                                     "remoteSort": true,
279                                                     "xtype": "Store",
280                                                     "|sortInfo": "{ direction : 'ASC', field: 'vendtype_descrip' }",
281                                                     "|xns": "Roo.data",
282                                                     "items": [
283                                                         {
284                                                             "*prop": "proxy",
285                                                             "method": "GET",
286                                                             "xtype": "HttpProxy",
287                                                             "|url": "baseURL + '/Roo/vendtype.php'",
288                                                             "|xns": "Roo.data"
289                                                         },
290                                                         {
291                                                             "*prop": "reader",
292                                                             "id": "vendtype_id",
293                                                             "root": "data",
294                                                             "totalProperty": "total",
295                                                             "xtype": "JsonReader",
296                                                             "|fields": "[{\"name\":\"vendtype_id\",\"type\":\"int\"},\"vendtype_descrip\"]",
297                                                             "|xns": "Roo.data"
298                                                         }
299                                                     ]
300                                                 }
301                                             ]
302                                         },
303                                         {
304                                             "fieldLabel": "Active",
305                                             "inputValue": "true",
306                                             "name": "vend_active",
307                                             "valueOff": 0,
308                                             "xtype": "Checkbox",
309                                             "|xns": "Roo.form"
310                                         },
311                                         {
312                                             "allowBlank": true,
313                                             "fieldLabel": "Comments",
314                                             "name": "vend_comments",
315                                             "xtype": "TextArea",
316                                             "|xns": "Roo.form"
317                                         }
318                                     ]
319                                 },
320                                 {
321                                     "hideLabels": true,
322                                     "legend": "Address",
323                                     "style": "width:450px;",
324                                     "xtype": "FieldSet",
325                                     "|xns": "Roo.form",
326                                     "items": [
327                                         {
328                                             "listeners": {
329                                                 "add": "function (combo)\n{\n    Pman.Dialog.XtupleAddress.show({addr_id : 0});\n}",
330                                                 "edit": "function (combo, record)\n{\n    var s = _this.form.findField('vend_addr_id').getValue() * 1;\n    if(s < 1){\n        Roo.MessageBox.alert('Error','Please select a address');\n        return;\n    }\n    Pman.Dialog.XtupleAddress.show({addr_id : s});\n}",
331                                                 "select": "function (combo, record, index)\n{\n    for(var i in record.data) {\n        _this.data['vend_addr_id_' + i] = record.data[i];\n    }\n\n    _this.form.findField('addr_view').sync();\n}"
332                                             },
333                                             "allowBlank": false,
334                                             "alwaysQuery": true,
335                                             "displayField": "addr_number",
336                                             "editable": true,
337                                             "emptyText": "Select Address",
338                                             "fieldLabel": "Address",
339                                             "forceSelection": true,
340                                             "hiddenName": "vend_addr_id",
341                                             "listWidth": 400,
342                                             "loadingText": "Searching...",
343                                             "minChars": 2,
344                                             "name": "vend_addr_id_addr_number",
345                                             "pageSize": 20,
346                                             "qtip": "Select Address",
347                                             "queryParam": "query[address]",
348                                             "selectOnFocus": true,
349                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>#{addr_id} - {addr_number}</b> </div>",
350                                             "triggerAction": "all",
351                                             "typeAhead": true,
352                                             "valueField": "addr_id",
353                                             "width": 400,
354                                             "xtype": "ComboBox",
355                                             "|xns": "Roo.form",
356                                             "items": [
357                                                 {
358                                                     "listeners": {
359                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    addr_active = 1;\n}\n"
360                                                     },
361                                                     "*prop": "store",
362                                                     "remoteSort": true,
363                                                     "xtype": "Store",
364                                                     "|sortInfo": "{ direction : 'DESC', field: 'addr_id' }",
365                                                     "|xns": "Roo.data",
366                                                     "items": [
367                                                         {
368                                                             "*prop": "proxy",
369                                                             "method": "GET",
370                                                             "xtype": "HttpProxy",
371                                                             "|url": "baseURL + '/Roo/addr.php'",
372                                                             "|xns": "Roo.data"
373                                                         },
374                                                         {
375                                                             "*prop": "reader",
376                                                             "id": "addr_id",
377                                                             "root": "data",
378                                                             "totalProperty": "total",
379                                                             "xtype": "JsonReader",
380                                                             "|fields": "[{\"name\":\"addr_id\",\"type\":\"int\"},\"addr_number\"]",
381                                                             "|xns": "Roo.data"
382                                                         }
383                                                     ]
384                                                 }
385                                             ]
386                                         },
387                                         {
388                                             "allowBlank": true,
389                                             "fieldLabel": "Notes",
390                                             "name": "addr_view",
391                                             "readOnly": true,
392                                             "width": 400,
393                                             "xtype": "TextArea",
394                                             "|sync": "function() {\n    var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];\n    var v = [];\n    \n    Roo.each(a, function(e) {\n        if (_this.data['vend_addr_id_addr_' +e].length) {\n            v.push(_this.data['vend_addr_id_addr_' +e]);\n        }\n    });\n    \n    this.setValue(v.join(\"\\n\"));\n}\n",
395                                             "|xns": "Roo.form"
396                                         }
397                                     ]
398                                 },
399                                 {
400                                     "name": "vend_id",
401                                     "xtype": "Hidden",
402                                     "|xns": "Roo.form"
403                                 }
404                             ]
405                         }
406                     ]
407                 },
408                 {
409                     "listeners": {
410                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
411                     },
412                     "background": true,
413                     "fitContainer": true,
414                     "fitToframe": true,
415                     "region": "center",
416                     "tableName": "itemsrc",
417                     "title": "Supplier of",
418                     "xtype": "GridPanel",
419                     "|xns": "Roo",
420                     "items": [
421                         {
422                             "listeners": {
423                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
424                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n   \n   Pman.Dialog.XtupleItem.show({ item_id  : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
425                             },
426                             "*prop": "grid",
427                             "autoExpandColumn": "itemsrc_vend_item_descrip",
428                             "loadMask": true,
429                             "xtype": "Grid",
430                             "|xns": "Roo.grid",
431                             "items": [
432                                 {
433                                     "listeners": {
434                                         "beforeload": "function (_self, options)\n{\n    options.params.itemsrc_vend_id =   _this.form.findField('vend_id').getValue();\n    var s = _this.searchBox.getValue();\n    if (s.length) {\n        options.params['search[name]'] = s;\n    }\n}"
435                                     },
436                                     "*prop": "dataSource",
437                                     "remoteSort": true,
438                                     "xtype": "Store",
439                                     "|sortInfo": "{ field : 'itemsrc_item_id_item_number', direction: 'ASC' }",
440                                     "|xns": "Roo.data",
441                                     "items": [
442                                         {
443                                             "*prop": "proxy",
444                                             "xtype": "HttpProxy",
445                                             "method": "GET",
446                                             "|url": "baseURL + '/Roo/itemsrc.php'",
447                                             "|xns": "Roo.data"
448                                         },
449                                         {
450                                             "|xns": "Roo.data",
451                                             "xtype": "JsonReader",
452                                             "totalProperty": "total",
453                                             "root": "data",
454                                             "*prop": "reader",
455                                             "id": "id",
456                                             "|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]"
457                                         }
458                                     ]
459                                 },
460                                 {
461                                     "*prop": "footer",
462                                     "displayInfo": true,
463                                     "displayMsg": "Displaying itemsrc{0} - {1} of {2}",
464                                     "emptyMsg": "No itemsrc found",
465                                     "pageSize": 100,
466                                     "xtype": "PagingToolbar",
467                                     "|xns": "Roo"
468                                 },
469                                 {
470                                     "*prop": "toolbar",
471                                     "xtype": "Toolbar",
472                                     "|xns": "Roo",
473                                     "items": [
474                                         {
475                                             "listeners": {
476                                                 "render": "function (_self)\n{\n    _this.searchBox = _self;\n}",
477                                                 "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
478                                             },
479                                             "xtype": "TextField",
480                                             "|xns": "Roo.form"
481                                         },
482                                         {
483                                             "listeners": {
484                                                 "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
485                                             },
486                                             "cls": "x-btn-icon",
487                                             "xtype": "Button",
488                                             "|icon": "rootURL + '/Pman/templates/images/search.gif'",
489                                             "|xns": "Roo.Toolbar"
490                                         },
491                                         {
492                                             "listeners": {
493                                                 "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
494                                             },
495                                             "cls": "x-btn-icon",
496                                             "xtype": "Button",
497                                             "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
498                                             "|xns": "Roo.Toolbar"
499                                         },
500                                         {
501                                             "|xns": "Roo.Toolbar",
502                                             "xtype": "Fill"
503                                         },
504                                         {
505                                             "listeners": {
506                                                 "|click": "function()\n{\n   \n    Pman.Dialog.XtupleSalesProductList.show({\n        exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),\n        multi_select : true\n    \n    }, function(sels) {\n       Roo.log(sels); \n\n       var ids = [];\n       Roo.each(sels,function(rec) {\n            ids.push(rec.data.item_id);\n        });\n        new Pman.Request({\n            mask: \"Adding\",\n            url : baseURL + '/Roo/Itemsrc',\n            method: 'POST',\n            params : {\n                add_multiple : ids.join(','),\n                itemsrc_vend_id : _this.form.findField('vend_id').getValue()\n            },\n            success : function() { \n                \n            \n                  _this.grid.footer.onClick('first');\n          }\n      });\n              \n    \n    });\n   \n}\n"
507                                             },
508                                             "cls": "x-btn-text-icon",
509                                             "text": "Add",
510                                             "xtype": "Button",
511                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
512                                             "|xns": "Roo.Toolbar"
513                                         },
514                                         {
515                                             "listeners": {
516                                                 "|click": "function()\n{\n     Pman.genericDelete(_this, 'itemsrc'); \n}\n        "
517                                             },
518                                             "cls": "x-btn-text-icon",
519                                             "text": "Delete",
520                                             "xtype": "Button",
521                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
522                                             "|xns": "Roo.Toolbar"
523                                         }
524                                     ]
525                                 },
526                                 {
527                                     "*prop": "colModel[]",
528                                     "dataIndex": "itemsrc_item_id_item_number",
529                                     "header": "Item",
530                                     "width": 120,
531                                     "xtype": "ColumnModel",
532                                     "|renderer": "function(v) { return String.format('{0}', v); }",
533                                     "|xns": "Roo.grid"
534                                 },
535                                 {
536                                     "*prop": "colModel[]",
537                                     "dataIndex": "itemsrc_vend_item_number",
538                                     "header": "Vendor item number",
539                                     "width": 120,
540                                     "xtype": "ColumnModel",
541                                     "|renderer": "function(v) { return String.format('{0}', v); }",
542                                     "|xns": "Roo.grid"
543                                 },
544                                 {
545                                     "*prop": "colModel[]",
546                                     "dataIndex": "itemsrc_vend_item_descrip",
547                                     "header": "Vendor item description",
548                                     "width": 200,
549                                     "xtype": "ColumnModel",
550                                     "|renderer": "function(v) { return String.format('{0}', v); }",
551                                     "|xns": "Roo.grid"
552                                 },
553                                 {
554                                     "*prop": "colModel[]",
555                                     "dataIndex": "itemsrc_vend_uom",
556                                     "header": "Uom",
557                                     "width": 50,
558                                     "xtype": "ColumnModel",
559                                     "|renderer": "function(v) { return String.format('{0}', v); }",
560                                     "|xns": "Roo.grid"
561                                 },
562                                 {
563                                     "*prop": "colModel[]",
564                                     "dataIndex": "itemsrc_minordqty",
565                                     "header": "Min ord qty",
566                                     "width": 50,
567                                     "xtype": "ColumnModel",
568                                     "|renderer": "function(v) { return String.format('{0}', v); }",
569                                     "|xns": "Roo.grid"
570                                 },
571                                 {
572                                     "*prop": "colModel[]",
573                                     "dataIndex": "itemsrc_leadtime",
574                                     "header": "Lead time",
575                                     "width": 75,
576                                     "xtype": "ColumnModel",
577                                     "|renderer": "function(v) { return String.format('{0}', v); }",
578                                     "|xns": "Roo.grid"
579                                 },
580                                 {
581                                     "*prop": "colModel[]",
582                                     "dataIndex": "itemsrc_active",
583                                     "header": "Active",
584                                     "width": 75,
585                                     "xtype": "ColumnModel",
586                                     "|renderer": "function(v) { return String.format('{0}', v); }",
587                                     "|xns": "Roo.grid"
588                                 }
589                             ]
590                         }
591                     ]
592                 },
593                 {
594                     "listeners": {
595                         "|activate": "function() {\n    _this.apanel = this;\n    if (_this.agrid) {\n        _this.agrid.footer.onClick('first');\n    }\n}"
596                     },
597                     "background": true,
598                     "fitContainer": true,
599                     "fitToframe": true,
600                     "region": "center",
601                     "tableName": "vendaddrinfo",
602                     "title": "Addresses",
603                     "xtype": "GridPanel",
604                     "|xns": "Roo",
605                     "items": [
606                         {
607                             "listeners": {
608                                 "|render": "function() \n{\n    _this.agrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.apanel.active) {\n       this.footer.onClick('first');\n    }\n}"
609                             },
610                             "*prop": "grid",
611                             "autoExpandColumn": "vendaddr_addr_id_addr_line1",
612                             "loadMask": true,
613                             "xtype": "Grid",
614                             "|xns": "Roo.grid",
615                             "items": [
616                                 {
617                                     "*prop": "sm",
618                                     "singleSelect": true,
619                                     "xtype": "RowSelectionModel",
620                                     "|xns": "Roo.grid"
621                                 },
622                                 {
623                                     "listeners": {
624                                         "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var id = _this.form.findField('vend_id').getValue();\n    \n    if(id * 1 < 1){\n        return false;\n    }\n    \n    options.params.vendaddr_vend_id = id;\n}"
625                                     },
626                                     "*prop": "dataSource",
627                                     "remoteSort": true,
628                                     "xtype": "Store",
629                                     "|sortInfo": "{ field : 'vendaddr_id', direction: 'ASC' }",
630                                     "|xns": "Roo.data",
631                                     "items": [
632                                         {
633                                             "*prop": "proxy",
634                                             "method": "GET",
635                                             "xtype": "HttpProxy",
636                                             "|url": "baseURL + '/Roo/vendaddrinfo.php'",
637                                             "|xns": "Roo.data"
638                                         },
639                                         {
640                                             "*prop": "reader",
641                                             "id": "vendaddr_id",
642                                             "root": "data",
643                                             "totalProperty": "total",
644                                             "xtype": "JsonReader",
645                                             "|fields": "[\n    {\n        'name': 'vendaddr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vendaddr_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vendaddr_code',\n        'type': 'string'\n    }\n]",
646                                             "|xns": "Roo.data"
647                                         }
648                                     ]
649                                 },
650                                 {
651                                     "*prop": "footer",
652                                     "displayInfo": true,
653                                     "displayMsg": "Displaying address{0} - {1} of {2}",
654                                     "emptyMsg": "Nothing found",
655                                     "pageSize": 100,
656                                     "xtype": "PagingToolbar",
657                                     "|xns": "Roo"
658                                 },
659                                 {
660                                     "*prop": "toolbar",
661                                     "xtype": "Toolbar",
662                                     "|xns": "Roo",
663                                     "items": [
664                                         {
665                                             "|xns": "Roo.Toolbar",
666                                             "xtype": "Fill"
667                                         },
668                                         {
669                                             "listeners": {
670                                                 "click": "function (_self, e)\n{\n    var id = _this.form.findField('vend_id').getValue();\n    \n    if(id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please save the vendor first');\n        return;\n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/VendAddrInfo?' + Roo.urlEncode({'vend_id' : id})\n        \n       },\n       function (data) {\n            _this.agrid.footer.onClick('first');\n       }\n   );\n}"
671                                             },
672                                             "text": "Upload",
673                                             "xtype": "Button",
674                                             "|xns": "Roo.Toolbar"
675                                         },
676                                         {
677                                             "listeners": {
678                                                 "|click": "function()\n{\n     var s = _this.agrid.getSelectionModel().getSelected();\n     \n     if(!s || s.data.vendaddr_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n     }\n     \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that?\",\n        function(v) {\n            if (v != 'yes') {\n                return;\n            }\n             new Pman.Request({\n                method: 'POST',\n                url: baseURL+ '/Roo/vendaddrinfo',\n                params : {\n                    _delete : s.data.vendaddr_id\n                },\n                success : function() {\n                    _this.agrid.footer.onClick('refresh');\n                }\n            });\n    });\n}\n        "
679                                             },
680                                             "cls": "x-btn-text-icon",
681                                             "text": "Delete",
682                                             "xtype": "Button",
683                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
684                                             "|xns": "Roo.Toolbar"
685                                         },
686                                         {
687                                             "listeners": {
688                                                 "|click": "function()\n{\n     var s = _this.form.findField('vend_id').getValue() * 1;\n     \n     if(!s || s * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Save first!');\n        return;\n     }\n     \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete all the address?\",\n        function(v) {\n            if (v != 'yes') {\n                return;\n            }\n             new Pman.Request({\n                method: 'POST',\n                url: baseURL+ '/Roo/vendinfo',\n                params : {\n                    vend_id : s,\n                    _remove_addr : 1\n                },\n                success : function() {\n                    _this.agrid.footer.onClick('refresh');\n                }\n            });\n    });\n}\n        "
689                                             },
690                                             "cls": "x-btn-text-icon",
691                                             "text": "Delete All",
692                                             "xtype": "Button",
693                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
694                                             "|xns": "Roo.Toolbar"
695                                         }
696                                     ]
697                                 },
698                                 {
699                                     "*prop": "colModel[]",
700                                     "dataIndex": "vendaddr_code",
701                                     "header": "Code",
702                                     "width": 75,
703                                     "xtype": "ColumnModel",
704                                     "|renderer": "function(v) { return String.format('{0}', v); }",
705                                     "|xns": "Roo.grid"
706                                 },
707                                 {
708                                     "*prop": "colModel[]",
709                                     "dataIndex": "vendaddr_addr_id_addr_city",
710                                     "header": "District",
711                                     "width": 100,
712                                     "xtype": "ColumnModel",
713                                     "|renderer": "function(v) { return String.format('{0}', v); }",
714                                     "|xns": "Roo.grid"
715                                 },
716                                 {
717                                     "*prop": "colModel[]",
718                                     "dataIndex": "vendaddr_addr_id_addr_line1",
719                                     "header": "Address Line 1",
720                                     "width": 200,
721                                     "xtype": "ColumnModel",
722                                     "|renderer": "function(v) { return String.format('{0}', v); }",
723                                     "|xns": "Roo.grid"
724                                 },
725                                 {
726                                     "*prop": "colModel[]",
727                                     "dataIndex": "vendaddr_addr_id_addr_line2",
728                                     "header": "Address Line 2",
729                                     "width": 200,
730                                     "xtype": "ColumnModel",
731                                     "|renderer": "function(v) { return String.format('{0}', v); }",
732                                     "|xns": "Roo.grid"
733                                 }
734                             ]
735                         }
736                     ]
737                 },
738                 {
739                     "listeners": {
740                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
741                     },
742                     "*prop": "buttons[]",
743                     "text": "Cancel",
744                     "xtype": "Button",
745                     "|xns": "Roo"
746                 },
747                 {
748                     "listeners": {
749                         "click": "function (_self, e)\n{\n    _this.form.doAction(\"submit\");\n\n}"
750                     },
751                     "*prop": "buttons[]",
752                     "text": "Save",
753                     "xtype": "Button",
754                     "|xns": "Roo"
755                 }
756             ]
757         }
758     ],
759     "permname": "",
760     "modOrder": "001"
761 }