Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtuplePriceLists.bjs
index 8d35f3f..c95a666 100644 (file)
@@ -26,6 +26,8 @@
                         },
                         {
                             "*prop": "east",
+                            "split": true,
+                            "width": 350,
                             "xtype": "LayoutRegion",
                             "|xns": "Roo"
                         },
                                     "xtype": "Grid",
                                     "|xns": "Roo.grid",
                                     "items": [
+                                        {
+                                            "listeners": {
+                                                "afterselectionchange": "function (_self)\n{\n    _this.igrid.footer.onClick('first');\n}"
+                                            },
+                                            "*prop": "sm",
+                                            "singleSelect": true,
+                                            "xtype": "RowSelectionModel",
+                                            "|xns": "Roo.grid"
+                                        },
                                         {
                                             "*prop": "dataSource",
                                             "xtype": "Store",
                                     ]
                                 }
                             ]
+                        },
+                        {
+                            "listeners": {
+                                "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       // _this.igrid.footer.onClick('first');\n    }\n}"
+                            },
+                            "background": true,
+                            "fitContainer": true,
+                            "fitToframe": true,
+                            "region": "east",
+                            "tableName": "item",
+                            "title": "Products",
+                            "xtype": "GridPanel",
+                            "|xns": "Roo",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "|render": "function() \n{\n    _this.igrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.ipanel.active) {\n       //this.footer.onClick('first');\n    }\n}",
+                                        "afteredit": "function (e)\n{\n    if(e.value == e.originalValue){\n        return false;       \n    }\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        Roo.MessageBox.alert('Error','Please select a price list');\n        return false;       \n    }\n    \n    new Pman.Request({\n        url : baseURL +'/Roo/Item',\n        method : 'POST',\n        marks : 'Posting',\n        params : {\n             update_ipshead : 1,\n             ipshead_id : p.data.ipshead_id,\n             item_id : e.record.data.item_id,\n             _price : e.value,\n         },\n         success : function() {\n            _this.igrid.footer.onClick('refresh');\n        }\n         \n     });\n    \n}",
+                                        "beforeedit": "function (e)\n{\n    if(e.field != 'ipshead_price'){\n        return false;\n    }\n\n}"
+                                    },
+                                    "*prop": "grid",
+                                    "autoExpandColumn": "item_number",
+                                    "clicksToEdit": 1,
+                                    "loadMask": true,
+                                    "xtype": "EditorGrid",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    \n    //o.params.item_active = 1;\n    o.params._ipshead_price = 1;\n    o.params._ipshead_id = p.data.ipshead_id;\n\n}"
+                                            },
+                                            "*prop": "dataSource",
+                                            "remoteSort": true,
+                                            "xtype": "Store",
+                                            "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
+                                            "|xns": "Roo.data",
+                                            "items": [
+                                                {
+                                                    "*prop": "proxy",
+                                                    "xtype": "HttpProxy",
+                                                    "method": "GET",
+                                                    "|url": "baseURL + '/Roo/item.php'",
+                                                    "|xns": "Roo.data"
+                                                },
+                                                {
+                                                    "*prop": "reader",
+                                                    "id": "id",
+                                                    "root": "data",
+                                                    "totalProperty": "total",
+                                                    "xtype": "JsonReader",
+                                                    "|fields": "[\n    {\n        'name': 'item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_number',\n        'type': 'string'\n    }\n]",
+                                                    "|xns": "Roo.data"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "*prop": "footer",
+                                            "displayInfo": true,
+                                            "displayMsg": "",
+                                            "emptyMsg": "",
+                                            "pageSize": 25,
+                                            "xtype": "PagingToolbar",
+                                            "|xns": "Roo"
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "item_number",
+                                            "header": "Number",
+                                            "width": 150,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid"
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "align": "right",
+                                            "dataIndex": "ipshead_price",
+                                            "header": "Price",
+                                            "width": 100,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
+                                            "|xns": "Roo.grid",
+                                            "items": [
+                                                {
+                                                    "|xns": "Roo.grid",
+                                                    "xtype": "GridEditor",
+                                                    "*prop": "editor",
+                                                    "items": [
+                                                        {
+                                                            "*prop": "field",
+                                                            "decimalPrecision": 2,
+                                                            "minValue": 1,
+                                                            "style": "text-align:right",
+                                                            "xtype": "NumberField",
+                                                            "|xns": "Roo.form"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
                         }
                     ]
                 }