Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleTerms.bjs
index 5f536ce..b97e23f 100644 (file)
@@ -27,9 +27,9 @@
                             "listeners" : {
                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
+                            "region" : "center",
                             "fitToframe" : true,
                             "background" : false,
-                            "region" : "center",
                             "title" : "Terms",
                             "xtype" : "GridPanel",
                             "fitContainer" : true,
@@ -38,6 +38,7 @@
                             "items" : [
                                 {
                                     "listeners" : {
+                                        "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var id = this.getDataSource().getAt(rowIndex).data.terms_id * 1;\n\n    if(id < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n    }\n    \n    Pman.Dialog.XtupleTerms.show( {id : id}, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n}\n",
                                         "|render" : "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
                                     "autoExpandColumn" : "terms_descrip",
                                     "$ xns" : "Roo.grid",
                                     "* prop" : "grid",
                                     "items" : [
+                                        {
+                                            "Boolean singleSelect" : true,
+                                            "xtype" : "RowSelectionModel",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
+                                        },
                                         {
                                             "xtype" : "Toolbar",
                                             "$ xns" : "Roo",
                                                     "cls" : "x-btn-icon",
                                                     "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
                                                     "$ xns" : "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n\n   Pman.Dialog.XtupleTerms.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                                    },
+                                                    "text" : "Add",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "xtype" : "Separator",
+                                                    "$ xns" : "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n    var sel = _this.grid.getSelectionModel().getSelected();\n\n    if(!sel || sel.data.terms_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Please select a terms\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete the terms?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n           new Pman.Request({\n                url : baseURL + '/Roo/terms.php',\n                method : 'POST',\n                params : {\n                    _delete : sel.data.terms_id * 1\n                }, \n                success : function(res) {\n                    _this.grid.footer.onClick('first');\n                }\n            }); \n            \n            return;\n        }\n    );\n    \n}\n        "
+                                                    },
+                                                    "text" : "Delete",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                             },
                                             "xtype" : "Store",
                                             "remoteSort" : true,
-                                            "$ sortInfo" : "{ field : 'crdate', direction: 'ASC' }",
+                                            "$ sortInfo" : "{ field : 'terms_id', direction: 'ASC' }",
                                             "$ xns" : "Roo.data",
                                             "* prop" : "dataSource",
                                             "items" : [
                                                 {
                                                     "$ url" : "baseURL + '/Roo/terms.php'",
-                                                    "xtype" : "HttpProxy",
                                                     "method" : "GET",
+                                                    "xtype" : "HttpProxy",
                                                     "$ xns" : "Roo.data",
                                                     "* prop" : "proxy"
                                                 },
                                         },
                                         {
                                             "xtype" : "ColumnModel",
+                                            "width" : 75,
                                             "header" : "ID#",
-                                            "width" : 200,
                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
                                             "$ xns" : "Roo.grid",
                                             "Boolean sortable" : true,
                                         },
                                         {
                                             "xtype" : "ColumnModel",
-                                            "width" : 150,
                                             "header" : "Code",
+                                            "width" : 150,
                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
                                             "$ xns" : "Roo.grid",
                                             "Boolean sortable" : true,
                                         },
                                         {
                                             "xtype" : "ColumnModel",
-                                            "header" : "Description",
                                             "width" : 150,
+                                            "header" : "Description",
                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
                                             "$ xns" : "Roo.grid",
                                             "Boolean sortable" : true,
                                         },
                                         {
                                             "xtype" : "ColumnModel",
-                                            "width" : 150,
                                             "header" : "Type",
+                                            "width" : 75,
                                             "$ renderer" : "function(v) { \n    var t = (v == 'D') ? 'Days' : 'Proximo';\n    \n    return String.format('{0}', t); \n}",
                                             "$ xns" : "Roo.grid",
                                             "Boolean sortable" : true,
                                             "* prop" : "cm[]",
-                                            "dataIndex" : "term_type"
+                                            "dataIndex" : "terms_type"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Due Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_duedays"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Discount Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_discdays"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Cut Off Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_cutoffday"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Used in Payables",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_ap"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "width" : 150,
+                                            "header" : "Used in Receivables",
+                                            "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_ar"
                                         }
                                     ]
                                 }