Fix #5702 - Supplier contact details - extra fields
authorEdward <edward@roojs.com>
Tue, 19 Feb 2019 05:51:54 +0000 (13:51 +0800)
committerEdward <edward@roojs.com>
Tue, 19 Feb 2019 05:51:54 +0000 (13:51 +0800)
Pman.Dialog.AdminGeoCityEdit.bjs [new file with mode: 0644]
Pman.Dialog.AdminGeoCityEdit.js [new file with mode: 0644]
Pman.Dialog.AdminGeoDivisionEdit.bjs [new file with mode: 0644]
Pman.Dialog.AdminGeoDivisionEdit.js [new file with mode: 0644]
Pman.Tab.AdminGeoLocations.bjs [new file with mode: 0644]
Pman.Tab.AdminGeoLocations.js [new file with mode: 0644]

diff --git a/Pman.Dialog.AdminGeoCityEdit.bjs b/Pman.Dialog.AdminGeoCityEdit.bjs
new file mode 100644 (file)
index 0000000..801842a
--- /dev/null
@@ -0,0 +1,232 @@
+{
+ "name" : "Pman.Dialog.AdminGeoCityEdit",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/Pman.Admin/Pman.Dialog.AdminGeoCityEdit.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "59716c97497eb9694541f7c3d37b1a4d" : "Country",
+  "3c1df4260ce594cb5594696461087f2f" : "Select Country",
+  "43ccafccb532cc57c20bc05a36aad7b7" : "Add / Edit City",
+  "4a39a1ff7adda1ac731be5bf500d0812" : "Select Division",
+  "45c10605e0a492fbe7a3eac258cd1e81" : "Time Zone",
+  "1243daf593fa297e07ab03bf06d925af" : "Searching...",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "25f75488c91cb6c3bab92672e479619f" : "Postal Code",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "c9cc8cce247e49bae79f15173ce97354" : "Save",
+  "3025cdaab2deb0bb2cd642449e570833" : "Division"
+ },
+ "named_strings" : {
+  "country_name_qtip" : "3c1df4260ce594cb5594696461087f2f",
+  "division_id_name_qtip" : "4a39a1ff7adda1ac731be5bf500d0812",
+  "time_zone_fieldLabel" : "45c10605e0a492fbe7a3eac258cd1e81",
+  "country_name_emptyText" : "3c1df4260ce594cb5594696461087f2f",
+  "postal_code_fieldLabel" : "25f75488c91cb6c3bab92672e479619f",
+  "name_fieldLabel" : "49ee3087348e8d44e1feda1917443987",
+  "country_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
+  "division_id_name_emptyText" : "4a39a1ff7adda1ac731be5bf500d0812",
+  "division_id_name_fieldLabel" : "3025cdaab2deb0bb2cd642449e570833",
+  "division_id_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
+  "country_name_fieldLabel" : "59716c97497eb9694541f7c3d37b1a4d"
+ },
+ "items" : [
+  {
+   "modal" : true,
+   "collapsible" : false,
+   "title" : "Add / Edit City",
+   "xtype" : "LayoutDialog",
+   "width" : 400,
+   "$ xns" : "Roo",
+   "closable" : false,
+   "resizable" : false,
+   "height" : 250,
+   "items" : [
+    {
+     "xtype" : "LayoutRegion",
+     "$ xns" : "Roo",
+     "* prop" : "center"
+    },
+    {
+     "region" : "center",
+     "xtype" : "ContentPanel",
+     "$ xns" : "Roo",
+     "items" : [
+      {
+       "listeners" : {
+        "|actioncomplete" : "function(_self, action)\n{\n    if (action.type == 'setdata') {\n        \n        if(_this.data.id) {\n            this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n        }\n        return;\n    }\n    if (action.type == 'load') {\n        \n        _this.dialog.el.unmask();\n        \n        _this.data = action.result.data;\n        \n        return;\n    }\n    if (action.type =='submit') {\n        \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\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"
+       },
+       "$ url" : "baseURL + '/Roo/geoip_city.php'",
+       "style" : "margin:10px;",
+       "method" : "POST",
+       "xtype" : "Form",
+       "labelWidth" : 100,
+       "$ xns" : "Roo.form",
+       "items" : [
+        {
+         "Boolean allowBlank" : false,
+         "fieldLabel" : "Name",
+         "xtype" : "TextField",
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "name"
+        },
+        {
+         "fieldLabel" : "Postal Code",
+         "xtype" : "TextField",
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "postal_code"
+        },
+        {
+         "fieldLabel" : "Time Zone",
+         "xtype" : "TextField",
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "time_zone"
+        },
+        {
+         "alwaysQuery" : true,
+         "listWidth" : 400,
+         "triggerAction" : "all",
+         "fieldLabel" : "Country",
+         "forceSelection" : true,
+         "selectOnFocus" : true,
+         "pageSize" : 20,
+         "displayField" : "lval",
+         "emptyText" : "Select Country",
+         "hiddenName" : "country",
+         "minChars" : 2,
+         "valueField" : "lkey",
+         "xtype" : "ComboBox",
+         "allowBlank" : false,
+         "typeAhead" : true,
+         "editable" : true,
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "country_name",
+         "qtip" : "Select Country",
+         "queryParam" : "query[name]",
+         "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>",
+         "loadingText" : "Searching...",
+         "items" : [
+          {
+           "listeners" : {
+            "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.ltype = 'c',\n    o.params.inlang = 'en';\n    o.is_active = 1;\n}\n"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ direction : 'ASC', field: 'lval' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "store",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/i18n.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        \"name\":\"id\",\n        \"type\":\"int\"\n    },\n    {\n        \"name\":\"code\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"name\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country_name\",\n        \"type\":\"string\"\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "listeners" : {
+          "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n    var country = _this.form.findField('country').getValue();\n    \n    if(!country.length) {\n        Roo.MessageBox.alert('Error', 'Please select a country');\n        return false;\n    }\n}"
+         },
+         "alwaysQuery" : true,
+         "listWidth" : 400,
+         "triggerAction" : "all",
+         "fieldLabel" : "Division",
+         "forceSelection" : true,
+         "selectOnFocus" : true,
+         "pageSize" : 20,
+         "displayField" : "name",
+         "emptyText" : "Select Division",
+         "hiddenName" : "division_id",
+         "minChars" : 2,
+         "valueField" : "id",
+         "xtype" : "ComboBox",
+         "typeAhead" : true,
+         "editable" : true,
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "division_id_name",
+         "qtip" : "Select Division",
+         "queryParam" : "query[name]",
+         "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
+         "loadingText" : "Searching...",
+         "items" : [
+          {
+           "listeners" : {
+            "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    var country = _this.form.findField('country').getValue();\n    \n    if(!country.length) {\n        return false;\n    }\n    \n    o.params.country = country;\n}\n"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ direction : 'ASC', field: 'name' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "store",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/geoip_division.php'",
+             "method" : "GET",
+             "xtype" : "HttpProxy",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        \"name\":\"id\",\n        \"type\":\"int\"\n    },\n    {\n        \"name\":\"name\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country_name\",\n        \"type\":\"string\"\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Hidden",
+         "$ xns" : "Roo.form",
+         "name" : "id"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "text" : "Cancel",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.form.doAction(\"submit\");\n}"
+     },
+     "text" : "Save",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman.Dialog.AdminGeoCityEdit.js b/Pman.Dialog.AdminGeoCityEdit.js
new file mode 100644 (file)
index 0000000..b4d9093
--- /dev/null
@@ -0,0 +1,358 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.AdminGeoCityEdit = {
+
+ _strings : {
+  '59716c97497eb9694541f7c3d37b1a4d' :"Country",
+  '3c1df4260ce594cb5594696461087f2f' :"Select Country",
+  '43ccafccb532cc57c20bc05a36aad7b7' :"Add / Edit City",
+  '4a39a1ff7adda1ac731be5bf500d0812' :"Select Division",
+  '45c10605e0a492fbe7a3eac258cd1e81' :"Time Zone",
+  '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '25f75488c91cb6c3bab92672e479619f' :"Postal Code",
+  '49ee3087348e8d44e1feda1917443987' :"Name",
+  'c9cc8cce247e49bae79f15173ce97354' :"Save",
+  '3025cdaab2deb0bb2cd642449e570833' :"Division"
+ },
+ _named_strings : {
+  'country_name_qtip' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
+  'division_id_name_qtip' : '4a39a1ff7adda1ac731be5bf500d0812' /* Select Division */ ,
+  'time_zone_fieldLabel' : '45c10605e0a492fbe7a3eac258cd1e81' /* Time Zone */ ,
+  'country_name_emptyText' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
+  'postal_code_fieldLabel' : '25f75488c91cb6c3bab92672e479619f' /* Postal Code */ ,
+  'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
+  'country_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'division_id_name_emptyText' : '4a39a1ff7adda1ac731be5bf500d0812' /* Select Division */ ,
+  'division_id_name_fieldLabel' : '3025cdaab2deb0bb2cd642449e570833' /* Division */ ,
+  'division_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'country_name_fieldLabel' : '59716c97497eb9694541f7c3d37b1a4d' /* Country */ 
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+   var _this = this;
+   this.dialog = Roo.factory({
+    xtype : 'LayoutDialog',
+    closable : false,
+    collapsible : false,
+    height : 250,
+    modal : true,
+    resizable : false,
+    title : _this._strings['43ccafccb532cc57c20bc05a36aad7b7'] /* Add / Edit City */,
+    width : 400,
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    buttons : [
+     {
+      xtype : 'Button',
+      text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     },
+     {
+      xtype : 'Button',
+      text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction("submit");
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'ContentPanel',
+      region : 'center',
+      xns : Roo,
+      '|xns' : 'Roo',
+      items  : [
+       {
+        xtype : 'Form',
+        labelWidth : 100,
+        method : 'POST',
+        style : 'margin:10px;',
+        url : baseURL + '/Roo/geoip_city.php',
+        listeners : {
+         actioncomplete : function(_self, action)
+          {
+              if (action.type == 'setdata') {
+                  
+                  if(_this.data.id) {
+                      this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                  }
+                  return;
+              }
+              if (action.type == 'load') {
+                  
+                  _this.dialog.el.unmask();
+                  
+                  _this.data = action.result.data;
+                  
+                  return;
+              }
+              if (action.type =='submit') {
+                  
+                  _this.dialog.el.unmask();
+                  _this.dialog.hide();
+              
+                   if (_this.callback) {
+                      _this.callback.call(_this, _this.form.getValues());
+                   }
+                   _this.form.reset();
+                   return;
+              }
+          },
+         rendered : function (form)
+          {
+              _this.form= form;
+          }
+        },
+        xns : Roo.form,
+        '|xns' : 'Roo.form',
+        items  : [
+         {
+          xtype : 'TextField',
+          allowBlank : false,
+          fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+          name : 'name',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'TextField',
+          fieldLabel : _this._strings['25f75488c91cb6c3bab92672e479619f'] /* Postal Code */,
+          name : 'postal_code',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'TextField',
+          fieldLabel : _this._strings['45c10605e0a492fbe7a3eac258cd1e81'] /* Time Zone */,
+          name : 'time_zone',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'ComboBox',
+          allowBlank : false,
+          alwaysQuery : true,
+          displayField : 'lval',
+          editable : true,
+          emptyText : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
+          fieldLabel : _this._strings['59716c97497eb9694541f7c3d37b1a4d'] /* Country */,
+          forceSelection : true,
+          hiddenName : 'country',
+          listWidth : 400,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+          minChars : 2,
+          name : 'country_name',
+          pageSize : 20,
+          qtip : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
+          queryParam : 'query[name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>',
+          triggerAction : 'all',
+          typeAhead : true,
+          valueField : 'lkey',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'Store',
+           remoteSort : true,
+           sortInfo : { direction : 'ASC', field: 'lval' },
+           listeners : {
+            beforeload : function (_self, o){
+                 o.params = o.params || {};
+                 // set more here
+                 o.params.ltype = 'c',
+                 o.params.inlang = 'en';
+                 o.is_active = 1;
+             }
+           },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           proxy : {
+            xtype : 'HttpProxy',
+            method : 'GET',
+            url : baseURL + '/Roo/i18n.php',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           },
+           reader : {
+            xtype : 'JsonReader',
+            fields : [
+                {
+                    "name":"id",
+                    "type":"int"
+                },
+                {
+                    "name":"code",
+                    "type":"string"
+                },
+                {
+                    "name":"name",
+                    "type":"string"
+                },
+                {
+                    "name":"country",
+                    "type":"string"
+                },
+                {
+                    "name":"country_name",
+                    "type":"string"
+                }
+            ],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           }
+          }
+         },
+         {
+          xtype : 'ComboBox',
+          alwaysQuery : true,
+          displayField : 'name',
+          editable : true,
+          emptyText : _this._strings['4a39a1ff7adda1ac731be5bf500d0812'] /* Select Division */,
+          fieldLabel : _this._strings['3025cdaab2deb0bb2cd642449e570833'] /* Division */,
+          forceSelection : true,
+          hiddenName : 'division_id',
+          listWidth : 400,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+          minChars : 2,
+          name : 'division_id_name',
+          pageSize : 20,
+          qtip : _this._strings['4a39a1ff7adda1ac731be5bf500d0812'] /* Select Division */,
+          queryParam : 'query[name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
+          triggerAction : 'all',
+          typeAhead : true,
+          valueField : 'id',
+          width : 200,
+          listeners : {
+           beforequery : function (combo, query, forceAll, cancel, e)
+            {
+                var country = _this.form.findField('country').getValue();
+                
+                if(!country.length) {
+                    Roo.MessageBox.alert('Error', 'Please select a country');
+                    return false;
+                }
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'Store',
+           remoteSort : true,
+           sortInfo : { direction : 'ASC', field: 'name' },
+           listeners : {
+            beforeload : function (_self, o){
+                 o.params = o.params || {};
+                 
+                 var country = _this.form.findField('country').getValue();
+                 
+                 if(!country.length) {
+                     return false;
+                 }
+                 
+                 o.params.country = country;
+             }
+           },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           proxy : {
+            xtype : 'HttpProxy',
+            method : 'GET',
+            url : baseURL + '/Roo/geoip_division.php',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           },
+           reader : {
+            xtype : 'JsonReader',
+            fields : [
+                {
+                    "name":"id",
+                    "type":"int"
+                },
+                {
+                    "name":"name",
+                    "type":"string"
+                },
+                {
+                    "name":"country",
+                    "type":"string"
+                },
+                {
+                    "name":"country_name",
+                    "type":"string"
+                }
+            ],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           }
+          }
+         },
+         {
+          xtype : 'Hidden',
+          name : 'id',
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   });
+ }
+};
diff --git a/Pman.Dialog.AdminGeoDivisionEdit.bjs b/Pman.Dialog.AdminGeoDivisionEdit.bjs
new file mode 100644 (file)
index 0000000..da053f8
--- /dev/null
@@ -0,0 +1,161 @@
+{
+ "name" : "Pman.Dialog.AdminGeoDivisionEdit",
+ "parent" : "center",
+ "title" : "",
+ "path" : "/home/edward/gitlive/Pman.Admin/Pman.Dialog.AdminGeoDivisionEdit.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "59716c97497eb9694541f7c3d37b1a4d" : "Country",
+  "3c1df4260ce594cb5594696461087f2f" : "Select Country",
+  "1243daf593fa297e07ab03bf06d925af" : "Searching...",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "211ffad4dcc51379ddbc8b96230a9bd9" : "Add / Edit Division",
+  "ca0dbad92a874b2f69b549293387925e" : "Code",
+  "c9cc8cce247e49bae79f15173ce97354" : "Save"
+ },
+ "named_strings" : {
+  "country_name_qtip" : "3c1df4260ce594cb5594696461087f2f",
+  "country_name_emptyText" : "3c1df4260ce594cb5594696461087f2f",
+  "code_fieldLabel" : "ca0dbad92a874b2f69b549293387925e",
+  "name_fieldLabel" : "49ee3087348e8d44e1feda1917443987",
+  "country_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
+  "country_name_fieldLabel" : "59716c97497eb9694541f7c3d37b1a4d"
+ },
+ "items" : [
+  {
+   "modal" : true,
+   "collapsible" : false,
+   "title" : "Add / Edit Division",
+   "xtype" : "LayoutDialog",
+   "width" : 400,
+   "$ xns" : "Roo",
+   "closable" : false,
+   "resizable" : false,
+   "height" : 200,
+   "items" : [
+    {
+     "xtype" : "LayoutRegion",
+     "$ xns" : "Roo",
+     "* prop" : "center"
+    },
+    {
+     "region" : "center",
+     "xtype" : "ContentPanel",
+     "$ xns" : "Roo",
+     "items" : [
+      {
+       "listeners" : {
+        "|actioncomplete" : "function(_self, action)\n{\n    if (action.type == 'setdata') {\n        \n        if(_this.data.id) {\n            this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n        }\n        return;\n    }\n    if (action.type == 'load') {\n        \n        _this.dialog.el.unmask();\n        \n        _this.data = action.result.data;\n        \n        return;\n    }\n    if (action.type =='submit') {\n        \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\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"
+       },
+       "$ url" : "baseURL + '/Roo/geoip_division.php'",
+       "style" : "margin:10px;",
+       "method" : "POST",
+       "xtype" : "Form",
+       "labelWidth" : 100,
+       "$ xns" : "Roo.form",
+       "items" : [
+        {
+         "Boolean allowBlank" : false,
+         "fieldLabel" : "Code",
+         "xtype" : "TextField",
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "code"
+        },
+        {
+         "Boolean allowBlank" : false,
+         "fieldLabel" : "Name",
+         "xtype" : "TextField",
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "name"
+        },
+        {
+         "alwaysQuery" : true,
+         "listWidth" : 400,
+         "triggerAction" : "all",
+         "fieldLabel" : "Country",
+         "forceSelection" : true,
+         "selectOnFocus" : true,
+         "pageSize" : 20,
+         "displayField" : "lval",
+         "emptyText" : "Select Country",
+         "hiddenName" : "country",
+         "minChars" : 2,
+         "valueField" : "lkey",
+         "xtype" : "ComboBox",
+         "allowBlank" : false,
+         "typeAhead" : true,
+         "editable" : true,
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "country_name",
+         "qtip" : "Select Country",
+         "queryParam" : "query[name]",
+         "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>",
+         "loadingText" : "Searching...",
+         "items" : [
+          {
+           "listeners" : {
+            "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.ltype = 'c',\n    o.params.inlang = 'en';\n    o.is_active = 1;\n}\n"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ direction : 'ASC', field: 'lval' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "store",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/i18n.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        \"name\":\"id\",\n        \"type\":\"int\"\n    },\n    {\n        \"name\":\"code\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"name\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country\",\n        \"type\":\"string\"\n    },\n    {\n        \"name\":\"country_name\",\n        \"type\":\"string\"\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Hidden",
+         "$ xns" : "Roo.form",
+         "name" : "id"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "text" : "Cancel",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.form.doAction(\"submit\");\n}"
+     },
+     "text" : "Save",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman.Dialog.AdminGeoDivisionEdit.js b/Pman.Dialog.AdminGeoDivisionEdit.js
new file mode 100644 (file)
index 0000000..c5b7f82
--- /dev/null
@@ -0,0 +1,254 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.AdminGeoDivisionEdit = {
+
+ _strings : {
+  '59716c97497eb9694541f7c3d37b1a4d' :"Country",
+  '3c1df4260ce594cb5594696461087f2f' :"Select Country",
+  '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '49ee3087348e8d44e1feda1917443987' :"Name",
+  '211ffad4dcc51379ddbc8b96230a9bd9' :"Add / Edit Division",
+  'ca0dbad92a874b2f69b549293387925e' :"Code",
+  'c9cc8cce247e49bae79f15173ce97354' :"Save"
+ },
+ _named_strings : {
+  'country_name_qtip' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
+  'country_name_emptyText' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
+  'code_fieldLabel' : 'ca0dbad92a874b2f69b549293387925e' /* Code */ ,
+  'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
+  'country_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
+  'country_name_fieldLabel' : '59716c97497eb9694541f7c3d37b1a4d' /* Country */ 
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+   var _this = this;
+   this.dialog = Roo.factory({
+    xtype : 'LayoutDialog',
+    closable : false,
+    collapsible : false,
+    height : 200,
+    modal : true,
+    resizable : false,
+    title : _this._strings['211ffad4dcc51379ddbc8b96230a9bd9'] /* Add / Edit Division */,
+    width : 400,
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    buttons : [
+     {
+      xtype : 'Button',
+      text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     },
+     {
+      xtype : 'Button',
+      text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction("submit");
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'ContentPanel',
+      region : 'center',
+      xns : Roo,
+      '|xns' : 'Roo',
+      items  : [
+       {
+        xtype : 'Form',
+        labelWidth : 100,
+        method : 'POST',
+        style : 'margin:10px;',
+        url : baseURL + '/Roo/geoip_division.php',
+        listeners : {
+         actioncomplete : function(_self, action)
+          {
+              if (action.type == 'setdata') {
+                  
+                  if(_this.data.id) {
+                      this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                  }
+                  return;
+              }
+              if (action.type == 'load') {
+                  
+                  _this.dialog.el.unmask();
+                  
+                  _this.data = action.result.data;
+                  
+                  return;
+              }
+              if (action.type =='submit') {
+                  
+                  _this.dialog.el.unmask();
+                  _this.dialog.hide();
+              
+                   if (_this.callback) {
+                      _this.callback.call(_this, _this.form.getValues());
+                   }
+                   _this.form.reset();
+                   return;
+              }
+          },
+         rendered : function (form)
+          {
+              _this.form= form;
+          }
+        },
+        xns : Roo.form,
+        '|xns' : 'Roo.form',
+        items  : [
+         {
+          xtype : 'TextField',
+          allowBlank : false,
+          fieldLabel : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
+          name : 'code',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'TextField',
+          allowBlank : false,
+          fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+          name : 'name',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'ComboBox',
+          allowBlank : false,
+          alwaysQuery : true,
+          displayField : 'lval',
+          editable : true,
+          emptyText : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
+          fieldLabel : _this._strings['59716c97497eb9694541f7c3d37b1a4d'] /* Country */,
+          forceSelection : true,
+          hiddenName : 'country',
+          listWidth : 400,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+          minChars : 2,
+          name : 'country_name',
+          pageSize : 20,
+          qtip : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
+          queryParam : 'query[name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>',
+          triggerAction : 'all',
+          typeAhead : true,
+          valueField : 'lkey',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'Store',
+           remoteSort : true,
+           sortInfo : { direction : 'ASC', field: 'lval' },
+           listeners : {
+            beforeload : function (_self, o){
+                 o.params = o.params || {};
+                 // set more here
+                 o.params.ltype = 'c',
+                 o.params.inlang = 'en';
+                 o.is_active = 1;
+             }
+           },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           proxy : {
+            xtype : 'HttpProxy',
+            method : 'GET',
+            url : baseURL + '/Roo/i18n.php',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           },
+           reader : {
+            xtype : 'JsonReader',
+            fields : [
+                {
+                    "name":"id",
+                    "type":"int"
+                },
+                {
+                    "name":"code",
+                    "type":"string"
+                },
+                {
+                    "name":"name",
+                    "type":"string"
+                },
+                {
+                    "name":"country",
+                    "type":"string"
+                },
+                {
+                    "name":"country_name",
+                    "type":"string"
+                }
+            ],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           }
+          }
+         },
+         {
+          xtype : 'Hidden',
+          name : 'id',
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   });
+ }
+};
diff --git a/Pman.Tab.AdminGeoLocations.bjs b/Pman.Tab.AdminGeoLocations.bjs
new file mode 100644 (file)
index 0000000..a38d04e
--- /dev/null
@@ -0,0 +1,520 @@
+{
+ "name" : "Pman.Tab.AdminGeoLocations",
+ "parent" : "Pman.Tab.Admin",
+ "title" : "",
+ "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminGeoLocations.bjs",
+ "permname" : "",
+ "modOrder" : "100",
+ "strings" : {
+  "f2b734f9d29a7b036a5f26b229f1e918" : "Geographic Locations",
+  "59716c97497eb9694541f7c3d37b1a4d" : "Country",
+  "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
+  "fc6f97505d89fe9277965c126744647a" : "No Companies found",
+  "7dce122004969d56ae2e0245cb754d35" : "Edit",
+  "646f95b46cdc6ae59dd9f2e86bf3b598" : "Displaying Country {0} - {1} of {2}",
+  "7faaef9675ee0e8280a243a290569359" : "No. Provinces",
+  "bbf2182dd4040fabc2b5433c32fd60f4" : "Province / District",
+  "05a43538cbc752df5428fe0a71192d09" : "No. Cities",
+  "155ca6a755e25c15ad7ce45e2f638f10" : "Displaying Companies{0} - {1} of {2}",
+  "57d056ed0984166336b7879c2af3657f" : "City",
+  "c6b5d0bb9a0c3f077863fdaef9773f7c" : "Province",
+  "31311feefd4f3253ed255d109da1480b" : "No Country found",
+  "42e3bd04a7339573df51e33a0e4e8969" : "Search Province",
+  "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "90fd8a29b37d805cf75af6a3809bca87" : "Search City",
+  "08b523137281088adf3cb1883c8e5627" : "Search Country",
+  "36dc0beb80c36193ac81b4f94e915e36" : "Country Name"
+ },
+ "items" : [
+  {
+   "background" : true,
+   "region" : "center",
+   "title" : "Geographic Locations",
+   "xtype" : "NestedLayoutPanel",
+   "$ xns" : "Roo",
+   "items" : [
+    {
+     "xtype" : "BorderLayout",
+     "$ xns" : "Roo",
+     "* prop" : "layout",
+     "items" : [
+      {
+       "xtype" : "LayoutRegion",
+       "$ xns" : "Roo",
+       "* prop" : "center"
+      },
+      {
+       "Number width" : 400,
+       "xtype" : "LayoutRegion",
+       "$ xns" : "Roo",
+       "split" : true,
+       "* prop" : "west"
+      },
+      {
+       "xtype" : "LayoutRegion",
+       "$ xns" : "Roo",
+       "width" : 400,
+       "split" : true,
+       "* prop" : "east"
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    \n    _this.country_panel = this;\n    if (_this.country_grid) {\n        _this.country_grid.footer.onClick('first');\n    }\n}"
+       },
+       "region" : "west",
+       "fitToframe" : true,
+       "title" : "Country",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "i18n",
+       "items" : [
+        {
+         "listeners" : {
+          "|render" : "function() \n{\n   _this.country_grid = this; \n   \n    if (_this.country_panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+         },
+         "autoExpandColumn" : "lval",
+         "xtype" : "Grid",
+         "loadMask" : true,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "listeners" : {
+            "afterselectionchange" : "function (_self)\n{\n    _this.province_grid.footer.onClick('first');\n}"
+           },
+           "Boolean singleSelect" : true,
+           "xtype" : "RowSelectionModel",
+           "$ xns" : "Roo.grid",
+           "* prop" : "sm"
+          },
+          {
+           "listeners" : {
+            "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.ltype = 'c',\n    options.params.inlang = 'en';\n    options.is_active = 1;\n    \n    options.params['query[name]'] = _this.country_searchBox.getValue();\n    \n    options.params._with_geoip_count = 1;\n}",
+            "load" : "function (_self, records, options)\n{\n    _this.province_grid.footer.onClick('first');\n}"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ field: 'lval', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/i18n.php'",
+             "method" : "GET",
+             "xtype" : "HttpProxy",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'lkey',\n        'type': 'string'\n    },\n    {\n        'name': 'inlang',\n        'type': 'string'\n    },\n    {\n        'name': 'lval',\n        'type': 'string'\n    },\n    {\n        'name': 'is_active',\n        'type': 'int'\n    },\n    {\n        'name': 'is_prefer',\n        'type': 'int'\n    },\n    {\n        'name': 'no_of_division',\n        'type': 'int'\n    },\n    {\n        'name': 'no_of_city',\n        'type': 'int'\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No Country found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying Country {0} - {1} of {2}",
+           "* prop" : "footer"
+          },
+          {
+           "xtype" : "Toolbar",
+           "$ xns" : "Roo",
+           "* prop" : "toolbar",
+           "items" : [
+            {
+             "listeners" : {
+              "specialkey" : "function (_self, e)\n{\n    if (e.getKey() == 13) {\n        _this.country_grid.footer.onClick('first');\n    }\n}",
+              "render" : "function (_self)\n{\n    _this.country_searchBox = _self;\n}"
+             },
+             "emptyText" : "Search Country",
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n    _this.country_grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n   _this.country_searchBox.setValue('');\n    _this.country_grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Country Name",
+           "width" : 200,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "lval"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "String align" : "right",
+           "sortable" : true,
+           "header" : "No. Provinces",
+           "width" : 100,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "no_of_division"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "String align" : "right",
+           "sortable" : true,
+           "header" : "No. Cities",
+           "width" : 100,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "no_of_city"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    _this.province_panel = this;\n    if (_this.province_grid) {\n        _this.province_grid.footer.onClick('first');\n    }\n}"
+       },
+       "region" : "center",
+       "fitToframe" : true,
+       "title" : "Province",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "geoip_division",
+       "items" : [
+        {
+         "listeners" : {
+          "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var s =  _this.province_grid.getDataSource().getAt(rowIndex);\n    \n    Pman.Dialog.AdminGeoDivisionEdit.show({\n        id : s.data.id\n    }, function(){\n        _this.province_grid.footer.onClick('refresh');\n    });\n}",
+          "|render" : "function() \n{\n   _this.province_grid = this; \n   \n    if (_this.province_panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+         },
+         "autoExpandColumn" : "name",
+         "xtype" : "Grid",
+         "loadMask" : true,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "listeners" : {
+            "afterselectionchange" : "function (_self)\n{\n    _this.city_grid.footer.onClick('first');\n}"
+           },
+           "Boolean singleSelect" : true,
+           "xtype" : "RowSelectionModel",
+           "$ xns" : "Roo.grid",
+           "* prop" : "sm"
+          },
+          {
+           "listeners" : {
+            "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var country = _this.country_grid.getSelectionModel().getSelected();\n    \n    if(!country) {\n        this.removeAll();\n        return false;\n    }\n    \n    options.params.country = country.data.lkey;\n    \n    options.params['query[name]'] = _this.province_searchBox.getValue();\n    \n    options.params._with_geoip_count = 1;\n}",
+            "load" : "function (_self, records, options)\n{\n    _this.city_grid.footer.onClick('first');\n}"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/geoip_division.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'code',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'country',\n        'type': 'string'\n    },\n    {\n        'name': 'country_name',\n        'type': 'string'\n    },\n    {\n        'name': 'no_of_city',\n        'type': 'string'\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No Companies found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying Companies{0} - {1} of {2}",
+           "* prop" : "footer"
+          },
+          {
+           "xtype" : "Toolbar",
+           "$ xns" : "Roo",
+           "* prop" : "toolbar",
+           "items" : [
+            {
+             "listeners" : {
+              "specialkey" : "function (_self, e)\n{\n     if (e.getKey() == 13) {\n        _this.province_grid.footer.onClick('first');\n     }\n}",
+              "render" : "function (_self)\n{\n    _this.province_searchBox = _self;\n}"
+             },
+             "emptyText" : "Search Province",
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n    _this.provincegrid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n    _this.province_searchBox.setValue('');\n    _this.province_grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Fill",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var country = _this.country_grid.getSelectionModel().getSelected();\n    \n    Pman.Dialog.AdminGeoDivisionEdit.show({\n        id : 0,\n        country : (country) ? country.data.lkey : '',\n        country_name : (country) ? country.data.lval : ''\n    }, function(){\n        _this.country_grid.footer.onClick('refresh');\n    });\n    \n}\n"
+             },
+             "text" : "Add",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var s = _this.province_grid.getSelectionModel().getSelected();\n    \n    if (!s)  {\n        Roo.MessageBox.alert(\"Error\", \"Select a Row\");\n        return;\n    }\n    \n    Pman.Dialog.AdminGeoDivisionEdit.show({\n        id : s.data.id\n    }, function(){\n        _this.province_grid.footer.onClick('refresh');\n    });\n    \n}"
+             },
+             "text" : "Edit",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var s = _this.province_grid.getSelectionModel().getSelected();\n    \n    if (!s)  {\n        Roo.MessageBox.alert(\"Error\", \"Select a Row\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Are you sure want to delete this division\", \n        function(res) {\n            if(res != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                method : 'POST',\n                url : baseURL + '/Roo/geoip_division',\n                params : {\n                    _delete  : s.data.id\n                },\n                success : function() {\n                    _this.country_grid.footer.onClick('refresh');\n                }\n            });\n        }\n    );\n}"
+             },
+             "text" : "Delete",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Name",
+           "width" : 200,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "name"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "String align" : "right",
+           "sortable" : true,
+           "header" : "No. Cities",
+           "width" : 100,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "no_of_city"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    \n    _this.city_panel = this;\n    if (_this.city_grid) {\n        _this.city_grid.footer.onClick('first');\n    }\n}"
+       },
+       "region" : "east",
+       "fitToframe" : true,
+       "title" : "City",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "geoip_city",
+       "items" : [
+        {
+         "listeners" : {
+          "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var s =  _this.city_grid.getDataSource().getAt(rowIndex);\n    \n    Pman.Dialog.AdminGeoCityEdit.show({\n        id : s.data.id\n    }, function(){\n        _this.city_grid.footer.onClick('refresh');\n    });\n    \n}",
+          "|render" : "function() \n{\n   _this.city_grid = this; \n   \n    if (_this.city_panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+         },
+         "autoExpandColumn" : "name",
+         "xtype" : "Grid",
+         "loadMask" : true,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "listeners" : {
+            "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var country = _this.country_grid.getSelectionModel().getSelected();\n    \n    if(!country) {\n        this.removeAll();\n        return false;\n    }\n    \n    options.params.country = country.data.lkey;\n    \n    var province = _this.province_grid.getSelectionModel().getSelected();\n    \n    if(province) {\n        options.params.division_id = province.data.id\n    }\n    \n    options.params['query[name]'] = _this.city_searchBox.getValue();\n}"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/geoip_city.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'country',\n        'type': 'string'\n    },\n    {\n        'name': 'country_name',\n        'type': 'string'\n    },\n    {\n        'name': 'division_id',\n        'type': 'int'\n    },\n    {\n        'name': 'division_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'postal_code',\n        'type': 'string'\n    },\n    {\n        'name': 'time_zone',\n        'type': 'string'\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No Country found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying Country {0} - {1} of {2}",
+           "* prop" : "footer"
+          },
+          {
+           "xtype" : "Toolbar",
+           "$ xns" : "Roo",
+           "* prop" : "toolbar",
+           "items" : [
+            {
+             "listeners" : {
+              "specialkey" : "function (_self, e)\n{\n    if (e.getKey() == 13) {\n        _this.city_grid.footer.onClick('first');\n    }\n}",
+              "render" : "function (_self)\n{\n    _this.city_searchBox = _self;\n}"
+             },
+             "emptyText" : "Search City",
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n    _this.country_grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n   _this.country_searchBox.setValue('');\n    _this.country_grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Fill",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var country = _this.country_grid.getSelectionModel().getSelected();\n    \n    var province = _this.province_grid.getSelectionModel().getSelected();\n    \n    Pman.Dialog.AdminGeoCityEdit.show({\n        id : 0,\n        country : (country) ? country.data.lkey : '',\n        country_name : (country) ? country.data.lval : '',\n        division_id : (province) ? province.data.id : '',\n        division_id_name : (province) ? province.data.name : ''\n    }, function(){\n        _this.country_grid.footer.onClick('refresh');\n    });\n    \n}\n"
+             },
+             "text" : "Add",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var s = _this.city_grid.getSelectionModel().getSelections();\n    \n    if (!s.length || s.length > 1)  {\n        Roo.MessageBox.alert(\"Error\", \"Select a single city\");\n        return;\n    }\n    \n    Pman.Dialog.AdminGeoCityEdit.show({\n        id : s[0].data.id\n    }, function(){\n        _this.city_grid.footer.onClick('refresh');\n    });\n    \n}"
+             },
+             "text" : "Edit",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var s = _this.city_grid.getSelectionModel().getSelections();\n    \n    if (!s.length)  {\n        Roo.MessageBox.alert(\"Error\", \"Select city to delete\");\n        return;\n    }\n    \n    var ids = [];\n    \n    Roo.each(s, function(v, k){\n        ids.push(v.data.id);\n    });\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Are you sure want to delete the selected city\", \n        function(res) {\n            if(res != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                method : 'POST',\n                url : baseURL + '/Roo/geoip_city',\n                params : {\n                    _delete  : ids.join(',')\n                },\n                success : function() {\n                    _this.country_grid.footer.onClick('refresh');\n                }\n            });\n        }\n    );\n}"
+             },
+             "text" : "Delete",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Name",
+           "width" : 200,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "name"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Province / District",
+           "width" : 150,
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+           "$ xns" : "Roo.grid",
+           "* prop" : "cm[]",
+           "dataIndex" : "division_id_name"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman.Tab.AdminGeoLocations.js b/Pman.Tab.AdminGeoLocations.js
new file mode 100644 (file)
index 0000000..0cfa05a
--- /dev/null
@@ -0,0 +1,931 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.AdminGeoLocations = new Roo.XComponent({
+
+ _strings : {
+  'f2b734f9d29a7b036a5f26b229f1e918' :"Geographic Locations",
+  '59716c97497eb9694541f7c3d37b1a4d' :"Country",
+  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
+  'fc6f97505d89fe9277965c126744647a' :"No Companies found",
+  '7dce122004969d56ae2e0245cb754d35' :"Edit",
+  '646f95b46cdc6ae59dd9f2e86bf3b598' :"Displaying Country {0} - {1} of {2}",
+  '7faaef9675ee0e8280a243a290569359' :"No. Provinces",
+  'bbf2182dd4040fabc2b5433c32fd60f4' :"Province / District",
+  '05a43538cbc752df5428fe0a71192d09' :"No. Cities",
+  '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
+  '57d056ed0984166336b7879c2af3657f' :"City",
+  'c6b5d0bb9a0c3f077863fdaef9773f7c' :"Province",
+  '31311feefd4f3253ed255d109da1480b' :"No Country found",
+  '42e3bd04a7339573df51e33a0e4e8969' :"Search Province",
+  'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
+  '49ee3087348e8d44e1feda1917443987' :"Name",
+  '90fd8a29b37d805cf75af6a3809bca87' :"Search City",
+  '08b523137281088adf3cb1883c8e5627' :"Search Country",
+  '36dc0beb80c36193ac81b4f94e915e36' :"Country Name"
+ },
+
+  part     :  ["Admin", "GeoLocations" ],
+  order    : '100-Pman.Tab.AdminGeoLocations',
+  region   : 'center',
+  parent   : 'Pman.Tab.Admin',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'NestedLayoutPanel',
+   background : true,
+   region : 'center',
+   title : _this._strings['f2b734f9d29a7b036a5f26b229f1e918'] /* Geographic Locations */,
+   xns : Roo,
+   '|xns' : 'Roo',
+   layout : {
+    xtype : 'BorderLayout',
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    east : {
+     xtype : 'LayoutRegion',
+     split : true,
+     width : 400,
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    west : {
+     xtype : 'LayoutRegion',
+     split : true,
+     width : 400,
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    items  : [
+     {
+      xtype : 'GridPanel',
+      fitContainer : true,
+      fitToframe : true,
+      region : 'west',
+      tableName : 'i18n',
+      title : _this._strings['59716c97497eb9694541f7c3d37b1a4d'] /* Country */,
+      listeners : {
+       activate : function() {
+            
+            _this.country_panel = this;
+            if (_this.country_grid) {
+                _this.country_grid.footer.onClick('first');
+            }
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      grid : {
+       xtype : 'Grid',
+       autoExpandColumn : 'lval',
+       loadMask : true,
+       listeners : {
+        render : function() 
+         {
+            _this.country_grid = this; 
+            
+             if (_this.country_panel.active) {
+                this.footer.onClick('first');
+             }
+         }
+       },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       footer : {
+        xtype : 'PagingToolbar',
+        displayInfo : true,
+        displayMsg : _this._strings['646f95b46cdc6ae59dd9f2e86bf3b598'] /* Displaying Country {0} - {1} of {2} */,
+        emptyMsg : _this._strings['31311feefd4f3253ed255d109da1480b'] /* No Country found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo'
+       },
+       toolbar : {
+        xtype : 'Toolbar',
+        xns : Roo,
+        '|xns' : 'Roo',
+        items  : [
+         {
+          xtype : 'TextField',
+          emptyText : _this._strings['08b523137281088adf3cb1883c8e5627'] /* Search Country */,
+          listeners : {
+           render : function (_self)
+            {
+                _this.country_searchBox = _self;
+            },
+           specialkey : function (_self, e)
+            {
+                if (e.getKey() == 13) {
+                    _this.country_grid.footer.onClick('first');
+                }
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/search.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.country_grid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+               _this.country_searchBox.setValue('');
+                _this.country_grid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
+       },
+       dataSource : {
+        xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field: 'lval', direction: 'ASC' },
+        listeners : {
+         beforeload : function (_self, options)
+          {
+              options.params = options.params || {};
+              
+              options.params.ltype = 'c',
+              options.params.inlang = 'en';
+              options.is_active = 1;
+              
+              options.params['query[name]'] = _this.country_searchBox.getValue();
+              
+              options.params._with_geoip_count = 1;
+          },
+         load : function (_self, records, options)
+          {
+              _this.province_grid.footer.onClick('first');
+          }
+        },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        proxy : {
+         xtype : 'HttpProxy',
+         method : 'GET',
+         url : baseURL + '/Roo/i18n.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        },
+        reader : {
+         xtype : 'JsonReader',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'lkey',
+                 'type': 'string'
+             },
+             {
+                 'name': 'inlang',
+                 'type': 'string'
+             },
+             {
+                 'name': 'lval',
+                 'type': 'string'
+             },
+             {
+                 'name': 'is_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'is_prefer',
+                 'type': 'int'
+             },
+             {
+                 'name': 'no_of_division',
+                 'type': 'int'
+             },
+             {
+                 'name': 'no_of_city',
+                 'type': 'int'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        }
+       },
+       sm : {
+        xtype : 'RowSelectionModel',
+        singleSelect : true,
+        listeners : {
+         afterselectionchange : function (_self)
+          {
+              _this.province_grid.footer.onClick('first');
+          }
+        },
+        xns : Roo.grid,
+        '|xns' : 'Roo.grid'
+       },
+       cm : [
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'lval',
+         header : _this._strings['36dc0beb80c36193ac81b4f94e915e36'] /* Country Name */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         align : 'right',
+         dataIndex : 'no_of_division',
+         header : _this._strings['7faaef9675ee0e8280a243a290569359'] /* No. Provinces */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         align : 'right',
+         dataIndex : 'no_of_city',
+         header : _this._strings['05a43538cbc752df5428fe0a71192d09'] /* No. Cities */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        }
+       ]
+      }
+     },
+     {
+      xtype : 'GridPanel',
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'geoip_division',
+      title : _this._strings['c6b5d0bb9a0c3f077863fdaef9773f7c'] /* Province */,
+      listeners : {
+       activate : function() {
+            _this.province_panel = this;
+            if (_this.province_grid) {
+                _this.province_grid.footer.onClick('first');
+            }
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      grid : {
+       xtype : 'Grid',
+       autoExpandColumn : 'name',
+       loadMask : true,
+       listeners : {
+        render : function() 
+         {
+            _this.province_grid = this; 
+            
+             if (_this.province_panel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        rowdblclick : function (_self, rowIndex, e)
+         {
+             var s =  _this.province_grid.getDataSource().getAt(rowIndex);
+             
+             Pman.Dialog.AdminGeoDivisionEdit.show({
+                 id : s.data.id
+             }, function(){
+                 _this.province_grid.footer.onClick('refresh');
+             });
+         }
+       },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       footer : {
+        xtype : 'PagingToolbar',
+        displayInfo : true,
+        displayMsg : _this._strings['155ca6a755e25c15ad7ce45e2f638f10'] /* Displaying Companies{0} - {1} of {2} */,
+        emptyMsg : _this._strings['fc6f97505d89fe9277965c126744647a'] /* No Companies found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo'
+       },
+       toolbar : {
+        xtype : 'Toolbar',
+        xns : Roo,
+        '|xns' : 'Roo',
+        items  : [
+         {
+          xtype : 'TextField',
+          emptyText : _this._strings['42e3bd04a7339573df51e33a0e4e8969'] /* Search Province */,
+          listeners : {
+           render : function (_self)
+            {
+                _this.province_searchBox = _self;
+            },
+           specialkey : function (_self, e)
+            {
+                 if (e.getKey() == 13) {
+                    _this.province_grid.footer.onClick('first');
+                 }
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/search.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.provincegrid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.province_searchBox.setValue('');
+                _this.province_grid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Fill',
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+          listeners : {
+           click : function()
+            {
+                var country = _this.country_grid.getSelectionModel().getSelected();
+                
+                Pman.Dialog.AdminGeoDivisionEdit.show({
+                    id : 0,
+                    country : (country) ? country.data.lkey : '',
+                    country_name : (country) ? country.data.lval : ''
+                }, function(){
+                    _this.country_grid.footer.onClick('refresh');
+                });
+                
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+          text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
+          listeners : {
+           click : function()
+            {
+                var s = _this.province_grid.getSelectionModel().getSelected();
+                
+                if (!s)  {
+                    Roo.MessageBox.alert("Error", "Select a Row");
+                    return;
+                }
+                
+                Pman.Dialog.AdminGeoDivisionEdit.show({
+                    id : s.data.id
+                }, function(){
+                    _this.province_grid.footer.onClick('refresh');
+                });
+                
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : rootURL + '/Pman/templates/images/trash.gif',
+          text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
+          listeners : {
+           click : function()
+            {
+                var s = _this.province_grid.getSelectionModel().getSelected();
+                
+                if (!s)  {
+                    Roo.MessageBox.alert("Error", "Select a Row");
+                    return;
+                }
+                
+                Roo.MessageBox.confirm(
+                    "Confirm", 
+                    "Are you sure want to delete this division", 
+                    function(res) {
+                        if(res != 'yes') {
+                            return;
+                        }
+                        new Pman.Request({
+                            method : 'POST',
+                            url : baseURL + '/Roo/geoip_division',
+                            params : {
+                                _delete  : s.data.id
+                            },
+                            success : function() {
+                                _this.country_grid.footer.onClick('refresh');
+                            }
+                        });
+                    }
+                );
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
+       },
+       dataSource : {
+        xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field: 'name', direction: 'ASC' },
+        listeners : {
+         beforeload : function (_self, options)
+          {
+              options.params = options.params || {};
+              
+              var country = _this.country_grid.getSelectionModel().getSelected();
+              
+              if(!country) {
+                  this.removeAll();
+                  return false;
+              }
+              
+              options.params.country = country.data.lkey;
+              
+              options.params['query[name]'] = _this.province_searchBox.getValue();
+              
+              options.params._with_geoip_count = 1;
+          },
+         load : function (_self, records, options)
+          {
+              _this.city_grid.footer.onClick('first');
+          }
+        },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        proxy : {
+         xtype : 'HttpProxy',
+         method : 'GET',
+         url : baseURL + '/Roo/geoip_division.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        },
+        reader : {
+         xtype : 'JsonReader',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'code',
+                 'type': 'string'
+             },
+             {
+                 'name': 'name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'country',
+                 'type': 'string'
+             },
+             {
+                 'name': 'country_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'no_of_city',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        }
+       },
+       sm : {
+        xtype : 'RowSelectionModel',
+        singleSelect : true,
+        listeners : {
+         afterselectionchange : function (_self)
+          {
+              _this.city_grid.footer.onClick('first');
+          }
+        },
+        xns : Roo.grid,
+        '|xns' : 'Roo.grid'
+       },
+       cm : [
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'name',
+         header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         align : 'right',
+         dataIndex : 'no_of_city',
+         header : _this._strings['05a43538cbc752df5428fe0a71192d09'] /* No. Cities */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        }
+       ]
+      }
+     },
+     {
+      xtype : 'GridPanel',
+      fitContainer : true,
+      fitToframe : true,
+      region : 'east',
+      tableName : 'geoip_city',
+      title : _this._strings['57d056ed0984166336b7879c2af3657f'] /* City */,
+      listeners : {
+       activate : function() {
+            
+            _this.city_panel = this;
+            if (_this.city_grid) {
+                _this.city_grid.footer.onClick('first');
+            }
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      grid : {
+       xtype : 'Grid',
+       autoExpandColumn : 'name',
+       loadMask : true,
+       listeners : {
+        render : function() 
+         {
+            _this.city_grid = this; 
+            
+             if (_this.city_panel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        rowdblclick : function (_self, rowIndex, e)
+         {
+             var s =  _this.city_grid.getDataSource().getAt(rowIndex);
+             
+             Pman.Dialog.AdminGeoCityEdit.show({
+                 id : s.data.id
+             }, function(){
+                 _this.city_grid.footer.onClick('refresh');
+             });
+             
+         }
+       },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       footer : {
+        xtype : 'PagingToolbar',
+        displayInfo : true,
+        displayMsg : _this._strings['646f95b46cdc6ae59dd9f2e86bf3b598'] /* Displaying Country {0} - {1} of {2} */,
+        emptyMsg : _this._strings['31311feefd4f3253ed255d109da1480b'] /* No Country found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo'
+       },
+       toolbar : {
+        xtype : 'Toolbar',
+        xns : Roo,
+        '|xns' : 'Roo',
+        items  : [
+         {
+          xtype : 'TextField',
+          emptyText : _this._strings['90fd8a29b37d805cf75af6a3809bca87'] /* Search City */,
+          listeners : {
+           render : function (_self)
+            {
+                _this.city_searchBox = _self;
+            },
+           specialkey : function (_self, e)
+            {
+                if (e.getKey() == 13) {
+                    _this.city_grid.footer.onClick('first');
+                }
+            }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/search.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.country_grid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+          listeners : {
+           click : function (_self, e)
+            {
+               _this.country_searchBox.setValue('');
+                _this.country_grid.footer.onClick('first');
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Fill',
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+          listeners : {
+           click : function()
+            {
+                var country = _this.country_grid.getSelectionModel().getSelected();
+                
+                var province = _this.province_grid.getSelectionModel().getSelected();
+                
+                Pman.Dialog.AdminGeoCityEdit.show({
+                    id : 0,
+                    country : (country) ? country.data.lkey : '',
+                    country_name : (country) ? country.data.lval : '',
+                    division_id : (province) ? province.data.id : '',
+                    division_id_name : (province) ? province.data.name : ''
+                }, function(){
+                    _this.country_grid.footer.onClick('refresh');
+                });
+                
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+          text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
+          listeners : {
+           click : function()
+            {
+                var s = _this.city_grid.getSelectionModel().getSelections();
+                
+                if (!s.length || s.length > 1)  {
+                    Roo.MessageBox.alert("Error", "Select a single city");
+                    return;
+                }
+                
+                Pman.Dialog.AdminGeoCityEdit.show({
+                    id : s[0].data.id
+                }, function(){
+                    _this.city_grid.footer.onClick('refresh');
+                });
+                
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : rootURL + '/Pman/templates/images/trash.gif',
+          text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
+          listeners : {
+           click : function()
+            {
+                var s = _this.city_grid.getSelectionModel().getSelections();
+                
+                if (!s.length)  {
+                    Roo.MessageBox.alert("Error", "Select city to delete");
+                    return;
+                }
+                
+                var ids = [];
+                
+                Roo.each(s, function(v, k){
+                    ids.push(v.data.id);
+                });
+                
+                Roo.MessageBox.confirm(
+                    "Confirm", 
+                    "Are you sure want to delete the selected city", 
+                    function(res) {
+                        if(res != 'yes') {
+                            return;
+                        }
+                        new Pman.Request({
+                            method : 'POST',
+                            url : baseURL + '/Roo/geoip_city',
+                            params : {
+                                _delete  : ids.join(',')
+                            },
+                            success : function() {
+                                _this.country_grid.footer.onClick('refresh');
+                            }
+                        });
+                    }
+                );
+            }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
+       },
+       dataSource : {
+        xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field: 'name', direction: 'ASC' },
+        listeners : {
+         beforeload : function (_self, options)
+          {
+              options.params = options.params || {};
+              
+              var country = _this.country_grid.getSelectionModel().getSelected();
+              
+              if(!country) {
+                  this.removeAll();
+                  return false;
+              }
+              
+              options.params.country = country.data.lkey;
+              
+              var province = _this.province_grid.getSelectionModel().getSelected();
+              
+              if(province) {
+                  options.params.division_id = province.data.id
+              }
+              
+              options.params['query[name]'] = _this.city_searchBox.getValue();
+          }
+        },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        proxy : {
+         xtype : 'HttpProxy',
+         method : 'GET',
+         url : baseURL + '/Roo/geoip_city.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        },
+        reader : {
+         xtype : 'JsonReader',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'country',
+                 'type': 'string'
+             },
+             {
+                 'name': 'country_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'division_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'division_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'postal_code',
+                 'type': 'string'
+             },
+             {
+                 'name': 'time_zone',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        }
+       },
+       cm : [
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'name',
+         header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        },
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'division_id_name',
+         header : _this._strings['bbf2182dd4040fabc2b5433c32fd60f4'] /* Province / District */,
+         renderer : function(v) 
+         { 
+             return String.format('{0}', v ? v : ''); 
+         },
+         sortable : true,
+         width : 150,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        }
+       ]
+      }
+     }
+    ]
+   }
+  };  }
+});