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