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