sync
[Pman.Admin] / Pman.Tab.Group_Members.js
1 //<script type="text/javascript">
2 /**
3  *  group membershipg - for permissions..
4  */
5  
6  
7  Pman.on('beforeload', function()
8 {
9     //                case 1 : Pman.Tab.Projects.add(this.mainLayout, 'west'); break;
10     
11    
12     
13     Pman.register({
14         modKey : '001-pman-tab-groups-members',
15         module : Pman.Tab.Group_Members,
16         region : 'center',
17         parent : Pman.Tab.GroupMgr,
18         name : "Permission Group Membership"
19     });
20
21     
22 });
23
24 Pman.Tab.Group_Members = new  Pman.Tab.PersonList({
25     id : 'group_members',
26     type: 0,
27     title : "Staff Membership",
28     permName : 'Core.Staff',
29     hideDelete: true, // as it's confusing..
30     getLeftSelections : function() {
31         return Pman.Tab.Groups.grid.getSelectionModel().getSelections();
32     },
33     
34     // beforeload handler... -- override on extended versions..
35     beforeload: function(t, o) {
36         //console.log(o.params);
37         // teams!?!
38         var tms = this.getLeftSelections();
39         
40         if (tms.length) {
41             o.params['query[in_group]'] = tms[0].data.id;
42         }
43         o.params['query[name]'] = this.searchBox.getValue();
44         o.params['query[type]'] = this.type; // group type..
45         o.params['query[person_internal_only_all]'] = 1;
46         o.params['query[person_inactive]'] = this.showInActive ? 0  : 1;
47         o.params.company_id_comptype = 'OWNER';
48         o.params._with_group_membership = 1;
49         
50     },
51     
52     columns : function()
53     {
54         return [
55             this.c_name(),
56             this.c_office_id_name(),
57             this.c_role(),
58             this.c_group_membership(),
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.AdminPerson;
68         //return Pman.Dialog.PersonStaff;
69     },
70     bulkAdd : function() {
71         //return Pman.Dialog.PersonBulkAdd
72         return false;
73     },
74     newDefaults : function() {
75         return {
76             
77             id : 0,
78             company_id : Pman.Login.authUser.company_id,
79             company_id_name : Pman.Login.authUser.company_id_name,
80             company_id_address : Pman.Login.authUser.company_id_address,
81             company_id_tel : Pman.Login.authUser.company_id_tel,
82             company_id_fax : Pman.Login.authUser.company_id_fax
83         };
84     }
85     
86 });