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