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