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