Pman.Tab.XtuplePurchasesVendors.bjs
[Pman.Xtuple] / Pman.Tab.XtuplePurchasesVendors.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.XtuplePurchasesVendors = new Roo.XComponent({
6     part     :  ["Xtuple","PurchasesVendors"],
7     order    : '300-Pman.Tab.XtuplePurchasesVendors',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtuplePurchases',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'NestedLayoutPanel',
19             xns: Roo,
20             background : true,
21             fitContainer : true,
22             fitToFrame : true,
23             region : 'center',
24             title : "Vendors",
25             layout : {
26                 xtype: 'BorderLayout',
27                 xns: Roo,
28                 items : [
29                     {
30                         xtype: 'GridPanel',
31                         xns: Roo,
32                         listeners : {
33                             activate : function() {
34                                 _this.panel = this;
35                                 if (_this.grid) {
36                                     _this.grid.footer.onClick('first');
37                                 }
38                             }
39                         },
40                         background : false,
41                         fitContainer : true,
42                         fitToframe : true,
43                         region : 'center',
44                         tableName : 'vendinfo',
45                         title : "Vendors",
46                         grid : {
47                             xtype: 'Grid',
48                             xns: Roo.grid,
49                             listeners : {
50                                 render : function() 
51                                 {
52                                     _this.grid = this; 
53                                     //_this.dialog = Pman.Dialog.FILL_IN
54                                     if (_this.panel.active) {
55                                        this.footer.onClick('first');
56                                     }
57                                 },
58                                 rowdblclick : function (_self, rowIndex, e)
59                                 {
60                                     var s = _this.grid.ds.getAt(rowIndex);
61                                     if(s.data.vend_id * 1 < 1){
62                                         Roo.MessageBox.alert("Error", "Select a row");
63                                     }
64                                     
65                                     Pman.Dialog.XtupleVendorEdit.show(s.data, function() {
66                                         _this.grid.footer.onClick('first');
67                                     }); 
68                                 }
69                             },
70                             autoExpandColumn : 'vend_name',
71                             loadMask : true,
72                             sm : {
73                                 xtype: 'RowSelectionModel',
74                                 xns: Roo.grid,
75                                 singleSelect : true
76                             },
77                             dataSource : {
78                                 xtype: 'Store',
79                                 xns: Roo.data,
80                                 listeners : {
81                                     beforeload : function (_self, options)
82                                     {
83                                         
84                                         if (! _this.searchBox) {
85                                         // not rendered yet...
86                                             return false;
87                                                 
88                                         }
89                                         options.params = options.params || {};
90                                         options.params._with_char = 1;
91                                         options.params['search[name]'] = _this.searchBox.getValue();
92                                         
93                                         if (!_this.active.pressed) {
94                                             options.params.vend_active = 1;
95                                         } 
96                                     }
97                                 },
98                                 remoteSort : true,
99                                 sortInfo : { field : 'vend_name', direction: 'ASC' },
100                                 proxy : {
101                                     xtype: 'HttpProxy',
102                                     xns: Roo.data,
103                                     method : 'GET',
104                                     url : baseURL + '/Roo/Vendinfo.php'
105                                 },
106                                 reader : {
107                                     xtype: 'JsonReader',
108                                     xns: Roo.data,
109                                     id : 'vend_id',
110                                     root : 'data',
111                                     totalProperty : 'total',
112                                     fields : [
113                                         {
114                                             'name': 'vend_id',
115                                             'type': 'int'
116                                         },
117                                         {
118                                             'name': 'vend_name',
119                                             'type': 'string'
120                                         }
121                                     ]
122                                 }
123                             },
124                             footer : {
125                                 xtype: 'PagingToolbar',
126                                 xns: Roo,
127                                 displayInfo : true,
128                                 displayMsg : "Displaying vendinfo{0} - {1} of {2}",
129                                 emptyMsg : "No vendinfo found",
130                                 pageSize : 25
131                             },
132                             toolbar : {
133                                 xtype: 'Toolbar',
134                                 xns: Roo,
135                                 items : [
136                                     {
137                                         xtype: 'TextItem',
138                                         xns: Roo.Toolbar,
139                                         text : "Search : "
140                                     },
141                                     {
142                                         xtype: 'TextField',
143                                         xns: Roo.form,
144                                         listeners : {
145                                             render : function (_self)
146                                             {
147                                                 _this.searchBox = _self;
148                                             },
149                                             specialkey : function (_self, e)
150                                             {
151                                                 _this.grid.footer.onClick('first');
152                                             }
153                                         }
154                                     },
155                                     {
156                                         xtype: 'Button',
157                                         xns: Roo.Toolbar,
158                                         listeners : {
159                                             click : function (_self, e)
160                                             {
161                                             _this.grid.footer.onClick('first');
162                                             }
163                                         },
164                                         cls : 'x-btn-icon',
165                                         icon : rootURL + '/Pman/templates/images/search.gif'
166                                     },
167                                     {
168                                         xtype: 'Button',
169                                         xns: Roo.Toolbar,
170                                         listeners : {
171                                             click : function (_self, e)
172                                             {
173                                                 _this.searchBox.setValue('');
174                                                 
175                                                 
176                                                 _this.grid.footer.onClick('first');
177                                             }
178                                         },
179                                         cls : 'x-btn-icon',
180                                         icon : rootURL + '/Pman/templates/images/edit-clear.gif'
181                                     },
182                                     {
183                                         xtype: 'Separator',
184                                         xns: Roo.Toolbar
185                                     },
186                                     {
187                                         xtype: 'Button',
188                                         xns: Roo.Toolbar,
189                                         listeners : {
190                                             toggle : function (_self, pressed)
191                                             {
192                                             
193                                                 this.setText(pressed ? "Hide Inactive" : "Show Inactive");
194                                                 (function() { _this.grid.footer.onClick('first'); }).defer(100);
195                                             },
196                                             render : function (_self)
197                                             {
198                                                 _this.active = _self;
199                                             }
200                                         },
201                                         enableToggle : true,
202                                         text : "Show Inactive"
203                                     },
204                                     {
205                                         xtype: 'Fill',
206                                         xns: Roo.Toolbar
207                                     },
208                                     {
209                                         xtype: 'Button',
210                                         xns: Roo.Toolbar,
211                                         listeners : {
212                                             click : function()
213                                             {
214                                             
215                                                Pman.Dialog.XtupleVendorEdit.show( { id : 0 } , function() {
216                                                     _this.grid.footer.onClick('first');
217                                                }); 
218                                             }
219                                         },
220                                         cls : 'x-btn-text-icon',
221                                         text : "Add",
222                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
223                                     },
224                                     {
225                                         xtype: 'Button',
226                                         xns: Roo.Toolbar,
227                                         listeners : {
228                                             click : function (_self, e)
229                                             {
230                                                Pman.Dialog.Image.show(
231                                                    {
232                                                         _url : baseURL+'/Xtuple/Import/Vendors' 
233                                                     
234                                                    },
235                                                    function (data) {
236                                                         _this.grid.footer.onClick('first');
237                                                         Roo.MessageBox.alert("Notice", "DONE");
238                                             //            Roo.MessageBox.alert("Notice", msg.join("\n"));
239                                             
240                                                    }
241                                                );
242                                             }
243                                         },
244                                         text : "Upload Vendors"
245                                     }
246                                 ]
247                             },
248                             colModel : [
249                                 {
250                                     xtype: 'ColumnModel',
251                                     xns: Roo.grid,
252                                     dataIndex : 'vend_name',
253                                     header : 'Name',
254                                     width : 100,
255                                     renderer : function(v) { return String.format('{0}', v); }
256                                 },
257                                 {
258                                     xtype: 'ColumnModel',
259                                     xns: Roo.grid,
260                                     dataIndex : 'vend_char_internalcompany',
261                                     header : 'Internal?',
262                                     width : 100,
263                                     renderer : function(v) { return String.format('{0}', v ? v : ''); }
264                                 }
265                             ]
266                         }
267                     }
268                 ],
269                 center : {
270                     xtype: 'LayoutRegion',
271                     xns: Roo
272                 }
273             }
274         };
275     }
276 });