1 //<script type="text/javascript">
3 // Auto generated file build Builder
7 // register the module first
8 Pman.on('beforeload', function()
11 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
15 if (!Pman.hasPerm('Core.Projects_All', 'S')) {
20 modKey : '010-pman_tab_adminprojects',
21 module : Pman.Tab.AdminProjects,
23 parent : Pman.Tab.Admin,
24 name : "Admin - Projects"
28 Pman.Tab.AdminProjects = {
34 add : function(parentLayout, region)
41 this.parentLayout = parentLayout;
43 this.panel = this.parentLayout.addxtype({
48 tableName : 'Projects',
51 activate: function() {
55 if (_this.grid && _this.grid.rendered) {
56 _this.grid.footer.onClick('first');
62 autoExpandColumn : 'remarks',
67 _this.dialog = Pman.Dialog.Projects;
69 _this.getTypes = function()
72 [ 'U' , "Project (Unconfirmed)" ],
74 [ 'C' , "Project (Closed)" ],
75 [ 'N' , "Non-Project" ],
76 [ 'X' , "Non-Project (Closed)" ]
80 _this.typeToString = function(v)
82 var ar = this.getTypes();
84 Roo.each(ar, function(a) {
92 _this.grid.footer.onClick('first');
94 rowdblclick: function (g, ri, e)
97 _this.dialog.show(g.getDataSource().getAt(ri).data, function() {
98 _self.footer.onClick('refresh');
104 reader: Pman.Readers.Projects,
106 beforeload: function (_self, o)
108 if (!_this.searchBox) {
111 o.params = o.params ? o.params : {};
112 o.params['query[project_search]'] = _this.searchBox.getValue();
113 o.params['query[project_filter]'] = _this.filter;
116 sortInfo: {field:'code', direction:'DESC'},
121 url: baseURL + '/Roo/Projects.php'
129 renderer: function(v) {return _this.typeToString(v); }
135 renderer: function(v) { return String.format('{0}', v); }
138 header : 'Project Name',
141 renderer: function(v) { return String.format('{0}', v); }
146 dataIndex : 'client_id_name',
147 renderer: function(v) { return String.format('{0}', v); }
152 dataIndex : 'remarks',
153 renderer: function(v) { return String.format('{0}', v); }
157 xtype : 'PagingToolbar',
160 displayMsg : "Displaying Projects {0} - {1} of {2}",
161 emptyMsg : "No Projects found"
169 cls : 'x-btn-text-icon',
170 icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
174 _this.dialog.show( { id : 0 }, function() {
175 _this.grid.footer.onClick('first');
186 cls : 'x-btn-text-icon',
187 icon: Roo.rootURL + 'images/default/tree/leaf.gif',
191 var s = _this.grid.getSelectionModel().getSelections();
192 if (!s.length || (s.length > 1)) {
193 Roo.MessageBox.alert("Error", s.length ? "Select only one Project" : "Select a Project");
197 _this.dialog.show(s[0].data, function() {
198 _this.grid.footer.onClick('first');
218 render: function (_self)
220 _this.searchBox = _self;
222 specialkey: function (_self, e)
224 if(e.getKey() == 13) {
225 _this.grid.footer.onClick('first');
235 click: function (_self, e)
237 _this.grid.footer.onClick('first');
240 icon: rootURL + '/Pman/templates/images/search.gif',
247 click: function (_self, e)
249 _this.searchBox.setValue('');
250 _this.grid.footer.onClick('first');
253 icon: rootURL + '/Pman/templates/images/edit-clear.gif',
270 toggle: function (_self, st)
272 if (st) { _this.filter = 'P,N,U'; }
273 _this.grid.footer.onClick('first');
276 toggleGroup : 'pgrp',
285 toggle: function (_self, st)
287 if (st) { _this.filter = 'P,U'; }
288 _this.grid.footer.onClick('first');
291 toggleGroup : 'pgrp',
298 text : "Non-Projects",
300 toggle: function (_self, st)
302 if (st) { _this.filter = 'N'; }
303 _this.grid.footer.onClick('first');
306 toggleGroup : 'pgrp',
315 toggle: function (_self, st)
317 if (st) { _this.filter = 'X,C'; }
318 _this.grid.footer.onClick('first');
321 toggleGroup : 'pgrp',
328 xtype : 'RowSelectionModel',