Pman.Tab.AdminLogDrill.bjs
[Pman.Admin] / Pman.Tab.AdminLogDrill.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         part :  ["Admin","LogDrill"],
12         modKey : '003-Pman.Tab.AdminLogDrill',
13         module : Pman.Tab.AdminLogDrill,
14         region : 'center',
15         parent : Pman.Tab.AdminLogs,
16         name : "Pman.Tab.AdminLogDrill",
17         disabled : false, 
18         permname: '' 
19     });
20 });
21
22 Pman.Tab.AdminLogDrill = new Roo.util.Observable({
23
24     panel : false,
25     disabled : false,
26     parentLayout:  false,
27
28     add : function(parentLayout, region)
29     {
30
31         var _this = this;
32         this.parentLayout = parentLayout;
33
34         this.panel = parentLayout.addxtype({
35             xtype: 'NestedLayoutPanel',
36             xns: Roo,
37             region : 'center',
38             title : "Event Drilldown",
39             layout : {
40                 xtype: 'BorderLayout',
41                 xns: Roo,
42                 items : [
43                     {
44                         xtype: 'GridPanel',
45                         xns: Roo,
46                         listeners : {
47                             activate : function() {
48                                 _this.datepanel = this;
49                                 if (_this.dategrid) {
50                                     _this.dategrid.ds.load({});
51                                 }
52                             }
53                         },
54                         background : true,
55                         fitContainer : true,
56                         fitToframe : true,
57                         region : 'west',
58                         tableName : 'Events',
59                         title : "Events",
60                         grid : {
61                             xtype: 'Grid',
62                             xns: Roo.grid,
63                             listeners : {
64                                 render : function() 
65                                 {
66                                     _this.dategrid = this; 
67                                     //_this.dialog = Pman.Dialog.FILL_IN
68                                     if (_this.panel.active) {
69                                        this.ds.load({});
70                                     }
71                                 },
72                                 rowclick : function (_self, rowIndex, e)
73                                 {
74                                     _this.tablegrid.footer.onClick('first');
75                                 }
76                             },
77                             autoExpandColumn : 'person_name',
78                             loadMask : true,
79                             dataSource : {
80                                 xtype: 'Store',
81                                 xns: Roo.data,
82                                 listeners : {
83                                     beforeload : function (_self, o)
84                                     {
85                                         if (! _this.dateFrom) {
86                                          return;
87                                         }
88                                         o.params = o.params || {};
89                                          
90                                      
91                                         act = _this.dateFrom.getValue();
92                                         if (act.format) {
93                                             o.params['query[from]'] = act.format('Y-m-d');
94                                         }
95                                         act = _this.dateTo.getValue();
96                                         if (act.format) {
97                                             o.params['query[to]'] = act.format('Y-m-d');
98                                         }
99                                         o.params['query[person_sum]'] = 1;
100                                         o.params._columns = 'person_id,person_id_name,person_id_email,qty';
101                                         o.params.limit = 999;
102                                      
103                                     }
104                                 },
105                                 remoteSort : true,
106                                 sortInfo : { field : 'person_name', direction: 'ASC' },
107                                 proxy : {
108                                     xtype: 'HttpProxy',
109                                     xns: Roo.data,
110                                     method : 'GET',
111                                     url : baseURL + '/Roo/Events.php'
112                                 },
113                                 reader : {
114                                     xtype: 'JsonReader',
115                                     xns: Roo.data,
116                                     totalProperty : 'total',
117                                     root : 'data',
118                                     id : 'id',
119                                     fields : [
120                                         {
121                                             'name': 'id',
122                                             'type': 'int'
123                                         },
124                                         {
125                                             'name': 'person_name',
126                                             'type': 'string'
127                                         },
128                                         {
129                                             'name': 'event_when',
130                                             'type': 'date',
131                                             'dateFormat': 'Y-m-d'
132                                         },
133                                         {
134                                             'name': 'action',
135                                             'type': 'string'
136                                         },
137                                         {
138                                             'name': 'ipaddr',
139                                             'type': 'string'
140                                         },
141                                         {
142                                             'name': 'on_id',
143                                             'type': 'int'
144                                         },
145                                         {
146                                             'name': 'on_table',
147                                             'type': 'string'
148                                         },
149                                         {
150                                             'name': 'person_id',
151                                             'type': 'int'
152                                         },
153                                         {
154                                             'name': 'remarks',
155                                             'type': 'string'
156                                         },
157                                         {
158                                             'name': 'person_id_id',
159                                             'type': 'int'
160                                         },
161                                         {
162                                             'name': 'person_id_office_id',
163                                             'type': 'int'
164                                         },
165                                         {
166                                             'name': 'person_id_name',
167                                             'type': 'string'
168                                         },
169                                         {
170                                             'name': 'person_id_phone',
171                                             'type': 'string'
172                                         },
173                                         {
174                                             'name': 'person_id_fax',
175                                             'type': 'string'
176                                         },
177                                         {
178                                             'name': 'person_id_email',
179                                             'type': 'string'
180                                         },
181                                         {
182                                             'name': 'person_id_company_id',
183                                             'type': 'int'
184                                         },
185                                         {
186                                             'name': 'person_id_role',
187                                             'type': 'string'
188                                         },
189                                         {
190                                             'name': 'person_id_active',
191                                             'type': 'int'
192                                         },
193                                         {
194                                             'name': 'person_id_remarks',
195                                             'type': 'string'
196                                         },
197                                         {
198                                             'name': 'person_id_passwd',
199                                             'type': 'string'
200                                         },
201                                         {
202                                             'name': 'person_id_owner_id',
203                                             'type': 'int'
204                                         },
205                                         {
206                                             'name': 'person_id_lang',
207                                             'type': 'string'
208                                         },
209                                         {
210                                             'name': 'person_id_no_reset_sent',
211                                             'type': 'int'
212                                         },
213                                         {
214                                             'name': 'person_id_action_type',
215                                             'type': 'string'
216                                         },
217                                         {
218                                             'name': 'person_id_project_id',
219                                             'type': 'int'
220                                         },
221                                         {
222                                             'name': 'person_id_deleted_by',
223                                             'type': 'int'
224                                         },
225                                         {
226                                             'name': 'person_id_deleted_dt',
227                                             'type': 'date'
228                                         }
229                                     ]
230                                 }
231                             },
232                             toolbar : {
233                                 xtype: 'Toolbar',
234                                 xns: Roo,
235                                 items : [
236                                     {
237                                         xtype: 'TextItem',
238                                         xns: Roo.Toolbar,
239                                         text : "Date Range"
240                                     },
241                                     {
242                                         xtype: 'DateField',
243                                         xns: Roo.form,
244                                         listeners : {
245                                             render : function (_self)
246                                             {
247                                               _this.dateFrom = _self;
248                                             },
249                                             change : function (_self, newValue, oldValue)
250                                             {
251                                               _this.dategrid.ds.load({});
252                                             }
253                                         },
254                                         format : 'Y-m-d',
255                                         value : (function() { d = new Date(); return d.format('Y-m-01'); })()
256                                     },
257                                     {
258                                         xtype: 'DateField',
259                                         xns: Roo.form,
260                                         listeners : {
261                                             render : function (_self)
262                                             {
263                                               _this.dateTo = _self;
264                                             },
265                                             change : function (_self, newValue, oldValue)
266                                             {
267                                               _this.dategrid.ds.load({});
268                                             }
269                                         },
270                                         format : 'Y-m-d',
271                                         value : (function() { d = new Date();d =  d.add(Date.MONTH, 1) ; return d.format('Y-m-01'); })()
272                                     }
273                                 ]
274                             },
275                             colModel : [
276                                 {
277                                     xtype: 'ColumnModel',
278                                     xns: Roo.grid,
279                                     dataIndex : 'person_id_name',
280                                     header : 'Person name',
281                                     sortable : true,
282                                     width : 200,
283                                     renderer : function(v,x,r) {
284                                          return String.format('{0} &lt;<a href="mailto:{1}">{1}</a>&gt;', v, r.data.person_id_email); 
285                                      }
286                                 },
287                                 {
288                                     xtype: 'ColumnModel',
289                                     xns: Roo.grid,
290                                     dataIndex : 'qty',
291                                     header : 'Changes',
292                                     sortable : true,
293                                     width : 70,
294                                     renderer : function(v) { return String.format('{0}', v); }
295                                 }
296                             ]
297                         }
298                     },
299                     {
300                         xtype: 'GridPanel',
301                         xns: Roo,
302                         listeners : {
303                             activate : function() {
304                                 _this.tablepanel = this;
305                                 if (_this.tablegrid) {
306                                     _this.tablegrid.footer.onClick('first');
307                                 }
308                             }
309                         },
310                         background : true,
311                         fitContainer : true,
312                         fitToframe : true,
313                         region : 'center',
314                         tableName : 'Events',
315                         title : "Events",
316                         grid : {
317                             xtype: 'Grid',
318                             xns: Roo.grid,
319                             listeners : {
320                                 render : function() 
321                                 {
322                                     _this.tablegrid = this; 
323                                     //_this.dialog = Pman.Dialog.FILL_IN
324                                     if (_this.tablepanel.active) {
325                                        this.footer.onClick('first');
326                                     }
327                                 },
328                                 rowclick : function (_self, rowIndex, e)
329                                 {
330                                     _this.detailgrid.footer.onClick('first');
331                                 }
332                             },
333                             autoExpandColumn : 'person_name',
334                             loadMask : true,
335                             dataSource : {
336                                 xtype: 'Store',
337                                 xns: Roo.data,
338                                 listeners : {
339                                     beforeload : function (_self, o)
340                                     {
341                                          if (! _this.dategrid) {
342                                          return;
343                                         }
344                                         
345                                         var s = _this.dategrid.selModel.getSelected();
346                                         if (!s) {
347                                             _this.tablegrid.view.el.mask("Select a person");
348                                             return false;
349                                         }
350                                         _this.tablegrid.view.el.unmask();
351                                      
352                                         o.params = o.params || {};
353                                          
354                                      
355                                         act = _this.dateFrom.getValue();
356                                         if (act.format) {
357                                             o.params['query[from]'] = act.format('Y-m-d');
358                                         }
359                                         act = _this.dateTo.getValue();
360                                         if (act.format) {
361                                             o.params['query[to]'] = act.format('Y-m-d');
362                                         }
363                                         o.params.person_id = s.data.person_id;
364                                         o.params['query[table_sum]'] = 1;
365                                         o.params._columns = 'on_table,qty,uqty';
366                                     
367                                         
368                                     }
369                                 },
370                                 remoteSort : true,
371                                 sortInfo : { field : 'on_table', direction: 'ASC' },
372                                 proxy : {
373                                     xtype: 'HttpProxy',
374                                     xns: Roo.data,
375                                     method : 'GET',
376                                     url : baseURL + '/Roo/Events.php'
377                                 },
378                                 reader : {
379                                     xtype: 'JsonReader',
380                                     xns: Roo.data,
381                                     totalProperty : 'total',
382                                     root : 'data',
383                                     id : 'id',
384                                     fields : [
385                                         {
386                                             'name': 'id',
387                                             'type': 'int'
388                                         },
389                                         {
390                                             'name': 'person_name',
391                                             'type': 'string'
392                                         },
393                                         {
394                                             'name': 'event_when',
395                                             'type': 'date',
396                                             'dateFormat': 'Y-m-d'
397                                         },
398                                         {
399                                             'name': 'action',
400                                             'type': 'string'
401                                         },
402                                         {
403                                             'name': 'ipaddr',
404                                             'type': 'string'
405                                         },
406                                         {
407                                             'name': 'on_id',
408                                             'type': 'int'
409                                         },
410                                         {
411                                             'name': 'on_table',
412                                             'type': 'string'
413                                         },
414                                         {
415                                             'name': 'person_id',
416                                             'type': 'int'
417                                         },
418                                         {
419                                             'name': 'remarks',
420                                             'type': 'string'
421                                         },
422                                         {
423                                             'name': 'person_id_id',
424                                             'type': 'int'
425                                         },
426                                         {
427                                             'name': 'person_id_office_id',
428                                             'type': 'int'
429                                         },
430                                         {
431                                             'name': 'person_id_name',
432                                             'type': 'string'
433                                         },
434                                         {
435                                             'name': 'person_id_phone',
436                                             'type': 'string'
437                                         },
438                                         {
439                                             'name': 'person_id_fax',
440                                             'type': 'string'
441                                         },
442                                         {
443                                             'name': 'person_id_email',
444                                             'type': 'string'
445                                         },
446                                         {
447                                             'name': 'person_id_company_id',
448                                             'type': 'int'
449                                         },
450                                         {
451                                             'name': 'person_id_role',
452                                             'type': 'string'
453                                         },
454                                         {
455                                             'name': 'person_id_active',
456                                             'type': 'int'
457                                         },
458                                         {
459                                             'name': 'person_id_remarks',
460                                             'type': 'string'
461                                         },
462                                         {
463                                             'name': 'person_id_passwd',
464                                             'type': 'string'
465                                         },
466                                         {
467                                             'name': 'person_id_owner_id',
468                                             'type': 'int'
469                                         },
470                                         {
471                                             'name': 'person_id_lang',
472                                             'type': 'string'
473                                         },
474                                         {
475                                             'name': 'person_id_no_reset_sent',
476                                             'type': 'int'
477                                         },
478                                         {
479                                             'name': 'person_id_action_type',
480                                             'type': 'string'
481                                         },
482                                         {
483                                             'name': 'person_id_project_id',
484                                             'type': 'int'
485                                         },
486                                         {
487                                             'name': 'person_id_deleted_by',
488                                             'type': 'int'
489                                         },
490                                         {
491                                             'name': 'person_id_deleted_dt',
492                                             'type': 'date'
493                                         }
494                                     ]
495                                 }
496                             },
497                             footer : {
498                                 xtype: 'PagingToolbar',
499                                 xns: Roo,
500                                 pageSize : 25,
501                                 displayInfo : true,
502                                 displayMsg : "Displaying Events{0} - {1} of {2}",
503                                 emptyMsg : "No Events found"
504                             },
505                             toolbar : {
506                                 xtype: 'Toolbar',
507                                 xns: Roo,
508                                 items : [
509                                     {
510                                         xtype: 'ComboBox',
511                                         xns: Roo.form,
512                                         listeners : {
513                                             select : function (combo, record, index)
514                                             {
515                                                _this.dategrid.ds.load({});
516                                             },
517                                             render : function (_self)
518                                             {
519                                               _this.actionSel = _self;
520                                             }
521                                         },
522                                         allowBlank : true,
523                                         displayField : 'action',
524                                         editable : false,
525                                         emptyText : "Select Action",
526                                         forceSelection : true,
527                                         listWidth : 300,
528                                         loadingText : "Searching...",
529                                         minChars : 2,
530                                         name : 'action',
531                                         pageSize : 20,
532                                         qtip : "Select Action",
533                                         queryParam : 'query[action]',
534                                         selectOnFocus : true,
535                                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{action}</b> </div>',
536                                         triggerAction : 'all',
537                                         typeAhead : true,
538                                         valueField : 'action',
539                                         width : 150,
540                                         store : {
541                                             xtype: 'Store',
542                                             xns: Roo.data,
543                                             listeners : {
544                                                 beforeload : function (_self, o)
545                                                 {
546                                                     o.params = o.params || {};
547                                                     // staff can see all logs, other companies can only see their own.
548                                                     if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
549                                                         o.params.company_id = Pman.Login.authUser.company_id;
550                                                     }
551                                                     o.params._distinct = 'action';
552                                                     o.params._columns ='action';
553                                                 }
554                                             },
555                                             remoteSort : true,
556                                             sortInfo : { field : 'action' , direction : 'ASC' },
557                                             proxy : {
558                                                 xtype: 'HttpProxy',
559                                                 xns: Roo.data,
560                                                 method : 'GET',
561                                                 url : baseURL + '/Roo/Events.php'
562                                             },
563                                             reader : {
564                                                 xtype: 'JsonReader',
565                                                 xns: Roo.data,
566                                                 totalProperty : 'total',
567                                                 root : 'data',
568                                                 id : 'id',
569                                                 fields : [
570                                                     {
571                                                         'name': 'id',
572                                                         'type': 'int'
573                                                     },
574                                                     {
575                                                         'name': 'person_name',
576                                                         'type': 'string'
577                                                     },
578                                                     {
579                                                         'name': 'event_when',
580                                                         'type': 'date',
581                                                         'dateFormat': 'Y-m-d'
582                                                     },
583                                                     {
584                                                         'name': 'action',
585                                                         'type': 'string'
586                                                     },
587                                                     {
588                                                         'name': 'ipaddr',
589                                                         'type': 'string'
590                                                     },
591                                                     {
592                                                         'name': 'on_id',
593                                                         'type': 'int'
594                                                     },
595                                                     {
596                                                         'name': 'on_table',
597                                                         'type': 'string'
598                                                     },
599                                                     {
600                                                         'name': 'person_id',
601                                                         'type': 'int'
602                                                     },
603                                                     {
604                                                         'name': 'remarks',
605                                                         'type': 'string'
606                                                     },
607                                                     {
608                                                         'name': 'person_id_id',
609                                                         'type': 'int'
610                                                     },
611                                                     {
612                                                         'name': 'person_id_office_id',
613                                                         'type': 'int'
614                                                     },
615                                                     {
616                                                         'name': 'person_id_name',
617                                                         'type': 'string'
618                                                     },
619                                                     {
620                                                         'name': 'person_id_phone',
621                                                         'type': 'string'
622                                                     },
623                                                     {
624                                                         'name': 'person_id_fax',
625                                                         'type': 'string'
626                                                     },
627                                                     {
628                                                         'name': 'person_id_email',
629                                                         'type': 'string'
630                                                     },
631                                                     {
632                                                         'name': 'person_id_company_id',
633                                                         'type': 'int'
634                                                     },
635                                                     {
636                                                         'name': 'person_id_role',
637                                                         'type': 'string'
638                                                     },
639                                                     {
640                                                         'name': 'person_id_active',
641                                                         'type': 'int'
642                                                     },
643                                                     {
644                                                         'name': 'person_id_remarks',
645                                                         'type': 'string'
646                                                     },
647                                                     {
648                                                         'name': 'person_id_passwd',
649                                                         'type': 'string'
650                                                     },
651                                                     {
652                                                         'name': 'person_id_owner_id',
653                                                         'type': 'int'
654                                                     },
655                                                     {
656                                                         'name': 'person_id_lang',
657                                                         'type': 'string'
658                                                     },
659                                                     {
660                                                         'name': 'person_id_no_reset_sent',
661                                                         'type': 'int'
662                                                     },
663                                                     {
664                                                         'name': 'person_id_action_type',
665                                                         'type': 'string'
666                                                     },
667                                                     {
668                                                         'name': 'person_id_project_id',
669                                                         'type': 'int'
670                                                     },
671                                                     {
672                                                         'name': 'person_id_deleted_by',
673                                                         'type': 'int'
674                                                     },
675                                                     {
676                                                         'name': 'person_id_deleted_dt',
677                                                         'type': 'date'
678                                                     }
679                                                 ]
680                                             }
681                                         }
682                                     },
683                                     {
684                                         xtype: 'ComboBox',
685                                         xns: Roo.form,
686                                         listeners : {
687                                             select : function (combo, record, index)
688                                             {
689                                                _this.dategrid.ds.load({});
690                                             },
691                                             render : function (_self)
692                                             {
693                                               _this.affectSel = _self;
694                                             }
695                                         },
696                                         allowBlank : true,
697                                         displayField : 'on_table',
698                                         editable : false,
699                                         emptyText : "Select Affects",
700                                         forceSelection : true,
701                                         listWidth : 300,
702                                         loadingText : "Searching...",
703                                         minChars : 2,
704                                         name : 'on_table',
705                                         pageSize : 20,
706                                         qtip : "Select Action",
707                                         queryParam : 'query[on_table]',
708                                         selectOnFocus : true,
709                                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{on_table}</b> </div>',
710                                         triggerAction : 'all',
711                                         typeAhead : true,
712                                         valueField : 'action',
713                                         width : 150,
714                                         store : {
715                                             xtype: 'Store',
716                                             xns: Roo.data,
717                                             listeners : {
718                                                 beforeload : function (_self, o)
719                                                 {
720                                                     o.params = o.params || {};
721                                                     // staff can see all logs, other companies can only see their own.
722                                                     if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
723                                                         o.params.company_id = Pman.Login.authUser.company_id;
724                                                     }
725                                                     o.params._distinct = 'on_table';
726                                                     o.params._columns ='on_table';
727                                                 }
728                                             },
729                                             remoteSort : true,
730                                             sortInfo : { field : 'on_table' , direction : 'ASC' },
731                                             proxy : {
732                                                 xtype: 'HttpProxy',
733                                                 xns: Roo.data,
734                                                 method : 'GET',
735                                                 url : baseURL + '/Roo/Events.php'
736                                             },
737                                             reader : {
738                                                 xtype: 'JsonReader',
739                                                 xns: Roo.data,
740                                                 totalProperty : 'total',
741                                                 root : 'data',
742                                                 id : 'id',
743                                                 fields : [
744                                                     {
745                                                         'name': 'id',
746                                                         'type': 'int'
747                                                     },
748                                                     {
749                                                         'name': 'person_name',
750                                                         'type': 'string'
751                                                     },
752                                                     {
753                                                         'name': 'event_when',
754                                                         'type': 'date',
755                                                         'dateFormat': 'Y-m-d'
756                                                     },
757                                                     {
758                                                         'name': 'action',
759                                                         'type': 'string'
760                                                     },
761                                                     {
762                                                         'name': 'ipaddr',
763                                                         'type': 'string'
764                                                     },
765                                                     {
766                                                         'name': 'on_id',
767                                                         'type': 'int'
768                                                     },
769                                                     {
770                                                         'name': 'on_table',
771                                                         'type': 'string'
772                                                     },
773                                                     {
774                                                         'name': 'person_id',
775                                                         'type': 'int'
776                                                     },
777                                                     {
778                                                         'name': 'remarks',
779                                                         'type': 'string'
780                                                     },
781                                                     {
782                                                         'name': 'person_id_id',
783                                                         'type': 'int'
784                                                     },
785                                                     {
786                                                         'name': 'person_id_office_id',
787                                                         'type': 'int'
788                                                     },
789                                                     {
790                                                         'name': 'person_id_name',
791                                                         'type': 'string'
792                                                     },
793                                                     {
794                                                         'name': 'person_id_phone',
795                                                         'type': 'string'
796                                                     },
797                                                     {
798                                                         'name': 'person_id_fax',
799                                                         'type': 'string'
800                                                     },
801                                                     {
802                                                         'name': 'person_id_email',
803                                                         'type': 'string'
804                                                     },
805                                                     {
806                                                         'name': 'person_id_company_id',
807                                                         'type': 'int'
808                                                     },
809                                                     {
810                                                         'name': 'person_id_role',
811                                                         'type': 'string'
812                                                     },
813                                                     {
814                                                         'name': 'person_id_active',
815                                                         'type': 'int'
816                                                     },
817                                                     {
818                                                         'name': 'person_id_remarks',
819                                                         'type': 'string'
820                                                     },
821                                                     {
822                                                         'name': 'person_id_passwd',
823                                                         'type': 'string'
824                                                     },
825                                                     {
826                                                         'name': 'person_id_owner_id',
827                                                         'type': 'int'
828                                                     },
829                                                     {
830                                                         'name': 'person_id_lang',
831                                                         'type': 'string'
832                                                     },
833                                                     {
834                                                         'name': 'person_id_no_reset_sent',
835                                                         'type': 'int'
836                                                     },
837                                                     {
838                                                         'name': 'person_id_action_type',
839                                                         'type': 'string'
840                                                     },
841                                                     {
842                                                         'name': 'person_id_project_id',
843                                                         'type': 'int'
844                                                     },
845                                                     {
846                                                         'name': 'person_id_deleted_by',
847                                                         'type': 'int'
848                                                     },
849                                                     {
850                                                         'name': 'person_id_deleted_dt',
851                                                         'type': 'date'
852                                                     }
853                                                 ]
854                                             }
855                                         }
856                                     }
857                                 ]
858                             },
859                             colModel : [
860                                 {
861                                     xtype: 'ColumnModel',
862                                     xns: Roo.grid,
863                                     dataIndex : 'on_table',
864                                     header : 'Table',
865                                     sortable : true,
866                                     width : 200,
867                                     renderer : function(v) { return String.format('{0}', v); }
868                                 },
869                                 {
870                                     xtype: 'ColumnModel',
871                                     xns: Roo.grid,
872                                     dataIndex : 'uqty',
873                                     header : '#Affected',
874                                     sortable : true,
875                                     width : 70,
876                                     renderer : function(v) { return String.format('{0}', v); }
877                                 },
878                                 {
879                                     xtype: 'ColumnModel',
880                                     xns: Roo.grid,
881                                     dataIndex : 'qty',
882                                     header : 'Changes',
883                                     sortable : true,
884                                     width : 70,
885                                     renderer : function(v) { return String.format('{0}', v); }
886                                 }
887                             ]
888                         }
889                     },
890                     {
891                         xtype: 'GridPanel',
892                         xns: Roo,
893                         listeners : {
894                             activate : function() {
895                                 _this.detailpanel = this;
896                                 if (_this.detailgrid) {
897                                     _this.detailgrid.footer.onClick('first');
898                                 }
899                             }
900                         },
901                         background : true,
902                         fitContainer : true,
903                         fitToframe : true,
904                         region : 'east',
905                         tableName : 'Events',
906                         title : "Events",
907                         grid : {
908                             xtype: 'Grid',
909                             xns: Roo.grid,
910                             listeners : {
911                                 render : function() 
912                                 {
913                                     _this.detailgrid = this; 
914                                     //_this.dialog = Pman.Dialog.FILL_IN
915                                     if (_this.detailpanel.active) {
916                                        this.footer.onClick('first');
917                                     }
918                                 }
919                             },
920                             autoExpandColumn : 'person_name',
921                             loadMask : true,
922                             dataSource : {
923                                 xtype: 'Store',
924                                 xns: Roo.data,
925                                 listeners : {
926                                     beforeload : function (_self, o)
927                                     {
928                                          if (! _this.dategrid) {
929                                              return false;
930                                         }
931                                         
932                                         o.params = o.params || {};
933                                         
934                                         var s = _this.dategrid.selModel.getSelected();
935                                         if (!s) {
936                                             _this.detailgrid.view.el.mask("Select a person");
937                                             return false;
938                                         }
939                                         
940                                         o.params.person_id = s.data.person_id;    
941                                         
942                                         var s = _this.tablegrid.selModel.getSelected();
943                                         if (!s) {
944                                             _this.detailgrid.view.el.mask("Select a table");
945                                             return false;
946                                         }
947                                         o.params.on_table = s.data.on_table;        
948                                         
949                                         _this.detailgrid.view.el.unmask();
950                                      
951                                     
952                                          
953                                      
954                                         act = _this.dateFrom.getValue();
955                                         if (act.format) {
956                                             o.params['query[from]'] = act.format('Y-m-d');
957                                         }
958                                         act = _this.dateTo.getValue();
959                                         if (act.format) {
960                                             o.params['query[to]'] = act.format('Y-m-d');
961                                         }
962                                     
963                                         //o.params['query[table_d]'] = 1;
964                                         //o.params._columns = 'on_table,qty,uqty';
965                                     
966                                         
967                                     }
968                                 },
969                                 remoteSort : true,
970                                 sortInfo : { field : 'person_name', direction: 'ASC' },
971                                 proxy : {
972                                     xtype: 'HttpProxy',
973                                     xns: Roo.data,
974                                     method : 'GET',
975                                     url : baseURL + '/Roo/Events.php'
976                                 },
977                                 reader : {
978                                     xtype: 'JsonReader',
979                                     xns: Roo.data,
980                                     totalProperty : 'total',
981                                     root : 'data',
982                                     id : 'id',
983                                     fields : [
984                                         {
985                                             'name': 'id',
986                                             'type': 'int'
987                                         },
988                                         {
989                                             'name': 'person_name',
990                                             'type': 'string'
991                                         },
992                                         {
993                                             'name': 'event_when',
994                                             'type': 'date',
995                                             'dateFormat': 'Y-m-d'
996                                         },
997                                         {
998                                             'name': 'action',
999                                             'type': 'string'
1000                                         },
1001                                         {
1002                                             'name': 'ipaddr',
1003                                             'type': 'string'
1004                                         },
1005                                         {
1006                                             'name': 'on_id',
1007                                             'type': 'int'
1008                                         },
1009                                         {
1010                                             'name': 'on_table',
1011                                             'type': 'string'
1012                                         },
1013                                         {
1014                                             'name': 'person_id',
1015                                             'type': 'int'
1016                                         },
1017                                         {
1018                                             'name': 'remarks',
1019                                             'type': 'string'
1020                                         },
1021                                         {
1022                                             'name': 'person_id_id',
1023                                             'type': 'int'
1024                                         },
1025                                         {
1026                                             'name': 'person_id_office_id',
1027                                             'type': 'int'
1028                                         },
1029                                         {
1030                                             'name': 'person_id_name',
1031                                             'type': 'string'
1032                                         },
1033                                         {
1034                                             'name': 'person_id_phone',
1035                                             'type': 'string'
1036                                         },
1037                                         {
1038                                             'name': 'person_id_fax',
1039                                             'type': 'string'
1040                                         },
1041                                         {
1042                                             'name': 'person_id_email',
1043                                             'type': 'string'
1044                                         },
1045                                         {
1046                                             'name': 'person_id_company_id',
1047                                             'type': 'int'
1048                                         },
1049                                         {
1050                                             'name': 'person_id_role',
1051                                             'type': 'string'
1052                                         },
1053                                         {
1054                                             'name': 'person_id_active',
1055                                             'type': 'int'
1056                                         },
1057                                         {
1058                                             'name': 'person_id_remarks',
1059                                             'type': 'string'
1060                                         },
1061                                         {
1062                                             'name': 'person_id_passwd',
1063                                             'type': 'string'
1064                                         },
1065                                         {
1066                                             'name': 'person_id_owner_id',
1067                                             'type': 'int'
1068                                         },
1069                                         {
1070                                             'name': 'person_id_lang',
1071                                             'type': 'string'
1072                                         },
1073                                         {
1074                                             'name': 'person_id_no_reset_sent',
1075                                             'type': 'int'
1076                                         },
1077                                         {
1078                                             'name': 'person_id_action_type',
1079                                             'type': 'string'
1080                                         },
1081                                         {
1082                                             'name': 'person_id_project_id',
1083                                             'type': 'int'
1084                                         },
1085                                         {
1086                                             'name': 'person_id_deleted_by',
1087                                             'type': 'int'
1088                                         },
1089                                         {
1090                                             'name': 'person_id_deleted_dt',
1091                                             'type': 'date'
1092                                         }
1093                                     ]
1094                                 }
1095                             },
1096                             footer : {
1097                                 xtype: 'PagingToolbar',
1098                                 xns: Roo,
1099                                 pageSize : 25,
1100                                 displayInfo : true,
1101                                 displayMsg : "Displaying Events{0} - {1} of {2}",
1102                                 emptyMsg : "No Events found"
1103                             },
1104                             colModel : [
1105                                 {
1106                                     xtype: 'ColumnModel',
1107                                     xns: Roo.grid,
1108                                     dataIndex : 'id',
1109                                     header : 'Id',
1110                                     width : 50,
1111                                     renderer : function(v) { return String.format('{0}', v); }
1112                                 },
1113                                 {
1114                                     xtype: 'ColumnModel',
1115                                     xns: Roo.grid,
1116                                     header : 'Event when',
1117                                     width : 75,
1118                                     dataIndex : 'event_when',
1119                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
1120                                 },
1121                                 {
1122                                     xtype: 'ColumnModel',
1123                                     xns: Roo.grid,
1124                                     dataIndex : 'action',
1125                                     header : 'Action',
1126                                     width : 50,
1127                                     renderer : function(v) { return String.format('{0}', v); }
1128                                 },
1129                                 {
1130                                     xtype: 'ColumnModel',
1131                                     xns: Roo.grid,
1132                                     dataIndex : 'ipaddr',
1133                                     header : 'Ipaddr',
1134                                     width : 100,
1135                                     renderer : function(v) { return String.format('{0}', v); }
1136                                 },
1137                                 {
1138                                     xtype: 'ColumnModel',
1139                                     xns: Roo.grid,
1140                                     dataIndex : 'on_id',
1141                                     header : '#ID',
1142                                     width : 75,
1143                                     renderer : function(v) { return String.format('{0}', v); }
1144                                 },
1145                                 {
1146                                     xtype: 'ColumnModel',
1147                                     xns: Roo.grid,
1148                                     header : 'Remarks',
1149                                     width : 200,
1150                                     dataIndex : 'remarks',
1151                                     renderer : function(v) { return String.format('{0}', v); }
1152                                 }
1153                             ]
1154                         }
1155                     }
1156                 ],
1157                 west : {
1158                     xtype: 'LayoutRegion',
1159                     xns: Roo,
1160                     split : true,
1161                     width : 270
1162                 },
1163                 center : {
1164                     xtype: 'LayoutRegion',
1165                     xns: Roo
1166                 },
1167                 east : {
1168                     xtype: 'LayoutRegion',
1169                     xns: Roo,
1170                     split : true,
1171                     width : 600
1172                 }
1173             }
1174         });
1175         this.layout = this.panel.layout;
1176
1177     }
1178 });