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