Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendorEdit.bjs
index d6ec2b8..21f9966 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "id": "roo-file-358",
+    "id": "roo-file-39",
     "name": "Pman.Dialog.XtupleVendorEdit",
     "parent": "",
     "title": "",
-    "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleVendorEdit.bjs",
+    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleVendorEdit.bjs",
     "items": [
         {
             "listeners": {
@@ -15,7 +15,7 @@
             "modal": true,
             "resizable": false,
             "title": "Edit / Create Vendor",
-            "width": 550,
+            "width": 600,
             "xtype": "LayoutDialog",
             "|xns": "Roo",
             "items": [
@@ -27,6 +27,7 @@
                 },
                 {
                     "region": "center",
+                    "title": "Details",
                     "xtype": "ContentPanel",
                     "|xns": "Roo",
                     "items": [
                         {
                             "listeners": {
                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                "|rowdblclick": "function (_self, rowIndex, e)\n{\n   \n   Pman.Dialog.XtupleItem.show({ item_id  : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
                             },
                             "*prop": "grid",
                             "autoExpandColumn": "itemsrc_vend_item_descrip",
                             "items": [
                                 {
                                     "listeners": {
-                                        "beforeload": "function (_self, options)\n{\n    options.params.itemsrc_vend_id =   _this.form.findField('vend_id').getValue();\n}"
+                                        "beforeload": "function (_self, options)\n{\n    options.params.itemsrc_vend_id =   _this.form.findField('vend_id').getValue();\n    var s = _this.searchBox.getValue();\n    if (s.length) {\n        options.params['search[name]'] = s;\n    }\n}"
                                     },
                                     "*prop": "dataSource",
                                     "remoteSort": true,
                                     "xtype": "Store",
-                                    "|sortInfo": "{ field : 'itemsrc_id_item_number', direction: 'ASC' }",
+                                    "|sortInfo": "{ field : 'itemsrc_item_id_item_number', direction: 'ASC' }",
                                     "|xns": "Roo.data",
                                     "items": [
                                         {
                                 },
                                 {
                                     "*prop": "footer",
-                                    "xtype": "PagingToolbar",
-                                    "pageSize": 25,
                                     "displayInfo": true,
                                     "displayMsg": "Displaying itemsrc{0} - {1} of {2}",
                                     "emptyMsg": "No itemsrc found",
+                                    "pageSize": 100,
+                                    "xtype": "PagingToolbar",
                                     "|xns": "Roo"
                                 },
                                 {
                                     "|xns": "Roo",
                                     "items": [
                                         {
-                                            "text": "Add",
+                                            "listeners": {
+                                                "render": "function (_self)\n{\n    _this.searchBox = _self;\n}",
+                                                "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                            },
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
+                                            },
+                                            "cls": "x-btn-icon",
                                             "xtype": "Button",
-                                            "cls": "x-btn-text-icon",
-                                            "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                            "|icon": "rootURL + '/Pman/templates/images/search.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
                                             "listeners": {
-                                                "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                                "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
                                             },
+                                            "cls": "x-btn-icon",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
                                             "|xns": "Roo.Toolbar"
                                         },
                                         {
                                             "xtype": "Fill"
                                         },
                                         {
-                                            "text": "Delete",
+                                            "listeners": {
+                                                "|click": "function()\n{\n   \n    Pman.Dialog.XtupleSalesProductList.show({\n        exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),\n        multi_select : true\n    \n    }, function(sels) {\n       Roo.log(sels); \n\n       var ids = [];\n       Roo.each(sels,function(rec) {\n            ids.push(rec.data.item_id);\n        });\n        new Pman.Request({\n            mask: \"Adding\",\n            url : baseURL + '/Roo/Itemsrc',\n            method: 'POST',\n            params : {\n                add_multiple : ids.join(','),\n                itemsrc_vend_id : _this.form.findField('vend_id').getValue()\n            },\n            success : function() { \n                \n            \n                  _this.grid.footer.onClick('first');\n          }\n      });\n              \n    \n    });\n   \n}\n"
+                                            },
                                             "cls": "x-btn-text-icon",
-                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                            "text": "Add",
                                             "xtype": "Button",
+                                            "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
                                             "listeners": {
                                                 "|click": "function()\n{\n     Pman.genericDelete(_this, 'itemsrc'); \n}\n        "
                                             },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Delete",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
                                             "|xns": "Roo.Toolbar"
                                         }
                                     ]
                                 },
                                 {
                                     "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_id_item_number",
+                                    "dataIndex": "itemsrc_item_id_item_number",
                                     "header": "Item",
                                     "width": 120,
                                     "xtype": "ColumnModel",
                         }
                     ]
                 },
+                {
+                    "listeners": {
+                        "|activate": "function() {\n    _this.apanel = this;\n    if (_this.agrid) {\n        _this.agrid.footer.onClick('first');\n    }\n}"
+                    },
+                    "background": true,
+                    "fitContainer": true,
+                    "fitToframe": true,
+                    "region": "center",
+                    "tableName": "vendaddrinfo",
+                    "title": "Addresses",
+                    "xtype": "GridPanel",
+                    "|xns": "Roo",
+                    "items": [
+                        {
+                            "listeners": {
+                                "|render": "function() \n{\n    _this.agrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.apanel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                            },
+                            "*prop": "grid",
+                            "autoExpandColumn": "vendaddr_addr_id_addr_line1",
+                            "loadMask": true,
+                            "xtype": "Grid",
+                            "|xns": "Roo.grid",
+                            "items": [
+                                {
+                                    "*prop": "sm",
+                                    "singleSelect": true,
+                                    "xtype": "RowSelectionModel",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "listeners": {
+                                        "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var id = _this.form.findField('vend_id').getValue();\n    \n    if(id * 1 < 1){\n        return false;\n    }\n    \n    options.params.vendaddr_vend_id = id;\n}"
+                                    },
+                                    "*prop": "dataSource",
+                                    "remoteSort": true,
+                                    "xtype": "Store",
+                                    "|sortInfo": "{ field : 'vendaddr_id', direction: 'ASC' }",
+                                    "|xns": "Roo.data",
+                                    "items": [
+                                        {
+                                            "*prop": "proxy",
+                                            "method": "GET",
+                                            "xtype": "HttpProxy",
+                                            "|url": "baseURL + '/Roo/vendaddrinfo.php'",
+                                            "|xns": "Roo.data"
+                                        },
+                                        {
+                                            "*prop": "reader",
+                                            "id": "vendaddr_id",
+                                            "root": "data",
+                                            "totalProperty": "total",
+                                            "xtype": "JsonReader",
+                                            "|fields": "[\n    {\n        'name': 'vendaddr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vendaddr_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vendaddr_code',\n        'type': 'string'\n    }\n]",
+                                            "|xns": "Roo.data"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "footer",
+                                    "displayInfo": true,
+                                    "displayMsg": "Displaying address{0} - {1} of {2}",
+                                    "emptyMsg": "Nothing found",
+                                    "pageSize": 100,
+                                    "xtype": "PagingToolbar",
+                                    "|xns": "Roo"
+                                },
+                                {
+                                    "*prop": "toolbar",
+                                    "xtype": "Toolbar",
+                                    "|xns": "Roo",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.Toolbar",
+                                            "xtype": "Fill"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "click": "function (_self, e)\n{\n    var id = _this.form.findField('vend_id').getValue();\n    \n    if(id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please save the vendor first');\n        return;\n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/VendAddrInfo?' + Roo.urlEncode({'vend_id' : id})\n        \n       },\n       function (data) {\n            _this.agrid.footer.onClick('first');\n       }\n   );\n}"
+                                            },
+                                            "text": "Upload",
+                                            "xtype": "Button",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function()\n{\n     var s = _this.agrid.getSelectionModel().getSelected();\n     \n     if(!s || s.data.vendaddr_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n     }\n     \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that?\",\n        function(v) {\n            if (v != 'yes') {\n                return;\n            }\n             new Pman.Request({\n                method: 'POST',\n                url: baseURL+ '/Roo/vendaddrinfo',\n                params : {\n                    _delete : s.data.vendaddr_id\n                },\n                success : function() {\n                    _this.agrid.footer.onClick('refresh');\n                }\n            });\n    });\n}\n        "
+                                            },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Delete",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function()\n{\n     var s = _this.form.findField('vend_id').getValue() * 1;\n     \n     if(!s || s * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Save first!');\n        return;\n     }\n     \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete all the address?\",\n        function(v) {\n            if (v != 'yes') {\n                return;\n            }\n             new Pman.Request({\n                method: 'POST',\n                url: baseURL+ '/Roo/vendinfo',\n                params : {\n                    vend_id : s,\n                    _remove_addr : 1\n                },\n                success : function() {\n                    _this.agrid.footer.onClick('refresh');\n                }\n            });\n    });\n}\n        "
+                                            },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Delete All",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "vendaddr_code",
+                                    "header": "Code",
+                                    "width": 75,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "vendaddr_addr_id_addr_city",
+                                    "header": "District",
+                                    "width": 100,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "vendaddr_addr_id_addr_line1",
+                                    "header": "Address Line 1",
+                                    "width": 200,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "vendaddr_addr_id_addr_line2",
+                                    "header": "Address Line 2",
+                                    "width": 200,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                }
+                            ]
+                        }
+                    ]
+                },
                 {
                     "listeners": {
                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"