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;
97 if (!Pman.Tab.AdminContactsGroup) {
102 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
103 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
108 o.params['query[in_group]'] = tms.data.id;
109 o.params['query[type]'] = 2; // group type..
112 //o.params['query[name]'] = _this.searchBox.getValue();
115 update : function (_self, record, operation)
117 if (operation != 'commit') {
120 // only used to change active status.
123 url : baseURL + '/Roo/Person.php',
127 active: record.data.active
130 success : function() {
133 _this.grid.ds.remove(record);
138 Roo.MessageBox.alert("Error", "saving failed", function() {
139 _this.grid.footer.onClick('first');
146 sortInfo : { field : 'name', direction: 'ASC' },
151 url : baseURL + '/Roo/Person.php'
156 totalProperty : 'total',
185 'name': 'company_id',
213 'name': 'no_reset_sent',
217 'name': 'action_type',
221 'name': 'project_id',
225 'name': 'office_id_id',
229 'name': 'office_id_company_id',
233 'name': 'office_id_name',
237 'name': 'office_id_address',
241 'name': 'office_id_phone',
245 'name': 'office_id_fax',
249 'name': 'office_id_email',
253 'name': 'office_id_role',
257 'name': 'company_id_code',
261 'name': 'company_id_name',
265 'name': 'company_id_remarks',
269 'name': 'company_id_owner_id',
273 'name': 'company_id_address',
277 'name': 'company_id_tel',
281 'name': 'company_id_fax',
285 'name': 'company_id_email',
289 'name': 'company_id_id',
293 'name': 'company_id_isOwner',
297 'name': 'company_id_logo_id',
301 'name': 'company_id_background_color',
305 'name': 'company_id_comptype',
309 'name': 'company_id_url',
313 'name': 'company_id_main_office_id',
317 'name': 'company_id_created_by',
321 'name': 'company_id_created_dt',
325 'name': 'company_id_updated_by',
329 'name': 'company_id_updated_dt',
333 'name': 'company_id_passwd',
337 'name': 'project_id_id',
341 'name': 'project_id_name',
345 'name': 'project_id_remarks',
349 'name': 'project_id_owner_id',
353 'name': 'project_id_code',
357 'name': 'project_id_active',
361 'name': 'project_id_type',
365 'name': 'project_id_client_id',
369 'name': 'project_id_team_id',
373 'name': 'project_id_file_location',
377 'name': 'project_id_open_date',
381 'name': 'project_id_open_by',
385 'name': 'project_id_close_date',
389 'name': 'project_id_countries',
393 'name': 'project_id_languages',
397 'name': 'project_id_agency_id',
401 'name': 'owner_id_id',
405 'name': 'owner_id_office_id',
409 'name': 'owner_id_name',
413 'name': 'owner_id_phone',
417 'name': 'owner_id_fax',
421 'name': 'owner_id_email',
425 'name': 'owner_id_company_id',
429 'name': 'owner_id_role',
433 'name': 'owner_id_active',
437 'name': 'owner_id_remarks',
441 'name': 'owner_id_passwd',
445 'name': 'owner_id_owner_id',
449 'name': 'owner_id_lang',
453 'name': 'owner_id_no_reset_sent',
457 'name': 'owner_id_action_type',
461 'name': 'owner_id_project_id',
468 xtype: 'PagingToolbar',
472 displayMsg : "Displaying Person{0} - {1} of {2}",
473 emptyMsg : "No Person found",
478 text : "Drag person to add or remove from group"
495 render : function (_self)
497 _this.searchBox = _self;
499 show : function (_self,e)
501 if (e.getCharCode() != 13) {
504 _this.grid.footer.onClick('first');
506 specialkey : function (_self, e)
508 if (e.getKey() == 13) {
509 _this.grid.footer.onClick('first');
518 render : function (_self)
520 _this.companyCombo = _self;
522 select : function (combo, record, index)
524 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
527 displayField : 'name',
529 emptyText : "Select Company",
530 forceSelection : true,
531 hiddenName : 'company_id',
533 loadingText : "Searching...",
535 name : 'company_name',
537 qtip : "Select Companies",
538 queryParam : 'query[name]',
539 selectOnFocus : true,
540 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
541 triggerAction : 'all',
549 beforeload : function (_self, o){
550 o.params = o.params || {};
555 sortInfo : { direction : 'ASC', field: 'name' },
560 url : baseURL + '/Roo/Companies.php'
567 totalProperty : 'total',
568 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
576 click : function (_self, e)
578 _this.grid.footer.onClick('first');
582 icon : rootURL + '/Pman/templates/images/search.gif'
588 click : function (_self, e)
590 _this.searchBox.setValue('');
591 _this.grid.footer.onClick('first');
595 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
601 toggle : function (_self, pressed)
603 _this.grid.footer.onClick('first');
604 this.setText(pressed ? "Show Active" : "Show Removed");
608 render : function (_self)
610 _this.activeButton = _self;
614 text : "Show Removed"
620 toggle : function (_self, pressed)
622 _this.grid.footer.onClick('first');
623 this.setText(pressed ? "Show Active" : "Show No Company");
627 render : function (_self)
629 _this.active_company_button = _self;
633 text : "Show No Company"
646 _this.dialog.show( { id : 0 } , function() {
647 _this.grid.footer.onClick('first');
651 cls : 'x-btn-text-icon',
653 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
662 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
663 _this.grid.footer.onClick('first');
667 cls : 'x-btn-text-icon',
669 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
677 var s = _this.grid.getSelectionModel().getSelections();
678 if (!s.length || (s.length > 1)) {
679 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
683 _this.dialog.show(s[0].data, function() {
684 _this.grid.footer.onClick('first');
689 cls : 'x-btn-text-icon',
691 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
699 Pman.genericDelete(_this, 'Person');
702 cls : 'x-btn-text-icon',
704 icon : rootURL + '/Pman/templates/images/trash.gif'
710 xtype: 'ColumnModel',
712 dataIndex : 'project_id_code',
717 renderer : function(v,x,r) {
718 return String.format('<span qtip="{0}">{1}</span>',
719 r.data.project_id_name,
724 xtype: 'ColumnModel',
726 dataIndex : 'company_id_comptype',
730 renderer : function(v,x,r) {
731 if (r.data.office_id) {
732 return String.format('{0} - {1}', v, r.data.office_id_name);
734 return String.format('{0}', v);
738 xtype: 'ColumnModel',
740 dataIndex : 'company_id_name',
744 renderer : function(v,x,r) {
745 if (r.data.office_id) {
746 return String.format('{0} - {1}', v, r.data.office_id_name);
748 return String.format('{0}', v);
752 xtype: 'ColumnModel',
758 renderer : function(v) { return String.format('{0}', v); }
761 xtype: 'ColumnModel',
766 renderer : function(v) { return String.format('{0}', v); }
769 xtype: 'ColumnModel',
774 renderer : function(v) { return String.format('{0}', v); }
777 xtype: 'ColumnModel',
782 renderer : function(v) { return String.format('{0}', v); }
785 xtype: 'ColumnModel',
791 renderer : function(v) {
792 return (v.length && v.indexOf('@') > 0 ) ?
793 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
797 xtype: 'ColumnModel',
799 dataIndex : 'active',
802 renderer : function(v) {
803 var state = v> 0 ? '-checked' : '';
805 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';