sync
[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         permname : 'Admin.Teams'
18     });
19    
20     // where is this loaded into??? - by staffmgr - ** fix this...
21       
22    
23     
24 });
25
26 Pman.Tab.PersonStaff = new  Pman.Tab.PersonList({
27     id : 'personstaff',
28     type: 1,
29     permName : 'Core.Staff', // or 'Core.Staff'
30     getLeftSelections : function() {
31         
32         return Pman.Tab.Teams.grid ? Pman.Tab.Teams.grid.getSelectionModel().getSelections() : [];
33     },
34     
35     
36     
37     
38     // beforeload handler... -- override on extended versions..
39     beforeload: function(t, o) {
40         //console.log(o.params);
41         // teams!?!
42         var tms = this.getLeftSelections();
43         
44         if (tms.length) {
45             o.params['query[in_group]'] = tms[0].data.id;
46         }
47         o.params['query[name]'] = this.searchBox.getValue();
48         o.params['query[type]'] = this.type; // group type..
49         o.params['query[person_internal_only_all]'] = 1;
50         o.params['query[person_inactive]'] = this.showInActive ? 0  : 1;
51         
52     },
53     
54     columns : function()
55     {
56         return [
57             this.c_name(),
58             this.c_office_id_name(),
59             this.c_role(),
60             this.c_phone(),
61             this.c_fax(),
62             this.c_email(),
63             this.c_active()
64         ]
65     },
66     
67     dialog: function () {
68         return Pman.Dialog.AdminPerson;
69         //return Pman.Dialog.PersonStaff;
70     },
71     bulkAdd : function() {
72         //return Pman.Dialog.PersonBulkAdd
73         return false;
74     },
75     newDefaults : function() {
76         return {
77             
78             id : 0,
79             company_id : Pman.Login.authUser.company_id,
80             company_id_name : Pman.Login.authUser.company_id_name,
81             company_id_address : Pman.Login.authUser.company_id_address,
82             company_id_tel : Pman.Login.authUser.company_id_tel,
83             company_id_fax : Pman.Login.authUser.company_id_fax
84         };
85     }
86 });