DataObjects/Core_domain.php
[Pman.Core] / Pman.Dialog.CorePersonContact.js
index 3608f19..a90c347 100644 (file)
@@ -32,10 +32,10 @@ Pman.Dialog.CorePersonContact = {
             xns: Roo,
             closable : false,
             collapsible : false,
-            height : 350,
+            height : 290,
             resizable : false,
             title : "Edit / Create Contact Details",
-            width : 500,
+            width : 450,
             items : [
                 {
                     xtype: 'ContentPanel',
@@ -143,6 +143,34 @@ Pman.Dialog.CorePersonContact = {
                                 {
                                     xtype: 'ComboBox',
                                     xns: Roo.form,
+                                    listeners : {
+                                        add : function (combo)
+                                        {
+                                            var coid = _this.form.findField('company_id').getValue();
+                                            if (!coid ) {
+                                            
+                                                 Ext.MessageBox.alert("Error", "Select An Company First");
+                                                return false;
+                                        
+                                            }
+                                            Pman.Dialog.Office.show(cfg, function(data) {
+                                                        _this.form.setValues({
+                                                            office_id_name : data.name,
+                                                            office_id : data.id
+                                                    });
+                                                }); 
+                                            
+                                            
+                                        },
+                                        beforequery : function (combo, query, forceAll, cancel, e)
+                                        {
+                                                var coid = _this.form.findField('company_id').getValue();
+                                                if (coid < 1 ) {
+                                                    Ext.MessageBox.alert("Error", "Select An Company First");
+                                                    return false;
+                                                }
+                                        }
+                                    },
                                     allowBlank : 'false',
                                     displayField : 'name',
                                     editable : 'false',
@@ -163,12 +191,6 @@ Pman.Dialog.CorePersonContact = {
                                     typeAhead : true,
                                     valueField : 'id',
                                     width : 300,
-                                    listeners : {
-                                        add : function (combo)
-                                        {
-                                        
-                                        }
-                                    },
                                     store : {
                                         xtype: 'Store',
                                         xns: Roo.data,
@@ -202,7 +224,8 @@ Pman.Dialog.CorePersonContact = {
                                     xns: Roo.form,
                                     fieldLabel : 'Name',
                                     name : 'name',
-                                    width : 300
+                                    width : 300,
+                                    allowBlank : true
                                 },
                                 {
                                     xtype: 'TextField',
@@ -228,6 +251,7 @@ Pman.Dialog.CorePersonContact = {
                                 {
                                     xtype: 'TextField',
                                     xns: Roo.form,
+                                    allowBlank : false,
                                     fieldLabel : 'Email',
                                     name : 'email',
                                     width : 200