Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendorEdit.js
index da96341..797cec0 100644 (file)
@@ -840,6 +840,11 @@ Pman.Dialog.XtupleVendorEdit = {
                         },
                         autoExpandColumn : 'vendaddr_addr_id_addr_line1',
                         loadMask : true,
+                        sm : {
+                            xtype: 'RowSelectionModel',
+                            xns: Roo.grid,
+                            singleSelect : true
+                        },
                         dataSource : {
                             xtype: 'Store',
                             xns: Roo.data,
@@ -928,6 +933,77 @@ Pman.Dialog.XtupleVendorEdit = {
                                         }
                                     },
                                     text : "Upload"
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function()
+                                        {
+                                             var s = _this.agrid.getSelectionModel().getSelected();
+                                             
+                                             if(!s || s.data.vendaddr_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/vendaddrinfo',
+                                                        params : {
+                                                            _delete : s.data.vendaddr_id
+                                                        },
+                                                        success : function() {
+                                                            _this.agrid.footer.onClick('refresh');
+                                                        }
+                                                    });
+                                            });
+                                        }
+                                    },
+                                    cls : 'x-btn-text-icon',
+                                    text : "Delete",
+                                    icon : rootURL + '/Pman/templates/images/trash.gif'
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function()
+                                        {
+                                             var s = _this.form.findField('vend_id').getValue() * 1;
+                                             
+                                             if(!s || s * 1 < 1){
+                                                Roo.MessageBox.alert('Error', 'Save first!');
+                                                return;
+                                             }
+                                             
+                                             Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete all the address?",
+                                                function(v) {
+                                                    if (v != 'yes') {
+                                                        return;
+                                                    }
+                                                     new Pman.Request({
+                                                        method: 'POST',
+                                                        url: baseURL+ '/Roo/vendinfo',
+                                                        params : {
+                                                            vend_id : s,
+                                                            _remove_addr : 1
+                                                        },
+                                                        success : function() {
+                                                            _this.agrid.footer.onClick('refresh');
+                                                        }
+                                                    });
+                                            });
+                                        }
+                                    },
+                                    cls : 'x-btn-text-icon',
+                                    text : "Delete All",
+                                    icon : rootURL + '/Pman/templates/images/trash.gif'
                                 }
                             ]
                         },