Pman.Dialog.PersonEditor.js
[Pman.Core] / Pman.Dialog.PersonEditor.js
index e66dbbe..b205a2f 100644 (file)
@@ -37,7 +37,7 @@ Pman.Dialog.PersonEditor.prototype = {
                 title: 'Edit Contact Details',
                 modal: true,
                 width:  530,
-                height: 300,
+                height: 400,
                 shadow:true,
                 minWidth:200,
                 minHeight:180,
@@ -232,7 +232,7 @@ Pman.Dialog.PersonEditor.prototype = {
                         beforeload : function(st,o)
                         {
                         
-                            o.params.isOwner = 0;
+                            o.params['!comptype'] = 'OWNER';
                         },
                         loadexception : Pman.loadException
                     
@@ -263,7 +263,7 @@ Pman.Dialog.PersonEditor.prototype = {
                     adderclick : function()
                     {
                         var cb = this;
-                        Pman.Dialog.Companies.show( {  id: 0 },  function(data) {
+                        Pman.Dialog.CoreCompanies.show( {  id: 0 },  function(data) {
                             cb.setFromData(data);
                         }); 
                     }
@@ -454,13 +454,77 @@ Pman.Dialog.PersonEditor.prototype = {
                 qtip : "Enter email",
                 xtype : 'TextField',
                 width : 300
+            },
+            country : {
+                
+                xtype: 'ComboBoxAdder',
+                fieldLabel: "Company",
+                name : 'country',
+                selectOnFocus:true,
+                qtip : "Select Company",
+                allowBlank : false,
+                width: 300,
+                
+                store: {
+                    xtype : 'Store',
+                      // load using HTTP
+                    proxy:{
+                        xtype:  'HttpProxy',
+                        url: baseURL + '/Roo/Companies.html',
+                        method: 'GET'
+                    },
+                    reader: Pman.Readers.Companies,
+                    listeners : {
+                        beforeload : function(st,o)
+                        {
+                        
+                            o.params['!comptype'] = 'OWNER';
+                        },
+                        loadexception : Pman.loadException
+                    
+                    },
+                    sortInfo: {
+                        field: 'name', direction: 'ASC'
+                    }
+                },
+                displayField:'name',
+                valueField : 'id',
+                hiddenName:  'company_id',
+                typeAhead: true,
+                forceSelection: true,
+                //mode: 'local',
+                triggerAction: 'all',
+                tpl: new Ext.Template(
+                    '<div class="x-grid-cell-text x-btn button">',
+                        '<b>{name}</b> {address}',
+                    '</div>'
+                ),
+                queryParam: 'query[name]',
+                loadingText: "Searching...",
+                listWidth: 400,
+               
+                minChars: 2,
+                pageSize:20,
+                listeners : {
+                    adderclick : function()
+                    {
+                        var cb = this;
+                        Pman.Dialog.CoreCompanies.show( {  id: 0 },  function(data) {
+                            cb.setFromData(data);
+                        }); 
+                    }
+                }
+               
+                 
+                 
+                 
             },
             passwd1 : {
                 name : 'passwd1',
                 fieldLabel : "New Password ",
                 value : '',
                 allowBlank : true, // must be filled in as we rely on it for login details..
-                inputType: 'password',
+                inputType: 'password', // << if comment out this input type, it should be ok
                 xtype : 'SecurePass',
                 width : 220,
                 imageRoot : rootURL + '/Pman/templates/images'
@@ -471,7 +535,7 @@ Pman.Dialog.PersonEditor.prototype = {
                 fieldLabel : "Password (type again to confirm)",
                 value : '',
                 allowBlank : true, // must be filled in as we rely on it for login details..
-                inputType: 'password',
+                inputType: 'password', // << if comment out this input type, it should be ok
                 xtype : 'TextField',
                 width : 220
             },
@@ -551,7 +615,7 @@ Pman.Dialog.PersonEditor.prototype = {
             return;
             
         }
-        if (!this.form.findField('company_id').getValue()) {
+        if (this.form.findField('company_id') && !this.form.findField('company_id').getValue()) {
             Ext.MessageBox.alert("Error", "Select a Company");
             return;
         }
@@ -611,7 +675,7 @@ Pman.Dialog.PersonEditor.prototype = {
         this.data = data;
         this.create();
         this.form.reset();
-        if (data._fetch) {
+        if ( this._id) {
             this.dialog.show();
             this.dialog.el.mask("Loading");
             this.form.doAction('load', {
@@ -624,9 +688,10 @@ Pman.Dialog.PersonEditor.prototype = {
             });
            // this.fireEvent('show');
             return;
-        } else {
-            this.form.setValues(data);
         }
+        //} else {
+        this.form.setValues(data);
+        //}
         this.form.fireEvent('actioncomplete', this.form,{
             type : 'setdata',
             data: data
@@ -719,7 +784,7 @@ Pman.Dialog.PersonEditor.prototype = {
              
             var c = ar[i];
             i++;
-            Pman.request({
+            new Pman.Request({
                 url : baseURL+'/Core/SendIntro.html',
                 method : 'POST',
                 params: c,