PHP8
[Pman.BAdmin] / Pman.Tab.BAdminStaff.bjs
1 {
2  "name" : "Pman.Tab.BAdminStaff",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Tab.BAdminStaff.bjs",
6  "permname" : "",
7  "modOrder" : "003",
8  "strings" : {
9   "cdb6b6bab1fd18b9dbfe3fb84a5d34ae" : "<i class=\"fa fa-search\"></i>",
10   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
11   "b15aafc19dc2ba4b788adf77268d8ca4" : "Hide Inactive",
12   "f29c99f082755399839b64ebaf9f608a" : "List / View",
13   "4f3cdff2e6a5e08440be182ef40d93f7" : "Print / Export",
14   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
15   "a37ede293936e29279ed543129451ec3" : "Groups",
16   "7dce122004969d56ae2e0245cb754d35" : "Edit",
17   "05b763f7d24f32575493b3c23f299b0e" : "Add To Group",
18   "9bac86fd9f499d47cea5f2fd70d701c1" : "search for account",
19   "e0a7cc944485bdedafb92b0cf98632fa" : "Remove From Group",
20   "25f57527ae8a27c94fb5230b5486c743" : "Permission List",
21   "09f0c5159c5e34504e453eff3fc70324" : "Account Management",
22   "054176c3a541fb2d4b63e29360c749aa" : "Members List",
23   "8a25a3ae30ab6e8ceb5b8c4009a3336f" : "Role / Position",
24   "17050e1914aff1e423a84e76db8ab0d1" : "[All]",
25   "5bc3fd20294c17c9803942958fd7f26d" : "Show Inactive",
26   "4d1c8263ba1036754f8db14a98f9f006" : "Reload",
27   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
28   "ec3249f16ee5880d4c1acb752e5c925f" : "Switch to Selected User",
29   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
30   "49ee3087348e8d44e1feda1917443987" : "Name",
31   "e55f75a29310d7b60f7ac1d390c8ae42" : "Module",
32   "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
33   "aba9f7d7443652e858969bfc280690b1" : "Manage Groups"
34  },
35  "named_strings" : {
36   "activeButton_offtext" : "5bc3fd20294c17c9803942958fd7f26d",
37   "activeButton_ontext" : "b15aafc19dc2ba4b788adf77268d8ca4",
38   "activeButton_html" : "5bc3fd20294c17c9803942958fd7f26d"
39  },
40  "items" : [
41   {
42    "listeners" : {
43     "activate" : "function (_self)\n{\n    if ( _this.group_grid) {\n         _this.group_grid.store.load({});\n    }\n}"
44    },
45    "xtype" : "Nest",
46    "$ xns" : "Roo.bootstrap.panel",
47    "String title" : "Account Management",
48    "Boolean background" : true,
49    "items" : [
50     {
51      "xtype" : "Border",
52      "$ xns" : "Roo.bootstrap.layout",
53      "* prop" : "layout",
54      "items" : [
55       {
56        "String tabPosition" : "top",
57        "xtype" : "Region",
58        "$ xns" : "Roo.bootstrap.layout",
59        "* prop" : "center"
60       },
61       {
62        "String tabPosition" : "top",
63        "Number width" : 250,
64        "xtype" : "Region",
65        "$ xns" : "Roo.bootstrap.layout",
66        "* prop" : "west",
67        "Boolean split" : true
68       },
69       {
70        "listeners" : {
71         "activate" : "function (_self)\n{\n    _this.edit_btn.el.hide();\n    _this.delete_btn.el.hide();\n    _this.addToGroupBtn.el.hide();\n    _this.removeFromGroupBtn.el.hide();\n    _this.switch_btn.el.hide();\n\n    if(_this.member_grid) {\n        _this.member_grid.footer.onClick('first');\n    }\n}",
72         "render" : "function (_self)\n{\n    _this.member_panel = _self; \n}"
73        },
74        "Boolean fitContainer" : true,
75        "xtype" : "Grid",
76        "Boolean fitToFrame" : true,
77        "String region" : "center",
78        "$ xns" : "Roo.bootstrap.panel",
79        "String title" : "Members List",
80        "Boolean background" : false,
81        "Boolean closable" : false,
82        "items" : [
83         {
84          "xtype" : "NavSimplebar",
85          "$ xns" : "Roo.bootstrap",
86          "* prop" : "toolbar",
87          "items" : [
88           {
89            "xtype" : "NavGroup",
90            "$ xns" : "Roo.bootstrap",
91            "String style" : "width: 100%;",
92            "items" : [
93             {
94              "xtype" : "NavItem",
95              "$ xns" : "Roo.bootstrap",
96              "String style" : "width: 100%;",
97              "items" : [
98               {
99                "xtype" : "Element",
100                "$ xns" : "Roo.bootstrap",
101                "String style" : "width: 100%;",
102                "items" : [
103                 {
104                  "String cls" : "roo-toolbar",
105                  "xtype" : "Row",
106                  "$ xns" : "Roo.bootstrap",
107                  "items" : [
108                   {
109                    "Number md" : 3,
110                    "xtype" : "Column",
111                    "$ xns" : "Roo.bootstrap",
112                    "items" : [
113                     {
114                      "listeners" : {
115                       "specialkey" : "function (_self, e)\n{    \n     if(e.keyCode == e.ENTER) {\n        if (_this.member_grid) {\n            _this.member_grid.footer.onClick('first'); \n        }\n    \n    }\n    \n}",
116                       "render" : "function (_self)\n{\n    _this.searchBox = this;\n}"
117                      },
118                      "xtype" : "Input",
119                      "string placeholder" : "search for account",
120                      "$ xns" : "Roo.bootstrap",
121                      "items" : [
122                       {
123                        "listeners" : {
124                         "click" : "function (_self, e)\n{\n    _this.member_grid.footer.onClick('first');\n}"
125                        },
126                        "xtype" : "Button",
127                        "$ xns" : "Roo.bootstrap",
128                        "String html" : "<i class=\"fa fa-search\"></i>",
129                        "* prop" : "after"
130                       }
131                      ]
132                     }
133                    ]
134                   },
135                   {
136                    "Number md" : 9,
137                    "String cls" : "text-right",
138                    "xtype" : "Column",
139                    "$ xns" : "Roo.bootstrap",
140                    "items" : [
141                     {
142                      "listeners" : {
143                       "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminStaff.show({ \n        id : 0,\n        company_id : Pman.Login.authUser.company_id\n    }, function(res) {\n    \n        if(res.length_oath_key * 1 < 1){\n            _this.member_grid.footer.onClick('first');\n            return;\n        }\n        \n        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({\n            id : res.id,\n            allow_close: false,\n            allow_cancel : true\n        }, function(res){\n            _this.member_grid.footer.onClick('first');\n        });\n    }); \n\n}"
144                      },
145                      "String cls" : "roo-toolbar-button",
146                      "String weight" : "default",
147                      "xtype" : "Button",
148                      "$ xns" : "Roo.bootstrap",
149                      "String html" : "Add",
150                      "String glyphicon" : "plus"
151                     },
152                     {
153                      "listeners" : {
154                       "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
155                       "click" : "function (_self, e)\n{\n    var sel = _this.member_grid.getSelectionModel().getSelections();\n    \n    if(!sel.length){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person');\n        return;\n    }\n    \n    if(sel.length > 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a single person');\n        return;\n    }\n    \n    var s = _this.member_grid.getSelectionModel().getSelected();\n    \n    if(s.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Invalid person');\n        return;\n    }\n    \n    Pman.Dialog.BAdminStaff.show( { id : s.data.id }, function() {\n        _this.member_grid.footer.onClick('first');\n    });\n    \n}"
156                      },
157                      "String cls" : "roo-toolbar-button",
158                      "String weight" : "default",
159                      "xtype" : "Button",
160                      "$ xns" : "Roo.bootstrap",
161                      "String html" : "Edit",
162                      "String glyphicon" : "edit"
163                     },
164                     {
165                      "listeners" : {
166                       "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
167                       "click" : "function (_self, e)\n{\n    // from pman.js\n    Pman.genericDelete(_this.member_panel, 'core_person');\n    \n    \n}"
168                      },
169                      "String cls" : "roo-toolbar-button",
170                      "String weight" : "primary",
171                      "xtype" : "Button",
172                      "$ xns" : "Roo.bootstrap",
173                      "String html" : "Delete",
174                      "String glyphicon" : "trash"
175                     },
176                     {
177                      "listeners" : {
178                       "render" : "function (_self)\n{\n    _this.addToGroupBtn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
179                       "click" : "function (_self, e)\n{\n    var sel = _this.member_grid.getSelectionModel().getSelections();\n    \n    if(!sel.length){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person');\n        return;\n    }\n    \n    var ids = [];\n    \n    Roo.each(sel, function(r){\n        if(r.data.id * 1 < 1){\n            return;\n        }\n        \n        ids.push(r.data.id);\n    });\n    \n    if(!ids.length){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person');\n        return;\n    }\n    \n    Pman.Dialog.BAdminAddToGroup.show({\n        user_ids : ids.join(',')\n        \n    }, function(res){\n        _this.member_grid.footer.onClick('first');\n    });\n    \n}"
180                      },
181                      "String cls" : "roo-toolbar-button",
182                      "String weight" : "default",
183                      "xtype" : "Button",
184                      "$ xns" : "Roo.bootstrap",
185                      "String html" : "Add To Group",
186                      "String glyphicon" : "plus"
187                     },
188                     {
189                      "listeners" : {
190                       "render" : "function (_self)\n{\n    _this.removeFromGroupBtn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
191                       "click" : "function (_self, e)\n{\n    var sel = _this.member_grid.getSelectionModel().getSelections();\n    \n    if(!sel.length){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person');\n        return;\n    }\n    \n    var ids = [];\n    \n    Roo.each(sel, function(r){\n        if(r.data.id * 1 < 1){\n            return;\n        }\n        \n        ids.push(r.data.id);\n    });\n    \n    if(!ids.length){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person');\n        return;\n    }\n    \n    var group = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!group || group.data.id < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');\n        return;\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Core_group',\n        method: 'POST',\n        params: {\n            group_id : group.data.id,\n            _action : 'sub',\n            user_ids : ids.join(',')\n        },\n        success: function(res){\n            _this.member_grid.footer.onClick('first');\n            return;\n        }\n    });\n    \n    \n}"
192                      },
193                      "String cls" : "roo-toolbar-button",
194                      "String weight" : "default",
195                      "xtype" : "Button",
196                      "$ xns" : "Roo.bootstrap",
197                      "String html" : "Remove From Group",
198                      "String glyphicon" : "trash"
199                     },
200                     {
201                      "listeners" : {
202                       "render" : "function (_self)\n{\n    _this.switch_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
203                       "click" : "function (_self, e)\n{\n    var s = _this.member_grid.getSelectionModel().getSelections();\n    \n    if (s.length != 1)  {\n        Roo.MessageBox.alert(\"Error\",  \"Select a Person\");\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL+ '/Login.php',\n        params  :{\n            'switch' : s[0].data.id\n        },\n        method : 'GET',\n        success : function() {\n            document.location = baseURL + '?ts=' + Math.random();\n            \n        }, \n        failure : function(d) {\n            Roo.log(d);\n            Roo.MessageBox.alert(\"Error\",  d);\n        }\n    });\n}"
204                      },
205                      "String cls" : "roo-toolbar-button",
206                      "String weight" : "default",
207                      "xtype" : "Button",
208                      "$ xns" : "Roo.bootstrap",
209                      "String html" : "Switch to Selected User",
210                      "String glyphicon" : "user"
211                     }
212                    ]
213                   }
214                  ]
215                 }
216                ]
217               }
218              ]
219             }
220            ]
221           }
222          ]
223         },
224         {
225          "listeners" : {
226           "celldblclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.member_grid.colModel.getDataIndex(columnIndex);\n\n    if (di == 'active') {\n        return;\n    }\n    var s = _this.member_grid.store.getAt(rowIndex);\n    \n    if(s.data.id * 1 < 1){\n        return;\n    }\n    \n    if (di == 'member_of') {\n        Pman.Dialog.BAdminStaffGroups.show(   s.data , function() {\n            _this.member_grid.footer.onClick('first');\n        });\n        return;\n    }\n    // show edit user dialog..\n    \n    \n    \n    Pman.Dialog.BAdminStaff.show( s.data , function() {\n        _this.member_grid.footer.onClick('first');\n    });\n     \n}",
227           "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.member_grid.colModel.getDataIndex(columnIndex);\n    \n    if (di != 'active') {\n        return;\n    }\n     \n    var rec = _this.member_grid.store.getAt(rowIndex);\n    \n    rec.set('active', rec.data.active ? 0 : 1);\n    rec.commit();\n\n    \n    // get the row number to make class x-row-0, x-row-1\n    \n    if(rec.data.active * 1 != 1){\n        var el = _this.member_grid.getRowDom(rowIndex);\n        \n        el.addClass('x-grid-row-fadeout');\n        \n        el.on('transitionend',function(){\n            _this.member_grid.ds.remove(rec);\n            el.remove();\n        },this,{single:true});\n    }\n}",
228           "render" : "function (_self)\n{\n    _this.member_grid = _self;\n   \n}"
229          },
230          "String cls" : "table-fixed",
231          "Boolean cellSelection" : true,
232          "boolean hover" : true,
233          "boolean striped" : false,
234          "xtype" : "Table",
235          "Boolean rowSelection" : true,
236          "$ xns" : "Roo.bootstrap",
237          "Boolean loadMask" : true,
238          "* prop" : "grid",
239          "bool auto_hide_footer" : true,
240          "items" : [
241           {
242            "listeners" : {
243             "selectionchange" : "function (_self)\n{\n    _this.edit_btn.el.hide();\n    _this.delete_btn.el.hide();\n    _this.addToGroupBtn.el.hide();\n    _this.removeFromGroupBtn.el.hide();\n    _this.switch_btn.el.hide();\n    \n    if(!_this.member_grid.getSelectionModel().getSelections().length){\n        return;\n    }\n    \n    _this.edit_btn.el.show();\n    _this.delete_btn.el.show();\n    _this.switch_btn.el.show();\n    \n    var group = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!group || group.data.id < 1){\n        _this.addToGroupBtn.el.show();\n        return;\n    }\n    \n    _this.removeFromGroupBtn.el.show();\n    \n}"
244            },
245            "xtype" : "RowSelectionModel",
246            "$ xns" : "Roo.bootstrap.Table",
247            "* prop" : "sm"
248           },
249           {
250            "listeners" : {
251             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    // only used to change active status.\n     \n    new Pman.Request({\n        url : baseURL + '/Roo/core_person',\n        method :'POST',\n        params : {\n            id : record.data.id,\n            active: record.data.active\n            \n        },\n        success : function() {\n            // do nothing\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}",
252             "beforeload" : "function (_self, options)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n    options.params = options.params || {};\n    \n    //options.params['query[type]'] = 0;\n    //options.params.active = 1;\n    \n    if(!_this.group_grid){\n        this.removeAll();\n        return false;\n    }\n    \n    var group = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!group){\n        this.removeAll();\n        return false;\n    }\n    \n    if(_this.footerActiveBtn && !_this.footerActiveBtn.pressed){\n        options.params.active = 1;\n    } \n    \n    options.params._with_group_membership = 1;\n    options.params['query[name_or_email]'] =    _this.searchBox.getValue();\n    \n    options.params['query[in_group]'] = group.data.id;\n  \n}",
253             "load" : "function (_self, records, options)\n{\n    _this.edit_btn.el.hide();\n    _this.delete_btn.el.hide();\n    _this.addToGroupBtn.el.hide();\n    _this.removeFromGroupBtn.el.hide();\n    _this.switch_btn.el.hide();\n    \n    options.params.active = 1;\n    \n\n    \n}"
254            },
255            "xtype" : "Store",
256            "boolean remoteSort" : true,
257            "$ xns" : "Roo.data",
258            "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
259            "* prop" : "store",
260            "items" : [
261             {
262              "xtype" : "JsonReader",
263              "String root" : "data",
264              "$ xns" : "Roo.data",
265              "String id" : "id",
266              "* prop" : "reader",
267              "String totalProperty" : "total"
268             },
269             {
270              "$ url" : "baseURL + '/Roo/core_person'",
271              "xtype" : "HttpProxy",
272              "$ xns" : "Roo.data",
273              "String method" : "GET",
274              "* prop" : "proxy"
275             }
276            ]
277           },
278           {
279            "String cursor" : "pointer",
280            "String header" : "Active",
281            "Number md" : 1,
282            "String dataIndex" : "active",
283            "xtype" : "ColumnModel",
284            "Number xs" : 1,
285            "String align" : "center",
286            "$ xns" : "Roo.grid",
287            "$ 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 }",
288            "Boolean sortable" : true,
289            "* prop" : "cm[]",
290            "Number sm" : 1
291           },
292           {
293            "String header" : "Name",
294            "String cursor" : "pointer",
295            "Number md" : 3,
296            "String dataIndex" : "name",
297            "xtype" : "ColumnModel",
298            "Number xs" : 3,
299            "$ xns" : "Roo.grid",
300            "$ renderer" : "function(v,x,r) {\n    if(r.data.active * 1 != 1){\n        return \"<span class='cell-strikethrough'>\"+String.format('{0}', v)+\"</span>\"; \n    }\n    return String.format('{0}', v);\n}",
301            "Boolean sortable" : true,
302            "* prop" : "cm[]",
303            "Number sm" : 3
304           },
305           {
306            "String header" : "Role / Position",
307            "String cursor" : "pointer",
308            "Number md" : 2,
309            "String dataIndex" : "role",
310            "xtype" : "ColumnModel",
311            "Number xs" : 2,
312            "$ xns" : "Roo.grid",
313            "$ renderer" : "function(v) { return String.format('{0}', v); }",
314            "Boolean sortable" : true,
315            "* prop" : "cm[]",
316            "Number sm" : 2
317           },
318           {
319            "String header" : "Groups",
320            "String cursor" : "pointer",
321            "Number md" : 2,
322            "String dataIndex" : "member_of",
323            "xtype" : "ColumnModel",
324            "Number xs" : 2,
325            "$ xns" : "Roo.grid",
326            "$ renderer" : "function(v) {\n     return String.format('{0}', v).split(\"\\n\").join(\"<br/>\"); \n }",
327            "* prop" : "cm[]",
328            "Number sm" : 2
329           },
330           {
331            "String header" : "Email",
332            "String cursor" : "pointer",
333            "Number md" : 4,
334            "String dataIndex" : "email",
335            "xtype" : "ColumnModel",
336            "Number xs" : 4,
337            "$ xns" : "Roo.grid",
338            "$ renderer" : "function (v,x,r) {\n    if(r.data.active * 1 != 1){\n        return (v.length && v.indexOf('@') > 0 ) ? \n            String.format('<a href=\"mailto:{0}\" class=\"cell-strikethrough\">{0}</a>',v) : v;\n    }\n    return (v.length && v.indexOf('@') > 0 ) ? \n            String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n            \n}",
339            "Boolean sortable" : true,
340            "* prop" : "cm[]",
341            "Number sm" : 2
342           },
343           {
344            "Number pageSize" : 25,
345            "Boolean displayInfo" : false,
346            "xtype" : "PagingToolbar",
347            "$ xns" : "Roo.bootstrap",
348            "* prop" : "footer",
349            "string name" : "footer",
350            "items" : [
351             {
352              "listeners" : {
353               "toggle" : "function (_self, e, pressed)\n{\n    this.setText(this.pressed ? this._ontext : this._offtext);\n\n    _this.member_grid.footer.onClick('first');\n    \n    return;\n    \n}",
354               "render" : "function (_self)\n{\n    _this.footerActiveBtn = this;\n}"
355              },
356              "String cls" : "roo-toolbar-button",
357              "String _offtext" : "Show Inactive",
358              "String weight" : "default",
359              "bool pressed" : false,
360              "xtype" : "Button",
361              "String _ontext" : "Hide Inactive",
362              "$ xns" : "Roo.bootstrap",
363              "String html" : "Show Inactive",
364              "* prop" : "buttons[]",
365              "string name" : "activeButton"
366             }
367            ]
368           }
369          ]
370         }
371        ]
372       },
373       {
374        "listeners" : {
375         "activate" : "function (_self)\n{\n    if(_this.permission_grid) {\n        _this.permission_grid.store.load({});\n    }\n}",
376         "render" : "function (_self)\n{\n    _this.permission_panel = this;\n}"
377        },
378        "Boolean fitContainer" : true,
379        "xtype" : "Grid",
380        "Boolean fitToFrame" : true,
381        "String region" : "center",
382        "$ xns" : "Roo.bootstrap.panel",
383        "String title" : "Permission List",
384        "Boolean background" : true,
385        "Boolean closable" : false,
386        "items" : [
387         {
388          "listeners" : {
389           "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.permission_grid.colModel.getDataIndex(columnIndex);\n    \n    var r = _this.permission_grid.store.getAt(rowIndex);\n    \n    if(di == 'rightname' || di == 'descript' || r.data.id * 1 < 1) {\n        return;\n    }\n    \n    if(di == 'id'){\n        \n        var accessmask = r.data.accessmask.split('').sort().join('');\n        var fullmask = r.data.FullMask.split('').sort().join('');\n        \n        r.set('accessmask', (accessmask == fullmask) ? '' : r.data.FullMask);\n        \n        r.commit();\n        \n        return;\n    }\n    \n    var mapping = {\n        'add' : 'A',\n        'edit' : 'E',\n        'delete' : 'D',\n        'view' : 'S',\n        'print' : 'P'\n    };\n    \n    var target = mapping[di];\n    \n    if(r.data.FullMask.indexOf(target) === -1){\n        return;\n    }\n    \n    var accessmask = r.data.accessmask.split('');\n    \n    if(accessmask.indexOf(target) !== -1){\n        accessmask.splice(accessmask.indexOf(target), 1);\n    } else {\n        accessmask.push(target);\n    }\n    \n    r.set('accessmask', accessmask.sort().join(''));\n    \n    r.commit();\n    \n}",
390           "render" : "function (_self)\n{\n    _this.permission_grid = this;\n    \n    if(_this.permission_panel.active) {\n        (function(){\n            _this.permission_grid.store.load({});\n        }).defer(50);\n    }\n}"
391          },
392          "Boolean cellSelection" : true,
393          "String cls" : "table-fixed",
394          "Boolean footerShow" : false,
395          "boolean striped" : true,
396          "boolean hover" : true,
397          "xtype" : "Table",
398          "Boolean rowSelection" : true,
399          "$ xns" : "Roo.bootstrap",
400          "Boolean loadMask" : true,
401          "* prop" : "grid",
402          "items" : [
403           {
404            "Boolean singleSelect" : true,
405            "xtype" : "RowSelectionModel",
406            "$ xns" : "Roo.bootstrap.Table",
407            "* prop" : "sm"
408           },
409           {
410            "listeners" : {
411             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n\n    var group = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!group || group.data.id * 1 < 1){\n        return;\n    }\n    \n    var params = {};\n    \n    params.group_id = group.data.id;\n    \n    params['dataUpdate[' + record.data.id + ']'] = record.data.accessmask;\n    \n    new Pman.Request({\n        url : baseURL + '/Admin/GroupRights',\n        method :'POST',\n        params : params,\n        success : function() {\n            // do nothing\n        },\n        failure : function() \n        {\n            Roo.bootstrap.MessageBox.alert(\"Error\", \"saving failed\", function() {\n                _this.permission_grid.store.load({});\n            });\n        }\n    });\n    \n}",
412             "beforeload" : "function (_self, o)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n    var group = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!group){\n        _this.permission_panel.el.mask('Please select a group');\n        this.removeAll();\n        return false;\n    }\n    \n    if(group.data.id * 1 < 1){\n        _this.permission_panel.el.mask('Please select a group on the left');\n        this.removeAll();\n        return false;\n    }\n    \n    _this.permission_panel.el.unmask();\n    \n    o.params = o.params || {};\n     \n    o.params._sort = 1;    \n    o.params.group_id = group.data.id;\n\n}"
413            },
414            "xtype" : "Store",
415            "boolean remoteSort" : true,
416            "$ xns" : "Roo.data",
417            "$ sortInfo" : "{ field: 'rightname', direction: 'ASC' }",
418            "* prop" : "store",
419            "items" : [
420             {
421              "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'rightname',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'accessmask',\n        'type': 'string'\n    },\n    {\n        'name': 'FullMask',\n        'type': 'string'\n    },\n    {\n        'name': 'group_id',\n        'type': 'int'\n    }\n]",
422              "xtype" : "JsonReader",
423              "String root" : "data",
424              "$ xns" : "Roo.data",
425              "String id" : "id",
426              "* prop" : "reader",
427              "String totalProperty" : "total"
428             },
429             {
430              "xtype" : "HttpProxy",
431              "$ xns" : "Roo.data",
432              "String method" : "GET",
433              "* prop" : "proxy",
434              "$ String url" : "baseURL + '/BAdmin/GroupRights.php'"
435             }
436            ]
437           },
438           {
439            "String header" : "[All]",
440            "String dataIndex" : "id",
441            "$ Function renderer" : "function (v,x,r) {\n    \n    if (!r.data.FullMask.length) {\n        return '';\n    }\n    \n    var accessmask = r.data.accessmask.split('').sort().join('');\n    var fullmask = r.data.FullMask.split('').sort().join('');\n    \n    var state = (accessmask == fullmask) ? 'check-' : '';\n    \n    var cls = (accessmask == fullmask) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n    \n}\n",
442            "xtype" : "ColumnModel",
443            "Number xs" : 1,
444            "String align" : "center",
445            "$ xns" : "Roo.grid",
446            "Boolean sortable" : false,
447            "* prop" : "cm[]"
448           },
449           {
450            "String header" : "Module",
451            "String dataIndex" : "rightname",
452            "$ Function renderer" : "function (v) {\n    return String.format('<span tooltip=\"{1}\">{0}</span>', v.split('.').shift(), v);\n}",
453            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 0 : 2",
454            "xtype" : "ColumnModel",
455            "$ xns" : "Roo.grid",
456            "$ Boolean hidden" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 1 : 0",
457            "* prop" : "cm[]"
458           },
459           {
460            "String header" : "Description",
461            "String dataIndex" : "descript",
462            "$ Function renderer" : "function (v) {\n    return String.format('{0}', v ? v : '');\n}",
463            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 6 : 4",
464            "xtype" : "ColumnModel",
465            "$ xns" : "Roo.grid",
466            "* prop" : "cm[]"
467           },
468           {
469            "String header" : "Add",
470            "String dataIndex" : "add",
471            "$ Function renderer" : "function (v,x,r) {\n    \n    if (r.data.FullMask.indexOf('A') === -1) {\n        return '';\n    }\n    \n    var state = (r.data.accessmask.indexOf('A') !== -1) ? 'check-' : '';\n    var cls = (r.data.accessmask.indexOf('A') !== -1) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n}",
472            "xtype" : "ColumnModel",
473            "Number xs" : 1,
474            "String align" : "center",
475            "$ xns" : "Roo.grid",
476            "Boolean sortable" : false,
477            "* prop" : "cm[]"
478           },
479           {
480            "String header" : "Edit",
481            "String dataIndex" : "edit",
482            "$ Function renderer" : "function (v,x,r) {\n    \n    if (r.data.FullMask.indexOf('E') === -1) {\n        return '';\n    }\n    \n    var state = (r.data.accessmask.indexOf('E') !== -1) ? 'check-' : '';\n    var cls = (r.data.accessmask.indexOf('E') !== -1) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n}",
483            "xtype" : "ColumnModel",
484            "Number xs" : 1,
485            "String align" : "center",
486            "$ xns" : "Roo.grid",
487            "Boolean sortable" : false,
488            "* prop" : "cm[]"
489           },
490           {
491            "String header" : "Delete",
492            "String dataIndex" : "delete",
493            "$ Function renderer" : "function (v,x,r) {\n    \n    if (r.data.FullMask.indexOf('D') === -1) {\n        return '';\n    }\n    \n    var state = (r.data.accessmask.indexOf('D') !== -1) ? 'check-' : '';\n    var cls = (r.data.accessmask.indexOf('D') !== -1) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n    \n}",
494            "xtype" : "ColumnModel",
495            "Number xs" : 1,
496            "String align" : "center",
497            "$ xns" : "Roo.grid",
498            "Boolean sortable" : false,
499            "* prop" : "cm[]"
500           },
501           {
502            "String header" : "List / View",
503            "String dataIndex" : "view",
504            "$ Function renderer" : "function (v,x,r) {\n    \n    if (r.data.FullMask.indexOf('S') === -1) {\n        return '';\n    }\n    \n    var state = (r.data.accessmask.indexOf('S') !== -1) ? 'check-' : '';\n    var cls = (r.data.accessmask.indexOf('S') !== -1) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n    \n}",
505            "xtype" : "ColumnModel",
506            "Number xs" : 1,
507            "String align" : "center",
508            "$ xns" : "Roo.grid",
509            "Boolean sortable" : false,
510            "* prop" : "cm[]"
511           },
512           {
513            "String header" : "Print / Export",
514            "String dataIndex" : "print",
515            "$ Function renderer" : "function (v,x,r) {\n    \n    if (r.data.FullMask.indexOf('P') === -1) {\n        return '';\n    }\n    \n    var state = (r.data.accessmask.indexOf('P') !== -1) ? 'check-' : '';\n    var cls = (r.data.accessmask.indexOf('P') !== -1) ? 'text-primary' : '';\n    \n    return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n    \n}",
516            "xtype" : "ColumnModel",
517            "Number xs" : 1,
518            "String align" : "center",
519            "$ xns" : "Roo.grid",
520            "Boolean sortable" : false,
521            "* prop" : "cm[]"
522           }
523          ]
524         }
525        ]
526       },
527       {
528        "listeners" : {
529         "activate" : "function (_self)\n{\n    if (_this.group_grid) {\n        _this.group_grid.store.load({});\n    }\n}",
530         "render" : "function (_self)\n{\n    _this.group_panel = _self;\n}"
531        },
532        "Boolean fitContainer" : true,
533        "xtype" : "Grid",
534        "Boolean fitToFrame" : true,
535        "String region" : "west",
536        "$ xns" : "Roo.bootstrap.panel",
537        "String title" : "Groups",
538        "Boolean background" : false,
539        "items" : [
540         {
541          "xtype" : "NavSimplebar",
542          "$ xns" : "Roo.bootstrap",
543          "* prop" : "toolbar",
544          "items" : [
545           {
546            "xtype" : "NavGroup",
547            "$ xns" : "Roo.bootstrap",
548            "items" : [
549             {
550              "String cls" : "account-management-group-nav-item",
551              "xtype" : "NavItem",
552              "$ xns" : "Roo.bootstrap",
553              "items" : [
554               {
555                "xtype" : "Button",
556                "$ xns" : "Roo.bootstrap",
557                "String html" : "Manage Groups",
558                "items" : [
559                 {
560                  "xtype" : "Menu",
561                  "$ xns" : "Roo.bootstrap",
562                  "* prop" : "menu",
563                  "items" : [
564                   {
565                    "listeners" : {
566                     "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminGroups.show({ id : 0 }, function(res){\n        _this.group_grid.store.load({});\n    });\n}"
567                    },
568                    "Boolean preventDefault" : true,
569                    "xtype" : "MenuItem",
570                    "String fa" : "fa fa-plus",
571                    "$ xns" : "Roo.bootstrap",
572                    "Boolean isContainer" : false,
573                    "String html" : "Add"
574                   },
575                   {
576                    "listeners" : {
577                     "click" : "function (_self, e)\n{\n    var sel = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!sel){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');\n        return;\n    }\n    \n    if(sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');\n        return;\n    }\n    \n    Pman.Dialog.BAdminGroups.show({ id : sel.data.id }, function(res){\n        _this.group_grid.store.load({});\n    });\n}"
578                    },
579                    "Boolean preventDefault" : true,
580                    "xtype" : "MenuItem",
581                    "String fa" : "fa fa-pencil",
582                    "$ xns" : "Roo.bootstrap",
583                    "Boolean isContainer" : false,
584                    "String html" : "Edit"
585                   },
586                   {
587                    "listeners" : {
588                     "click" : "function (_self, e)\n{\n    var sel = _this.group_grid.getSelectionModel().getSelected();\n    \n    if(!sel){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');\n        return;\n    }\n    \n    if(sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');\n        return;\n    }\n    \n    var deleteIt = function()\n    {\n        new Pman.Request({\n            url: baseURL + '/Roo/Core_group',\n            method: 'POST',\n            params: {\n                _delete : sel.data.id\n            },\n            success: function(res){\n                _this.group_grid.store.load({});\n                return;\n            }\n        });\n    }\n    \n    Roo.bootstrap.MessageBox.confirm('Confirm', 'Are you sure to delete the group?',function(ret) {\n        \n        if(ret == 'no'){\n            return;\n        }\n        \n        deleteIt();\n        \n     }, this);\n    \n    \n}"
589                    },
590                    "Boolean preventDefault" : true,
591                    "xtype" : "MenuItem",
592                    "String fa" : "fa fa-trash",
593                    "$ xns" : "Roo.bootstrap",
594                    "Boolean isContainer" : false,
595                    "String html" : "Delete"
596                   },
597                   {
598                    "listeners" : {
599                     "click" : "function (_self, e)\n{\n    _this.group_grid.store.load({});\n}"
600                    },
601                    "Boolean preventDefault" : true,
602                    "xtype" : "MenuItem",
603                    "String fa" : "fa fa-refresh",
604                    "$ xns" : "Roo.bootstrap",
605                    "Boolean isContainer" : false,
606                    "String html" : "Reload"
607                   }
608                  ]
609                 }
610                ]
611               }
612              ]
613             }
614            ]
615           }
616          ]
617         },
618         {
619          "listeners" : {
620           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    var sel = _this.group_grid.store.getAt(rowIndex);\n    \n    if(!sel || sel.data.id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.BAdminGroups.show({ id : sel.data.id }, function(res){\n        _this.group_grid.store.load({});\n    });\n}",
621           "rowsrendered" : "function (_self)\n{\n    if(this.ds.getCount() * 1 < 1){\n        return;\n    }\n    \n    var sm = _this.group_grid.getSelectionModel();\n    \n    sm.selectFirstRow();\n    sm.fireEvent('afterselectionchange', sm);\n    \n}",
622           "render" : "function (_self)\n{\n    _this.group_grid = _self; \n\n    if (_this.group_panel.active) {\n        _this.group_grid.store.load({});\n    }\n}"
623          },
624          "String cls" : "table-fixed",
625          "Boolean footerShow" : false,
626          "boolean hover" : true,
627          "boolean striped" : true,
628          "xtype" : "Table",
629          "Boolean rowSelection" : true,
630          "$ xns" : "Roo.bootstrap",
631          "Boolean loadMask" : true,
632          "* prop" : "grid",
633          "items" : [
634           {
635            "listeners" : {
636             "afterselectionchange" : "function (_self)\n{\n    if(_this.footerActiveBtn){\n        _this.footerActiveBtn.setActive(false);\n        _this.footerActiveBtn.fireEvent('toggle', _this.footerActiveBtn);\n    }\n    \n    if(_this.permission_grid){\n        _this.permission_grid.store.load({});\n    }\n    \n}"
637            },
638            "Boolean singleSelect" : true,
639            "xtype" : "RowSelectionModel",
640            "$ xns" : "Roo.bootstrap.Table",
641            "* prop" : "sm"
642           },
643           {
644            "listeners" : {
645             "beforeload" : "function (_self, options)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n    options.params = options.params || {};\n    \n    options.params.type = 0;\n    \n    options.params._add_everyone = 1;\noptions.params.limit = 999;\n}"
646            },
647            "xtype" : "Store",
648            "boolean remoteSort" : true,
649            "$ xns" : "Roo.data",
650            "$ sortInfo" : "{ field: 'name', direction: 'ASC'}",
651            "* prop" : "store",
652            "items" : [
653             {
654              "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader',\n        'type': 'string'\n    },\n    {\n        'name': 'group_member_count',\n        'type': 'int'\n    },\n    {\n        'name': 'display_name',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    }\n]",
655              "xtype" : "JsonReader",
656              "String root" : "data",
657              "$ xns" : "Roo.data",
658              "String id" : "id",
659              "* prop" : "reader",
660              "String totalProperty" : "total"
661             },
662             {
663              "$ url" : "baseURL + '/Roo/core_group'",
664              "xtype" : "HttpProxy",
665              "$ xns" : "Roo.data",
666              "String method" : "GET",
667              "* prop" : "proxy"
668             }
669            ]
670           },
671           {
672            "String header" : "Name",
673            "String cursor" : "pointer",
674            "Number md" : 12,
675            "String dataIndex" : "name",
676            "xtype" : "ColumnModel",
677            "Number xs" : 12,
678            "$ xns" : "Roo.grid",
679            "$ renderer" : "function(v,x,r) { \n\n    if (r.data.id == 0) {\n        return '<b>' + \"All Staff\" + '</b>';\n    }\n    \n    if (r.data.id == -1) {\n        return '<b>' + \"Not in a Group\" + '</b>';\n    }\n\n    var vv = (r.json.display_name.length) ? r.json.display_name : v;\n    \n    if (v == 'Administrators') {\n        return '<b>' + vv + '</b>';\n    }\n    \n    if (r.data.leader) {\n        return vv + ' (' + r.json.leader_name + ')';\n    }\n    \n    return String.format('{0} ({1})',vv, r.json.group_member_count);\n}",
680            "Boolean sortable" : false,
681            "* prop" : "cm[]",
682            "Number sm" : 12
683           }
684          ]
685         }
686        ]
687       }
688      ]
689     }
690    ]
691   }
692  ]
693 }