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)
85 o.params['!company_id_comptype'] = 'OWNER';
87 o.params['query[search]'] = _this.searchBox.getValue();
89 if (!_this.activeButton) {return; false;}
91 if (_this.companyCombo && _this.companyCombo.getValue()) {
92 o.params.company_id = _this.companyCombo.getValue();
96 o.params.active = _this.activeButton.pressed ? 0 : 1;
98 if(_this.active_company_button.pressed){
99 o.params.company_id = 0;
101 if (!Pman.Tab.AdminContactsGroup) {
106 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
107 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
112 o.params['query[in_group]'] = tms.data.id;
113 o.params['query[type]'] = 2; // group type..
116 //o.params['query[name]'] = _this.searchBox.getValue();
119 update : function (_self, record, operation)
121 if (operation != 'commit') {
124 // only used to change active status.
127 url : baseURL + '/Roo/Person.php',
131 active: record.data.active
134 success : function() {
137 _this.grid.ds.remove(record);
142 Roo.MessageBox.alert("Error", "saving failed", function() {
143 _this.grid.footer.onClick('first');
150 sortInfo : { field : 'name', direction: 'ASC' },
155 url : baseURL + '/Roo/Person.php'
160 totalProperty : 'total',
189 'name': 'company_id',
217 'name': 'no_reset_sent',
221 'name': 'action_type',
225 'name': 'project_id',
229 'name': 'office_id_id',
233 'name': 'office_id_company_id',
237 'name': 'office_id_name',
241 'name': 'office_id_address',
245 'name': 'office_id_phone',
249 'name': 'office_id_fax',
253 'name': 'office_id_email',
257 'name': 'office_id_role',
261 'name': 'company_id_code',
265 'name': 'company_id_name',
269 'name': 'company_id_remarks',
273 'name': 'company_id_owner_id',
277 'name': 'company_id_address',
281 'name': 'company_id_tel',
285 'name': 'company_id_fax',
289 'name': 'company_id_email',
293 'name': 'company_id_id',
297 'name': 'company_id_isOwner',
301 'name': 'company_id_logo_id',
305 'name': 'company_id_background_color',
309 'name': 'company_id_comptype',
313 'name': 'company_id_url',
317 'name': 'company_id_main_office_id',
321 'name': 'company_id_created_by',
325 'name': 'company_id_created_dt',
329 'name': 'company_id_updated_by',
333 'name': 'company_id_updated_dt',
337 'name': 'company_id_passwd',
341 'name': 'project_id_id',
345 'name': 'project_id_name',
349 'name': 'project_id_remarks',
353 'name': 'project_id_owner_id',
357 'name': 'project_id_code',
361 'name': 'project_id_active',
365 'name': 'project_id_type',
369 'name': 'project_id_client_id',
373 'name': 'project_id_team_id',
377 'name': 'project_id_file_location',
381 'name': 'project_id_open_date',
385 'name': 'project_id_open_by',
389 'name': 'project_id_close_date',
393 'name': 'project_id_countries',
397 'name': 'project_id_languages',
401 'name': 'project_id_agency_id',
405 'name': 'owner_id_id',
409 'name': 'owner_id_office_id',
413 'name': 'owner_id_name',
417 'name': 'owner_id_phone',
421 'name': 'owner_id_fax',
425 'name': 'owner_id_email',
429 'name': 'owner_id_company_id',
433 'name': 'owner_id_role',
437 'name': 'owner_id_active',
441 'name': 'owner_id_remarks',
445 'name': 'owner_id_passwd',
449 'name': 'owner_id_owner_id',
453 'name': 'owner_id_lang',
457 'name': 'owner_id_no_reset_sent',
461 'name': 'owner_id_action_type',
465 'name': 'owner_id_project_id',
472 xtype: 'PagingToolbar',
476 displayMsg : "Displaying Person{0} - {1} of {2}",
477 emptyMsg : "No Person found",
482 text : "Drag person to add or remove from group"
499 render : function (_self)
501 _this.searchBox = _self;
503 show : function (_self,e)
505 if (e.getCharCode() != 13) {
508 _this.grid.footer.onClick('first');
510 specialkey : function (_self, e)
512 if (e.getKey() == 13) {
513 _this.grid.footer.onClick('first');
522 render : function (_self)
524 _this.companyCombo = _self;
526 select : function (combo, record, index)
528 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
531 displayField : 'name',
533 emptyText : "Select Company",
534 forceSelection : true,
535 hiddenName : 'company_id',
537 loadingText : "Searching...",
539 name : 'company_name',
541 qtip : "Select Companies",
542 queryParam : 'query[name]',
543 selectOnFocus : true,
544 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
545 triggerAction : 'all',
553 beforeload : function (_self, o){
554 o.params = o.params || {};
559 sortInfo : { direction : 'ASC', field: 'name' },
564 url : baseURL + '/Roo/Companies.php'
571 totalProperty : 'total',
572 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
580 click : function (_self, e)
582 _this.grid.footer.onClick('first');
586 icon : rootURL + '/Pman/templates/images/search.gif'
592 click : function (_self, e)
594 _this.searchBox.setValue('');
595 _this.grid.footer.onClick('first');
599 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
605 toggle : function (_self, pressed)
607 _this.grid.footer.onClick('first');
608 this.setText(pressed ? "Show Active" : "Show Removed");
612 render : function (_self)
614 _this.activeButton = _self;
618 text : "Show Removed"
624 toggle : function (_self, pressed)
626 _this.grid.footer.onClick('first');
627 this.setText(pressed ? "Show Company" : "Show No Company");
631 render : function (_self)
633 _this.active_company_button = _self;
637 text : "Show No Company"
650 _this.dialog.show( { id : 0 } , function() {
651 _this.grid.footer.onClick('first');
655 cls : 'x-btn-text-icon',
657 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
666 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
667 _this.grid.footer.onClick('first');
671 cls : 'x-btn-text-icon',
673 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
681 var s = _this.grid.getSelectionModel().getSelections();
682 if (!s.length || (s.length > 1)) {
683 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
687 _this.dialog.show(s[0].data, function() {
688 _this.grid.footer.onClick('first');
693 cls : 'x-btn-text-icon',
695 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
703 Pman.genericDelete(_this, 'Person');
706 cls : 'x-btn-text-icon',
708 icon : rootURL + '/Pman/templates/images/trash.gif'
714 xtype: 'ColumnModel',
716 dataIndex : 'project_id_code',
721 renderer : function(v,x,r) {
722 return String.format('<span qtip="{0}">{1}</span>',
723 r.data.project_id_name,
728 xtype: 'ColumnModel',
730 dataIndex : 'company_id_comptype',
734 renderer : function(v,x,r) {
735 if (r.data.office_id) {
736 return String.format('{0} - {1}', v, r.data.office_id_name);
738 return String.format('{0}', v);
742 xtype: 'ColumnModel',
744 dataIndex : 'company_id_name',
748 renderer : function(v,x,r) {
749 if (r.data.office_id) {
750 return String.format('{0} - {1}', v, r.data.office_id_name);
752 return String.format('{0}', v);
756 xtype: 'ColumnModel',
762 renderer : function(v) { return String.format('{0}', v); }
765 xtype: 'ColumnModel',
770 renderer : function(v) { return String.format('{0}', v); }
773 xtype: 'ColumnModel',
778 renderer : function(v) { return String.format('{0}', v); }
781 xtype: 'ColumnModel',
786 renderer : function(v) { return String.format('{0}', v); }
789 xtype: 'ColumnModel',
795 renderer : function(v) {
796 return (v.length && v.indexOf('@') > 0 ) ?
797 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
801 xtype: 'ColumnModel',
803 dataIndex : 'active',
806 renderer : function(v) {
807 var state = v> 0 ? '-checked' : '';
809 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';