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