Pman.Tab.PersonStaff.js
[Pman.Admin] / Pman.Tab.PersonStaff.js
1 //<script type="text/javascript">
2
3 /**
4  * 
5  * Staff list with General Group adding ability.
6  * 
7  */
8 Pman.on('beforeload', function()
9 {
10      
11     Pman.register({
12         modKey : '001-pman-tab-personlist',
13         module : Pman.Tab.PersonStaff,
14         region : 'center',
15         parent : Pman.Tab.StaffMgr,
16         name : "Staff"
17     });
18    
19     // where is this loaded into??? - by staffmgr - ** fix this...
20       
21    
22     
23 });
24
25 Pman.Tab.PersonStaff = new  Pman.Tab.PersonList({
26     id : 'personstaff',
27     type: 1,
28     permName : 'Core.Teams', // or 'Core.Staff'
29     getLeftSelections : function() {
30         
31         return Pman.Tab.Teams.grid ? Pman.Tab.Teams.grid.getSelectionModel().getSelections() : [];
32     },
33     
34     
35     
36     
37     // beforeload handler... -- override on extended versions..
38     beforeload: function(t, o) {
39         //console.log(o.params);
40         // teams!?!
41         var tms = this.getLeftSelections();
42         
43         if (tms.length) {
44             o.params['query[in_group]'] = tms[0].data.id;
45         }
46         o.params['query[name]'] = this.searchBox.getValue();
47         o.params['query[type]'] = this.type; // group type..
48         o.params['query[person_internal_only_all]'] = 1;
49         o.params['query[person_inactive]'] = this.showInActive ? 0  : 1;
50         
51     },
52     
53     columns : function()
54     {
55         return [
56             this.c_name(),
57             this.c_office_id_name(),
58             this.c_role(),
59             this.c_phone(),
60             this.c_fax(),
61             this.c_email(),
62             this.c_active()
63         ]
64     },
65     
66     dialog: function () {
67         return Pman.Dialog.PersonStaff;
68     },
69     bulkAdd : function() {
70         //return Pman.Dialog.PersonBulkAdd
71         return false;
72     },
73     newDefaults : function() {
74         return {
75             
76             id : 0,
77             company_id : Pman.Login.authUser.company_id,
78             company_id_name : Pman.Login.authUser.company_id_name,
79             company_id_address : Pman.Login.authUser.company_id_address,
80             company_id_tel : Pman.Login.authUser.company_id_tel,
81             company_id_fax : Pman.Login.authUser.company_id_fax
82         };
83     }
84 });