Pman.Tab.MtrackCal.bjs
[Pman.MTrack] / Pman.Tab.MtrackCal.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.MtrackCal = new Roo.XComponent({
6     part     :  ["MTrack","MtrackCal"],
7     order    : '100-Pman.Tab.MtrackCal',
8     region   : 'center',
9     parent   : 'Pman.Tab.DocumentsTab',
10     name     : "Pman.Tab.MtrackCal",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function (_self)
22                 {
23                     if (!_this.cal) {
24                         return;
25                     }
26                     _this.cal.setDate(new Date());
27                 }
28             },
29             region : 'center',
30             title : "Schedule",
31             grid : {
32                 xtype: 'Calendar',
33                 xns: Roo.grid,
34                 listeners : {
35                     render : function (grid)
36                     {
37                         
38                         _this.cal = grid;
39                     },
40                     eventclick : function (_self, Ev,r )
41                     {
42                         // show the dialog..
43                         // reload the calendar on exit.
44                         Roo.log(Ev);
45                         Roo.log(r);
46                           Pman.Dialog.MTrackTicket.show({ id : r.id } , function(res) {
47                             _this.cal.load();
48                         
49                         });
50                     },
51                     eventrender : function (_self, rec)
52                     {
53                         
54                         rec.data.time = ''; // not needed
55                         rec.data.title = rec.data.developer_id_name + ' ' + rec.data.project_id_name;
56                         rec.data.qtip  = '#' + rec.data.id + ' ' + rec.data.summary;
57                         
58                         if (rec.data.estimated) {
59                             rec.data.cls = "Greys-q3-6"; // grey...
60                         } else {
61                             rec.data.cls = 'RdYlGn-q' + rec.data.priority_id_seqid +'-7'
62                         }
63                         
64                                         
65                     }
66                 },
67                 toolbar : {
68                     xtype: 'Toolbar',
69                     xns: Roo,
70                     items : [
71                         {
72                             xtype: 'ComboBox',
73                             xns: Roo.form,
74                             listeners : {
75                                 select : function (combo, record, index)
76                                 {
77                                   _this.grid.footer.onClick('first');
78                                   
79                                 },
80                                 render : function (_self)
81                                 {
82                                   _this.personSel = _self;
83                                 }
84                             },
85                             allowBlank : true,
86                             displayField : 'name',
87                             editable : true,
88                             emptyText : "Select Person ",
89                             fieldLabel : 'Person ',
90                             forceSelection : true,
91                             listWidth : 600,
92                             loadingText : "Searching...",
93                             minChars : 2,
94                             name : 'person_id_name',
95                             pageSize : 20,
96                             qtip : "Select Person ",
97                             queryParam : 'query[name]',
98                             selectOnFocus : true,
99                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>',
100                             triggerAction : 'all',
101                             typeAhead : true,
102                             valueField : 'id',
103                             width : 150,
104                             store : {
105                                 xtype: 'Store',
106                                 xns: Roo.data,
107                                 listeners : {
108                                     beforeload : function (_self, o)
109                                     {
110                                         o.params = o.params || {};
111                                         o.company_id = Pman.Login.authUser.company_id;
112                                         o.params['query[role]'] = 'DEVELOPER';
113                                     }
114                                 },
115                                 sortInfo : { field : 'name' , direction : 'ASC' },
116                                 proxy : {
117                                     xtype: 'HttpProxy',
118                                     xns: Roo.data,
119                                     url : baseURL + '/Roo/Person.php',
120                                     method : 'GET'
121                                 },
122                                 reader : {
123                                     xtype: 'JsonReader',
124                                     xns: Roo.data,
125                                     id : 'id',
126                                     root : 'data',
127                                     totalProperty : 'total',
128                                     fields : [
129                                         {
130                                             'name': 'id',
131                                             'type': 'int'
132                                         },
133                                         {
134                                             'name': 'office_id',
135                                             'type': 'int'
136                                         },
137                                         {
138                                             'name': 'name',
139                                             'type': 'string'
140                                         },
141                                         {
142                                             'name': 'phone',
143                                             'type': 'string'
144                                         },
145                                         {
146                                             'name': 'fax',
147                                             'type': 'string'
148                                         },
149                                         {
150                                             'name': 'email',
151                                             'type': 'string'
152                                         },
153                                         {
154                                             'name': 'company_id',
155                                             'type': 'int'
156                                         },
157                                         {
158                                             'name': 'role',
159                                             'type': 'string'
160                                         },
161                                         {
162                                             'name': 'active',
163                                             'type': 'int'
164                                         },
165                                         {
166                                             'name': 'remarks',
167                                             'type': 'string'
168                                         },
169                                         {
170                                             'name': 'passwd',
171                                             'type': 'string'
172                                         },
173                                         {
174                                             'name': 'owner_id',
175                                             'type': 'int'
176                                         },
177                                         {
178                                             'name': 'lang',
179                                             'type': 'string'
180                                         },
181                                         {
182                                             'name': 'no_reset_sent',
183                                             'type': 'int'
184                                         },
185                                         {
186                                             'name': 'action_type',
187                                             'type': 'string'
188                                         },
189                                         {
190                                             'name': 'project_id',
191                                             'type': 'int'
192                                         },
193                                         {
194                                             'name': 'deleted_by',
195                                             'type': 'int'
196                                         },
197                                         {
198                                             'name': 'deleted_dt',
199                                             'type': 'date',
200                                             'dateFormat': 'Y-m-d'
201                                         },
202                                         {
203                                             'name': 'office_id_id',
204                                             'type': 'int'
205                                         },
206                                         {
207                                             'name': 'office_id_company_id',
208                                             'type': 'int'
209                                         },
210                                         {
211                                             'name': 'office_id_name',
212                                             'type': 'string'
213                                         },
214                                         {
215                                             'name': 'office_id_address',
216                                             'type': 'string'
217                                         },
218                                         {
219                                             'name': 'office_id_phone',
220                                             'type': 'string'
221                                         },
222                                         {
223                                             'name': 'office_id_fax',
224                                             'type': 'string'
225                                         },
226                                         {
227                                             'name': 'office_id_email',
228                                             'type': 'string'
229                                         },
230                                         {
231                                             'name': 'office_id_role',
232                                             'type': 'string'
233                                         },
234                                         {
235                                             'name': 'company_id_code',
236                                             'type': 'string'
237                                         },
238                                         {
239                                             'name': 'company_id_name',
240                                             'type': 'string'
241                                         },
242                                         {
243                                             'name': 'company_id_remarks',
244                                             'type': 'string'
245                                         },
246                                         {
247                                             'name': 'company_id_owner_id',
248                                             'type': 'int'
249                                         },
250                                         {
251                                             'name': 'company_id_address',
252                                             'type': 'string'
253                                         },
254                                         {
255                                             'name': 'company_id_tel',
256                                             'type': 'string'
257                                         },
258                                         {
259                                             'name': 'company_id_fax',
260                                             'type': 'string'
261                                         },
262                                         {
263                                             'name': 'company_id_email',
264                                             'type': 'string'
265                                         },
266                                         {
267                                             'name': 'company_id_id',
268                                             'type': 'int'
269                                         },
270                                         {
271                                             'name': 'company_id_isOwner',
272                                             'type': 'int'
273                                         },
274                                         {
275                                             'name': 'company_id_logo_id',
276                                             'type': 'int'
277                                         },
278                                         {
279                                             'name': 'company_id_background_color',
280                                             'type': 'string'
281                                         },
282                                         {
283                                             'name': 'company_id_comptype',
284                                             'type': 'string'
285                                         },
286                                         {
287                                             'name': 'company_id_url',
288                                             'type': 'string'
289                                         },
290                                         {
291                                             'name': 'company_id_main_office_id',
292                                             'type': 'int'
293                                         },
294                                         {
295                                             'name': 'company_id_created_by',
296                                             'type': 'int'
297                                         },
298                                         {
299                                             'name': 'company_id_created_dt',
300                                             'type': 'date'
301                                         },
302                                         {
303                                             'name': 'company_id_updated_by',
304                                             'type': 'int'
305                                         },
306                                         {
307                                             'name': 'company_id_updated_dt',
308                                             'type': 'date'
309                                         },
310                                         {
311                                             'name': 'company_id_passwd',
312                                             'type': 'string'
313                                         },
314                                         {
315                                             'name': 'company_id_dispatch_port',
316                                             'type': 'string'
317                                         },
318                                         {
319                                             'name': 'company_id_province',
320                                             'type': 'string'
321                                         },
322                                         {
323                                             'name': 'company_id_country',
324                                             'type': 'string'
325                                         },
326                                         {
327                                             'name': 'project_id_id',
328                                             'type': 'int'
329                                         },
330                                         {
331                                             'name': 'project_id_name',
332                                             'type': 'string'
333                                         },
334                                         {
335                                             'name': 'project_id_remarks',
336                                             'type': 'string'
337                                         },
338                                         {
339                                             'name': 'project_id_owner_id',
340                                             'type': 'int'
341                                         },
342                                         {
343                                             'name': 'project_id_code',
344                                             'type': 'string'
345                                         },
346                                         {
347                                             'name': 'project_id_active',
348                                             'type': 'int'
349                                         },
350                                         {
351                                             'name': 'project_id_type',
352                                             'type': 'string'
353                                         },
354                                         {
355                                             'name': 'project_id_client_id',
356                                             'type': 'int'
357                                         },
358                                         {
359                                             'name': 'project_id_team_id',
360                                             'type': 'int'
361                                         },
362                                         {
363                                             'name': 'project_id_file_location',
364                                             'type': 'string'
365                                         },
366                                         {
367                                             'name': 'project_id_open_date',
368                                             'type': 'date'
369                                         },
370                                         {
371                                             'name': 'project_id_open_by',
372                                             'type': 'int'
373                                         },
374                                         {
375                                             'name': 'project_id_close_date',
376                                             'type': 'date'
377                                         },
378                                         {
379                                             'name': 'project_id_countries',
380                                             'type': 'string'
381                                         },
382                                         {
383                                             'name': 'project_id_languages',
384                                             'type': 'string'
385                                         },
386                                         {
387                                             'name': 'project_id_agency_id',
388                                             'type': 'int'
389                                         },
390                                         {
391                                             'name': 'owner_id_id',
392                                             'type': 'int'
393                                         },
394                                         {
395                                             'name': 'owner_id_office_id',
396                                             'type': 'int'
397                                         },
398                                         {
399                                             'name': 'owner_id_name',
400                                             'type': 'string'
401                                         },
402                                         {
403                                             'name': 'owner_id_phone',
404                                             'type': 'string'
405                                         },
406                                         {
407                                             'name': 'owner_id_fax',
408                                             'type': 'string'
409                                         },
410                                         {
411                                             'name': 'owner_id_email',
412                                             'type': 'string'
413                                         },
414                                         {
415                                             'name': 'owner_id_company_id',
416                                             'type': 'int'
417                                         },
418                                         {
419                                             'name': 'owner_id_role',
420                                             'type': 'string'
421                                         },
422                                         {
423                                             'name': 'owner_id_active',
424                                             'type': 'int'
425                                         },
426                                         {
427                                             'name': 'owner_id_remarks',
428                                             'type': 'string'
429                                         },
430                                         {
431                                             'name': 'owner_id_passwd',
432                                             'type': 'string'
433                                         },
434                                         {
435                                             'name': 'owner_id_owner_id',
436                                             'type': 'int'
437                                         },
438                                         {
439                                             'name': 'owner_id_lang',
440                                             'type': 'string'
441                                         },
442                                         {
443                                             'name': 'owner_id_no_reset_sent',
444                                             'type': 'int'
445                                         },
446                                         {
447                                             'name': 'owner_id_action_type',
448                                             'type': 'string'
449                                         },
450                                         {
451                                             'name': 'owner_id_project_id',
452                                             'type': 'int'
453                                         },
454                                         {
455                                             'name': 'owner_id_deleted_by',
456                                             'type': 'int'
457                                         },
458                                         {
459                                             'name': 'owner_id_deleted_dt',
460                                             'type': 'date'
461                                         }
462                                     ]
463                                 }
464                             }
465                         },
466                         {
467                             xtype: 'Button',
468                             xns: Roo.Toolbar,
469                             listeners : {
470                                 click : function (_self, e)
471                                 {
472                                     _this.cal.load();
473                                 }
474                             },
475                             cls : 'x-btn-icon',
476                             icon : rootURL + '/Pman/templates/images/search.gif'
477                         }
478                     ]
479                 },
480                 eventStore : {
481                     xtype: 'Store',
482                     xns: Roo.data,
483                     listeners : {
484                         beforeload : function (_self, o)
485                         {
486                             if (!_this.personSel) {
487                                 return false;
488                             }
489                         
490                            o = o || {};
491                             o.params = o.params || {};
492                             o.params._future_schedule = 1;
493                             o.params['query[viewtype]']= 'active'
494                             o.params.limit= 999
495                             o.params.sort = 'summary';
496                             o.params.dir = 'ASC';
497                             var pid = _this.personSel.getValue();
498                             if (pid*1) {
499                                 o.params['filter[developer_id]'] = pid;
500                             }
501                            try { 
502                                  o.params['filter[project_id]']   = Pman.Tab.DocumentsTab.panel.getProjectId();
503                             } catch(e) {
504                                
505                             }
506                             _this.cal.setDate(new Date());
507                             
508                         }
509                     },
510                     proxy : {
511                         xtype: 'HttpProxy',
512                         xns: Roo.data,
513                         method : 'GET',
514                         url : baseURL + '/Roo/mtrack_ticket'
515                     },
516                     reader : {
517                         xtype: 'JsonReader',
518                         xns: Roo.data,
519                         id : 'id',
520                         root : 'data',
521                         totalProperty : 'total'
522                     }
523                 }
524             }
525         };
526     }
527 });