X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Pman.Dialog.CoreCompanies.js;h=bb462d81146a47405daf580c82d65c76468a6590;hb=3b998a4a81f8a8676429488ad9728e9c878f3f17;hp=ccd0e296d90beb1bc9bd8bf93f44d0ff55f8932e;hpb=7e5294995201f40fd48a1271c5d53a1e38362e29;p=Pman.Core diff --git a/Pman.Dialog.CoreCompanies.js b/Pman.Dialog.CoreCompanies.js index ccd0e296..bb462d81 100644 --- a/Pman.Dialog.CoreCompanies.js +++ b/Pman.Dialog.CoreCompanies.js @@ -28,317 +28,331 @@ Pman.Dialog.CoreCompanies = { { var _this = this; this.dialog = Roo.factory({ - xtype: 'LayoutDialog', - xns: Roo, - autoCreate : 'true', - closable : false, - collapsible : false, - draggable : false, - height : 400, + center : { + alwaysShowTabs : false, + autoScroll : false, + xtype : 'LayoutRegion', + hideTabs : true, + xns : Roo, + closeOnTab : true, + titlebar : false + }, modal : true, - shadow : 'true', + shadow : true, + collapsible : false, title : "Add / Edit Organization", + xtype : 'LayoutDialog', + autoCreate : true, width : 750, + xns : Roo, + closable : false, + height : 400, + draggable : false, + buttons : [ + { + text : "Cancel", + xtype : 'Button', + xns : Roo, + listeners : { + click : function (_self, e) + { + _this.dialog.hide(); + } + } + }, +{ + text : "Save", + xtype : 'Button', + xns : Roo, + listeners : { + click : function (_self, e) + { + // do some checks? + + + _this.dialog.el.mask("Saving"); + _this.form.doAction("submit"); + + } + } + } + ], items : [ - { - xtype: 'ContentPanel', - xns: Roo, - autoCreate : 'true', - fitToFrame : true, + { region : 'center', + fitToFrame : true, + xtype : 'ContentPanel', + autoCreate : true, + xns : Roo, items : [ - { - xtype: 'Form', - xns: Roo.form, - listeners : { - actionfailed : function(f, act) { - _this.dialog.el.unmask(); - // error msg??? - Pman.standardActionFailed(f,act); - - }, - actioncomplete : function(f, act) { - _this.dialog.el.unmask(); - //console.log('load completed'); - // error messages????? - if(act.type == 'setdata'){ - this.load({ method: 'GET', params: { '_id' : _this.data.id }}); - return; - } - - if (act.type == 'load') { - _this.data = act.result.data; - var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable'; - - - if (_this.form.findField('comptype')) { - _this.form.findField('comptype')[meth](); - } - - // _this.loaded(); - return; - } - - - if (act.type == 'submit') { // only submitted here if we are - _this.dialog.hide(); - - if (_this.callback) { - _this.callback.call(this, act.result.data); - } - return; - } - // unmask?? - }, - rendered : function (form) - { - _this.form = form; - } - }, + { + url : baseURL + '/Roo/Companies.php', fileUpload : true, + xtype : 'Form', labelWidth : 160, - url : baseURL + '/Roo/Companies.php', + xns : Roo.form, + listeners : { + actionfailed : function(f, act) { + _this.dialog.el.unmask(); + // error msg??? + Pman.standardActionFailed(f,act); + + }, + rendered : function (form) + { + _this.form = form; + }, + actioncomplete : function(f, act) { + _this.dialog.el.unmask(); + //console.log('load completed'); + // error messages????? + if(act.type == 'setdata'){ + this.load({ method: 'GET', params: { '_id' : _this.data.id }}); + return; + } + + if (act.type == 'load') { + _this.data = act.result.data; + var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable'; + + + if (_this.form.findField('comptype')) { + _this.form.findField('comptype')[meth](); + } + + // _this.loaded(); + return; + } + + + if (act.type == 'submit') { // only submitted here if we are + _this.dialog.hide(); + + if (_this.callback) { + _this.callback.call(this, act.result.data); + } + return; + } + // unmask?? + } + }, items : [ - { - xtype: 'Column', - xns: Roo.form, + { + xtype : 'Column', + xns : Roo.form, width : 500, items : [ - { - xtype: 'TextField', - xns: Roo.form, - allowBlank : true, + { fieldLabel : 'Company ID (for filing Ref.)', + xtype : 'TextField', + allowBlank : true, + width : 100, + xns : Roo.form, name : 'code', - qtip : "Enter code", - width : 100 + qtip : "Enter code" }, - { - xtype: 'ComboBox', - xns: Roo.form, - listeners : { - render : function (_self) - { - _this.etypeCombo = _self; - } + { + store : { + proxy : { + url : baseURL + '/Roo/core_enum.php', + method : 'GET', + xtype : 'HttpProxy', + xns : Roo.data + }, + reader : { + id : 'id', + root : 'data', + xtype : 'JsonReader', + fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}], + xns : Roo.data, + totalProperty : 'total' + }, + xtype : 'Store', + remoteSort : true, + sortInfo : { direction : 'ASC', field: 'id' }, + xns : Roo.data, + listeners : { + beforeload : function (_self, o){ + o.params = o.params || {}; + // set more here + //o.params['query[empty_etype]'] = 1; + o.params.etype = 'COMPTYPE'; + } + }, + items : [ + + ] + }, alwaysQuery : true, - displayField : 'display_name', - emptyText : "Select Type", + listWidth : 250, + triggerAction : 'all', fieldLabel : 'Type', forceSelection : true, + selectOnFocus : true, + pageSize : 20, + emptyText : "Select Type", + displayField : 'display_name', hiddenName : 'comptype', - listWidth : 250, - loadingText : "Searching...", minChars : 2, + valueField : 'name', + xtype : 'ComboBox', + typeAhead : false, + width : 200, + xns : Roo.form, name : 'comptype_display_name', - pageSize : 20, qtip : "Select type", queryParam : 'query[name]', - selectOnFocus : true, - tpl : '
', - triggerAction : 'all', - typeAhead : false, - valueField : 'name', - width : 200, - store : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - // set more here - //o.params['query[empty_etype]'] = 1; - o.params.etype = 'COMPTYPE'; - } - }, - remoteSort : true, - sortInfo : { direction : 'ASC', field: 'id' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/core_enum.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}] - } - } + tpl : '