Pman.Dialog.XtupleQuickContact.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 12 Nov 2014 03:00:43 +0000 (11:00 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 12 Nov 2014 03:00:43 +0000 (11:00 +0800)
Pman.Dialog.XtupleQuickContact.js

Pman.Dialog.XtupleQuickContact.bjs
Pman.Dialog.XtupleQuickContact.js

index d91ac61..f27b3f2 100644 (file)
 {
-    "id": "roo-file-192",
-    "name": "Pman.Dialog.XtupleQuickContact",
-    "parent": "",
-    "title": "",
-    "path": "/home/alan/gitlive/Pman.Xtuple/Pman.Dialog.XtupleQuickContact.bjs",
-    "items": [
+    "name" : "Pman.Dialog.XtupleQuickContact",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/Pman.Xtuple/Pman.Dialog.XtupleQuickContact.bjs",
+    "permname" : "",
+    "modOrder" : "001",
+    "items" : [
         {
-            "closable": false,
-            "collapsible": false,
-            "height": 480,
-            "modal": true,
-            "resizable": false,
-            "title": "Quick enter Contact /  Address",
-            "width": 500,
-            "xtype": "LayoutDialog",
-            "|xns": "Roo",
-            "items": [
+            "modal" : true,
+            "collapsible" : false,
+            "title" : "Quick enter Contact /  Address",
+            "xtype" : "LayoutDialog",
+            "width" : 500,
+            "$ xns" : "Roo",
+            "closable" : false,
+            "resizable" : false,
+            "height" : 480,
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "LayoutRegion",
-                    "*prop": "center"
+                    "xtype" : "LayoutRegion",
+                    "$ xns" : "Roo",
+                    "* prop" : "center"
                 },
                 {
-                    "region": "center",
-                    "xtype": "ContentPanel",
-                    "|xns": "Roo",
-                    "items": [
+                    "region" : "center",
+                    "xtype" : "ContentPanel",
+                    "$ xns" : "Roo",
+                    "items" : [
                         {
-                            "listeners": {
-                                "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        if (_this.data._id) { \n            this.load({ method: 'GET', params: { \n                _id : _this.data._id , \n                _with_addr : 1\n            }});\n        }\n       return;\n    }\n    if (action.type == 'load') {\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.hide();\n    \n         if (_this.callback) {\n             _this.form.setValues(action.result.data);\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
-                                "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
+                            "listeners" : {
+                                "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        if (_this.data._id) { \n            this.load({ method: 'GET', params: { \n                _id : _this.data._id , \n                _with_addr : 1\n            }});\n        }\n       return;\n    }\n    if (action.type == 'load') {\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.hide();\n    \n         if (_this.callback) {\n             _this.form.setValues(action.result.data);\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
+                                "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
                             },
-                            "method": "POST",
-                            "style": "margin:10px;",
-                            "xtype": "Form",
-                            "|url": "baseURL + '/Roo/cntct.php'",
-                            "|xns": "Roo.form",
-                            "items": [
+                            "$ url" : "baseURL + '/Roo/cntct.php'",
+                            "xtype" : "Form",
+                            "method" : "POST",
+                            "style" : "margin:10px;",
+                            "$ xns" : "Roo.form",
+                            "items" : [
                                 {
-                                    "allowBlank": false,
-                                    "fieldLabel": "First Name",
-                                    "name": "cntct_first_name",
-                                    "width": 300,
-                                    "xtype": "TextField",
-                                    "|xns": "Roo.form"
+                                    "fieldLabel" : "First Name",
+                                    "xtype" : "TextField",
+                                    "allowBlank" : false,
+                                    "width" : 300,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_first_name"
                                 },
                                 {
-                                    "fieldLabel": "Last Name",
-                                    "name": "cntct_last_name",
-                                    "width": 300,
-                                    "xtype": "TextField",
-                                    "|xns": "Roo.form"
+                                    "fieldLabel" : "Last Name",
+                                    "xtype" : "TextField",
+                                    "width" : 300,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_last_name"
                                 },
                                 {
-                                    "fieldLabel": "Phone",
-                                    "name": "cntct_phone",
-                                    "width": 200,
-                                    "xtype": "TextField",
-                                    "|regex": "/^[0-9 +-]+$/",
-                                    "|xns": "Roo.form"
+                                    "fieldLabel" : "Phone",
+                                    "xtype" : "TextField",
+                                    "$ regex" : "/^[0-9 +-]+$/",
+                                    "width" : 200,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_phone"
                                 },
                                 {
-                                    "fieldLabel": "Email",
-                                    "name": "cntct_email",
-                                    "vtype": "email",
-                                    "width": 200,
-                                    "xtype": "TextField",
-                                    "|xns": "Roo.form"
+                                    "fieldLabel" : "Phone",
+                                    "xtype" : "TextField",
+                                    "$ regex" : "/^[0-9 +-]+$/",
+                                    "width" : 200,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_phone"
                                 },
                                 {
-                                    "legend": "Address",
-                                    "style": "width:420px",
-                                    "xtype": "FieldSet",
-                                    "|xns": "Roo.form",
-                                    "items": [
+                                    "fieldLabel" : "Email",
+                                    "vtype" : "email",
+                                    "xtype" : "TextField",
+                                    "width" : 200,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_email"
+                                },
+                                {
+                                    "xtype" : "FieldSet",
+                                    "legend" : "Address",
+                                    "style" : "width:420px",
+                                    "$ xns" : "Roo.form",
+                                    "items" : [
                                         {
-                                            "listeners": {
-                                                "keyup": "function (_self, e)\n{\n    _this.form.findField('addr_number').sync();\n}"
+                                            "listeners" : {
+                                                "keyup" : "function (_self, e)\n{\n    _this.form.findField('addr_number').sync();\n}"
                                             },
-                                            "allowBlank": false,
-                                            "fieldLabel": "Line 1",
-                                            "name": "cntct_addr_id_addr_line1",
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Line 1",
+                                            "xtype" : "TextField",
+                                            "allowBlank" : false,
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_line1"
                                         },
                                         {
-                                            "fieldLabel": "Line 2",
-                                            "name": "cntct_addr_id_addr_line2",
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Line 2",
+                                            "xtype" : "TextField",
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_line2"
                                         },
                                         {
-                                            "fieldLabel": "Line 3",
-                                            "name": "cntct_addr_id_addr_line3",
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Line 3",
+                                            "xtype" : "TextField",
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_line3"
                                         },
                                         {
-                                            "allowBlank": true,
-                                            "displayField": "addr_state",
-                                            "editable": true,
-                                            "emptyText": "State",
-                                            "fieldLabel": "State",
-                                            "hiddenName": "cntct_addr_id_addr_state",
-                                            "listWidth": 400,
-                                            "loadingText": "Searching...",
-                                            "minChars": 2,
-                                            "name": "cntct_addr_id_addr_state",
-                                            "qtip": "Select State",
-                                            "queryParam": "query[addr_state]",
-                                            "selectOnFocus": true,
-                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b> </div>",
-                                            "triggerAction": "all",
-                                            "typeAhead": true,
-                                            "valueField": "addr_state",
-                                            "width": 200,
-                                            "xtype": "ComboBox",
-                                            "|xns": "Roo.form",
-                                            "items": [
+                                            "listWidth" : 400,
+                                            "triggerAction" : "all",
+                                            "fieldLabel" : "State",
+                                            "selectOnFocus" : true,
+                                            "displayField" : "addr_state",
+                                            "emptyText" : "State",
+                                            "hiddenName" : "cntct_addr_id_addr_state",
+                                            "minChars" : 2,
+                                            "valueField" : "addr_state",
+                                            "xtype" : "ComboBox",
+                                            "allowBlank" : true,
+                                            "typeAhead" : true,
+                                            "editable" : true,
+                                            "width" : 200,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_state",
+                                            "qtip" : "Select State",
+                                            "queryParam" : "query[addr_state]",
+                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b> </div>",
+                                            "loadingText" : "Searching...",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    \n   // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();\n    //if (!o.params.state_country_id_country_name.length) {\n    //    Roo.MessageBox.alert(\"Select Country First\");\n//        return false;\n  //  }\n  \n   o.params._distinct = 'addr_state';\n   o.params._columns = 'addr_state';\n   o.params.limit = 999;\n    // set more here\n}\n"
+                                                    "listeners" : {
+                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n   // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();\n    //if (!o.params.state_country_id_country_name.length) {\n    //    Roo.MessageBox.alert(\"Select Country First\");\n//        return false;\n  //  }\n  \n   o.params._distinct = 'addr_state';\n   o.params._columns = 'addr_state';\n   o.params.limit = 999;\n    // set more here\n}\n"
                                                     },
-                                                    "*prop": "store",
-                                                    "remoteSort": true,
-                                                    "xtype": "Store",
-                                                    "|sortInfo": "{ direction : 'ASC', field: 'addr_state' }",
-                                                    "|xns": "Roo.data",
-                                                    "items": [
+                                                    "xtype" : "Store",
+                                                    "remoteSort" : true,
+                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'addr_state' }",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "store",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "proxy",
-                                                            "method": "GET",
-                                                            "xtype": "HttpProxy",
-                                                            "|url": "baseURL + '/Roo/addr.php'",
-                                                            "|xns": "Roo.data"
+                                                            "$ url" : "baseURL + '/Roo/addr.php'",
+                                                            "xtype" : "HttpProxy",
+                                                            "method" : "GET",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "proxy"
                                                         },
                                                         {
-                                                            "*prop": "reader",
-                                                            "id": "addr_state",
-                                                            "root": "data",
-                                                            "totalProperty": "total",
-                                                            "xtype": "JsonReader",
-                                                            "|fields": "[ \"addr_state\"]",
-                                                            "|xns": "Roo.data"
+                                                            "id" : "addr_state",
+                                                            "root" : "data",
+                                                            "xtype" : "JsonReader",
+                                                            "$ fields" : "[ \"addr_state\"]",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "reader",
+                                                            "totalProperty" : "total"
                                                         }
                                                     ]
                                                 }
                                             ]
                                         },
                                         {
-                                            "fieldLabel": "City",
-                                            "name": "cntct_addr_id_addr_city",
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "City",
+                                            "xtype" : "TextField",
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_city"
                                         },
                                         {
-                                            "fieldLabel": "Zip code",
-                                            "name": "cntct_addr_id_addr_postalcode",
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Zip code",
+                                            "xtype" : "TextField",
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_postalcode"
                                         },
                                         {
-                                            "allowBlank": true,
-                                            "displayField": "country_name",
-                                            "editable": true,
-                                            "emptyText": "Country",
-                                            "fieldLabel": "Country",
-                                            "hiddenName": "cntct_addr_id_addr_country",
-                                            "listWidth": 400,
-                                            "loadingText": "Searching...",
-                                            "minChars": 2,
-                                            "name": "cntct_addr_id_addr_country",
-                                            "qtip": "Select Country",
-                                            "queryParam": "query[country_name]",
-                                            "selectOnFocus": true,
-                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>",
-                                            "triggerAction": "all",
-                                            "typeAhead": true,
-                                            "valueField": "country_name",
-                                            "width": 200,
-                                            "xtype": "ComboBox",
-                                            "|xns": "Roo.form",
-                                            "items": [
+                                            "listWidth" : 400,
+                                            "triggerAction" : "all",
+                                            "fieldLabel" : "Country",
+                                            "selectOnFocus" : true,
+                                            "displayField" : "country_name",
+                                            "emptyText" : "Country",
+                                            "hiddenName" : "cntct_addr_id_addr_country",
+                                            "minChars" : 2,
+                                            "valueField" : "country_name",
+                                            "xtype" : "ComboBox",
+                                            "allowBlank" : true,
+                                            "typeAhead" : true,
+                                            "editable" : true,
+                                            "width" : 200,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "cntct_addr_id_addr_country",
+                                            "qtip" : "Select Country",
+                                            "queryParam" : "query[country_name]",
+                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>",
+                                            "loadingText" : "Searching...",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.limit = 999;\n}\n"
+                                                    "listeners" : {
+                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.limit = 999;\n}\n"
                                                     },
-                                                    "*prop": "store",
-                                                    "remoteSort": true,
-                                                    "xtype": "Store",
-                                                    "|sortInfo": "{ direction : 'ASC', field: 'country_name' }",
-                                                    "|xns": "Roo.data",
-                                                    "items": [
+                                                    "xtype" : "Store",
+                                                    "remoteSort" : true,
+                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'country_name' }",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "store",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "proxy",
-                                                            "method": "GET",
-                                                            "xtype": "HttpProxy",
-                                                            "|url": "baseURL + '/Roo/country.php'",
-                                                            "|xns": "Roo.data"
+                                                            "$ url" : "baseURL + '/Roo/country.php'",
+                                                            "xtype" : "HttpProxy",
+                                                            "method" : "GET",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "proxy"
                                                         },
                                                         {
-                                                            "*prop": "reader",
-                                                            "id": "country_id",
-                                                            "root": "data",
-                                                            "totalProperty": "total",
-                                                            "xtype": "JsonReader",
-                                                            "|fields": "[{\"name\":\"country_id\",\"type\":\"int\"},\"county_name\"]",
-                                                            "|xns": "Roo.data"
+                                                            "id" : "country_id",
+                                                            "root" : "data",
+                                                            "xtype" : "JsonReader",
+                                                            "$ fields" : "[{\"name\":\"country_id\",\"type\":\"int\"},\"county_name\"]",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "reader",
+                                                            "totalProperty" : "total"
                                                         }
                                                     ]
                                                 }
                                     ]
                                 },
                                 {
-                                    "legend": "Store Details (Delivery only)",
-                                    "xtype": "FieldSet",
-                                    "|xns": "Roo.form",
-                                    "items": [
+                                    "legend" : "Store Details (Delivery only)",
+                                    "xtype" : "FieldSet",
+                                    "$ xns" : "Roo.form",
+                                    "items" : [
                                         {
-                                            "allowBlank": true,
-                                            "fieldLabel": "Name",
-                                            "name": "vend_name",
-                                            "readOnly": true,
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Name",
+                                            "xtype" : "TextField",
+                                            "allowBlank" : true,
+                                            "readOnly" : true,
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "vend_name"
                                         },
                                         {
-                                            "allowBlank": true,
-                                            "fieldLabel": "Code",
-                                            "name": "vendaddr_code",
-                                            "readOnly": true,
-                                            "width": 300,
-                                            "xtype": "TextField",
-                                            "|xns": "Roo.form"
+                                            "fieldLabel" : "Code",
+                                            "xtype" : "TextField",
+                                            "allowBlank" : true,
+                                            "readOnly" : true,
+                                            "width" : 300,
+                                            "$ xns" : "Roo.form",
+                                            "name" : "vendaddr_code"
                                         }
                                     ]
                                 },
                                 {
-                                    "name": "customer_id",
-                                    "width": 100,
-                                    "xtype": "Hidden",
-                                    "|xns": "Roo.form"
+                                    "xtype" : "Hidden",
+                                    "width" : 100,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "customer_id"
                                 },
                                 {
-                                    "name": "cntct_addr_id",
-                                    "width": 100,
-                                    "xtype": "Hidden",
-                                    "|xns": "Roo.form"
+                                    "xtype" : "Hidden",
+                                    "width" : 100,
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_addr_id"
                                 },
                                 {
-                                    "name": "cntct_id",
-                                    "xtype": "Hidden",
-                                    "|xns": "Roo.form"
+                                    "xtype" : "Hidden",
+                                    "$ xns" : "Roo.form",
+                                    "name" : "cntct_id"
                                 }
                             ]
                         }
                     ]
                 },
                 {
-                    "listeners": {
-                        "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+                    "listeners" : {
+                        "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
                     },
-                    "*prop": "buttons[]",
-                    "text": "Cancel",
-                    "xtype": "Button",
-                    "|xns": "Roo"
+                    "text" : "Cancel",
+                    "xtype" : "Button",
+                    "$ xns" : "Roo",
+                    "* prop" : "buttons[]"
                 },
                 {
-                    "listeners": {
-                        "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n \n    _this.form.doAction(\"submit\");\n\n}"
+                    "listeners" : {
+                        "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n \n    _this.form.doAction(\"submit\");\n\n}"
                     },
-                    "*prop": "buttons[]",
-                    "text": "Save",
-                    "xtype": "Button",
-                    "|xns": "Roo"
+                    "text" : "Save",
+                    "xtype" : "Button",
+                    "$ xns" : "Roo",
+                    "* prop" : "buttons[]"
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "001"
+    ]
 }
\ No newline at end of file
index 1779507..1f14a85 100644 (file)
@@ -2,6 +2,8 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Dialog');
+
 Pman.Dialog.XtupleQuickContact = {
 
     dialog : false,
@@ -28,328 +30,388 @@ Pman.Dialog.XtupleQuickContact = {
     {
         var _this = this;
         this.dialog = Roo.factory({
-            xtype: 'LayoutDialog',
-            xns: Roo,
-            closable : false,
-            collapsible : false,
-            height : 480,
+            center : {
+                '|xns' : 'Roo',
+                xtype : 'LayoutRegion',
+                xns : Roo
+            },
+            '|xns' : 'Roo',
             modal : true,
-            resizable : false,
+            collapsible : false,
             title : "Quick enter Contact /  Address",
+            xtype : 'LayoutDialog',
             width : 500,
+            xns : Roo,
+            closable : false,
+            resizable : false,
+            height : 480,
+            buttons : [
+                {
+                       '|xns' : 'Roo',
+                       text : "Cancel",
+                       xtype : 'Button',
+                       xns : Roo,
+                       listeners : {
+                               click : function (_self, e)
+                                  {
+                                      _this.dialog.hide();
+                                  }
+                       }
+                   },
+{
+                       '|xns' : 'Roo',
+                       text : "Save",
+                       xtype : 'Button',
+                       xns : Roo,
+                       listeners : {
+                               click : function (_self, e)
+                                  {
+                                      // do some checks?
+                                       
+                                      
+                                   
+                                      _this.form.doAction("submit");
+                                  
+                                  }
+                       }
+                   }
+            ],
             items : [
-                {
-                    xtype: 'ContentPanel',
-                    xns: Roo,
+               {
+                    '|xns' : 'Roo',
                     region : 'center',
+                    xtype : 'ContentPanel',
+                    xns : Roo,
                     items : [
-                        {
-                            xtype: 'Form',
-                            xns: Roo.form,
-                            listeners : {
-                                actioncomplete : function(_self,action)
-                                {
-                                    if (action.type == 'setdata') {
-                                        if (_this.data._id) { 
-                                            this.load({ method: 'GET', params: { 
-                                                _id : _this.data._id , 
-                                                _with_addr : 1
-                                            }});
-                                        }
-                                       return;
-                                    }
-                                    if (action.type == 'load') {
-                                        return;
-                                    }
-                                    if (action.type =='submit') {
-                                    
-                                        _this.dialog.hide();
-                                    
-                                         if (_this.callback) {
-                                             _this.form.setValues(action.result.data);
-                                            _this.callback.call(_this, _this.form.getValues());
-                                         }
-                                         _this.form.reset();
-                                         return;
-                                    }
-                                },
-                                rendered : function (form)
-                                {
-                                    _this.form= form;
-                                }
-                            },
+                       {
+                            '|xns' : 'Roo.form',
+                            url : baseURL + '/Roo/cntct.php',
+                            xtype : 'Form',
                             method : 'POST',
                             style : 'margin:10px;',
-                            url : baseURL + '/Roo/cntct.php',
+                            xns : Roo.form,
+                            listeners : {
+                               actioncomplete : function(_self,action)
+                                  {
+                                      if (action.type == 'setdata') {
+                                          if (_this.data._id) { 
+                                              this.load({ method: 'GET', params: { 
+                                                  _id : _this.data._id , 
+                                                  _with_addr : 1
+                                              }});
+                                          }
+                                         return;
+                                      }
+                                      if (action.type == 'load') {
+                                          return;
+                                      }
+                                      if (action.type =='submit') {
+                                      
+                                          _this.dialog.hide();
+                                      
+                                           if (_this.callback) {
+                                               _this.form.setValues(action.result.data);
+                                              _this.callback.call(_this, _this.form.getValues());
+                                           }
+                                           _this.form.reset();
+                                           return;
+                                      }
+                                  },
+                               rendered : function (form)
+                                  {
+                                      _this.form= form;
+                                  }
+                            },
                             items : [
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    allowBlank : false,
+                               {
+                                    '|xns' : 'Roo.form',
                                     fieldLabel : 'First Name',
-                                    name : 'cntct_first_name',
-                                    width : 300
+                                    xtype : 'TextField',
+                                    allowBlank : false,
+                                    width : 300,
+                                    xns : Roo.form,
+                                    name : 'cntct_first_name'
                                 },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
                                     fieldLabel : 'Last Name',
-                                    name : 'cntct_last_name',
-                                    width : 300
+                                    xtype : 'TextField',
+                                    width : 300,
+                                    xns : Roo.form,
+                                    name : 'cntct_last_name'
                                 },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
                                     fieldLabel : 'Phone',
-                                    name : 'cntct_phone',
+                                    xtype : 'TextField',
+                                    regex : /^[0-9 +-]+$/,
                                     width : 200,
-                                    regex : /^[0-9 +-]+$/
+                                    xns : Roo.form,
+                                    name : 'cntct_phone'
                                 },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
+                                    fieldLabel : 'Phone',
+                                    xtype : 'TextField',
+                                    regex : /^[0-9 +-]+$/,
+                                    width : 200,
+                                    xns : Roo.form,
+                                    name : 'cntct_phone'
+                                },
+                               {
+                                    '|xns' : 'Roo.form',
                                     fieldLabel : 'Email',
-                                    name : 'cntct_email',
                                     vtype : 'email',
-                                    width : 200
+                                    xtype : 'TextField',
+                                    width : 200,
+                                    xns : Roo.form,
+                                    name : 'cntct_email'
                                 },
-                                {
-                                    xtype: 'FieldSet',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
+                                    xtype : 'FieldSet',
                                     legend : "Address",
                                     style : 'width:420px',
+                                    xns : Roo.form,
                                     items : [
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            listeners : {
-                                                keyup : function (_self, e)
-                                                {
-                                                    _this.form.findField('addr_number').sync();
-                                                }
-                                            },
-                                            allowBlank : false,
+                                       {
+                                            '|xns' : 'Roo.form',
                                             fieldLabel : 'Line 1',
+                                            xtype : 'TextField',
+                                            allowBlank : false,
+                                            width : 300,
+                                            xns : Roo.form,
                                             name : 'cntct_addr_id_addr_line1',
-                                            width : 300
+                                            listeners : {
+                                               keyup : function (_self, e)
+                                                  {
+                                                      _this.form.findField('addr_number').sync();
+                                                  }
+                                            }
                                         },
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
+                                       {
+                                            '|xns' : 'Roo.form',
                                             fieldLabel : 'Line 2',
-                                            name : 'cntct_addr_id_addr_line2',
-                                            width : 300
+                                            xtype : 'TextField',
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'cntct_addr_id_addr_line2'
                                         },
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
+                                       {
+                                            '|xns' : 'Roo.form',
                                             fieldLabel : 'Line 3',
-                                            name : 'cntct_addr_id_addr_line3',
-                                            width : 300
+                                            xtype : 'TextField',
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'cntct_addr_id_addr_line3'
                                         },
-                                        {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            allowBlank : true,
+                                       {
+                                            store : {
+                                                proxy : {
+                                                    '|xns' : 'Roo.data',
+                                                    url : baseURL + '/Roo/addr.php',
+                                                    xtype : 'HttpProxy',
+                                                    method : 'GET',
+                                                    xns : Roo.data
+                                                },
+                                                reader : {
+                                                    '|xns' : 'Roo.data',
+                                                    id : 'addr_state',
+                                                    root : 'data',
+                                                    xtype : 'JsonReader',
+                                                    fields : [ "addr_state"],
+                                                    xns : Roo.data,
+                                                    totalProperty : 'total'
+                                                },
+                                                '|xns' : 'Roo.data',
+                                                xtype : 'Store',
+                                                remoteSort : true,
+                                                sortInfo : { direction : 'ASC', field: 'addr_state' },
+                                                xns : Roo.data,
+                                                listeners : {
+                                                       beforeload : function (_self, o){
+                                                              o.params = o.params || {};
+                                                              
+                                                             // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();
+                                                              //if (!o.params.state_country_id_country_name.length) {
+                                                              //    Roo.MessageBox.alert("Select Country First");
+                                                          //        return false;
+                                                            //  }
+                                                            
+                                                             o.params._distinct = 'addr_state';
+                                                             o.params._columns = 'addr_state';
+                                                             o.params.limit = 999;
+                                                              // set more here
+                                                          }
+                                                },
+                                                items : [
+
+                                                ]
+
+                                            },
+                                            '|xns' : 'Roo.form',
+                                            listWidth : 400,
+                                            triggerAction : 'all',
+                                            fieldLabel : 'State',
+                                            selectOnFocus : true,
                                             displayField : 'addr_state',
-                                            editable : true,
                                             emptyText : "State",
-                                            fieldLabel : 'State',
                                             hiddenName : 'cntct_addr_id_addr_state',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
                                             minChars : 2,
+                                            valueField : 'addr_state',
+                                            xtype : 'ComboBox',
+                                            allowBlank : true,
+                                            typeAhead : true,
+                                            editable : true,
+                                            width : 200,
+                                            xns : Roo.form,
                                             name : 'cntct_addr_id_addr_state',
                                             qtip : "Select State",
                                             queryParam : 'query[addr_state]',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_state}</b> </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'addr_state',
-                                            width : 200,
+                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b> </div>',
+                                            loadingText : "Searching...",
+                                            items : [
+
+                                            ]
+
+                                        },
+                                       {
+                                            '|xns' : 'Roo.form',
+                                            fieldLabel : 'City',
+                                            xtype : 'TextField',
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'cntct_addr_id_addr_city'
+                                        },
+                                       {
+                                            '|xns' : 'Roo.form',
+                                            fieldLabel : 'Zip code',
+                                            xtype : 'TextField',
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'cntct_addr_id_addr_postalcode'
+                                        },
+                                       {
                                             store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                        
-                                                       // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();
-                                                        //if (!o.params.state_country_id_country_name.length) {
-                                                        //    Roo.MessageBox.alert("Select Country First");
-                                                    //        return false;
-                                                      //  }
-                                                      
-                                                       o.params._distinct = 'addr_state';
-                                                       o.params._columns = 'addr_state';
-                                                       o.params.limit = 999;
-                                                        // set more here
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'addr_state' },
                                                 proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
+                                                    '|xns' : 'Roo.data',
+                                                    url : baseURL + '/Roo/country.php',
+                                                    xtype : 'HttpProxy',
                                                     method : 'GET',
-                                                    url : baseURL + '/Roo/addr.php'
+                                                    xns : Roo.data
                                                 },
                                                 reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'addr_state',
+                                                    '|xns' : 'Roo.data',
+                                                    id : 'country_id',
                                                     root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [ "addr_state"]
-                                                }
-                                            }
-                                        },
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            fieldLabel : 'City',
-                                            name : 'cntct_addr_id_addr_city',
-                                            width : 300
-                                        },
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            fieldLabel : 'Zip code',
-                                            name : 'cntct_addr_id_addr_postalcode',
-                                            width : 300
-                                        },
-                                        {
-                                            xtype: 'ComboBox',
-                                            xns: Roo.form,
-                                            allowBlank : true,
+                                                    xtype : 'JsonReader',
+                                                    fields : [{"name":"country_id","type":"int"},"county_name"],
+                                                    xns : Roo.data,
+                                                    totalProperty : 'total'
+                                                },
+                                                '|xns' : 'Roo.data',
+                                                xtype : 'Store',
+                                                remoteSort : true,
+                                                sortInfo : { direction : 'ASC', field: 'country_name' },
+                                                xns : Roo.data,
+                                                listeners : {
+                                                       beforeload : function (_self, o){
+                                                              o.params = o.params || {};
+                                                              // set more here
+                                                              o.params.limit = 999;
+                                                          }
+                                                },
+                                                items : [
+
+                                                ]
+
+                                            },
+                                            '|xns' : 'Roo.form',
+                                            listWidth : 400,
+                                            triggerAction : 'all',
+                                            fieldLabel : 'Country',
+                                            selectOnFocus : true,
                                             displayField : 'country_name',
-                                            editable : true,
                                             emptyText : "Country",
-                                            fieldLabel : 'Country',
                                             hiddenName : 'cntct_addr_id_addr_country',
-                                            listWidth : 400,
-                                            loadingText : "Searching...",
                                             minChars : 2,
+                                            valueField : 'country_name',
+                                            xtype : 'ComboBox',
+                                            allowBlank : true,
+                                            typeAhead : true,
+                                            editable : true,
+                                            width : 200,
+                                            xns : Roo.form,
                                             name : 'cntct_addr_id_addr_country',
                                             qtip : "Select Country",
                                             queryParam : 'query[country_name]',
-                                            selectOnFocus : true,
-                                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{country_name}</b> </div>',
-                                            triggerAction : 'all',
-                                            typeAhead : true,
-                                            valueField : 'country_name',
-                                            width : 200,
-                                            store : {
-                                                xtype: 'Store',
-                                                xns: Roo.data,
-                                                listeners : {
-                                                    beforeload : function (_self, o){
-                                                        o.params = o.params || {};
-                                                        // set more here
-                                                        o.params.limit = 999;
-                                                    }
-                                                },
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'country_name' },
-                                                proxy : {
-                                                    xtype: 'HttpProxy',
-                                                    xns: Roo.data,
-                                                    method : 'GET',
-                                                    url : baseURL + '/Roo/country.php'
-                                                },
-                                                reader : {
-                                                    xtype: 'JsonReader',
-                                                    xns: Roo.data,
-                                                    id : 'country_id',
-                                                    root : 'data',
-                                                    totalProperty : 'total',
-                                                    fields : [{"name":"country_id","type":"int"},"county_name"]
-                                                }
-                                            }
+                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>',
+                                            loadingText : "Searching...",
+                                            items : [
+
+                                            ]
+
                                         }
                                     ]
+
                                 },
-                                {
-                                    xtype: 'FieldSet',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
                                     legend : "Store Details (Delivery only)",
+                                    xtype : 'FieldSet',
+                                    xns : Roo.form,
                                     items : [
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            allowBlank : true,
+                                       {
+                                            '|xns' : 'Roo.form',
                                             fieldLabel : 'Name',
-                                            name : 'vend_name',
+                                            xtype : 'TextField',
+                                            allowBlank : true,
                                             readOnly : true,
-                                            width : 300
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'vend_name'
                                         },
-                                        {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            allowBlank : true,
+                                       {
+                                            '|xns' : 'Roo.form',
                                             fieldLabel : 'Code',
-                                            name : 'vendaddr_code',
+                                            xtype : 'TextField',
+                                            allowBlank : true,
                                             readOnly : true,
-                                            width : 300
+                                            width : 300,
+                                            xns : Roo.form,
+                                            name : 'vendaddr_code'
                                         }
                                     ]
+
                                 },
-                                {
-                                    xtype: 'Hidden',
-                                    xns: Roo.form,
-                                    name : 'customer_id',
-                                    width : 100
+                               {
+                                    '|xns' : 'Roo.form',
+                                    xtype : 'Hidden',
+                                    width : 100,
+                                    xns : Roo.form,
+                                    name : 'customer_id'
                                 },
-                                {
-                                    xtype: 'Hidden',
-                                    xns: Roo.form,
-                                    name : 'cntct_addr_id',
-                                    width : 100
+                               {
+                                    '|xns' : 'Roo.form',
+                                    xtype : 'Hidden',
+                                    width : 100,
+                                    xns : Roo.form,
+                                    name : 'cntct_addr_id'
                                 },
-                                {
-                                    xtype: 'Hidden',
-                                    xns: Roo.form,
+                               {
+                                    '|xns' : 'Roo.form',
+                                    xtype : 'Hidden',
+                                    xns : Roo.form,
                                     name : 'cntct_id'
                                 }
                             ]
+
                         }
                     ]
-                }
-            ],
-            center : {
-                xtype: 'LayoutRegion',
-                xns: Roo
-            },
-            buttons : [
-                {
-                    xtype: 'Button',
-                    xns: Roo,
-                    listeners : {
-                        click : function (_self, e)
-                        {
-                            _this.dialog.hide();
-                        }
-                    },
-                    text : "Cancel"
-                },
-                {
-                    xtype: 'Button',
-                    xns: Roo,
-                    listeners : {
-                        click : function (_self, e)
-                        {
-                            // do some checks?
-                             
-                            
-                         
-                            _this.form.doAction("submit");
-                        
-                        }
-                    },
-                    text : "Save"
+
                 }
             ]
+
         });
     }
 };