add bjs
[Pman.Admin] / Pman.Tab.AdminProjects.bjs
1 {"xtype":"*Module","app":"Admin","modkey":10,"|module":"Pman.Tab.AdminProjects","region":"center","|parent":"Pman.Tab.Admin","name":"Pman.Tab.AdminProjects","listeners":{},"perm":"Core.Projects_All","permtype":"E","items":[{"xtype":"GridPanel","title":"Projects","fitToframe":true,"fitContainer":true,"tableName":"Projects","background":true,"listeners":{"|activate":"function() {\n    _this.panel = this;\n  \n    \n      if (_this.grid && _this.grid.rendered) {\n        _this.grid.footer.onClick('first');\n    }\n}"},"items":[{"*prop":"grid","xtype":"Grid","autoExpandColumn":"remarks","loadMask":true,"listeners":{"|render":"function() { \n    _this.grid = this; \n    _this.dialog = Pman.Dialog.Projects;\n    _this.filter =  'P,U';\n    _this.getTypes = function()\n    {\n        return [\n            [  'U' , \"Project (Unconfirmed)\" ],\n            [  'P' , \"Project\" ],\n            [  'C' , \"Project (Closed)\" ],\n            [  'N' , \"Non-Project\" ],\n            [  'X' , \"Non-Project (Closed)\" ]\n        \n        ];\n    };\n    _this.typeToString = function(v)\n    {\n        var ar = this.getTypes();\n        var ret = '';\n        Roo.each(ar, function(a) {\n            if (a[0] == v) {\n                ret = a[1];\n                return false;\n            }\n        });\n        return ret;\n    }\n     _this.grid.footer.onClick('first');\n}","|rowdblclick":"function (g, ri, e)\n{\n\n    _this.dialog.show(g.getDataSource().getAt(ri).data, function() {\n       _self.footer.onClick('refresh');\n    });\n}"},"items":[{"*prop":"dataSource","xtype":"Store","|reader":"Pman.Readers.Projects","listeners":{"|beforeload":"function (_self, o)\n{\n    if (!_this.searchBox) {\n        return false;\n    }  \n    o.params = o.params ? o.params : {};\n                            o.params['query[project_search]'] = _this.searchBox.getValue();\n                            o.params['query[project_filter]'] = _this.filter;\n}"},"|sortInfo":"{field:'code', direction:'DESC'}","remoteSort":true,"items":[{"*prop":"proxy","xtype":"HttpProxy","method":"GET","|url":"baseURL + '\/Roo\/Projects.php'"}]},{"*prop":"colModel","xtype":"Array","items":[{"xtype":"*ColumnModel","header":"Type","width":70,"dataIndex":"type","|renderer":"function(v) {return _this.typeToString(v); }","listeners":{}},{"xtype":"*ColumnModel","header":"Code","width":90,"dataIndex":"code","|renderer":"function(v) { return String.format('{0}', v); }","listeners":{}},{"xtype":"*ColumnModel","header":"Project Name","width":300,"dataIndex":"name","|renderer":"function(v) { return String.format('{0}', v); }","listeners":{}},{"xtype":"*ColumnModel","header":"Client ","width":100,"dataIndex":"client_id_name","|renderer":"function(v) { return String.format('{0}', v); }","listeners":{}},{"xtype":"*ColumnModel","header":"Remarks","width":300,"dataIndex":"remarks","|renderer":"function(v) { return String.format('{0}', v); }","listeners":{}}]},{"*prop":"footer","xtype":"PagingToolbar","pageSize":25,"displayInfo":true,"displayMsg":"Displaying Projects  {0} - {1} of {2}","emptyMsg":"No Projects found"},{"*prop":"toolbar","xtype":"Toolbar","listeners":{},"items":[{"text":"Add","xtype":"Button","cls":"x-btn-text-icon","|icon":"Roo.rootURL + 'images\/default\/dd\/drop-add.gif'","listeners":{"|click":"function()\n        {\n            _this.dialog.show( { id : 0 }, function() {\n                _this.grid.footer.onClick('first');\n\n            }); \n\n        }\n        "}},{"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 Project\" : \"Select a Project\");\n                return;\n            }\n            \n            _this.dialog.show(s[0].data, function() {\n                _this.grid.footer.onClick('first');\n               }); \n            \n        }\n        "}},{"xtype":"Separator","|xns":"Roo.Toolbar","listeners":{}},{"xtype":"TextItem","|xns":"Roo.Toolbar","text":"Search:","listeners":{}},{"xtype":"TextField","|xns":"Roo.form","listeners":{"|render":"function (_self)\n{\n   _this.searchBox = _self;\n}","|specialkey":"function (_self, e)\n{\n    if(e.getKey() == 13) {\n        _this.grid.footer.onClick('first');\n    }\n}"},"width":135},{"xtype":"Button","|xns":"Roo.Toolbar","listeners":{"|click":"function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}"},"|icon":"rootURL + '\/Pman\/templates\/images\/search.gif'","cls":"x-btn-icon"},{"xtype":"Button","|xns":"Roo.Toolbar","listeners":{"|click":"function (_self, e)\n{\n    _this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"},"|icon":"rootURL + '\/Pman\/templates\/images\/edit-clear.gif'","cls":"x-btn-icon"},{"xtype":"Separator","|xns":"Roo.Toolbar","listeners":{}},{"xtype":"TextItem","|xns":"Roo.Toolbar","text":"Show:","listeners":{}},{"xtype":"Button","|xns":"Roo.Toolbar","text":"All","listeners":{"|toggle":"function (_self, st)\n{\nif (st) { _this.filter = 'P,N,U'; } \n    _this.grid.footer.onClick('first');\n}"},"toggleGroup":"pgrp","pressed":false,"enableToggle":true},{"xtype":"Button","|xns":"Roo.Toolbar","text":"Projects","listeners":{"|toggle":"function (_self, st)\n{\nif (st) { _this.filter = 'P,U'; } \n    _this.grid.footer.onClick('first');\n}"},"toggleGroup":"pgrp","pressed":true,"enableToggle":true},{"xtype":"Button","|xns":"Roo.Toolbar","text":"Non-Projects","listeners":{"|toggle":"function (_self, st)\n{\nif (st) { _this.filter = 'N'; } \n    _this.grid.footer.onClick('first');\n}"},"toggleGroup":"pgrp","pressed":false,"enableToggle":true},{"xtype":"Button","|xns":"Roo.Toolbar","text":"Closed","listeners":{"|toggle":"function (_self, st)\n{\nif (st) { _this.filter = 'X,C'; } \n    _this.grid.footer.onClick('first');\n}"},"toggleGroup":"pgrp","pressed":false,"enableToggle":true}]},{"xtype":"RowSelectionModel","|xns":"Roo.grid","*prop":"selModel","listeners":{},"singleSelect":true}]}]}],"title":"Admin - Projects"}