DataObjects/Core_domain.php
[Pman.Core] / Pman.Dialog.CorePersonContact.js
index edbe544..a90c347 100644 (file)
@@ -32,10 +32,10 @@ Pman.Dialog.CorePersonContact = {
             xns: Roo,
             closable : false,
             collapsible : false,
-            height : 630,
+            height : 290,
             resizable : false,
-            title : "Edit / Create Person",
-            width : 500,
+            title : "Edit / Create Contact Details",
+            width : 450,
             items : [
                 {
                     xtype: 'ContentPanel',
@@ -81,26 +81,38 @@ Pman.Dialog.CorePersonContact = {
                                 {
                                     xtype: 'ComboBox',
                                     xns: Roo.form,
+                                    listeners : {
+                                        add : function (combo)
+                                        {
+                                        
+                                            Pman.Dialog.Companies.show( {  id: 0 },  function(data) {
+                                                    _this.form.setValues({
+                                                            company_id_name : data.name,
+                                                            company_id : data.id
+                                                    });
+                                            }); 
+                                        }
+                                    },
                                     allowBlank : 'false',
+                                    displayField : 'code',
                                     editable : 'false',
                                     emptyText : "Select Companies",
+                                    fieldLabel : 'Company',
                                     forceSelection : true,
+                                    hiddenName : 'company_id',
                                     listWidth : 400,
                                     loadingText : "Searching...",
                                     minChars : 2,
+                                    name : 'company_id_code',
                                     pageSize : 20,
                                     qtip : "Select Companies",
+                                    queryParam : 'query[code]',
                                     selectOnFocus : true,
+                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> </div>',
                                     triggerAction : 'all',
                                     typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> </div>',
-                                    queryParam : 'query[code]',
-                                    fieldLabel : 'Company',
                                     valueField : 'id',
-                                    displayField : 'code',
-                                    hiddenName : 'company_id',
-                                    name : 'company_id_code',
+                                    width : 300,
                                     store : {
                                         xtype: 'Store',
                                         xns: Roo.data,
@@ -131,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,
@@ -183,28 +224,8 @@ Pman.Dialog.CorePersonContact = {
                                     xns: Roo.form,
                                     fieldLabel : 'Name',
                                     name : 'name',
-                                    width : 300
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Phone',
-                                    name : 'phone',
-                                    width : 200
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Fax',
-                                    name : 'fax',
-                                    width : 200
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Email',
-                                    name : 'email',
-                                    width : 200
+                                    width : 300,
+                                    allowBlank : true
                                 },
                                 {
                                     xtype: 'TextField',
@@ -216,160 +237,25 @@ Pman.Dialog.CorePersonContact = {
                                 {
                                     xtype: 'TextField',
                                     xns: Roo.form,
-                                    fieldLabel : 'Active',
-                                    name : 'active',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'TextArea',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Remarks',
-                                    name : 'remarks',
-                                    width : 200,
-                                    height : 100
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Passwd',
-                                    name : 'passwd',
+                                    fieldLabel : 'Phone',
+                                    name : 'phone',
                                     width : 200
                                 },
-                                {
-                                    xtype: 'ComboBox',
-                                    xns: Roo.form,
-                                    allowBlank : 'false',
-                                    editable : 'false',
-                                    emptyText : "Select Person",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select Person",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    queryParam : 'query[name]',
-                                    fieldLabel : 'Owner',
-                                    valueField : 'id',
-                                    displayField : 'name',
-                                    hiddenName : 'owner_id',
-                                    name : 'owner_id_name',
-                                    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
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/Person.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                        }
-                                    }
-                                },
                                 {
                                     xtype: 'TextField',
                                     xns: Roo.form,
-                                    fieldLabel : 'Lang',
-                                    name : 'lang',
+                                    fieldLabel : 'Fax',
+                                    name : 'fax',
                                     width : 200
                                 },
                                 {
                                     xtype: 'TextField',
                                     xns: Roo.form,
-                                    fieldLabel : 'No reset sent',
-                                    name : 'no_reset_sent',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Action type',
-                                    name : 'action_type',
+                                    allowBlank : false,
+                                    fieldLabel : 'Email',
+                                    name : 'email',
                                     width : 200
                                 },
-                                {
-                                    xtype: 'ComboBox',
-                                    xns: Roo.form,
-                                    allowBlank : 'false',
-                                    editable : 'false',
-                                    emptyText : "Select Projects",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select Projects",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    queryParam : 'query[name]',
-                                    fieldLabel : 'Project',
-                                    valueField : 'id',
-                                    displayField : 'name',
-                                    hiddenName : 'project_id',
-                                    name : 'project_id_name',
-                                    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
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/Projects.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Deleted by',
-                                    name : 'deleted_by',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'DateField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Deleted dt',
-                                    name : 'deleted_dt',
-                                    width : 75
-                                },
                                 {
                                     xtype: 'Hidden',
                                     xns: Roo.form,