PHP8
[Pman.BAdmin] / Pman.Tab.BAdminCoreEnum.bjs
index 0c7099c..62d0292 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Tab.BAdminCoreEnum",
  "parent" : "Pman.Tab.BAdmin",
  "title" : "",
- "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Tab.BAdminCoreEnum.bjs",
+ "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Tab.BAdminCoreEnum.bjs",
  "permname" : "",
  "modOrder" : "005",
  "strings" : {
@@ -31,8 +31,8 @@
      "items" : [
       {
        "String tabPosition" : "top",
-       "Boolean hideTabs" : true,
        "xtype" : "Region",
+       "Boolean hideTabs" : true,
        "$ xns" : "Roo.bootstrap.layout",
        "* prop" : "center"
       },
@@ -47,7 +47,7 @@
       },
       {
        "listeners" : {
-        "activate" : "function (_self)\n{\n    if(_this.type_grid) {\n        _this.type_grid.footer.onClick('first');\n    }\n}",
+        "activate" : "function (_self)\n{\n    _this.type_edit_btn.hide();\n    \n    if(_this.type_grid) {\n        _this.type_grid.footer.onClick('first');\n    }\n}",
         "render" : "function (_self)\n{\n    _this.type_panel = _self; \n}"
        },
        "Boolean fitContainer" : true,
              "$ xns" : "Roo.bootstrap",
              "items" : [
               {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n\n}"
-               },
-               "String weight" : "default",
-               "xtype" : "Button",
+               "xtype" : "Element",
                "$ xns" : "Roo.bootstrap",
-               "String html" : "Add",
-               "String style" : "margin: 10px;",
-               "String glyphicon" : "plus"
+               "items" : [
+                {
+                 "String cls" : "roo-toolbar",
+                 "xtype" : "Row",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "Number md" : 12,
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n\n}"
+                     },
+                     "String cls" : "roo-toolbar-button",
+                     "String weight" : "default",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Add",
+                     "String glyphicon" : "plus"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.type_edit_btn = this;\n    \n    this.hide();\n}",
+                      "click" : "function (_self, e)\n{\n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n}"
+                     },
+                     "String cls" : "roo-toolbar-button",
+                     "String weight" : "default",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Edit",
+                     "String glyphicon" : "edit"
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
               }
              ]
             }
          "boolean hover" : true,
          "boolean striped" : false,
          "xtype" : "Table",
-         "boolean responsive" : true,
          "Boolean rowSelection" : true,
          "$ xns" : "Roo.bootstrap",
          "Boolean loadMask" : true,
          "items" : [
           {
            "listeners" : {
-            "selectionchange" : "function (_self)\n{\n    _this.option_grid.store.load({});\n}"
+            "selectionchange" : "function (_self)\n{\n    _this.type_edit_btn.hide();\n    \n    if(this.getSelected()){\n        _this.type_edit_btn.show();\n    }\n    \n    _this.option_grid.store.load({});\n}"
            },
            "Boolean singleSelect" : true,
            "xtype" : "RowSelectionModel",
           },
           {
            "listeners" : {
-            "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params['query[empty_etype]'] = 1;\n    \n}"
+            "beforeload" : "function (_self, o)\n{\n      if (!Pman.buildCompleted) {\n        return false;\n    }\n    \n    o.params = o.params || {};\n    \n    o.params['query[empty_etype]'] = 1;\n    \n}",
+            "load" : "function (_self, records, options)\n{\n    _this.type_edit_btn.hide();\n}"
            },
            "$ Object sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
            "xtype" : "Store",
           },
           {
            "String header" : "Name",
+           "String cursor" : "pointer",
            "String dataIndex" : "display_name",
            "xtype" : "ColumnModel",
            "Number xs" : 12,
              "$ xns" : "Roo.bootstrap",
              "items" : [
               {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0,\n        etype : sel.data.name\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
-               },
-               "String weight" : "default",
-               "xtype" : "Button",
-               "$ xns" : "Roo.bootstrap",
-               "String html" : "Add",
-               "String style" : "margin: 10px;",
-               "String glyphicon" : "plus"
-              },
-              {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
-               },
-               "String weight" : "default",
-               "xtype" : "Button",
+               "xtype" : "Element",
                "$ xns" : "Roo.bootstrap",
-               "String html" : "Edit",
-               "String style" : "margin: 10px;",
-               "String glyphicon" : "edit"
-              },
-              {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    new Pman.Request({\n        url: baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            _delete : sel.data.id\n        }, \n        success : function(res) {\n            _this.option_grid.store.load({});\n        }\n    });\n\n}"
-               },
-               "String weight" : "primary",
-               "xtype" : "Button",
-               "$ xns" : "Roo.bootstrap",
-               "String html" : "Delete",
-               "String style" : "margin: 10px;",
-               "String glyphicon" : "trash"
+               "items" : [
+                {
+                 "String cls" : "roo-toolbar",
+                 "xtype" : "Row",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "Number md" : 12,
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "click" : "function (_self, e)\n{\n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0,\n        etype : sel.data.name\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
+                     },
+                     "String cls" : "roo-toolbar-button",
+                     "String weight" : "default",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Add",
+                     "String glyphicon" : "plus"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.hide();\n}",
+                      "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
+                     },
+                     "String cls" : "roo-toolbar-button",
+                     "String weight" : "default",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Edit",
+                     "String glyphicon" : "edit"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.hide();\n}",
+                      "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    new Pman.Request({\n        url: baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            _delete : sel.data.id\n        }, \n        success : function(res) {\n            _this.option_grid.store.load({});\n        }\n    });\n\n}"
+                     },
+                     "String cls" : "roo-toolbar-button",
+                     "String weight" : "primary",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Delete",
+                     "String glyphicon" : "trash"
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
               }
              ]
             }
         {
          "listeners" : {
           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    var sel = _this.option_grid.store.getAt(rowIndex);\n    \n    if(!sel || sel.data.id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n    \n}",
-          "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.option_grid.colModel.getDataIndex(columnIndex);\n    \n    if (di != 'active') {\n        return;\n    }\n     \n    var rec = _this.option_grid.store.getAt(rowIndex);\n    \n    rec.set('active', rec.data.active ? 0 : 1);\n    \n    rec.commit();\n}",
+          "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.option_grid.colModel.getDataIndex(columnIndex);\n    \n    if (di != 'active') {\n        return;\n    }\n     \n    var rec = _this.option_grid.store.getAt(rowIndex);\n    \n    rec.set('active', rec.data.active ? 0 : 1);\n    \n    rec.commit();\n    \n    /*if(rec.data.active * 1 != 1){\n        var el = _this.option_grid.getRowDom(rowIndex);\n        \n        el.addClass('x-grid-row-fadeout');\n        \n        el.on('transitionend',function(){\n            _this.option_grid.ds.remove(rec);\n            el.remove();\n        },this,{single:true});\n    }*/\n}",
           "render" : "function (_self)\n{\n    _this.option_grid = _self; \n\n}"
          },
          "Boolean cellSelection" : true,
          "boolean hover" : true,
          "boolean striped" : true,
          "xtype" : "Table",
-         "boolean responsive" : true,
          "Boolean rowSelection" : true,
          "$ xns" : "Roo.bootstrap",
          "Boolean loadMask" : true,
          "* prop" : "grid",
          "items" : [
           {
+           "listeners" : {
+            "selectionchange" : "function (_self)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n    \n    if (!this.getSelected()) {\n        return;\n    }\n    \n    _this.edit_btn.show();\n    _this.delete_btn.show();\n    \n}"
+           },
            "Boolean singleSelect" : true,
            "xtype" : "RowSelectionModel",
            "$ xns" : "Roo.bootstrap.Table",
           {
            "listeners" : {
             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_enum',\n        method :'POST',\n        params : {\n            id : record.data.id,\n            active: record.data.active\n        },\n        success : function() {\n\n        },\n        failure : function() \n        {\n            Roo.bootstrap.MessageBox.alert(\"Error\", \"saving failed\", function() {\n                _this.grid.footer.onClick('first');\n            });\n        }\n    });\n}",
-            "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){\n        this.removeAll();\n        return false;\n    }\n    \n    o.params.etype = sel.data.name;\n    \n}"
+            "beforeload" : "function (_self, o)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n    \n    o.params = o.params || {};\n    \n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){\n        this.removeAll();\n        return false;\n    }\n    \n    o.params.etype = sel.data.name;\n    \n}",
+            "load" : "function (_self, records, options)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n}"
            },
            "xtype" : "Store",
            "boolean remoteSort" : true,
            "$ xns" : "Roo.data",
-           "$ sortinfo" : "{ field : 'display_name', direction: 'ASC' }",
+           "$ sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
            "* prop" : "store",
            "items" : [
             {
            "xtype" : "ColumnModel",
            "Number xs" : 2,
            "$ xns" : "Roo.grid",
-           "$ renderer" : "function(v,x,r) { \n    var state = v > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
+           "$ renderer" : "function(v,x,r) { \n    \n    var state = v > 0 ? 'check-' : '';\n    \n    //return '<img class=\\\"x-grid-check-icon' + state + '\\\" src=\\\"' + Roo.BLANK_IMAGE_URL + '\\\"/>';\n    return '<i class=\"far fa-'+ state + 'square-o fa-2x\" aria-hidden=\"true\"></i>';\n}",
            "Boolean sortable" : false,
            "* prop" : "cm[]",
            "Number sm" : 2