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';
86 o.params['query[search]'] = _this.searchBox.getValue();
88 if (!_this.activeButton) {return; false;}
90 if (_this.companyCombo && _this.companyCombo.getValue()) {
91 o.params.company_id = _this.companyCombo.getValue();
95 o.params.active = _this.activeButton.pressed ? 0 : 1;
96 if (!Pman.Tab.AdminContactsGroup) {
101 if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {
102 var tms = Pman.Tab.AdminContactsGroup.grid.getSelectionModel().getSelected();
107 o.params['query[in_group]'] = tms.data.id;
108 o.params['query[type]'] = 2; // group type..
111 //o.params['query[name]'] = _this.searchBox.getValue();
114 update : function (_self, record, operation)
116 if (operation != 'commit') {
119 // only used to change active status.
122 url : baseURL + '/Roo/Person.php',
126 active: record.data.active
129 success : function() {
132 _this.grid.ds.remove(record);
137 Roo.MessageBox.alert("Error", "saving failed", function() {
138 _this.grid.footer.onClick('first');
145 sortInfo : { field : 'name', direction: 'ASC' },
150 url : baseURL + '/Roo/Person.php'
155 totalProperty : 'total',
184 'name': 'company_id',
212 'name': 'no_reset_sent',
216 'name': 'action_type',
220 'name': 'project_id',
224 'name': 'office_id_id',
228 'name': 'office_id_company_id',
232 'name': 'office_id_name',
236 'name': 'office_id_address',
240 'name': 'office_id_phone',
244 'name': 'office_id_fax',
248 'name': 'office_id_email',
252 'name': 'office_id_role',
256 'name': 'company_id_code',
260 'name': 'company_id_name',
264 'name': 'company_id_remarks',
268 'name': 'company_id_owner_id',
272 'name': 'company_id_address',
276 'name': 'company_id_tel',
280 'name': 'company_id_fax',
284 'name': 'company_id_email',
288 'name': 'company_id_id',
292 'name': 'company_id_isOwner',
296 'name': 'company_id_logo_id',
300 'name': 'company_id_background_color',
304 'name': 'company_id_comptype',
308 'name': 'company_id_url',
312 'name': 'company_id_main_office_id',
316 'name': 'company_id_created_by',
320 'name': 'company_id_created_dt',
324 'name': 'company_id_updated_by',
328 'name': 'company_id_updated_dt',
332 'name': 'company_id_passwd',
336 'name': 'project_id_id',
340 'name': 'project_id_name',
344 'name': 'project_id_remarks',
348 'name': 'project_id_owner_id',
352 'name': 'project_id_code',
356 'name': 'project_id_active',
360 'name': 'project_id_type',
364 'name': 'project_id_client_id',
368 'name': 'project_id_team_id',
372 'name': 'project_id_file_location',
376 'name': 'project_id_open_date',
380 'name': 'project_id_open_by',
384 'name': 'project_id_close_date',
388 'name': 'project_id_countries',
392 'name': 'project_id_languages',
396 'name': 'project_id_agency_id',
400 'name': 'owner_id_id',
404 'name': 'owner_id_office_id',
408 'name': 'owner_id_name',
412 'name': 'owner_id_phone',
416 'name': 'owner_id_fax',
420 'name': 'owner_id_email',
424 'name': 'owner_id_company_id',
428 'name': 'owner_id_role',
432 'name': 'owner_id_active',
436 'name': 'owner_id_remarks',
440 'name': 'owner_id_passwd',
444 'name': 'owner_id_owner_id',
448 'name': 'owner_id_lang',
452 'name': 'owner_id_no_reset_sent',
456 'name': 'owner_id_action_type',
460 'name': 'owner_id_project_id',
467 xtype: 'PagingToolbar',
471 displayMsg : "Displaying Person{0} - {1} of {2}",
472 emptyMsg : "No Person found",
477 text : "Drag person to add or remove from group"
494 render : function (_self)
496 _this.searchBox = _self;
498 show : function (_self,e)
500 if (e.getCharCode() != 13) {
503 _this.grid.footer.onClick('first');
505 specialkey : function (_self, e)
507 if (e.getKey() == 13) {
508 _this.grid.footer.onClick('first');
517 render : function (_self)
519 _this.companyCombo = _self;
521 select : function (combo, record, index)
523 _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );
526 displayField : 'name',
528 emptyText : "Select Company",
529 forceSelection : true,
530 hiddenName : 'company_id',
532 loadingText : "Searching...",
534 name : 'company_name',
536 qtip : "Select Companies",
537 queryParam : 'query[name]',
538 selectOnFocus : true,
539 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
540 triggerAction : 'all',
548 beforeload : function (_self, o){
549 o.params = o.params || {};
554 sortInfo : { direction : 'ASC', field: 'name' },
559 url : baseURL + '/Roo/Companies.php'
566 totalProperty : 'total',
567 fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
575 click : function (_self, e)
577 _this.grid.footer.onClick('first');
581 icon : rootURL + '/Pman/templates/images/search.gif'
587 click : function (_self, e)
589 _this.searchBox.setValue('');
590 _this.grid.footer.onClick('first');
594 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
600 toggle : function (_self, pressed)
602 _this.grid.footer.onClick('first');
603 this.setText(pressed ? "Show Active" : "Show Removed");
607 render : function (_self)
609 _this.activeButton = _self;
613 text : "Show Removed"
619 toggle : function (_self, pressed)
621 _this.grid.footer.onClick('first');
622 this.setText(pressed ? "Show Active" : "Show No Company");
626 render : function (_self)
628 _this.active_company_button = _self;
632 text : "Show No Company"
645 _this.dialog.show( { id : 0 } , function() {
646 _this.grid.footer.onClick('first');
650 cls : 'x-btn-text-icon',
652 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
661 Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
662 _this.grid.footer.onClick('first');
666 cls : 'x-btn-text-icon',
668 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
676 var s = _this.grid.getSelectionModel().getSelections();
677 if (!s.length || (s.length > 1)) {
678 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
682 _this.dialog.show(s[0].data, function() {
683 _this.grid.footer.onClick('first');
688 cls : 'x-btn-text-icon',
690 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
698 Pman.genericDelete(_this, 'Person');
701 cls : 'x-btn-text-icon',
703 icon : rootURL + '/Pman/templates/images/trash.gif'
709 xtype: 'ColumnModel',
711 dataIndex : 'project_id_code',
716 renderer : function(v,x,r) {
717 return String.format('<span qtip="{0}">{1}</span>',
718 r.data.project_id_name,
723 xtype: 'ColumnModel',
725 dataIndex : 'company_id_comptype',
729 renderer : function(v,x,r) {
730 if (r.data.office_id) {
731 return String.format('{0} - {1}', v, r.data.office_id_name);
733 return String.format('{0}', v);
737 xtype: 'ColumnModel',
739 dataIndex : 'company_id_name',
743 renderer : function(v,x,r) {
744 if (r.data.office_id) {
745 return String.format('{0} - {1}', v, r.data.office_id_name);
747 return String.format('{0}', v);
751 xtype: 'ColumnModel',
757 renderer : function(v) { return String.format('{0}', v); }
760 xtype: 'ColumnModel',
765 renderer : function(v) { return String.format('{0}', v); }
768 xtype: 'ColumnModel',
773 renderer : function(v) { return String.format('{0}', v); }
776 xtype: 'ColumnModel',
781 renderer : function(v) { return String.format('{0}', v); }
784 xtype: 'ColumnModel',
790 renderer : function(v) {
791 return (v.length && v.indexOf('@') > 0 ) ?
792 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
796 xtype: 'ColumnModel',
798 dataIndex : 'active',
801 renderer : function(v) {
802 var state = v> 0 ? '-checked' : '';
804 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';