Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendorEdit.bjs
index ffb3f41..21f9966 100644 (file)
@@ -1,5 +1,5 @@
 {
-    "id": "roo-file-38",
+    "id": "roo-file-39",
     "name": "Pman.Dialog.XtupleVendorEdit",
     "parent": "",
     "title": "",
@@ -15,7 +15,7 @@
             "modal": true,
             "resizable": false,
             "title": "Edit / Create Vendor",
-            "width": 550,
+            "width": 600,
             "xtype": "LayoutDialog",
             "|xns": "Roo",
             "items": [
                     "items": [
                         {
                             "listeners": {
-                                "|render": "function() \n{\n    _this.sgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.spanel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                                "|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_code",
+                            "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.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}"
+                                        "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 : 'itemsrc_item_id_item_number', direction: 'ASC' }",
+                                    "|sortInfo": "{ field : 'vendaddr_id', direction: 'ASC' }",
                                     "|xns": "Roo.data",
                                     "items": [
                                         {
                                             "*prop": "proxy",
-                                            "xtype": "HttpProxy",
                                             "method": "GET",
-                                            "|url": "baseURL + '/Roo/itemsrc.php'",
+                                            "xtype": "HttpProxy",
+                                            "|url": "baseURL + '/Roo/vendaddrinfo.php'",
                                             "|xns": "Roo.data"
                                         },
                                         {
-                                            "|xns": "Roo.data",
-                                            "xtype": "JsonReader",
-                                            "totalProperty": "total",
-                                            "root": "data",
                                             "*prop": "reader",
-                                            "id": "id",
-                                            "|fields": "[\n    {\n        'name': 'itemsrc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_uom',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_invvendoruomratio',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_minordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_multordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_leadtime',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_ranking',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_active',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_manuf_name',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_default',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_upccode',\n        'type': 'string'\n    }\n]"
+                                            "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 itemsrc{0} - {1} of {2}",
-                                    "emptyMsg": "No itemsrc found",
+                                    "displayMsg": "Displaying address{0} - {1} of {2}",
+                                    "emptyMsg": "Nothing found",
                                     "pageSize": 100,
                                     "xtype": "PagingToolbar",
                                     "|xns": "Roo"
                                     "|xns": "Roo",
                                     "items": [
                                         {
-                                            "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",
-                                            "|icon": "rootURL + '/Pman/templates/images/search.gif'",
-                                            "|xns": "Roo.Toolbar"
+                                            "|xns": "Roo.Toolbar",
+                                            "xtype": "Fill"
                                         },
                                         {
                                             "listeners": {
-                                                "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
+                                                "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}"
                                             },
-                                            "cls": "x-btn-icon",
+                                            "text": "Upload",
                                             "xtype": "Button",
-                                            "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
                                             "|xns": "Roo.Toolbar"
                                         },
-                                        {
-                                            "|xns": "Roo.Toolbar",
-                                            "xtype": "Fill"
-                                        },
                                         {
                                             "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"
+                                                "|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": "Add",
+                                            "text": "Delete",
                                             "xtype": "Button",
-                                            "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
                                             "|xns": "Roo.Toolbar"
                                         },
                                         {
                                             "listeners": {
-                                                "|click": "function()\n{\n     Pman.genericDelete(_this, 'itemsrc'); \n}\n        "
+                                                "|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",
+                                            "text": "Delete All",
                                             "xtype": "Button",
                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
                                             "|xns": "Roo.Toolbar"
                                 },
                                 {
                                     "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_item_id_item_number",
-                                    "header": "Item",
-                                    "width": 120,
+                                    "dataIndex": "vendaddr_code",
+                                    "header": "Code",
+                                    "width": 75,
                                     "xtype": "ColumnModel",
                                     "|renderer": "function(v) { return String.format('{0}', v); }",
                                     "|xns": "Roo.grid"
                                 },
                                 {
                                     "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_vend_item_number",
-                                    "header": "Vendor item number",
-                                    "width": 120,
+                                    "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": "itemsrc_vend_item_descrip",
-                                    "header": "Vendor item description",
+                                    "dataIndex": "vendaddr_addr_id_addr_line1",
+                                    "header": "Address Line 1",
                                     "width": 200,
                                     "xtype": "ColumnModel",
                                     "|renderer": "function(v) { return String.format('{0}', v); }",
                                 },
                                 {
                                     "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_vend_uom",
-                                    "header": "Uom",
-                                    "width": 50,
-                                    "xtype": "ColumnModel",
-                                    "|renderer": "function(v) { return String.format('{0}', v); }",
-                                    "|xns": "Roo.grid"
-                                },
-                                {
-                                    "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_minordqty",
-                                    "header": "Min ord qty",
-                                    "width": 50,
-                                    "xtype": "ColumnModel",
-                                    "|renderer": "function(v) { return String.format('{0}', v); }",
-                                    "|xns": "Roo.grid"
-                                },
-                                {
-                                    "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_leadtime",
-                                    "header": "Lead time",
-                                    "width": 75,
-                                    "xtype": "ColumnModel",
-                                    "|renderer": "function(v) { return String.format('{0}', v); }",
-                                    "|xns": "Roo.grid"
-                                },
-                                {
-                                    "*prop": "colModel[]",
-                                    "dataIndex": "itemsrc_active",
-                                    "header": "Active",
-                                    "width": 75,
+                                    "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"