Pman.Tab.XtupleCurrency.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 23 Dec 2013 10:38:15 +0000 (18:38 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 23 Dec 2013 10:38:15 +0000 (18:38 +0800)
Pman.Tab.XtupleCurrency.js

Pman.Tab.XtupleCurrency.bjs
Pman.Tab.XtupleCurrency.js

index a63bdde..89e3ef9 100644 (file)
                                     ]
                                 }
                             ]
+                        },
+                        {
+                            "|xns": "Roo",
+                            "xtype": "GridPanel",
+                            "title": "curr_rate",
+                            "fitToframe": true,
+                            "fitContainer": true,
+                            "tableName": "curr_rate",
+                            "background": true,
+                            "region": "center",
+                            "listeners": {
+                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            },
+                            "items": [
+                                {
+                                    "*prop": "grid",
+                                    "xtype": "Grid",
+                                    "autoExpandColumn": "",
+                                    "loadMask": true,
+                                    "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"
+                                    },
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "*prop": "dataSource",
+                                            "xtype": "Store",
+                                            "remoteSort": true,
+                                            "|sortInfo": "{ field : '', direction: 'ASC' }",
+                                            "|xns": "Roo.data",
+                                            "items": [
+                                                {
+                                                    "*prop": "proxy",
+                                                    "xtype": "HttpProxy",
+                                                    "method": "GET",
+                                                    "|url": "baseURL + '/Roo/curr_rate.php'",
+                                                    "|xns": "Roo.data"
+                                                },
+                                                {
+                                                    "|xns": "Roo.data",
+                                                    "xtype": "JsonReader",
+                                                    "totalProperty": "total",
+                                                    "root": "data",
+                                                    "*prop": "reader",
+                                                    "id": "id",
+                                                    "|fields": "[\n    {\n        'name': 'curr_rate_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_rate',\n        'type': 'float'\n    },\n    {\n        'name': 'curr_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'curr_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    }\n]"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "*prop": "footer",
+                                            "xtype": "PagingToolbar",
+                                            "pageSize": 25,
+                                            "displayInfo": true,
+                                            "displayMsg": "Displaying curr_rate{0} - {1} of {2}",
+                                            "emptyMsg": "No curr_rate found",
+                                            "|xns": "Roo"
+                                        },
+                                        {
+                                            "*prop": "toolbar",
+                                            "xtype": "Toolbar",
+                                            "|xns": "Roo",
+                                            "items": [
+                                                {
+                                                    "text": "Add",
+                                                    "xtype": "Button",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "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"
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "text": "Edit",
+                                                    "xtype": "Button",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                    "listeners": {
+                                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "text": "Delete",
+                                                    "cls": "x-btn-text-icon",
+                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "xtype": "Button",
+                                                    "listeners": {
+                                                        "|click": "function()\n{\n     Pman.genericDelete(_this, 'curr_rate'); \n}\n        "
+                                                    },
+                                                    "|xns": "Roo.Toolbar"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr rate",
+                                            "width": 75,
+                                            "dataIndex": "curr_rate_id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr",
+                                            "width": 75,
+                                            "dataIndex": "curr_id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr",
+                                            "width": 75,
+                                            "dataIndex": "curr_id",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr rate",
+                                            "width": 75,
+                                            "dataIndex": "curr_rate",
+                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr effective",
+                                            "width": 75,
+                                            "dataIndex": "curr_effective",
+                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        },
+                                        {
+                                            "xtype": "ColumnModel",
+                                            "header": "Curr expires",
+                                            "width": 75,
+                                            "dataIndex": "curr_expires",
+                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                            "|xns": "Roo.grid",
+                                            "*prop": "colModel[]"
+                                        }
+                                    ]
+                                }
+                            ]
                         }
                     ]
                 }
index 4f2c40a..7e70329 100644 (file)
@@ -209,6 +209,209 @@ Pman.Tab.XtupleCurrency = new Roo.XComponent({
                                 }
                             ]
                         }
+                    },
+                    {
+                        xtype: 'GridPanel',
+                        xns: Roo,
+                        title : "curr_rate",
+                        fitToframe : true,
+                        fitContainer : true,
+                        tableName : 'curr_rate',
+                        background : true,
+                        region : 'center',
+                        listeners : {
+                            activate : function() {
+                                _this.panel = this;
+                                if (_this.grid) {
+                                    _this.grid.footer.onClick('first');
+                                }
+                            }
+                        },
+                        grid : {
+                            xtype: 'Grid',
+                            xns: Roo.grid,
+                            autoExpandColumn : '',
+                            loadMask : true,
+                            listeners : {
+                                render : function() 
+                                {
+                                    _this.grid = this; 
+                                    //_this.dialog = Pman.Dialog.FILL_IN
+                                    if (_this.panel.active) {
+                                       this.footer.onClick('first');
+                                    }
+                                },
+                                rowdblclick : function (_self, rowIndex, e)
+                                {
+                                    if (!_this.dialog) return;
+                                    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
+                                        _this.grid.footer.onClick('first');
+                                    }); 
+                                }
+                            },
+                            dataSource : {
+                                xtype: 'Store',
+                                xns: Roo.data,
+                                remoteSort : true,
+                                sortInfo : { field : '', direction: 'ASC' },
+                                proxy : {
+                                    xtype: 'HttpProxy',
+                                    xns: Roo.data,
+                                    method : 'GET',
+                                    url : baseURL + '/Roo/curr_rate.php'
+                                },
+                                reader : {
+                                    xtype: 'JsonReader',
+                                    xns: Roo.data,
+                                    totalProperty : 'total',
+                                    root : 'data',
+                                    id : 'id',
+                                    fields : [
+                                        {
+                                            'name': 'curr_rate_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'curr_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'curr_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'curr_rate',
+                                            'type': 'float'
+                                        },
+                                        {
+                                            'name': 'curr_effective',
+                                            'type': 'date',
+                                            'dateFormat': 'Y-m-d'
+                                        },
+                                        {
+                                            'name': 'curr_expires',
+                                            'type': 'date',
+                                            'dateFormat': 'Y-m-d'
+                                        }
+                                    ]
+                                }
+                            },
+                            footer : {
+                                xtype: 'PagingToolbar',
+                                xns: Roo,
+                                pageSize : 25,
+                                displayInfo : true,
+                                displayMsg : "Displaying curr_rate{0} - {1} of {2}",
+                                emptyMsg : "No curr_rate found"
+                            },
+                            toolbar : {
+                                xtype: 'Toolbar',
+                                xns: Roo,
+                                items : [
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Add",
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show( { id : 0 } , function() {
+                                                    _this.grid.footer.onClick('first');
+                                               }); 
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Edit",
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                var s = _this.grid.getSelectionModel().getSelections();
+                                                if (!s.length || (s.length > 1))  {
+                                                    Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                                                    return;
+                                                }
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show(s[0].data, function() {
+                                                    _this.grid.footer.onClick('first');
+                                                }); 
+                                                
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Delete",
+                                        cls : 'x-btn-text-icon',
+                                        icon : rootURL + '/Pman/templates/images/trash.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                 Pman.genericDelete(_this, 'curr_rate'); 
+                                            }
+                                        }
+                                    }
+                                ]
+                            },
+                            colModel : [
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr rate',
+                                    width : 75,
+                                    dataIndex : 'curr_rate_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr',
+                                    width : 75,
+                                    dataIndex : 'curr_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr',
+                                    width : 75,
+                                    dataIndex : 'curr_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr rate',
+                                    width : 75,
+                                    dataIndex : 'curr_rate',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr effective',
+                                    width : 75,
+                                    dataIndex : 'curr_effective',
+                                    renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Curr expires',
+                                    width : 75,
+                                    dataIndex : 'curr_expires',
+                                    renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
+                                }
+                            ]
+                        }
                     }
                 ],
                 west : {