Pman.Tab.CoreOAuthClient.bjs
[Pman.Core] / Pman.Tab.CoreOAuthClient.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.CoreOAuthClient = new Roo.XComponent({
6     part     :  ["Core","OAuthClient"],
7     order    : '900-Pman.Tab.CoreOAuthClient',
8     region   : 'center',
9     parent   : 'Pman.Tab.Admin',
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             region : 'center',
21             title : "Oauth2 Clients",
22             layout : {
23                 xtype: 'BorderLayout',
24                 xns: Roo,
25                 items : [
26                     {
27                         xtype: 'GridPanel',
28                         xns: Roo,
29                         listeners : {
30                             activate : function() {
31                                 _this.panel = this;
32                                 
33                                 if (_this.grid) {
34                                     _this.grid.footer.onClick('first');
35                                 }
36                             }
37                         },
38                         background : true,
39                         fitContainer : true,
40                         fitToframe : true,
41                         region : 'center',
42                         tableName : 'core_oauth_clients',
43                         title : "Oauth2 Clients",
44                         grid : {
45                             xtype: 'EditorGrid',
46                             xns: Roo.grid,
47                             listeners : {
48                                 render : function() 
49                                 {
50                                     _this.grid = this; 
51                                     if (_this.panel.active) {
52                                        this.footer.onClick('first');
53                                     }
54                                 },
55                                 beforeedit : function (e)
56                                 {
57                                     var r = e.record.data.poitem_qty_received * 1;
58                                     
59                                     if(r > 0){
60                                         Roo.MessageBox.alert("Error", "This item has been receipted");
61                                         return false;
62                                     }
63                                     
64                                     var status = _this.form.findField('pohead_status').getValue();
65                                     
66                                     if(status == 'C'){
67                                         Roo.MessageBox.alert("Error", "This PO has been closed");
68                                         return false;
69                                     }
70                                     
71                                     
72                                 }
73                             },
74                             autoExpandColumn : 'redirect_uri',
75                             clicksToEdit : 1,
76                             loadMask : true,
77                             dataSource : {
78                                 xtype: 'Store',
79                                 xns: Roo.data,
80                                 listeners : {
81                                     beforeload : function (_self, o){
82                                         o.params = o.params || {};
83                                     
84                                     }
85                                 },
86                                 remoteSort : true,
87                                 sortInfo : { field : 'client_id', direction: 'ASC' },
88                                 proxy : {
89                                     xtype: 'HttpProxy',
90                                     xns: Roo.data,
91                                     method : 'GET',
92                                     url : baseURL + '/Roo/Core_oauth_clients'
93                                 },
94                                 reader : {
95                                     xtype: 'JsonReader',
96                                     xns: Roo.data,
97                                     id : 'id',
98                                     root : 'data',
99                                     totalProperty : 'total',
100                                     fields : [
101                                         {
102                                             'name': 'client_id',
103                                             'type': 'string'
104                                         },
105                                         {
106                                             'name': 'client_secret',
107                                             'type': 'string'
108                                         },
109                                         {
110                                             'name': 'redirect_uri',
111                                             'type': 'string'
112                                         }
113                                     ]
114                                 }
115                             },
116                             toolbar : {
117                                 xtype: 'Toolbar',
118                                 xns: Roo,
119                                 items : [
120                                     {
121                                         xtype: 'Button',
122                                         xns: Roo.Toolbar,
123                                         listeners : {
124                                             click : function()
125                                             {
126                                                 var status = _this.form.findField('pohead_status').getValue();
127                                                 
128                                                 if(status == 'C'){
129                                                     Roo.MessageBox.alert("Error", "This PO has been closed");
130                                                     return;
131                                                 }
132                                                 
133                                                 var ct  =    _this.grid.ds.getCount();
134                                                 
135                                                 var last = ct ? _this.grid.ds.getAt(ct-1).data.poitem_linenumber * 1 + 1 : 1;
136                                                 
137                                                 var dt = _this.form.findField('pohead_orderdate').getValue();
138                                                 
139                                                 var nr = _this.grid.ds.reader.newRow({
140                                                     poitem_id : 0,
141                                                     poitem_linenumber : last,
142                                                     item_number : '',
143                                                     item_descrip1 : '',
144                                                     poitem_duedate : dt,
145                                                     poitem_qty_ordered : 1,
146                                                     poitem_unitprice : 0
147                                                 });
148                                                 
149                                                 _this.grid.stopEditing();
150                                                 _this.grid.ds.insert(_this.grid.ds.getCount(), nr); 
151                                                 _this.grid.startEditing(_this.grid.ds.getCount()-1, 1);
152                                             }
153                                         },
154                                         cls : 'x-btn-text-icon',
155                                         text : "Add",
156                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
157                                     },
158                                     {
159                                         xtype: 'Button',
160                                         xns: Roo.Toolbar,
161                                         listeners : {
162                                             click : function ()
163                                             {
164                                                 var status = _this.form.findField('pohead_status').getValue();
165                                                 
166                                                 if(status == 'C'){
167                                                     Roo.MessageBox.alert("Error", "This PO has been closed");
168                                                     return;
169                                                 }
170                                                 
171                                                 var cs = _this.grid.getSelectionModel().getSelectedCell();
172                                                 if (!cs) {
173                                                     Roo.MessageBox.alert("Error", "Select a cell");
174                                                     return;
175                                                 }
176                                                 _this.grid.stopEditing();
177                                                 var r = _this.grid.ds.getAt(cs[0]);
178                                                 
179                                                 if(r.data.poitem_qty_received * 1 > 0){
180                                                     Roo.MessageBox.alert("Error", "This item has been receipted");
181                                                     return;
182                                                 }
183                                                 
184                                                 
185                                                 _this.grid.ds.remove(r);
186                                                
187                                             }
188                                         },
189                                         cls : 'x-btn-text-icon',
190                                         text : "Remove",
191                                         icon : rootURL + '/Pman/templates/images/trash.gif'
192                                     }
193                                 ]
194                             },
195                             footer : {
196                                 xtype: 'PagingToolbar',
197                                 xns: Roo,
198                                 displayInfo : true,
199                                 emptyMsg : "No Clients found",
200                                 pageSize : 25
201                             },
202                             colModel : [
203                                 {
204                                     xtype: 'ColumnModel',
205                                     xns: Roo.grid,
206                                     dataIndex : 'client_id',
207                                     header : 'Client ID',
208                                     width : 150,
209                                     renderer : function(v) { 
210                                         return String.format('{0}', v ? v : '');
211                                     },
212                                     editor : {
213                                         xtype: 'GridEditor',
214                                         xns: Roo.grid,
215                                         field : {
216                                             xtype: 'TextField',
217                                             xns: Roo.form
218                                         }
219                                     }
220                                 },
221                                 {
222                                     xtype: 'ColumnModel',
223                                     xns: Roo.grid,
224                                     dataIndex : 'client_secret',
225                                     header : 'Client Secret',
226                                     width : 150,
227                                     renderer : function(v) { 
228                                         return String.format('{0}', v ? v : '');
229                                     },
230                                     editor : {
231                                         xtype: 'GridEditor',
232                                         xns: Roo.grid,
233                                         field : {
234                                             xtype: 'TextField',
235                                             xns: Roo.form
236                                         }
237                                     }
238                                 },
239                                 {
240                                     xtype: 'ColumnModel',
241                                     xns: Roo.grid,
242                                     dataIndex : 'redirect_uri',
243                                     header : 'Redirect URI',
244                                     width : 150,
245                                     renderer : function(v) { 
246                                         return String.format('{0}', v ? v : '');
247                                     },
248                                     editor : {
249                                         xtype: 'GridEditor',
250                                         xns: Roo.grid,
251                                         field : {
252                                             xtype: 'TextField',
253                                             xns: Roo.form
254                                         }
255                                     }
256                                 }
257                             ]
258                         }
259                     }
260                 ],
261                 center : {
262                     xtype: 'LayoutRegion',
263                     xns: Roo,
264                     autoScroll : false,
265                     split : true
266                 }
267             }
268         };
269     }
270 });