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