X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Tab.PersonList.js;h=cf2c3134042a9b52e5e3e2fc0e267840d9c113c7;hp=264b14151bf2552ff919b074f9c60a5b6f15f31e;hb=1524f8b36295809a3eedd6da3c6494f8aa0d86f5;hpb=5d588643732a7f1e622f208b24a7afea0bce20c8 diff --git a/Pman.Tab.PersonList.js b/Pman.Tab.PersonList.js index 264b1415..cf2c3134 100644 --- a/Pman.Tab.PersonList.js +++ b/Pman.Tab.PersonList.js @@ -144,7 +144,7 @@ Pman.Tab.PersonList.prototype = { { center: { - autoScroll:true, + autoScroll:false, hideTabs: true } } @@ -152,8 +152,13 @@ Pman.Tab.PersonList.prototype = { - this.tab = parentLayout.add(region, new Roo.NestedLayoutPanel( - this.layout, {title: this.title, background: true, controller : this})); + this.tab = parentLayout.add(region, + new Roo.NestedLayoutPanel( + this.layout, { + title: this.title, + background: true, + controller : this + })); this.tab.on('activate', function() { _this.delayedCreate(); @@ -183,10 +188,10 @@ Pman.Tab.PersonList.prototype = { ds: new Roo.data.Store({ // load using HTTP proxy: new Roo.data.HttpProxy({ - url: baseURL + '/Roo/Person.html', + url: baseURL + '/Roo/core_person', method: 'GET' }), - reader: Pman.Readers.Person, + reader: new Roo.data.JsonReader({}, []), remoteSort: true, listeners : { @@ -206,7 +211,7 @@ Pman.Tab.PersonList.prototype = { // only used to change active status. new Pman.Request({ - url : baseURL + '/Roo/Person.php', + url : baseURL + '/Roo/core_person', method :'POST', params : { id : record.data.id, @@ -251,18 +256,25 @@ Pman.Tab.PersonList.prototype = { }, cellclick : function (_self, rowIndex, columnIndex, e) - { + { var di = this.colModel.getDataIndex(columnIndex); if (di != 'active') { return; } - + var rec = _this.grid.ds.getAt(rowIndex); rec.set('active', rec.data.active ? 0 : 1); rec.commit(); - + // only hide if viewing active members... + if (!_this.showInActive) { + var el = Roo.select('.x-grid-row-selected').item(3); + el.addClass('x-grid-row-fadeout'); + el.on('transitionend',function(){ + _this.grid.ds.remove(rec); + },this,{single:true}); + } } @@ -272,7 +284,8 @@ Pman.Tab.PersonList.prototype = { }); this.panel = this.layout.add('center', new Roo.GridPanel(this.grid , { fitToframe: true, - fitContainer: true, + fitContainer: true, + //background : false, id: this.id, title: this.title || "Staff", controller : this @@ -414,7 +427,7 @@ Pman.Tab.PersonList.prototype = { Roo.Ajax.request({ - url: baseURL + '/Roo/Person.html', + url: baseURL + '/Roo/core_person', method: 'GET', params: { _toggleActive : r.join(',') @@ -445,7 +458,41 @@ Pman.Tab.PersonList.prototype = { hidden : !Pman.hasPerm(_this.permName, 'D'), icon: rootURL + '/Pman/templates/images/trash.gif', handler : function(){ - Pman.genericDelete(_this, 'Person'); + //Pman.genericDelete(_this, 'Person'); + + var rec = _this.grid.ds.getAt(_this.grid.selModel.last); + + var rec_id = rec.id; + + if (rec_id * 1 < 1) { + Roo.MessageBox.alert("Error", "Select row to delete"); + return; + } + + Roo.MessageBox.confirm( + "Confirm", + "Confirm Deletion of selected row (some rows can not be deleted if they are referenced elsewhere", + function(res) { + if(res != 'yes') { + return; + } + new Pman.Request({ + method : 'POST', + url : baseURL + '/Roo/core_person', + params : { + _delete : rec_id + }, + success : function() { + _this.paging.onClick('refresh'); + //_this.grid.footer.onClick('refresh'); + } + }); + } + ); + + + + } } , @@ -569,10 +616,34 @@ Pman.Tab.PersonList.prototype = { // id : (this.id + '-name').toLowerCase(), header : "Name", dataIndex : 'name', - sortable : true + sortable : true, + renderer : function(v,p,r) { + if(r.data.active != 1){ + return String.format('
{0}
', v); + } + return String.format('{0}', v); + } // width : 150 }, cfg); }, + + c_group_membership : function(cfg) { + cfg = cfg || {}; + return Roo.apply({ + // id : (this.id + '-name').toLowerCase(), + header : "Group Membership", + dataIndex : 'member_of', + sortable : false, + renderer : function(v,p,r) { + if(r.data.active != 1){ + return String.format('
{0}
', v).split("\n").join("
"); + } + return String.format('{0}', v).split("\n").join("
"); + }, + width : 150 + }, cfg); + }, + c_company_id_comptype : function(cfg) { cfg = cfg || {}; return Roo.apply({