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