DataObjects/Core_domain.php
[Pman.Core] / Pman.Dialog.CorePersonContact.js
index f51bd1f..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',
@@ -87,8 +87,9 @@ Pman.Dialog.CorePersonContact = {
                                         
                                             Pman.Dialog.Companies.show( {  id: 0 },  function(data) {
                                                     _this.form.setValues({
-                                                            
-                                                    })
+                                                            company_id_name : data.name,
+                                                            company_id : data.id
+                                                    });
                                             }); 
                                         }
                                     },
@@ -142,37 +143,66 @@ 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',
                                     emptyText : "Select Office",
+                                    fieldLabel : 'Office',
                                     forceSelection : true,
+                                    hiddenName : 'office_id',
                                     listWidth : 400,
                                     loadingText : "Searching...",
                                     minChars : 2,
+                                    name : 'office_id_name',
                                     pageSize : 20,
                                     qtip : "Select Office",
+                                    queryParam : 'query[name]',
                                     selectOnFocus : true,
+                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
                                     triggerAction : 'all',
                                     typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    queryParam : 'query[name]',
-                                    fieldLabel : 'Office',
                                     valueField : 'id',
-                                    displayField : 'name',
-                                    hiddenName : 'office_id',
-                                    name : 'office_id_name',
+                                    width : 300,
                                     store : {
                                         xtype: 'Store',
                                         xns: Roo.data,
-                                        remoteSort : true,
-                                        sortInfo : { direction : 'ASC', field: 'id' },
                                         listeners : {
                                             beforeload : function (_self, o){
                                                 o.params = o.params || {};
-                                                // set more here
+                                                var coid = _this.form.findField('company_id').getValue();
+                                                o.params.company_id = coid;
                                             }
                                         },
+                                        remoteSort : true,
+                                        sortInfo : { direction : 'ASC', field: 'id' },
                                         proxy : {
                                             xtype: 'HttpProxy',
                                             xns: Roo.data,
@@ -194,7 +224,8 @@ Pman.Dialog.CorePersonContact = {
                                     xns: Roo.form,
                                     fieldLabel : 'Name',
                                     name : 'name',
-                                    width : 300
+                                    width : 300,
+                                    allowBlank : true
                                 },
                                 {
                                     xtype: 'TextField',
@@ -220,6 +251,7 @@ Pman.Dialog.CorePersonContact = {
                                 {
                                     xtype: 'TextField',
                                     xns: Roo.form,
+                                    allowBlank : false,
                                     fieldLabel : 'Email',
                                     name : 'email',
                                     width : 200