sync
[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 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.AdminProjectManager = new Roo.XComponent({
8
9  _strings : {
10   '54e1d44609e3abed11f6e1eb6ae54988' :"Projects",
11   '8115b8afd5b2953d9fa63eb0db9559fc' :"No Projects found",
12   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
13   '13348442cc6a27032d2b4aa28b75a5d3' :"Search",
14   '7dce122004969d56ae2e0245cb754d35' :"Edit",
15   '577d7068826de925ea2aec01dbadf5e4' :"Client",
16   '917d465e9a9e8b16a8da50a1ca8156ca' :"Show:",
17   '0f111c111475c934057e6f8bb8314d56' :"Non-Projects",
18   '03f4a47830f97377a35321051685071e' :"Closed",
19   'f45e7cfb0824b6d381ade7d81bb81615' :"Displaying Projects {0} - {1} of {2}",
20   'b1c94ca2fbc3e78fc30069c8d0f01680' :"All",
21   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
22   'ca0dbad92a874b2f69b549293387925e' :"Code",
23   '49ee3087348e8d44e1feda1917443987' :"Name",
24   '93573647a6041adaabd942e88cc29e23' :"Projects / Members"
25  },
26
27   part     :  ["Admin", "ProjectManager" ],
28   order    : '002-Pman.Tab.AdminProjectManager',
29   region   : 'center',
30   parent   : 'Pman.Tab.Admin',
31   name     : "Pman.Tab.AdminProjectManager",
32   disabled : false, 
33   permname : 'Core.Projects_All', 
34   _tree : function(_data)
35   {
36    var _this = this;
37    var MODULE = this;
38    return {
39    xtype : 'NestedLayoutPanel',
40    fitContainer : true,
41    fitToFrame : true,
42    region : 'center',
43    title : _this._strings['93573647a6041adaabd942e88cc29e23'] /* Projects / Members */,
44    xns : Roo,
45    '|xns' : 'Roo',
46    layout : {
47     xtype : 'BorderLayout',
48     xns : Roo,
49     '|xns' : 'Roo',
50     center : {
51      xtype : 'LayoutRegion',
52      xns : Roo,
53      '|xns' : 'Roo'
54     },
55     east : {
56      xtype : 'LayoutRegion',
57      split : true,
58      width : 300,
59      xns : Roo,
60      '|xns' : 'Roo'
61     },
62     items  : [
63      {
64       xtype : 'GridPanel',
65       background : true,
66       fitContainer : true,
67       fitToframe : true,
68       region : 'center',
69       tableName : 'Projects',
70       title : _this._strings['54e1d44609e3abed11f6e1eb6ae54988'] /* Projects */,
71       listeners : {
72        activate : function() {
73             _this.panel = this;
74             try {
75                 _this.dialog =  Pman.Dialog.CoreProject ; 
76             } catch(e) {}
77             if (_this.grid) {
78                 _this.grid.footer.onClick('first');
79             }
80         }
81       },
82       xns : Roo,
83       '|xns' : 'Roo',
84       grid : {
85        xtype : 'Grid',
86        autoExpandColumn : 'name',
87        filter : 'P,U',
88        getTypes : function() {
89            return [
90                [  'U' , "Project (Unconfirmed)" ],
91                [  'P' , "Project" ],
92                [  'C' , "Project (Closed)" ],
93                [  'N' , "Non-Project" ],
94                [  'X' , "Non-Project (Closed)" ]
95        
96            ];
97        },
98        loadMask : true,
99        typeToString : function(v)
100        {
101            var ar = this.getTypes();
102            var ret = '';
103            Roo.each(ar, function(a) {
104                if (a[0] == v) {
105                    ret = a[1];
106                    return false;
107                }
108            });
109            return ret;
110        },
111        listeners : {
112         render : function() 
113          {
114              _this.grid = this; 
115              //_this.dialog = Pman.Dialog.FILL_IN
116              if (_this.panel.active) {
117                 this.footer.onClick('first');
118              }
119          },
120         rowdblclick : function (_self, rowIndex, e)
121          {
122              if (!_this.dialog) {
123                   return;
124               }
125              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
126                  _this.grid.footer.onClick('refresh');
127              }); 
128          }
129        },
130        xns : Roo.grid,
131        '|xns' : 'Roo.grid',
132        footer : {
133         xtype : 'PagingToolbar',
134         displayInfo : true,
135         displayMsg : _this._strings['f45e7cfb0824b6d381ade7d81bb81615'] /* Displaying Projects {0} - {1} of {2} */,
136         emptyMsg : _this._strings['8115b8afd5b2953d9fa63eb0db9559fc'] /* No Projects found */,
137         pageSize : 25,
138         xns : Roo,
139         '|xns' : 'Roo'
140        },
141        toolbar : {
142         xtype : 'Toolbar',
143         xns : Roo,
144         '|xns' : 'Roo',
145         items  : [
146          {
147           xtype : 'Button',
148           cls : 'x-btn-text-icon',
149           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
150           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
151           listeners : {
152            click : function()
153             {
154                 if (!_this.dialog) {
155                     return;
156                 }
157                 _this.dialog.show( { id : 0 } , function() {
158                     _this.grid.footer.onClick('first');
159                }); 
160             }
161           },
162           xns : Roo.Toolbar,
163           '|xns' : 'Roo.Toolbar'
164          },
165          {
166           xtype : 'Button',
167           cls : 'x-btn-text-icon',
168           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
169           text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
170           listeners : {
171            click : function()
172             {
173                 var s = _this.grid.getSelectionModel().getSelections();
174                 if (!s.length || (s.length > 1))  {
175                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
176                     return;
177                 }
178                 if (!_this.dialog) {
179                     return;
180                 }
181                 _this.dialog.show(s[0].data, function() {
182                     _this.grid.footer.onClick('first');
183                 }); 
184                 
185             }
186           },
187           xns : Roo.Toolbar,
188           '|xns' : 'Roo.Toolbar'
189          },
190          {
191           xtype : 'Separator',
192           xns : Roo.Toolbar,
193           '|xns' : 'Roo.Toolbar'
194          },
195          {
196           xtype : 'TextItem',
197           text : _this._strings['13348442cc6a27032d2b4aa28b75a5d3'] /* Search */,
198           xns : Roo.Toolbar,
199           '|xns' : 'Roo.Toolbar'
200          },
201          {
202           xtype : 'TextField',
203           listeners : {
204            render : function (_self)
205             {
206                 _this.searchBox = _self;
207             },
208            specialkey : function (_self, e)
209             {
210                 if(e.getKey() == 13) {
211                       _this.grid.footer.onClick('first');
212                 }
213             }
214           },
215           xns : Roo.form,
216           '|xns' : 'Roo.form'
217          },
218          {
219           xtype : 'Button',
220           cls : 'x-btn-icon',
221           icon : rootURL + '/Pman/templates/images/search.gif',
222           listeners : {
223            click : function (_self, e)
224             {
225             _this.grid.footer.onClick('first');
226             }
227           },
228           xns : Roo.Toolbar,
229           '|xns' : 'Roo.Toolbar'
230          },
231          {
232           xtype : 'Button',
233           cls : 'x-btn-icon',
234           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
235           listeners : {
236            click : function (_self, e)
237             {
238             _this.searchBox.setValue('');
239                 _this.grid.footer.onClick('first');
240             }
241           },
242           xns : Roo.Toolbar,
243           '|xns' : 'Roo.Toolbar'
244          },
245          {
246           xtype : 'Separator',
247           xns : Roo.Toolbar,
248           '|xns' : 'Roo.Toolbar'
249          },
250          {
251           xtype : 'TextItem',
252           text : _this._strings['917d465e9a9e8b16a8da50a1ca8156ca'] /* Show: */,
253           xns : Roo.Toolbar,
254           '|xns' : 'Roo.Toolbar'
255          },
256          {
257           xtype : 'Button',
258           enableToggle : true,
259           pressed : false,
260           text : _this._strings['b1c94ca2fbc3e78fc30069c8d0f01680'] /* All */,
261           toggleGroup : 'pgrp',
262           listeners : {
263            toggle : function (_self,st)
264             {
265                 if (st) { _this.grid.filter = 'P,N,U'; } 
266                 _this.grid.footer.onClick('first');
267                  
268             }
269           },
270           xns : Roo.Toolbar,
271           '|xns' : 'Roo.Toolbar'
272          },
273          {
274           xtype : 'Button',
275           enableToggle : true,
276           pressed : true,
277           text : _this._strings['54e1d44609e3abed11f6e1eb6ae54988'] /* Projects */,
278           toggleGroup : 'pgrp',
279           listeners : {
280            toggle : function (_self,st)
281             {
282                 if (st) { _this.grid.filter = 'P,U'; } 
283                 _this.grid.footer.onClick('first');
284                  
285             }
286           },
287           xns : Roo.Toolbar,
288           '|xns' : 'Roo.Toolbar'
289          },
290          {
291           xtype : 'Button',
292           enableToggle : true,
293           pressed : false,
294           text : _this._strings['0f111c111475c934057e6f8bb8314d56'] /* Non-Projects */,
295           toggleGroup : 'pgrp',
296           listeners : {
297            toggle : function (_self,st)
298             {
299                 if (st) { _this.grid.filter = 'N'; } 
300                 _this.grid.footer.onClick('first');
301                  
302             }
303           },
304           xns : Roo.Toolbar,
305           '|xns' : 'Roo.Toolbar'
306          },
307          {
308           xtype : 'Button',
309           enableToggle : true,
310           pressed : false,
311           text : _this._strings['03f4a47830f97377a35321051685071e'] /* Closed */,
312           toggleGroup : 'pgrp',
313           listeners : {
314            toggle : function (_self, st)
315             {
316                     if (st) { _this.grid.filter = 'X,C'; } 
317                             _this.grid.footer.onClick('first');
318                     
319             }
320           },
321           xns : Roo.Toolbar,
322           '|xns' : 'Roo.Toolbar'
323          }
324         ]
325        },
326        dataSource : {
327         xtype : 'Store',
328         remoteSort : true,
329         sortInfo : { field : 'code', direction: 'ASC' },
330         listeners : {
331          beforeload : function (_self, o)
332           {
333               if (!_this.searchBox) {
334                   return false;
335               }  
336               o.params = o.params ? o.params : {};
337               o.params['query[project_search]'] = _this.searchBox.getValue();
338               o.params['query[project_filter]'] = _this.grid.filter;
339           }
340         },
341         xns : Roo.data,
342         '|xns' : 'Roo.data',
343         proxy : {
344          xtype : 'HttpProxy',
345          method : 'GET',
346          url : baseURL + '/Roo/core_project.php',
347          xns : Roo.data,
348          '|xns' : 'Roo.data'
349         },
350         reader : {
351          xtype : 'JsonReader',
352          fields : [
353              {
354                  'name': 'id',
355                  'type': 'int'
356              },
357              {
358                  'name': 'name',
359                  'type': 'string'
360              },
361              {
362                  'name': 'remarks',
363                  'type': 'string'
364              },
365              {
366                  'name': 'owner_id',
367                  'type': 'int'
368              },
369              {
370                  'name': 'code',
371                  'type': 'string'
372              },
373              {
374                  'name': 'active',
375                  'type': 'int'
376              },
377              {
378                  'name': 'type',
379                  'type': 'string'
380              },
381              {
382                  'name': 'client_id',
383                  'type': 'int'
384              },
385              {
386                  'name': 'team_id',
387                  'type': 'int'
388              },
389              {
390                  'name': 'file_location',
391                  'type': 'string'
392              },
393              {
394                  'name': 'open_date',
395                  'type': 'date',
396                  'dateFormat': 'Y-m-d'
397              },
398              {
399                  'name': 'open_by',
400                  'type': 'int'
401              },
402              {
403                  'name': 'close_date',
404                  'type': 'date',
405                  'dateFormat': 'Y-m-d'
406              },
407              {
408                  'name': 'countries',
409                  'type': 'string'
410              },
411              {
412                  'name': 'languages',
413                  'type': 'string'
414              },
415              {
416                  'name': 'agency_id',
417                  'type': 'int'
418              },
419              {
420                  'name': 'client_id_code',
421                  'type': 'string'
422              },
423              {
424                  'name': 'client_id_name',
425                  'type': 'string'
426              },
427              {
428                  'name': 'client_id_remarks',
429                  'type': 'string'
430              },
431              {
432                  'name': 'client_id_owner_id',
433                  'type': 'int'
434              },
435              {
436                  'name': 'client_id_address',
437                  'type': 'string'
438              },
439              {
440                  'name': 'client_id_tel',
441                  'type': 'string'
442              },
443              {
444                  'name': 'client_id_fax',
445                  'type': 'string'
446              },
447              {
448                  'name': 'client_id_email',
449                  'type': 'string'
450              },
451              {
452                  'name': 'client_id_id',
453                  'type': 'int'
454              },
455              {
456                  'name': 'client_id_isOwner',
457                  'type': 'int'
458              },
459              {
460                  'name': 'client_id_logo_id',
461                  'type': 'int'
462              },
463              {
464                  'name': 'client_id_background_color',
465                  'type': 'string'
466              },
467              {
468                  'name': 'client_id_comptype',
469                  'type': 'string'
470              },
471              {
472                  'name': 'client_id_url',
473                  'type': 'string'
474              },
475              {
476                  'name': 'client_id_main_office_id',
477                  'type': 'int'
478              },
479              {
480                  'name': 'client_id_created_by',
481                  'type': 'int'
482              },
483              {
484                  'name': 'client_id_created_dt',
485                  'type': 'date'
486              },
487              {
488                  'name': 'client_id_updated_by',
489                  'type': 'int'
490              },
491              {
492                  'name': 'client_id_updated_dt',
493                  'type': 'date'
494              },
495              {
496                  'name': 'client_id_passwd',
497                  'type': 'string'
498              },
499              {
500                  'name': 'agency_id_code',
501                  'type': 'string'
502              },
503              {
504                  'name': 'agency_id_name',
505                  'type': 'string'
506              },
507              {
508                  'name': 'agency_id_remarks',
509                  'type': 'string'
510              },
511              {
512                  'name': 'agency_id_owner_id',
513                  'type': 'int'
514              },
515              {
516                  'name': 'agency_id_address',
517                  'type': 'string'
518              },
519              {
520                  'name': 'agency_id_tel',
521                  'type': 'string'
522              },
523              {
524                  'name': 'agency_id_fax',
525                  'type': 'string'
526              },
527              {
528                  'name': 'agency_id_email',
529                  'type': 'string'
530              },
531              {
532                  'name': 'agency_id_id',
533                  'type': 'int'
534              },
535              {
536                  'name': 'agency_id_isOwner',
537                  'type': 'int'
538              },
539              {
540                  'name': 'agency_id_logo_id',
541                  'type': 'int'
542              },
543              {
544                  'name': 'agency_id_background_color',
545                  'type': 'string'
546              },
547              {
548                  'name': 'agency_id_comptype',
549                  'type': 'string'
550              },
551              {
552                  'name': 'agency_id_url',
553                  'type': 'string'
554              },
555              {
556                  'name': 'agency_id_main_office_id',
557                  'type': 'int'
558              },
559              {
560                  'name': 'agency_id_created_by',
561                  'type': 'int'
562              },
563              {
564                  'name': 'agency_id_created_dt',
565                  'type': 'date'
566              },
567              {
568                  'name': 'agency_id_updated_by',
569                  'type': 'int'
570              },
571              {
572                  'name': 'agency_id_updated_dt',
573                  'type': 'date'
574              },
575              {
576                  'name': 'agency_id_passwd',
577                  'type': 'string'
578              },
579              {
580                  'name': 'team_id_id',
581                  'type': 'int'
582              },
583              {
584                  'name': 'team_id_name',
585                  'type': 'string'
586              },
587              {
588                  'name': 'team_id_type',
589                  'type': 'int'
590              },
591              {
592                  'name': 'team_id_leader',
593                  'type': 'int'
594              },
595              {
596                  'name': 'open_by_id',
597                  'type': 'int'
598              },
599              {
600                  'name': 'open_by_office_id',
601                  'type': 'int'
602              },
603              {
604                  'name': 'open_by_name',
605                  'type': 'string'
606              },
607              {
608                  'name': 'open_by_phone',
609                  'type': 'string'
610              },
611              {
612                  'name': 'open_by_fax',
613                  'type': 'string'
614              },
615              {
616                  'name': 'open_by_email',
617                  'type': 'string'
618              },
619              {
620                  'name': 'open_by_company_id',
621                  'type': 'int'
622              },
623              {
624                  'name': 'open_by_role',
625                  'type': 'string'
626              },
627              {
628                  'name': 'open_by_active',
629                  'type': 'int'
630              },
631              {
632                  'name': 'open_by_remarks',
633                  'type': 'string'
634              },
635              {
636                  'name': 'open_by_passwd',
637                  'type': 'string'
638              },
639              {
640                  'name': 'open_by_owner_id',
641                  'type': 'int'
642              },
643              {
644                  'name': 'open_by_lang',
645                  'type': 'string'
646              },
647              {
648                  'name': 'open_by_no_reset_sent',
649                  'type': 'int'
650              },
651              {
652                  'name': 'open_by_action_type',
653                  'type': 'string'
654              },
655              {
656                  'name': 'open_by_project_id',
657                  'type': 'int'
658              },
659              {
660                  'name': 'owner_id_id',
661                  'type': 'int'
662              },
663              {
664                  'name': 'owner_id_office_id',
665                  'type': 'int'
666              },
667              {
668                  'name': 'owner_id_name',
669                  'type': 'string'
670              },
671              {
672                  'name': 'owner_id_phone',
673                  'type': 'string'
674              },
675              {
676                  'name': 'owner_id_fax',
677                  'type': 'string'
678              },
679              {
680                  'name': 'owner_id_email',
681                  'type': 'string'
682              },
683              {
684                  'name': 'owner_id_company_id',
685                  'type': 'int'
686              },
687              {
688                  'name': 'owner_id_role',
689                  'type': 'string'
690              },
691              {
692                  'name': 'owner_id_active',
693                  'type': 'int'
694              },
695              {
696                  'name': 'owner_id_remarks',
697                  'type': 'string'
698              },
699              {
700                  'name': 'owner_id_passwd',
701                  'type': 'string'
702              },
703              {
704                  'name': 'owner_id_owner_id',
705                  'type': 'int'
706              },
707              {
708                  'name': 'owner_id_lang',
709                  'type': 'string'
710              },
711              {
712                  'name': 'owner_id_no_reset_sent',
713                  'type': 'int'
714              },
715              {
716                  'name': 'owner_id_action_type',
717                  'type': 'string'
718              },
719              {
720                  'name': 'owner_id_project_id',
721                  'type': 'int'
722              }
723          ],
724          id : 'id',
725          root : 'data',
726          totalProperty : 'total',
727          xns : Roo.data,
728          '|xns' : 'Roo.data'
729         }
730        },
731        sm : {
732         xtype : 'RowSelectionModel',
733         singleSelect : true,
734         listeners : {
735          afterselectionchange : function (_self)
736           {
737               // load project members.
738           }
739         },
740         xns : Roo.grid,
741         '|xns' : 'Roo.grid'
742        },
743        colModel : [
744         {
745          xtype : 'ColumnModel',
746          dataIndex : 'type',
747          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
748          renderer : function(v) { return _this.grid.typeToString(v);},
749          sortable : true,
750          width : 70,
751          xns : Roo.grid,
752          '|xns' : 'Roo.grid'
753         },
754         {
755          xtype : 'ColumnModel',
756          dataIndex : 'client_id_name',
757          header : _this._strings['577d7068826de925ea2aec01dbadf5e4'] /* Client */,
758          renderer : function(v) { return String.format('{0}', v); },
759          width : 75,
760          xns : Roo.grid,
761          '|xns' : 'Roo.grid'
762         },
763         {
764          xtype : 'ColumnModel',
765          dataIndex : 'code',
766          header : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
767          renderer : function(v) { return String.format('{0}', v); },
768          sortable : true,
769          width : 120,
770          xns : Roo.grid,
771          '|xns' : 'Roo.grid'
772         },
773         {
774          xtype : 'ColumnModel',
775          dataIndex : 'name',
776          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
777          renderer : function(v) { return String.format('{0}', v); },
778          sortable : true,
779          width : 200,
780          xns : Roo.grid,
781          '|xns' : 'Roo.grid'
782         }
783        ]
784       }
785      }
786     ]
787    }
788   };  }
789 });