1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.AdminContacts = new Roo.XComponent({
6 part : ["Admin","Contacts"],
7 order : '001-Pman.Tab.AdminContacts',
9 parent : 'Pman.Tab.AdminContactsManager',
10 name : "Pman.Tab.AdminContacts",
12 permname : 'Core.Person',
21 activate : function() {
24 _this.grid.footer.onClick('first');
43 _this.dialog = Pman.Dialog.PersonEdit;
46 //_this.dialog = Pman.Dialog.FILL_IN
47 if (_this.panel.active) {
48 this.footer.onClick('first');
51 rowdblclick : function (_self, rowIndex, e)
53 if (!_this.dialog) return;
54 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
55 _this.grid.footer.onClick('first');
58 cellclick : function (_self, rowIndex, columnIndex, e)
61 var di = this.colModel.getDataIndex(columnIndex);
66 var rec = _this.grid.ds.getAt(rowIndex);
68 rec.set('active', rec.data.active ? 0 : 1);
74 autoExpandColumn : 'name',
82 beforeload : function (_self, o)
84 if(_this.active_company_button){
85 o.params['company_id'] = 0;
87 o.params['!company_id_comptype'] = 'OWNER';
89 o.params['query[search]'] = _this.searchBox.getValue();
91 if (!_this.activeButton) {return; false;}
92 Roo.log(_this.active_company_button);
93 if (_this.companyCombo && _this.companyCombo.getValue()) {
94 o.params.company_id = _this.companyCombo.getValue();
98 o.params.active = _this.activeButton.pressed ? 0 : 1;
99 if (!Pman.Tab.AdminContactsGroup) {
104 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
105 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
110 o.params['query[in_group]'] = tms.data.id;
111 o.params['query[type]'] = 2; // group type..
114 //o.params['query[name]'] = _this.searchBox.getValue();
117 update : function (_self, record, operation)
119 if (operation != 'commit') {
122 // only used to change active status.
125 url : baseURL + '/Roo/Person.php',
129 active: record.data.active
132 success : function() {
135 _this.grid.ds.remove(record);
140 Roo.MessageBox.alert("Error", "saving failed", function() {
141 _this.grid.footer.onClick('first');
148 sortInfo : { field : 'name', direction: 'ASC' },
153 url : baseURL + '/Roo/Person.php'
158 totalProperty : 'total',
187 'name': 'company_id',
215 'name': 'no_reset_sent',
219 'name': 'action_type',
223 'name': 'project_id',
227 'name': 'office_id_id',
231 'name': 'office_id_company_id',
235 'name': 'office_id_name',
239 'name': 'office_id_address',
243 'name': 'office_id_phone',
247 'name': 'office_id_fax',
251 'name': 'office_id_email',
255 'name': 'office_id_role',
259 'name': 'company_id_code',
263 'name': 'company_id_name',
267 'name': 'company_id_remarks',
271 'name': 'company_id_owner_id',
275 'name': 'company_id_address',
279 'name': 'company_id_tel',
283 'name': 'company_id_fax',
287 'name': 'company_id_email',
291 'name': 'company_id_id',
295 'name': 'company_id_isOwner',
299 'name': 'company_id_logo_id',
303 'name': 'company_id_background_color',
307 'name': 'company_id_comptype',
311 'name': 'company_id_url',
315 'name': 'company_id_main_office_id',
319 'name': 'company_id_created_by',
323 'name': 'company_id_created_dt',
327 'name': 'company_id_updated_by',
331 'name': 'company_id_updated_dt',
335 'name': 'company_id_passwd',
339 'name': 'project_id_id',
343 'name': 'project_id_name',
347 'name': 'project_id_remarks',
351 'name': 'project_id_owner_id',
355 'name': 'project_id_code',
359 'name': 'project_id_active',
363 'name': 'project_id_type',
367 'name': 'project_id_client_id',
371 'name': 'project_id_team_id',
375 'name': 'project_id_file_location',
379 'name': 'project_id_open_date',
383 'name': 'project_id_open_by',
387 'name': 'project_id_close_date',
391 'name': 'project_id_countries',
395 'name': 'project_id_languages',
399 'name': 'project_id_agency_id',
403 'name': 'owner_id_id',
407 'name': 'owner_id_office_id',
411 'name': 'owner_id_name',
415 'name': 'owner_id_phone',
419 'name': 'owner_id_fax',
423 'name': 'owner_id_email',
427 'name': 'owner_id_company_id',
431 'name': 'owner_id_role',
435 'name': 'owner_id_active',
439 'name': 'owner_id_remarks',
443 'name': 'owner_id_passwd',
447 'name': 'owner_id_owner_id',
451 'name': 'owner_id_lang',
455 'name': 'owner_id_no_reset_sent',
459 'name': 'owner_id_action_type',
463 'name': 'owner_id_project_id',
470 xtype: 'PagingToolbar',
474 displayMsg : "Displaying Person{0} - {1} of {2}",
475 emptyMsg : "No Person found",
480 text : "Drag person to add or remove from group"
497 render : function (_self)
499 _this.searchBox = _self;
501 show : function (_self,e)
503 if (e.getCharCode() != 13) {
506 _this.grid.footer.onClick('first');
508 specialkey : function (_self, e)
510 if (e.getKey() == 13) {
511 _this.grid.footer.onClick('first');
520 render : function (_self)
522 _this.companyCombo = _self;
524 select : function (combo, record, index)
526 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
529 displayField : 'name',
531 emptyText : "Select Company",
532 forceSelection : true,
533 hiddenName : 'company_id',
535 loadingText : "Searching...",
537 name : 'company_name',
539 qtip : "Select Companies",
540 queryParam : 'query[name]',
541 selectOnFocus : true,
542 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
543 triggerAction : 'all',
551 beforeload : function (_self, o){
552 o.params = o.params || {};
557 sortInfo : { direction : 'ASC', field: 'name' },
562 url : baseURL + '/Roo/Companies.php'
569 totalProperty : 'total',
570 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
578 click : function (_self, e)
580 _this.grid.footer.onClick('first');
584 icon : rootURL + '/Pman/templates/images/search.gif'
590 click : function (_self, e)
592 _this.searchBox.setValue('');
593 _this.grid.footer.onClick('first');
597 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
603 toggle : function (_self, pressed)
605 _this.grid.footer.onClick('first');
606 this.setText(pressed ? "Show Active" : "Show Removed");
610 render : function (_self)
612 _this.activeButton = _self;
616 text : "Show Removed"
622 toggle : function (_self, pressed)
624 _this.grid.footer.onClick('first');
625 this.setText(pressed ? "Show Active" : "Show No Company");
629 render : function (_self)
631 _this.active_company_button = _self;
635 text : "Show No Company"
648 _this.dialog.show( { id : 0 } , function() {
649 _this.grid.footer.onClick('first');
653 cls : 'x-btn-text-icon',
655 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
664 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
665 _this.grid.footer.onClick('first');
669 cls : 'x-btn-text-icon',
671 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
679 var s = _this.grid.getSelectionModel().getSelections();
680 if (!s.length || (s.length > 1)) {
681 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
685 _this.dialog.show(s[0].data, function() {
686 _this.grid.footer.onClick('first');
691 cls : 'x-btn-text-icon',
693 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
701 Pman.genericDelete(_this, 'Person');
704 cls : 'x-btn-text-icon',
706 icon : rootURL + '/Pman/templates/images/trash.gif'
712 xtype: 'ColumnModel',
714 dataIndex : 'project_id_code',
719 renderer : function(v,x,r) {
720 return String.format('<span qtip="{0}">{1}</span>',
721 r.data.project_id_name,
726 xtype: 'ColumnModel',
728 dataIndex : 'company_id_comptype',
732 renderer : function(v,x,r) {
733 if (r.data.office_id) {
734 return String.format('{0} - {1}', v, r.data.office_id_name);
736 return String.format('{0}', v);
740 xtype: 'ColumnModel',
742 dataIndex : 'company_id_name',
746 renderer : function(v,x,r) {
747 if (r.data.office_id) {
748 return String.format('{0} - {1}', v, r.data.office_id_name);
750 return String.format('{0}', v);
754 xtype: 'ColumnModel',
760 renderer : function(v) { return String.format('{0}', v); }
763 xtype: 'ColumnModel',
768 renderer : function(v) { return String.format('{0}', v); }
771 xtype: 'ColumnModel',
776 renderer : function(v) { return String.format('{0}', v); }
779 xtype: 'ColumnModel',
784 renderer : function(v) { return String.format('{0}', v); }
787 xtype: 'ColumnModel',
793 renderer : function(v) {
794 return (v.length && v.indexOf('@') > 0 ) ?
795 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
799 xtype: 'ColumnModel',
801 dataIndex : 'active',
804 renderer : function(v) {
805 var state = v> 0 ? '-checked' : '';
807 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';