Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtuplePurchasesVendors.js
index 9097fc0..5f87571 100644 (file)
@@ -90,8 +90,8 @@ Pman.Tab.XtuplePurchasesVendors = new Roo.XComponent({
                                         options.params._with_char = 1;
                                         options.params['search[name]'] = _this.searchBox.getValue();
                                         
-                                        if (_this.active.pressed) {
-                                            o.params.vendor_active = 1;
+                                        if (!_this.active.pressed) {
+                                            options.params.vend_active = 1;
                                         } 
                                     }
                                 },
@@ -187,17 +187,23 @@ Pman.Tab.XtuplePurchasesVendors = new Roo.XComponent({
                                         xtype: 'Button',
                                         xns: Roo.Toolbar,
                                         listeners : {
-                                            click : function()
+                                            toggle : function (_self, pressed)
                                             {
                                             
-                                               Pman.Dialog.XtupleVendorEdit.show( { id : 0 } , function() {
-                                                    _this.grid.footer.onClick('first');
-                                               }); 
+                                                this.setText(pressed ? "Hide Inactive" : "Show Inactive");
+                                                (function() { _this.grid.footer.onClick('first'); }).defer(100);
+                                            },
+                                            render : function (_self)
+                                            {
+                                                _this.active = _self;
                                             }
                                         },
-                                        cls : 'x-btn-text-icon',
-                                        text : "Add",
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                        enableToggle : true,
+                                        text : "Show Inactive"
+                                    },
+                                    {
+                                        xtype: 'Fill',
+                                        xns: Roo.Toolbar
                                     },
                                     {
                                         xtype: 'Button',
@@ -205,47 +211,50 @@ Pman.Tab.XtuplePurchasesVendors = new Roo.XComponent({
                                         listeners : {
                                             click : function()
                                             {
-                                                var s = _this.grid.getSelectionModel().getSelected();
-                                                if (!s)  {
-                                                    Roo.MessageBox.alert("Error", "Select a Row");
-                                                    return;
-                                                }
                                             
-                                                Pman.Dialog.XtupleVendorEdit.show(s.data, function() {
+                                               Pman.Dialog.XtupleVendorEdit.show( { id : 0 } , function() {
                                                     _this.grid.footer.onClick('first');
-                                                }); 
-                                                
+                                               }); 
                                             }
                                         },
                                         cls : 'x-btn-text-icon',
-                                        text : "Edit",
-                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif'
-                                    },
-                                    {
-                                        xtype: 'Separator',
-                                        xns: Roo.Toolbar
+                                        text : "Add",
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
                                     },
                                     {
                                         xtype: 'Button',
                                         xns: Roo.Toolbar,
                                         listeners : {
-                                            toggle : function (_self, pressed)
-                                            {
-                                            
-                                                this.setText(pressed ? "Hide Inactive" : "Show Inactive");
-                                                (function() { _this.grid.footer.onClick('first'); }).defer(100);
-                                            },
-                                            render : function (_self)
+                                            click : function()
                                             {
-                                                _this.active = _self;
+                                                 var s = _this.grid.getSelectionModel().getSelected();
+                                                 
+                                                 if(!s || s.data.vend_id * 1 < 1){
+                                                    Roo.MessageBox.alert('Error', 'Please select a row');
+                                                    return;
+                                                 }
+                                                 
+                                                 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
+                                                    function(v) {
+                                                        if (v != 'yes') {
+                                                            return;
+                                                        }
+                                                         new Pman.Request({
+                                                            method: 'POST',
+                                                            url: baseURL+ '/Roo/vendinfo',
+                                                            params : {
+                                                                _delete : s.data.vend_id
+                                                            },
+                                                            success : function() {
+                                                                _this.grid.footer.onClick('refresh');
+                                                            }
+                                                        });
+                                                });
                                             }
                                         },
-                                        enableToggle : true,
-                                        text : "Show Inactive"
-                                    },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                        cls : 'x-btn-text-icon',
+                                        text : "Delete",
+                                        icon : rootURL + '/Pman/templates/images/trash.gif'
                                     },
                                     {
                                         xtype: 'Button',
@@ -280,6 +289,14 @@ Pman.Tab.XtuplePurchasesVendors = new Roo.XComponent({
                                     width : 100,
                                     renderer : function(v) { return String.format('{0}', v); }
                                 },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    dataIndex : 'vend_vendtype_id_vendtype_descrip',
+                                    header : 'Type',
+                                    width : 150,
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
                                 {
                                     xtype: 'ColumnModel',
                                     xns: Roo.grid,