PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminStaffGroups.bjs
1 {
2  "name" : "Pman.Dialog.BAdminStaffGroups",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaffGroups.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "4910043d0b2c8c864a0e8672716fee94" : "Is a Member",
10   "566a352f95c879ff26e50bad767a28dc" : "Group Membership",
11   "6b79852e4370cae80ee551e0671616bb" : "Manage Users Group",
12   "28974c2c793e780427dfb571b26443e6" : "Group Name",
13   "d3d2e617335f08df83599665eef8a418" : "Close"
14  },
15  "items" : [
16   {
17    "listeners" : {
18     "show" : "function (_self)\n{\n    this.setTitle(\"Manage Membership for \" + _this.data.name);\n     if(_this.option_grid){\n        _this.option_grid.store.load({});\n    }\n}",
19     "render" : "function (_self)\n{\n    _this.dialog = this;\n}"
20    },
21    "String size" : "md",
22    "xtype" : "Modal",
23    "Boolean fitwindow" : true,
24    "$ xns" : "Roo.bootstrap",
25    "Number max_width" : 500,
26    "String title" : "Manage Users Group",
27    "items" : [
28     {
29      "listeners" : {
30       "render" : "function (_self)\n{\n    _this.layout = _self;\n}"
31      },
32      "xtype" : "Border",
33      "$ xns" : "Roo.bootstrap.layout",
34      "items" : [
35       {
36        "xtype" : "Region",
37        "$ xns" : "Roo.bootstrap.layout",
38        "* prop" : "center"
39       },
40       {
41        "listeners" : {
42         "activate" : "function (_self)\n{\n   \n    \n}",
43         "render" : "function (_self)\n{\n    _this.option_panel = this;\n    \n    \n}"
44        },
45        "fitToFrame" : true,
46        "xtype" : "Grid",
47        "String region" : "center",
48        "$ xns" : "Roo.bootstrap.panel",
49        "fitContainer" : true,
50        "String title" : "Group Membership",
51        "Boolean background" : false,
52        "items" : [
53         {
54          "listeners" : {
55           "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.option_grid.colModel.getDataIndex(columnIndex);\n    \n    /*\n    if (di != 'is_in_group') {\n        return;\n    }\n     */\n    var rec = _this.option_grid.store.getAt(rowIndex);\n    \n    if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){\n        Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');\n        return;\n    }\n    \n    rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);\n    rec.commit();\n\n}",
56           "render" : "function (_self)\n{\n    _this.option_grid = this;\n    \n    this.store.load({})\n}"
57          },
58          "Boolean footerShow" : false,
59          "String cls" : "table-fixed",
60          "xtype" : "Table",
61          "$ xns" : "Roo.bootstrap",
62          "cellSelection" : true,
63          "Boolean loadMask" : true,
64          "* prop" : "grid",
65          "boolean condensed" : true,
66          "rowSelection" : false,
67          "items" : [
68           {
69            "Boolean singleSelect" : true,
70            "xtype" : "RowSelectionModel",
71            "$ xns" : "Roo.bootstrap.Table",
72            "* prop" : "sm"
73           },
74           {
75            "listeners" : {
76             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    \n    var params = {\n        user_ids : _this.data.id,\n        _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',\n        group_id : record.data.id\n    };\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Core_group',\n        method : 'POST',\n        params : params,\n        success : function() { \n            //_this.option_grid.ds.load({});\n        }\n  });\n}",
77             "beforeload" : "function (_self, options)\n{ \n    options.params = options.params || {};\n    \n    if(_this.data.id * 1 < 1){\n        _this.option_grid.el.mask('Please save the member first');\n        this.removeAll();\n        return false;\n    }\n    options.params.limit = 200;\n    options.params._is_in_group = _this.data.id;\n\n}"
78            },
79            "$ Object sortInfo" : "{ direction : 'ASC', field: 'display_name' }",
80            "xtype" : "Store",
81            "boolean remoteSort" : true,
82            "$ xns" : "Roo.data",
83            "* prop" : "store",
84            "items" : [
85             {
86              "$ url" : "baseURL + '/Roo/core_group'",
87              "xtype" : "HttpProxy",
88              "$ xns" : "Roo.data",
89              "String method" : "GET",
90              "* prop" : "proxy"
91             },
92             {
93              "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'display_name',\n        'type': 'string'\n    },\n    {\n        'name': 'is_in_group',\n        'type': 'int'\n    }\n]",
94              "xtype" : "JsonReader",
95              "String root" : "data",
96              "$ xns" : "Roo.data",
97              "String id" : "id",
98              "* prop" : "reader"
99             }
100            ]
101           },
102           {
103            "String header" : "Is a Member",
104            "String cursor" : "pointer",
105            "String dataIndex" : "is_in_group",
106            "xtype" : "ColumnModel",
107            "Number xs" : 3,
108            "String align" : "center",
109            "$ xns" : "Roo.grid",
110            "$ renderer" : "function(v) {  \n\n    var state = v > 0 ?  'check-' : '';\n    var cls = v > 0 ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n         \n }",
111            "Boolean sortable" : false,
112            "* prop" : "cm[]"
113           },
114           {
115            "String header" : "Group Name",
116            "cursor" : "pointer",
117            "String dataIndex" : "display_name",
118            "xtype" : "ColumnModel",
119            "Number xs" : 9,
120            "$ xns" : "Roo.grid",
121            "$ renderer" : "function(v,x,r) \n{\n    var vv = v.length ? v : r.data.name;\n    \n    return String.format('{0}', vv);\n}",
122            "Boolean sortable" : true,
123            "* prop" : "cm[]"
124           }
125          ]
126         }
127        ]
128       }
129      ]
130     },
131     {
132      "listeners" : {
133       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    _this.callback();\n    \n    return;\n\n}"
134      },
135      "String weight" : "primary",
136      "xtype" : "Button",
137      "$ xns" : "Roo.bootstrap",
138      "String html" : "Close",
139      "* prop" : "buttons[]"
140     }
141    ]
142   }
143  ]
144 }