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',
68 _this.dialog = Pman.Dialog.CoreProject;
70 _this.getTypes = function()
73 [ 'U' , "Project (Unconfirmed)" ],
75 [ 'C' , "Project (Closed)" ],
76 [ 'N' , "Non-Project" ],
77 [ 'X' , "Non-Project (Closed)" ]
81 _this.typeToString = function(v)
83 var ar = this.getTypes();
85 Roo.each(ar, function(a) {
93 _this.grid.footer.onClick('first');
95 rowdblclick: function (g, ri, e)
98 _this.dialog.show(g.getDataSource().getAt(ri).data, function() {
99 g.footer.onClick('refresh');
105 reader: Pman.Readers.Projects,
107 beforeload: function (_self, o)
109 if (!_this.searchBox) {
112 o.params = o.params ? o.params : {};
113 o.params['query[project_search]'] = _this.searchBox.getValue();
114 o.params['query[project_filter]'] = _this.filter;
117 sortInfo: {field:'code', direction:'DESC'},
122 url: baseURL + '/Roo/core_project.php'
130 renderer: function(v) {return _this.typeToString(v); }
136 renderer: function(v) { return String.format('{0}', v); }
139 header : 'Project Name',
142 renderer: function(v) { return String.format('{0}', v); }
147 dataIndex : 'client_id_name',
148 renderer: function(v) { return String.format('{0}', v); }
153 dataIndex : 'remarks',
154 renderer: function(v) { return String.format('{0}', v); }
158 xtype : 'PagingToolbar',
161 displayMsg : "Displaying Projects {0} - {1} of {2}",
162 emptyMsg : "No Projects found"
170 cls : 'x-btn-text-icon',
171 icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
175 _this.dialog.show( { id : 0 }, function() {
176 _this.grid.footer.onClick('first');
187 cls : 'x-btn-text-icon',
188 icon: Roo.rootURL + 'images/default/tree/leaf.gif',
192 var s = _this.grid.getSelectionModel().getSelections();
193 if (!s.length || (s.length > 1)) {
194 Roo.MessageBox.alert("Error", s.length ? "Select only one Project" : "Select a Project");
198 _this.dialog.show(s[0].data, function() {
199 _this.grid.footer.onClick('refresh');
219 render: function (_self)
221 _this.searchBox = _self;
223 specialkey: function (_self, e)
225 if(e.getKey() == 13) {
226 _this.grid.footer.onClick('first');
236 click: function (_self, e)
238 _this.grid.footer.onClick('first');
241 icon: rootURL + '/Pman/templates/images/search.gif',
248 click: function (_self, e)
250 _this.searchBox.setValue('');
251 _this.grid.footer.onClick('first');
254 icon: rootURL + '/Pman/templates/images/edit-clear.gif',
271 toggle: function (_self, st)
273 if (st) { _this.filter = 'P,N,U'; }
274 _this.grid.footer.onClick('first');
277 toggleGroup : 'pgrp',
286 toggle: function (_self, st)
288 if (st) { _this.filter = 'P,U'; }
289 _this.grid.footer.onClick('first');
292 toggleGroup : 'pgrp',
299 text : "Non-Projects",
301 toggle: function (_self, st)
303 if (st) { _this.filter = 'N'; }
304 _this.grid.footer.onClick('first');
307 toggleGroup : 'pgrp',
316 toggle: function (_self, st)
318 if (st) { _this.filter = 'X,C'; }
319 _this.grid.footer.onClick('first');
322 toggleGroup : 'pgrp',
329 xtype : 'RowSelectionModel',