sync
[Pman.Admin] / old / Pman.Tab.Contacts.js
1 //<script type="text/javascript">
2 /**
3  * 
4  * The contacts..
5  * 
6  * -- this should implement personlist.!!!!
7  */
8 Pman.on('beforeload', function()
9 {
10     if (!Pman.hasPerm('Core.Person', 'E')) {
11         return;
12     }
13    
14     
15     
16     Pman.register({
17         modKey : '040-pman-tab-contacts',
18         module : Pman.Tab.Contacts,
19         region : 'center',
20         parent : Pman.Tab.ContactsMgr,
21         name : "Contacts List"
22     });
23
24     
25 });
26 Pman.Tab.Contacts = new Pman.Tab.PersonList({
27         id: 'contacts',
28         type: 2,
29         title : "Contacts",
30         itemDisplayName : "Contact",
31         permName : 'Core.Person',
32         getLeftSelections : function() {
33         
34             return Pman.Tab.ContactGrps.grid ? 
35                 Pman.Tab.ContactGrps.grid.getSelectionModel().getSelections() : [];
36         },
37         beforeload: function(t, o) {
38                 //console.log(o.params);
39             var _this= Pman.Tab.Contacts;
40             o.params['query[person_not_internal]'] = 1;
41             o.params['query[search]'] = _this.searchBox.getValue();
42             
43             var tms = _this.getLeftSelections();
44             
45             if (tms.length) {
46                 o.params['query[in_group]'] = tms[0].data.id;
47             }
48             //o.params['query[name]'] = _this.searchBox.getValue();
49             o.params['query[type]'] = _this.type; // group type..
50             
51             
52             
53         }, 
54         columns : function()
55         {
56             return [
57                 this.c_project_id_code(),
58                 this.c_company_id_name(),
59                 this.c_name(),
60                 this.c_role(),
61                 this.c_phone(),
62                 this.c_fax(),
63                 this.c_email() 
64             ]
65         },
66         dialog: function () {
67             return Pman.Dialog.PersonEdit;
68         },
69         bulkAdd : function() {
70             return Pman.Dialog.PersonBulkAdd;
71         },  
72         newDefaults : function() {  return { id : 0 }; }
73
74     
75     });