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