Pman.Dialog.BuilderProp.js
[Pman.Builder] / Pman.Dialog.BuilderProp.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.Dialog.BuilderProp = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 170,
36             resizable : false,
37             title : "Add Property",
38             width : 400,
39             items : [
40                 {
41                     xtype: 'GridPanel',
42                     xns: Roo,
43                     title : "AutoAuth",
44                     fitToframe : true,
45                     fitContainer : true,
46                     tableName : 'AutoAuth',
47                     background : true,
48                     region : 'center',
49                     listeners : {
50                         activate : function() {
51                             _this.panel = this;
52                             if (_this.grid) {
53                                 _this.grid.footer.onClick('first');
54                             }
55                         }
56                     },
57                     grid : {
58                         xtype: 'Grid',
59                         xns: Roo.grid,
60                         autoExpandColumn : 'url',
61                         loadMask : true,
62                         listeners : {
63                             render : function() 
64                             {
65                                 _this.grid = this; 
66                                 //_this.dialog = Pman.Dialog.FILL_IN
67                                 if (_this.panel.active) {
68                                    this.footer.onClick('first');
69                                 }
70                             },
71                             rowdblclick : function (_self, rowIndex, e)
72                             {
73                                 if (!_this.dialog) return;
74                                 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
75                                     _this.grid.footer.onClick('first');
76                                 }); 
77                             }
78                         },
79                         dataSource : {
80                             xtype: 'Store',
81                             xns: Roo.data,
82                             remoteSort : true,
83                             sortInfo : { field : 'url', direction: 'ASC' },
84                             proxy : {
85                                 xtype: 'HttpProxy',
86                                 xns: Roo.data,
87                                 method : 'GET',
88                                 url : baseURL + '/Builder/Prop.php'
89                             },
90                             reader : {
91                                 xtype: 'JsonReader',
92                                 xns: Roo.data,
93                                 totalProperty : 'total',
94                                 root : 'data',
95                                 id : 'id',
96                                 fields : [
97                                     {
98                                         'name': 'id',
99                                         'type': 'int'
100                                     },
101                                     {
102                                         'name': 'user_id',
103                                         'type': 'int'
104                                     },
105                                     {
106                                         'name': 'url',
107                                         'type': 'string'
108                                     },
109                                     {
110                                         'name': 'ts',
111                                         'type': 'date',
112                                         'dateFormat': 'Y-m-d'
113                                     },
114                                     {
115                                         'name': 'checksum',
116                                         'type': 'string'
117                                     },
118                                     {
119                                         'name': 'user_id_id',
120                                         'type': 'int'
121                                     },
122                                     {
123                                         'name': 'user_id_name',
124                                         'type': 'string'
125                                     },
126                                     {
127                                         'name': 'user_id_title',
128                                         'type': 'string'
129                                     },
130                                     {
131                                         'name': 'user_id_company',
132                                         'type': 'string'
133                                     },
134                                     {
135                                         'name': 'user_id_address',
136                                         'type': 'string'
137                                     },
138                                     {
139                                         'name': 'user_id_email',
140                                         'type': 'string'
141                                     },
142                                     {
143                                         'name': 'user_id_telephone',
144                                         'type': 'string'
145                                     },
146                                     {
147                                         'name': 'user_id_fax',
148                                         'type': 'string'
149                                     },
150                                     {
151                                         'name': 'user_id_mobile',
152                                         'type': 'string'
153                                     },
154                                     {
155                                         'name': 'user_id_country',
156                                         'type': 'string'
157                                     },
158                                     {
159                                         'name': 'user_id_currency',
160                                         'type': 'string'
161                                     },
162                                     {
163                                         'name': 'user_id_shipping_method',
164                                         'type': 'string'
165                                     },
166                                     {
167                                         'name': 'user_id_shipping_acc',
168                                         'type': 'string'
169                                     },
170                                     {
171                                         'name': 'user_id_terms_agreed',
172                                         'type': 'int'
173                                     },
174                                     {
175                                         'name': 'user_id_passwd',
176                                         'type': 'string'
177                                     },
178                                     {
179                                         'name': 'user_id_is_buyer',
180                                         'type': 'int'
181                                     },
182                                     {
183                                         'name': 'user_id_is_seller',
184                                         'type': 'int'
185                                     },
186                                     {
187                                         'name': 'user_id_is_want_blind_rfq',
188                                         'type': 'int'
189                                     },
190                                     {
191                                         'name': 'user_id_buyer_type',
192                                         'type': 'string'
193                                     },
194                                     {
195                                         'name': 'user_id_is_verified',
196                                         'type': 'int'
197                                     },
198                                     {
199                                         'name': 'user_id_is_disabled',
200                                         'type': 'int'
201                                     },
202                                     {
203                                         'name': 'user_id_is_want_email',
204                                         'type': 'int'
205                                     },
206                                     {
207                                         'name': 'user_id_mail_newprod_freq',
208                                         'type': 'int'
209                                     },
210                                     {
211                                         'name': 'user_id_quotation_by',
212                                         'type': 'string'
213                                     },
214                                     {
215                                         'name': 'user_id_is_want_make_offer',
216                                         'type': 'int'
217                                     },
218                                     {
219                                         'name': 'user_id_mail_inventry_freq',
220                                         'type': 'int'
221                                     },
222                                     {
223                                         'name': 'user_id_max_rfq_per_day',
224                                         'type': 'int'
225                                     },
226                                     {
227                                         'name': 'user_id_is_approved',
228                                         'type': 'int'
229                                     },
230                                     {
231                                         'name': 'user_id_created',
232                                         'type': 'date'
233                                     },
234                                     {
235                                         'name': 'user_id_modified',
236                                         'type': 'date'
237                                     },
238                                     {
239                                         'name': 'user_id_modified_by',
240                                         'type': 'int'
241                                     },
242                                     {
243                                         'name': 'user_id_is_administrator',
244                                         'type': 'int'
245                                     },
246                                     {
247                                         'name': 'user_id_bank_name',
248                                         'type': 'string'
249                                     },
250                                     {
251                                         'name': 'user_id_bank_account',
252                                         'type': 'string'
253                                     },
254                                     {
255                                         'name': 'user_id_last_inventory_sent',
256                                         'type': 'date'
257                                     },
258                                     {
259                                         'name': 'user_id_last_rfq_report_sent',
260                                         'type': 'date'
261                                     },
262                                     {
263                                         'name': 'user_id_last_productlist_sent',
264                                         'type': 'date'
265                                     },
266                                     {
267                                         'name': 'user_id_company_id',
268                                         'type': 'int'
269                                     }
270                                 ]
271                             }
272                         },
273                         footer : {
274                             xtype: 'PagingToolbar',
275                             xns: Roo,
276                             pageSize : 25,
277                             displayInfo : true,
278                             displayMsg : 'Displaying AutoAuth{0} - {1} of {2}',
279                             emptyMsg : 'No AutoAuth found'
280                         },
281                         toolbar : {
282                             xtype: 'Toolbar',
283                             xns: Roo,
284                             items : [
285                                 {
286                                     xtype: 'Button',
287                                     xns: Roo.Toolbar,
288                                     text : "Add",
289                                     cls : 'x-btn-text-icon',
290                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
291                                     listeners : {
292                                         click : function()
293                                         {
294                                             if (!_this.dialog) return;
295                                             _this.dialog.show( { id : 0 } , function() {
296                                                 _this.grid.footer.onClick('first');
297                                            }); 
298                                         }
299                                     }
300                                 },
301                                 {
302                                     xtype: 'Button',
303                                     xns: Roo.Toolbar,
304                                     text : "Edit",
305                                     cls : 'x-btn-text-icon',
306                                     icon : Roo.rootURL + 'images/default/tree/leaf.gif',
307                                     listeners : {
308                                         click : function()
309                                         {
310                                             var s = _this.grid.getSelectionModel().getSelections();
311                                             if (!s.length || (s.length > 1))  {
312                                                 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
313                                                 return;
314                                             }
315                                             if (!_this.dialog) return;
316                                             _this.dialog.show(s[0].data, function() {
317                                                 _this.grid.footer.onClick('first');
318                                             }); 
319                                             
320                                         }
321                                     }
322                                 },
323                                 {
324                                     xtype: 'Button',
325                                     xns: Roo.Toolbar,
326                                     text : "Delete",
327                                     cls : 'x-btn-text-icon',
328                                     icon : rootURL + '/Pman/templates/images/trash.gif',
329                                     listeners : {
330                                         click : function()
331                                         {
332                                              Pman.genericDelete(_this, 'AutoAuth'); 
333                                         }
334                                     }
335                                 }
336                             ]
337                         },
338                         colModel : [
339                             {
340                                 xtype: 'ColumnModel',
341                                 xns: Roo.grid,
342                                 header : 'Ts',
343                                 width : 75,
344                                 dataIndex : 'ts',
345                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
346                             },
347                             {
348                                 xtype: 'ColumnModel',
349                                 xns: Roo.grid,
350                                 header : 'Checksum',
351                                 width : 200,
352                                 dataIndex : 'checksum',
353                                 renderer : function(v) { return String.format('{0}', v); }
354                             }
355                         ]
356                     }
357                 }
358             ],
359             center : {
360                 xtype: 'LayoutRegion',
361                 xns: Roo
362             },
363             buttons : [
364                 {
365                     xtype: 'Button',
366                     xns: Roo,
367                     listeners : {
368                         click : function (_self, e)
369                         {
370                             _this.dialog.hide();
371                         }
372                     },
373                     text : "Cancel"
374                 },
375                 {
376                     xtype: 'Button',
377                     xns: Roo,
378                     listeners : {
379                         click : function (_self, e)
380                         {
381                             // do some checks?
382                              
383                             
384                             _this.dialog.el.mask("Saving");
385                             _this.form.doAction("submit");
386                         
387                         }
388                     },
389                     text : "Save"
390                 }
391             ]
392         });
393     }
394 };