Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendorEdit.js
index 873c408..797cec0 100644 (file)
@@ -42,7 +42,7 @@ Pman.Dialog.XtupleVendorEdit = {
             modal : true,
             resizable : false,
             title : "Edit / Create Vendor",
-            width : 550,
+            width : 600,
             items : [
                 {
                     xtype: 'ContentPanel',
@@ -838,8 +838,13 @@ Pman.Dialog.XtupleVendorEdit = {
                                 }
                             }
                         },
-                        autoExpandColumn : 'vendaddr_code',
+                        autoExpandColumn : 'vendaddr_addr_id_addr_line1',
                         loadMask : true,
+                        sm : {
+                            xtype: 'RowSelectionModel',
+                            xns: Roo.grid,
+                            singleSelect : true
+                        },
                         dataSource : {
                             xtype: 'Store',
                             xns: Roo.data,
@@ -851,7 +856,7 @@ Pman.Dialog.XtupleVendorEdit = {
                                     var id = _this.form.findField('vend_id').getValue();
                                     
                                     if(id * 1 < 1){
-                                        return;
+                                        return false;
                                     }
                                     
                                     options.params.vendaddr_vend_id = id;
@@ -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'
                                 }
                             ]
                         },
@@ -937,16 +1013,32 @@ Pman.Dialog.XtupleVendorEdit = {
                                 xns: Roo.grid,
                                 dataIndex : 'vendaddr_code',
                                 header : 'Code',
-                                width : 100,
+                                width : 75,
                                 renderer : function(v) { return String.format('{0}', v); }
                             },
                             {
                                 xtype: 'ColumnModel',
                                 xns: Roo.grid,
-                                dataIndex : 'vendaddr_name',
-                                header : 'Name',
+                                dataIndex : 'vendaddr_addr_id_addr_city',
+                                header : 'District',
                                 width : 100,
                                 renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'vendaddr_addr_id_addr_line1',
+                                header : 'Address Line 1',
+                                width : 200,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'vendaddr_addr_id_addr_line2',
+                                header : 'Address Line 2',
+                                width : 200,
+                                renderer : function(v) { return String.format('{0}', v); }
                             }
                         ]
                     }