DataObjects/Core_person_signup.php
[Pman.Core] / Pman.Tab.CoreOAuthClient.js
index a097b02..92d36bc 100644 (file)
@@ -58,6 +58,7 @@ Pman.Tab.CoreOAuthClient = new Roo.XComponent({
                                         return false;
                                     }
                                     
+                                    Roo.log('commit it');
                                     e.record.commit();
                                 }
                             },
@@ -77,35 +78,25 @@ Pman.Tab.CoreOAuthClient = new Roo.XComponent({
                                         if (operation != Roo.data.Record.COMMIT) {
                                             return;
                                         }
-                                        Roo.log(record);
                                     
-                                        if (typeof(_this.data._hide_name) != 'undefined') {
-                                            record.set('name', record.data.display_name);
-                                        }
                                         if (!record.data.client_id.length || !record.data.client_secret.length) {
                                             return;
                                         }
-                                        /*
+                                        
                                         new Pman.Request({
-                                            url : baseURL + '/Roo/Core_enum.php',
+                                            url : baseURL + '/Roo/Core_oauth_clients',
                                             method : 'POST',
                                             params : {
                                                 id : record.data.id,
-                                                etype : _this.data.etype,
-                                                name :  record.data.name,
-                                                active : record.data.active,
-                                                seqid : record.data.seqid,
-                                                display_name : record.data.display_name
-                                            }, 
+                                                client_id : record.data.client_id,
+                                                client_secret : record.data.client_secret,
+                                                redirect_uri : record.data.redirect_uri
+                                            },
                                             success : function(res) {
-                                                //Roo.log(data);
-                                                // update the ID if it's not set..
-                                                if (record.data.id * 1 < 1) {
-                                                    record.set('id', res.data.id);
-                                                }
+                                                _this.grid.footer.onClick('refresh');
                                             }
                                         });
-                                     */   
+                                        
                                     }
                                 },
                                 remoteSort : true,
@@ -123,6 +114,10 @@ Pman.Tab.CoreOAuthClient = new Roo.XComponent({
                                     root : 'data',
                                     totalProperty : 'total',
                                     fields : [
+                                        {
+                                            'name': 'id',
+                                            'type': 'int'
+                                        },
                                         {
                                             'name': 'client_id',
                                             'type': 'string'
@@ -148,32 +143,17 @@ Pman.Tab.CoreOAuthClient = new Roo.XComponent({
                                         listeners : {
                                             click : function()
                                             {
-                                                var status = _this.form.findField('pohead_status').getValue();
-                                                
-                                                if(status == 'C'){
-                                                    Roo.MessageBox.alert("Error", "This PO has been closed");
-                                                    return;
-                                                }
-                                                
-                                                var ct  =    _this.grid.ds.getCount();
-                                                
-                                                var last = ct ? _this.grid.ds.getAt(ct-1).data.poitem_linenumber * 1 + 1 : 1;
-                                                
-                                                var dt = _this.form.findField('pohead_orderdate').getValue();
                                                 
                                                 var nr = _this.grid.ds.reader.newRow({
-                                                    poitem_id : 0,
-                                                    poitem_linenumber : last,
-                                                    item_number : '',
-                                                    item_descrip1 : '',
-                                                    poitem_duedate : dt,
-                                                    poitem_qty_ordered : 1,
-                                                    poitem_unitprice : 0
+                                                    id : 0,
+                                                    client_id : '',
+                                                    client_secret : '',
+                                                    redirect_uri : ''
                                                 });
                                                 
                                                 _this.grid.stopEditing();
                                                 _this.grid.ds.insert(_this.grid.ds.getCount(), nr); 
-                                                _this.grid.startEditing(_this.grid.ds.getCount()-1, 1);
+                                                _this.grid.startEditing(_this.grid.ds.getCount()-1, 0);
                                             }
                                         },
                                         cls : 'x-btn-text-icon',
@@ -185,30 +165,32 @@ Pman.Tab.CoreOAuthClient = new Roo.XComponent({
                                         xns: Roo.Toolbar,
                                         listeners : {
                                             click : function ()
-                                            {
-                                                var status = _this.form.findField('pohead_status').getValue();
-                                                
-                                                if(status == 'C'){
-                                                    Roo.MessageBox.alert("Error", "This PO has been closed");
-                                                    return;
-                                                }
-                                                
+                                            {   
                                                 var cs = _this.grid.getSelectionModel().getSelectedCell();
                                                 if (!cs) {
                                                     Roo.MessageBox.alert("Error", "Select a cell");
                                                     return;
                                                 }
                                                 _this.grid.stopEditing();
+                                             
                                                 var r = _this.grid.ds.getAt(cs[0]);
                                                 
-                                                if(r.data.poitem_qty_received * 1 > 0){
-                                                    Roo.MessageBox.alert("Error", "This item has been receipted");
-                                                    return;
-                                                }
-                                                
-                                                
-                                                _this.grid.ds.remove(r);
-                                               
+                                                Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete this client?", function (v){
+                                                    if (v != 'yes') {
+                                                        return;
+                                                    }
+                                                    
+                                                    new Pman.Request({
+                                                        url : baseURL + '/Roo/Core_oauth_clients',
+                                                        method : 'POST',
+                                                        params : {
+                                                            _delete : r.data.id
+                                                        },
+                                                        success : function(res) {
+                                                            _this.grid.footer.onClick('refresh');
+                                                        }
+                                                    });
+                                                });
                                             }
                                         },
                                         cls : 'x-btn-text-icon',