Pman.Tab.AdminCompanies.bjs
authoredward <edward@roojs.com>
Fri, 4 Nov 2016 05:07:24 +0000 (13:07 +0800)
committeredward <edward@roojs.com>
Fri, 4 Nov 2016 05:07:24 +0000 (13:07 +0800)
Pman.Tab.AdminCompanies.js

Pman.Tab.AdminCompanies.bjs
Pman.Tab.AdminCompanies.js

index 0e42218..028e063 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Tab.AdminCompanies",
  "parent" : "Pman.Tab.Admin",
  "title" : "Pman.Tab.AdminCompanies",
- "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminCompanies.bjs",
+ "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminCompanies.bjs",
  "permname" : "Admin.Companies",
  "modOrder" : "030",
  "strings" : {
@@ -12,6 +12,7 @@
   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
   "fc6f97505d89fe9277965c126744647a" : "No Companies found",
   "7dce122004969d56ae2e0245cb754d35" : "Edit",
+  "68be4837f6c739877233e527a996dd00" : "Merge",
   "155ca6a755e25c15ad7ce45e2f638f10" : "Displaying Companies{0} - {1} of {2}",
   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
@@ -24,8 +25,8 @@
  "items" : [
   {
    "region" : "center",
-   "title" : "Companies",
    "xtype" : "NestedLayoutPanel",
+   "title" : "Companies",
    "$ xns" : "Roo",
    "items" : [
     {
@@ -50,9 +51,9 @@
        "listeners" : {
         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
        },
+       "region" : "center",
        "fitToframe" : true,
        "background" : true,
-       "region" : "center",
        "title" : "Companies",
        "xtype" : "GridPanel",
        "fitContainer" : true,
@@ -87,8 +88,8 @@
               "load" : "function (This, o, arg)\n{\n \n}"
              },
              "$ url" : "baseURL + '/Roo/Companies.php'",
-             "method" : "GET",
              "xtype" : "HttpProxy",
+             "method" : "GET",
              "$ xns" : "Roo.data",
              "* prop" : "proxy"
             },
              "xtype" : "Fill",
              "$ xns" : "Roo.Toolbar"
             },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) {\n        return;\n    }\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
+             },
+             "text" : "Merge",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Separator",
+             "$ xns" : "Roo.Toolbar"
+            },
             {
              "listeners" : {
               "|click" : "function()\n{\n    if (!_this.dialog) {\n        return;\n        }\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 100,
            "header" : "Tel",
+           "width" : 100,
            "$ renderer" : "function(v) { return String.format('{0}', v); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 100,
            "header" : "Fax",
+           "width" : 100,
            "$ renderer" : "function(v) { return String.format('{0}', v); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
           },
           {
            "xtype" : "ColumnModel",
-           "header" : "Remarks",
            "width" : 200,
+           "header" : "Remarks",
            "$ renderer" : "function(v) { return String.format('{0}', v); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
index e512d8b..d8b9bf2 100644 (file)
@@ -13,6 +13,7 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
   '7dce122004969d56ae2e0245cb754d35' :"Edit",
+  '68be4837f6c739877233e527a996dd00' :"Merge",
   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
@@ -35,39 +36,37 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
    var _this = this;
    var MODULE = this;
    return {
+   xtype : 'NestedLayoutPanel',
    region : 'center',
    title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
    xns : Roo,
    '|xns' : 'Roo',
-   xtype : 'NestedLayoutPanel',
    layout : {
+    xtype : 'BorderLayout',
     xns : Roo,
     '|xns' : 'Roo',
-    xtype : 'BorderLayout',
     center : {
+     xtype : 'LayoutRegion',
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     south : {
+     xtype : 'LayoutRegion',
      height : 150,
      split : true,
      titlebar : true,
      xns : Roo,
-     '|xns' : 'Roo',
-     xtype : 'LayoutRegion'
+     '|xns' : 'Roo'
     },
     items  : [
      {
+      xtype : 'GridPanel',
       background : true,
       fitContainer : true,
       fitToframe : true,
       region : 'center',
       tableName : 'Companies',
       title : _this._strings['edefbda3a2bdd979e42d8944b7325b79'] /* Companies */,
-      xns : Roo,
-      '|xns' : 'Roo',
-      xtype : 'GridPanel',
       listeners : {
        activate : function() {
             _this.panel = this;
@@ -76,12 +75,12 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
             }
         }
       },
+      xns : Roo,
+      '|xns' : 'Roo',
       grid : {
+       xtype : 'Grid',
        autoExpandColumn : 'name',
        loadMask : true,
-       xns : Roo.grid,
-       '|xns' : 'Roo.grid',
-       xtype : 'Grid',
        listeners : {
         render : function() 
          {
@@ -107,23 +106,23 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
              
          }
        },
+       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',
-        xtype : 'PagingToolbar'
+        '|xns' : 'Roo'
        },
        toolbar : {
+        xtype : 'Toolbar',
         xns : Roo,
         '|xns' : 'Roo',
-        xtype : 'Toolbar',
         items  : [
          {
-          xns : Roo.form,
-          '|xns' : 'Roo.form',
           xtype : 'TextField',
           listeners : {
            render : function (_self)
@@ -140,47 +139,77 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
                  _this.grid.footer.onClick( 'first' );
               }
             }
-          }
+          },
+          xns : Roo.form,
+          '|xns' : 'Roo.form'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/search.gif',
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function (_self, e)
             {
             _this.grid.footer.onClick('first');
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function (_self, e)
             {
                 _this.searchBox.setValue('');
                 _this.grid.footer.onClick('first');
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Fill',
           xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Fill'
+          '|xns' : 'Roo.Toolbar'
          },
          {
+          xtype : 'Button',
           cls : 'x-btn-text-icon',
-          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
-          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+          icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+          text : _this._strings['68be4837f6c739877233e527a996dd00'] /* Merge */,
+          listeners : {
+           click : function()
+            {
+                var s = _this.grid.getSelectionModel().getSelections();
+                if (!s.length || (s.length > 1))  {
+                    Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                    return;
+                }
+                if (!_this.dialog) {
+                    return;
+                }
+                _this.dialog.show(s[0].data, function() {
+                    _this.grid.footer.onClick('first');
+                }); 
+                
+            }
+          },
           xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
+          '|xns' : 'Roo.Toolbar'
+         },
+         {
+          xtype : 'Separator',
+          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()
             {
@@ -191,15 +220,15 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
                     _this.grid.footer.onClick('first');
                }); 
             }
-          }
+          },
+          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 */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function()
             {
@@ -216,30 +245,30 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
                 }); 
                 
             }
-          }
+          },
+          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 */,
-          xns : Roo.Toolbar,
-          '|xns' : 'Roo.Toolbar',
-          xtype : 'Button',
           listeners : {
            click : function()
             {
                  Pman.genericDelete(_this, 'Companies'); 
             }
-          }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
          }
         ]
        },
        dataSource : {
+        xtype : 'Store',
         remoteSort : true,
         sortInfo : { field : 'name', direction: 'ASC' },
-        xns : Roo.data,
-        '|xns' : 'Roo.data',
-        xtype : 'Store',
         listeners : {
          beforeload : function (_self, o)
           {
@@ -255,20 +284,23 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
               } catch (e) {}
           }
         },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
         proxy : {
+         xtype : 'HttpProxy',
          method : 'GET',
          url : baseURL + '/Roo/Companies.php',
-         xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'HttpProxy',
          listeners : {
           load : function (This, o, arg)
            {
             
            }
-         }
+         },
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
         },
         reader : {
+         xtype : 'JsonReader',
          fields : [
              {
                  'name': 'code',
@@ -537,12 +569,12 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
          root : 'data',
          totalProperty : 'total',
          xns : Roo.data,
-         '|xns' : 'Roo.data',
-         xtype : 'JsonReader'
+         '|xns' : 'Roo.data'
         }
        },
        colModel : [
         {
+         xtype : 'ColumnModel',
          dataIndex : 'comptype',
          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
          renderer : function (v,x ,r) {
@@ -552,20 +584,20 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
          sortable : true,
          width : 90,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'code',
          header : _this._strings['9c9745a343efeacc9efe9b7222b27afb'] /* Ref# */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 50,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'name',
          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
          renderer : function(v,x,r) {
@@ -574,28 +606,28 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
          sortable : true,
          width : 200,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'tel',
          header : _this._strings['2e006b735fbd916d8ab26978ae6714d4'] /* Tel */,
          renderer : function(v) { return String.format('{0}', v); },
          width : 100,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'fax',
          header : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
          renderer : function(v) { return String.format('{0}', v); },
          width : 100,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'email',
          header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
          renderer : function (v) {
@@ -606,27 +638,26 @@ Pman.Tab.AdminCompanies = new Roo.XComponent({
          sortable : true,
          width : 100,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'address',
          header : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
          renderer : function(v) { return String.format('{0}', v); },
          sortable : true,
          width : 200,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         },
         {
+         xtype : 'ColumnModel',
          dataIndex : 'remarks',
          header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
          renderer : function(v) { return String.format('{0}', v); },
          width : 200,
          xns : Roo.grid,
-         '|xns' : 'Roo.grid',
-         xtype : 'ColumnModel'
+         '|xns' : 'Roo.grid'
         }
        ]
       }