Pman.Tab.AdminProjectManager.js
[Pman.Admin] / Pman.Tab.AdminProjectManager.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '002-Pman.Tab.AdminProjectManager',
12         module : Pman.Tab.AdminProjectManager,
13         region : 'center',
14         parent : Pman.Tab.Admin,
15         name : "Pman.Tab.AdminProjectManager",
16         disabled : false, 
17         permname: 'Core.Projects_All' 
18     });
19 });
20
21 Pman.Tab.AdminProjectManager = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'NestedLayoutPanel',
35             xns: Roo,
36             region : 'center',
37             title : "Projects",
38             layout : {
39                 xtype: 'BorderLayout',
40                 xns: Roo,
41                 items : [
42                     {
43                         xtype: 'GridPanel',
44                         xns: Roo,
45                         title : "Projects",
46                         fitToframe : true,
47                         fitContainer : true,
48                         tableName : 'Projects',
49                         background : true,
50                         region : 'center',
51                         listeners : {
52                             activate : function() {
53                                 _this.panel = this;
54                                 if (_this.grid) {
55                                     _this.grid.footer.onClick('first');
56                                 }
57                             }
58                         },
59                         grid : {
60                             xtype: 'Grid',
61                             xns: Roo.grid,
62                             listeners : {
63                                 render : function() 
64                                 {
65                                     _this.grid = this; 
66                                     //_this.dialog = Pman.Dialog.FILL_IN
67                                     if (_this.panel.active) {
68                                        this.footer.onClick('first');
69                                     }
70                                 },
71                                 rowdblclick : function (_self, rowIndex, e)
72                                 {
73                                     if (!_this.dialog) return;
74                                     _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
75                                         _this.grid.footer.onClick('first');
76                                     }); 
77                                 }
78                             },
79                             autoExpandColumn : 'name',
80                             loadMask : true,
81                              : function(v)
82                             {
83                                 var ar = this.getTypes();
84                                 var ret = '';
85                                 Roo.each(ar, function(a) {
86                                     if (a[0] == v) {
87                                         ret = a[1];
88                                         return false;
89                                     }
90                                 });
91                                 return ret;
92                             },
93                             dataSource : {
94                                 xtype: 'Store',
95                                 xns: Roo.data,
96                                 listeners : {
97                                     beforeload : function (_self, options)
98                                     {
99                                         if (!_this.searchBox) {
100                                             return false;
101                                         }  
102                                         o.params = o.params ? o.params : {};
103                                         o.params['query[project_search]'] = _this.searchBox.getValue();
104                                         o.params['query[project_filter]'] = _this.filter;
105                                     }
106                                 },
107                                 remoteSort : true,
108                                 sortInfo : { field : 'code', direction: 'ASC' },
109                                 proxy : {
110                                     xtype: 'HttpProxy',
111                                     xns: Roo.data,
112                                     method : 'GET',
113                                     url : baseURL + '/Roo/Projects.php'
114                                 },
115                                 reader : {
116                                     xtype: 'JsonReader',
117                                     xns: Roo.data,
118                                     totalProperty : 'total',
119                                     root : 'data',
120                                     id : 'id',
121                                     fields : [
122                                         {
123                                             'name': 'id',
124                                             'type': 'int'
125                                         },
126                                         {
127                                             'name': 'name',
128                                             'type': 'string'
129                                         },
130                                         {
131                                             'name': 'remarks',
132                                             'type': 'string'
133                                         },
134                                         {
135                                             'name': 'owner_id',
136                                             'type': 'int'
137                                         },
138                                         {
139                                             'name': 'code',
140                                             'type': 'string'
141                                         },
142                                         {
143                                             'name': 'active',
144                                             'type': 'int'
145                                         },
146                                         {
147                                             'name': 'type',
148                                             'type': 'string'
149                                         },
150                                         {
151                                             'name': 'client_id',
152                                             'type': 'int'
153                                         },
154                                         {
155                                             'name': 'team_id',
156                                             'type': 'int'
157                                         },
158                                         {
159                                             'name': 'file_location',
160                                             'type': 'string'
161                                         },
162                                         {
163                                             'name': 'open_date',
164                                             'type': 'date',
165                                             'dateFormat': 'Y-m-d'
166                                         },
167                                         {
168                                             'name': 'open_by',
169                                             'type': 'int'
170                                         },
171                                         {
172                                             'name': 'close_date',
173                                             'type': 'date',
174                                             'dateFormat': 'Y-m-d'
175                                         },
176                                         {
177                                             'name': 'countries',
178                                             'type': 'string'
179                                         },
180                                         {
181                                             'name': 'languages',
182                                             'type': 'string'
183                                         },
184                                         {
185                                             'name': 'agency_id',
186                                             'type': 'int'
187                                         },
188                                         {
189                                             'name': 'client_id_code',
190                                             'type': 'string'
191                                         },
192                                         {
193                                             'name': 'client_id_name',
194                                             'type': 'string'
195                                         },
196                                         {
197                                             'name': 'client_id_remarks',
198                                             'type': 'string'
199                                         },
200                                         {
201                                             'name': 'client_id_owner_id',
202                                             'type': 'int'
203                                         },
204                                         {
205                                             'name': 'client_id_address',
206                                             'type': 'string'
207                                         },
208                                         {
209                                             'name': 'client_id_tel',
210                                             'type': 'string'
211                                         },
212                                         {
213                                             'name': 'client_id_fax',
214                                             'type': 'string'
215                                         },
216                                         {
217                                             'name': 'client_id_email',
218                                             'type': 'string'
219                                         },
220                                         {
221                                             'name': 'client_id_id',
222                                             'type': 'int'
223                                         },
224                                         {
225                                             'name': 'client_id_isOwner',
226                                             'type': 'int'
227                                         },
228                                         {
229                                             'name': 'client_id_logo_id',
230                                             'type': 'int'
231                                         },
232                                         {
233                                             'name': 'client_id_background_color',
234                                             'type': 'string'
235                                         },
236                                         {
237                                             'name': 'client_id_comptype',
238                                             'type': 'string'
239                                         },
240                                         {
241                                             'name': 'client_id_url',
242                                             'type': 'string'
243                                         },
244                                         {
245                                             'name': 'client_id_main_office_id',
246                                             'type': 'int'
247                                         },
248                                         {
249                                             'name': 'client_id_created_by',
250                                             'type': 'int'
251                                         },
252                                         {
253                                             'name': 'client_id_created_dt',
254                                             'type': 'date'
255                                         },
256                                         {
257                                             'name': 'client_id_updated_by',
258                                             'type': 'int'
259                                         },
260                                         {
261                                             'name': 'client_id_updated_dt',
262                                             'type': 'date'
263                                         },
264                                         {
265                                             'name': 'client_id_passwd',
266                                             'type': 'string'
267                                         },
268                                         {
269                                             'name': 'agency_id_code',
270                                             'type': 'string'
271                                         },
272                                         {
273                                             'name': 'agency_id_name',
274                                             'type': 'string'
275                                         },
276                                         {
277                                             'name': 'agency_id_remarks',
278                                             'type': 'string'
279                                         },
280                                         {
281                                             'name': 'agency_id_owner_id',
282                                             'type': 'int'
283                                         },
284                                         {
285                                             'name': 'agency_id_address',
286                                             'type': 'string'
287                                         },
288                                         {
289                                             'name': 'agency_id_tel',
290                                             'type': 'string'
291                                         },
292                                         {
293                                             'name': 'agency_id_fax',
294                                             'type': 'string'
295                                         },
296                                         {
297                                             'name': 'agency_id_email',
298                                             'type': 'string'
299                                         },
300                                         {
301                                             'name': 'agency_id_id',
302                                             'type': 'int'
303                                         },
304                                         {
305                                             'name': 'agency_id_isOwner',
306                                             'type': 'int'
307                                         },
308                                         {
309                                             'name': 'agency_id_logo_id',
310                                             'type': 'int'
311                                         },
312                                         {
313                                             'name': 'agency_id_background_color',
314                                             'type': 'string'
315                                         },
316                                         {
317                                             'name': 'agency_id_comptype',
318                                             'type': 'string'
319                                         },
320                                         {
321                                             'name': 'agency_id_url',
322                                             'type': 'string'
323                                         },
324                                         {
325                                             'name': 'agency_id_main_office_id',
326                                             'type': 'int'
327                                         },
328                                         {
329                                             'name': 'agency_id_created_by',
330                                             'type': 'int'
331                                         },
332                                         {
333                                             'name': 'agency_id_created_dt',
334                                             'type': 'date'
335                                         },
336                                         {
337                                             'name': 'agency_id_updated_by',
338                                             'type': 'int'
339                                         },
340                                         {
341                                             'name': 'agency_id_updated_dt',
342                                             'type': 'date'
343                                         },
344                                         {
345                                             'name': 'agency_id_passwd',
346                                             'type': 'string'
347                                         },
348                                         {
349                                             'name': 'team_id_id',
350                                             'type': 'int'
351                                         },
352                                         {
353                                             'name': 'team_id_name',
354                                             'type': 'string'
355                                         },
356                                         {
357                                             'name': 'team_id_type',
358                                             'type': 'int'
359                                         },
360                                         {
361                                             'name': 'team_id_leader',
362                                             'type': 'int'
363                                         },
364                                         {
365                                             'name': 'open_by_id',
366                                             'type': 'int'
367                                         },
368                                         {
369                                             'name': 'open_by_office_id',
370                                             'type': 'int'
371                                         },
372                                         {
373                                             'name': 'open_by_name',
374                                             'type': 'string'
375                                         },
376                                         {
377                                             'name': 'open_by_phone',
378                                             'type': 'string'
379                                         },
380                                         {
381                                             'name': 'open_by_fax',
382                                             'type': 'string'
383                                         },
384                                         {
385                                             'name': 'open_by_email',
386                                             'type': 'string'
387                                         },
388                                         {
389                                             'name': 'open_by_company_id',
390                                             'type': 'int'
391                                         },
392                                         {
393                                             'name': 'open_by_role',
394                                             'type': 'string'
395                                         },
396                                         {
397                                             'name': 'open_by_active',
398                                             'type': 'int'
399                                         },
400                                         {
401                                             'name': 'open_by_remarks',
402                                             'type': 'string'
403                                         },
404                                         {
405                                             'name': 'open_by_passwd',
406                                             'type': 'string'
407                                         },
408                                         {
409                                             'name': 'open_by_owner_id',
410                                             'type': 'int'
411                                         },
412                                         {
413                                             'name': 'open_by_lang',
414                                             'type': 'string'
415                                         },
416                                         {
417                                             'name': 'open_by_no_reset_sent',
418                                             'type': 'int'
419                                         },
420                                         {
421                                             'name': 'open_by_action_type',
422                                             'type': 'string'
423                                         },
424                                         {
425                                             'name': 'open_by_project_id',
426                                             'type': 'int'
427                                         },
428                                         {
429                                             'name': 'owner_id_id',
430                                             'type': 'int'
431                                         },
432                                         {
433                                             'name': 'owner_id_office_id',
434                                             'type': 'int'
435                                         },
436                                         {
437                                             'name': 'owner_id_name',
438                                             'type': 'string'
439                                         },
440                                         {
441                                             'name': 'owner_id_phone',
442                                             'type': 'string'
443                                         },
444                                         {
445                                             'name': 'owner_id_fax',
446                                             'type': 'string'
447                                         },
448                                         {
449                                             'name': 'owner_id_email',
450                                             'type': 'string'
451                                         },
452                                         {
453                                             'name': 'owner_id_company_id',
454                                             'type': 'int'
455                                         },
456                                         {
457                                             'name': 'owner_id_role',
458                                             'type': 'string'
459                                         },
460                                         {
461                                             'name': 'owner_id_active',
462                                             'type': 'int'
463                                         },
464                                         {
465                                             'name': 'owner_id_remarks',
466                                             'type': 'string'
467                                         },
468                                         {
469                                             'name': 'owner_id_passwd',
470                                             'type': 'string'
471                                         },
472                                         {
473                                             'name': 'owner_id_owner_id',
474                                             'type': 'int'
475                                         },
476                                         {
477                                             'name': 'owner_id_lang',
478                                             'type': 'string'
479                                         },
480                                         {
481                                             'name': 'owner_id_no_reset_sent',
482                                             'type': 'int'
483                                         },
484                                         {
485                                             'name': 'owner_id_action_type',
486                                             'type': 'string'
487                                         },
488                                         {
489                                             'name': 'owner_id_project_id',
490                                             'type': 'int'
491                                         }
492                                     ]
493                                 }
494                             },
495                             footer : {
496                                 xtype: 'PagingToolbar',
497                                 xns: Roo,
498                                 pageSize : 25,
499                                 displayInfo : true,
500                                 displayMsg : 'Displaying Projects{0} - {1} of {2}',
501                                 emptyMsg : 'No Projects found'
502                             },
503                             toolbar : {
504                                 xtype: 'Toolbar',
505                                 xns: Roo,
506                                 items : [
507                                     {
508                                         xtype: 'Button',
509                                         xns: Roo.Toolbar,
510                                         text : "Add",
511                                         cls : 'x-btn-text-icon',
512                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
513                                         listeners : {
514                                             click : function()
515                                             {
516                                                 if (!_this.dialog) return;
517                                                 _this.dialog.show( { id : 0 } , function() {
518                                                     _this.grid.footer.onClick('first');
519                                                }); 
520                                             }
521                                         }
522                                     },
523                                     {
524                                         xtype: 'Button',
525                                         xns: Roo.Toolbar,
526                                         text : "Edit",
527                                         cls : 'x-btn-text-icon',
528                                         icon : Roo.rootURL + 'images/default/tree/leaf.gif',
529                                         listeners : {
530                                             click : function()
531                                             {
532                                                 var s = _this.grid.getSelectionModel().getSelections();
533                                                 if (!s.length || (s.length > 1))  {
534                                                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
535                                                     return;
536                                                 }
537                                                 if (!_this.dialog) return;
538                                                 _this.dialog.show(s[0].data, function() {
539                                                     _this.grid.footer.onClick('first');
540                                                 }); 
541                                                 
542                                             }
543                                         }
544                                     },
545                                     {
546                                         xtype: 'Button',
547                                         xns: Roo.Toolbar,
548                                         text : "Delete",
549                                         cls : 'x-btn-text-icon',
550                                         icon : rootURL + '/Pman/templates/images/trash.gif',
551                                         listeners : {
552                                             click : function()
553                                             {
554                                                  Pman.genericDelete(_this, 'Projects'); 
555                                             }
556                                         }
557                                     }
558                                 ]
559                             },
560                             colModel : [
561                                 {
562                                     xtype: 'ColumnModel',
563                                     xns: Roo.grid,
564                                     header : 'Type',
565                                     width : 200,
566                                     dataIndex : 'type',
567                                     renderer : function(v) { return String.format('{0}', v); }
568                                 },
569                                 {
570                                     xtype: 'ColumnModel',
571                                     xns: Roo.grid,
572                                     header : 'Code',
573                                     width : 200,
574                                     dataIndex : 'code',
575                                     renderer : function(v) { return String.format('{0}', v); }
576                                 },
577                                 {
578                                     xtype: 'ColumnModel',
579                                     xns: Roo.grid,
580                                     header : 'Name',
581                                     width : 200,
582                                     dataIndex : 'name',
583                                     renderer : function(v) { return String.format('{0}', v); }
584                                 },
585                                 {
586                                     xtype: 'ColumnModel',
587                                     xns: Roo.grid,
588                                     header : 'Client',
589                                     width : 75,
590                                     dataIndex : 'client_id',
591                                     renderer : function(v) { return String.format('{0}', v); }
592                                 }
593                             ]
594                         }
595                     }
596                 ],
597                 center : {
598                     xtype: 'LayoutRegion',
599                     xns: Roo
600                 },
601                 east : {
602                     xtype: 'LayoutRegion',
603                     xns: Roo,
604                     width : 300
605                 }
606             }
607         });
608         this.layout = this.panel.layout;
609
610     }
611 });