BS4 support
[Pman.BAdmin] / Pman.Tab.BAdminStaff.bjs
1 {
2  "name" : "Pman.Tab.BAdminStaff",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "",
5  "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Tab.BAdminStaff.bjs",
6  "permname" : "",
7  "modOrder" : "003",
8  "strings" : {
9   "b15aafc19dc2ba4b788adf77268d8ca4" : "Hide Inactive",
10   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
11   "f29c99f082755399839b64ebaf9f608a" : "List / View",
12   "4f3cdff2e6a5e08440be182ef40d93f7" : "Print / Export",
13   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
14   "a37ede293936e29279ed543129451ec3" : "Groups",
15   "7dce122004969d56ae2e0245cb754d35" : "Edit",
16   "05b763f7d24f32575493b3c23f299b0e" : "Add To Group",
17   "e0a7cc944485bdedafb92b0cf98632fa" : "Remove From Group",
18   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
19   "25f57527ae8a27c94fb5230b5486c743" : "Permission List",
20   "09f0c5159c5e34504e453eff3fc70324" : "Account Management",
21   "054176c3a541fb2d4b63e29360c749aa" : "Members List",
22   "8a25a3ae30ab6e8ceb5b8c4009a3336f" : "Role / Position",
23   "17050e1914aff1e423a84e76db8ab0d1" : "[All]",
24   "5bc3fd20294c17c9803942958fd7f26d" : "Show Inactive",
25   "4d1c8263ba1036754f8db14a98f9f006" : "Reload",
26   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
27   "ec3249f16ee5880d4c1acb752e5c925f" : "Switch to Selected User",
28   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
29   "49ee3087348e8d44e1feda1917443987" : "Name",
30   "e55f75a29310d7b60f7ac1d390c8ae42" : "Module",
31   "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
32   "aba9f7d7443652e858969bfc280690b1" : "Manage Groups"
33  },
34  "named_strings" : {
35   "activeButton_offtext" : "5bc3fd20294c17c9803942958fd7f26d",
36   "activeButton_ontext" : "b15aafc19dc2ba4b788adf77268d8ca4",
37   "activeButton_html" : "5bc3fd20294c17c9803942958fd7f26d"
38  },
39  "items" : [
40   {
41    "listeners" : {
42     "activate" : "function (_self)\n{\n    if ( _this.group_grid) {\n         _this.group_grid.store.load({});\n    }\n}"
43    },
44    "xtype" : "Nest",
45    "$ xns" : "Roo.bootstrap.panel",
46    "String title" : "Account Management",
47    "Boolean background" : true,
48    "items" : [
49     {
50      "xtype" : "Border",
51      "$ xns" : "Roo.bootstrap.layout",
52      "* prop" : "layout",
53      "items" : [
54       {
55        "String tabPosition" : "top",
56        "xtype" : "Region",
57        "$ xns" : "Roo.bootstrap.layout",
58        "* prop" : "center"
59       },
60       {
61        "String tabPosition" : "top",
62        "Number width" : 250,
63        "xtype" : "Region",
64        "$ xns" : "Roo.bootstrap.layout",
65        "* prop" : "west",
66        "Boolean split" : true
67       },
68       {
69        "listeners" : {
70         "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}",
71         "render" : "function (_self)\n{\n    _this.member_panel = _self; \n}"
72        },
73        "Boolean fitContainer" : true,
74        "xtype" : "Grid",
75        "Boolean fitToFrame" : true,
76        "String region" : "center",
77        "$ xns" : "Roo.bootstrap.panel",
78        "String title" : "Members List",
79        "Boolean background" : false,
80        "Boolean closable" : false,
81        "items" : [
82         {
83          "xtype" : "NavSimplebar",
84          "$ xns" : "Roo.bootstrap",
85          "* prop" : "toolbar",
86          "items" : [
87           {
88            "xtype" : "NavGroup",
89            "$ xns" : "Roo.bootstrap",
90            "String style" : "width: 100%;",
91            "items" : [
92             {
93              "xtype" : "NavItem",
94              "$ xns" : "Roo.bootstrap",
95              "String style" : "width: 100%;",
96              "items" : [
97               {
98                "xtype" : "Element",
99                "$ xns" : "Roo.bootstrap",
100                "String style" : "width: 100%;",
101                "items" : [
102                 {
103                  "String cls" : "roo-toolbar",
104                  "xtype" : "Row",
105                  "$ xns" : "Roo.bootstrap",
106                  "items" : [
107                   {
108                    "Number md" : 9,
109                    "xtype" : "Column",
110                    "$ xns" : "Roo.bootstrap",
111                    "items" : [
112                     {
113                      "listeners" : {
114                       "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}"
115                      },
116                      "String cls" : "roo-toolbar-button",
117                      "String weight" : "default",
118                      "xtype" : "Button",
119                      "$ xns" : "Roo.bootstrap",
120                      "String html" : "Add",
121                      "String glyphicon" : "plus"
122                     },
123                     {
124                      "listeners" : {
125                       "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
126                       "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}"
127                      },
128                      "String cls" : "roo-toolbar-button",
129                      "String weight" : "default",
130                      "xtype" : "Button",
131                      "$ xns" : "Roo.bootstrap",
132                      "String html" : "Edit",
133                      "String glyphicon" : "edit"
134                     },
135                     {
136                      "listeners" : {
137                       "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
138                       "click" : "function (_self, e)\n{\n    // from pman.js\n    Pman.genericDelete(_this.member_panel, 'core_person');\n    \n    \n}"
139                      },
140                      "String cls" : "roo-toolbar-button",
141                      "String weight" : "primary",
142                      "xtype" : "Button",
143                      "$ xns" : "Roo.bootstrap",
144                      "String html" : "Delete",
145                      "String glyphicon" : "trash"
146                     },
147                     {
148                      "listeners" : {
149                       "render" : "function (_self)\n{\n    _this.addToGroupBtn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
150                       "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}"
151                      },
152                      "String cls" : "roo-toolbar-button",
153                      "String weight" : "default",
154                      "xtype" : "Button",
155                      "$ xns" : "Roo.bootstrap",
156                      "String html" : "Add To Group",
157                      "String glyphicon" : "plus"
158                     },
159                     {
160                      "listeners" : {
161                       "render" : "function (_self)\n{\n    _this.removeFromGroupBtn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
162                       "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}"
163                      },
164                      "String cls" : "roo-toolbar-button",
165                      "String weight" : "default",
166                      "xtype" : "Button",
167                      "$ xns" : "Roo.bootstrap",
168                      "String html" : "Remove From Group",
169                      "String glyphicon" : "trash"
170                     },
171                     {
172                      "listeners" : {
173                       "render" : "function (_self)\n{\n    _this.switch_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
174                       "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}"
175                      },
176                      "String cls" : "roo-toolbar-button",
177                      "String weight" : "default",
178                      "xtype" : "Button",
179                      "$ xns" : "Roo.bootstrap",
180                      "String html" : "Switch to Selected User",
181                      "String glyphicon" : "user"
182                     }
183                    ]
184                   },
185                   {
186                    "Number md" : 3,
187                    "String cls" : "text-right",
188                    "xtype" : "Column",
189                    "$ xns" : "Roo.bootstrap",
190                    "items" : [
191                     {
192                      "listeners" : {
193                       "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}",
194                       "render" : "function (_self)\n{\n    _this.footerActiveBtn = this;\n}"
195                      },
196                      "String cls" : "roo-toolbar-button",
197                      "String _offtext" : "Show Inactive",
198                      "String weight" : "default",
199                      "bool pressed" : false,
200                      "xtype" : "Button",
201                      "String _ontext" : "Hide Inactive",
202                      "$ xns" : "Roo.bootstrap",
203                      "String html" : "Show Inactive",
204                      "string name" : "activeButton"
205                     }
206                    ]
207                   }
208                  ]
209                 }
210                ]
211               }
212              ]
213             }
214            ]
215           }
216          ]
217         },
218         {
219          "listeners" : {
220           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    var s = _this.member_grid.store.getAt(rowIndex);\n    \n    if(s.data.id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.BAdminStaff.show( { id : s.data.id }, function() {\n        _this.member_grid.footer.onClick('first');\n    });\n}",
221           "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}",
222           "render" : "function (_self)\n{\n    _this.member_grid = _self;\n   \n}"
223          },
224          "String cls" : "table-fixed",
225          "Boolean cellSelection" : true,
226          "boolean hover" : true,
227          "boolean striped" : false,
228          "xtype" : "Table",
229          "boolean responsive" : true,
230          "Boolean rowSelection" : true,
231          "$ xns" : "Roo.bootstrap",
232          "Boolean loadMask" : true,
233          "* prop" : "grid",
234          "bool auto_hide_footer" : true,
235          "items" : [
236           {
237            "listeners" : {
238             "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}"
239            },
240            "xtype" : "RowSelectionModel",
241            "$ xns" : "Roo.bootstrap.Table",
242            "* prop" : "sm"
243           },
244           {
245            "listeners" : {
246             "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}",
247             "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['query[in_group]'] = group.data.id;\n  \n}",
248             "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}"
249            },
250            "xtype" : "Store",
251            "boolean remoteSort" : true,
252            "$ xns" : "Roo.data",
253            "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
254            "* prop" : "store",
255            "items" : [
256             {
257              "xtype" : "JsonReader",
258              "String root" : "data",
259              "$ xns" : "Roo.data",
260              "String id" : "id",
261              "* prop" : "reader",
262              "String totalProperty" : "total"
263             },
264             {
265              "$ url" : "baseURL + '/Roo/core_person'",
266              "xtype" : "HttpProxy",
267              "$ xns" : "Roo.data",
268              "String method" : "GET",
269              "* prop" : "proxy"
270             }
271            ]
272           },
273           {
274            "String cursor" : "pointer",
275            "String header" : "Active",
276            "Number md" : 1,
277            "String dataIndex" : "active",
278            "xtype" : "ColumnModel",
279            "Number xs" : 1,
280            "String align" : "center",
281            "$ xns" : "Roo.grid",
282            "$ 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 }",
283            "Boolean sortable" : true,
284            "* prop" : "cm[]",
285            "Number sm" : 1
286           },
287           {
288            "String header" : "Name",
289            "String cursor" : "pointer",
290            "Number md" : 3,
291            "String dataIndex" : "name",
292            "xtype" : "ColumnModel",
293            "Number xs" : 3,
294            "$ xns" : "Roo.grid",
295            "$ 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}",
296            "Boolean sortable" : true,
297            "* prop" : "cm[]",
298            "Number sm" : 3
299           },
300           {
301            "String header" : "Role / Position",
302            "String cursor" : "pointer",
303            "Number md" : 2,
304            "String dataIndex" : "role",
305            "xtype" : "ColumnModel",
306            "Number xs" : 2,
307            "$ xns" : "Roo.grid",
308            "$ renderer" : "function(v) { return String.format('{0}', v); }",
309            "Boolean sortable" : true,
310            "* prop" : "cm[]",
311            "Number sm" : 2
312           },
313           {
314            "String header" : "Phone",
315            "String cursor" : "pointer",
316            "Number md" : 2,
317            "String dataIndex" : "phone",
318            "xtype" : "ColumnModel",
319            "Number xs" : 2,
320            "$ xns" : "Roo.grid",
321            "$ renderer" : "function(v) { return String.format('{0}', v); }",
322            "* prop" : "cm[]",
323            "Number sm" : 2
324           },
325           {
326            "String header" : "Email",
327            "String cursor" : "pointer",
328            "Number md" : 4,
329            "String dataIndex" : "email",
330            "xtype" : "ColumnModel",
331            "Number xs" : 4,
332            "$ xns" : "Roo.grid",
333            "$ 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}",
334            "Boolean sortable" : true,
335            "* prop" : "cm[]",
336            "Number sm" : 2
337           },
338           {
339            "Number pageSize" : 25,
340            "Boolean displayInfo" : false,
341            "xtype" : "PagingToolbar",
342            "$ xns" : "Roo.bootstrap",
343            "* prop" : "footer",
344            "string name" : "footer"
345           }
346          ]
347         }
348        ]
349       },
350       {
351        "listeners" : {
352         "activate" : "function (_self)\n{\n    if(_this.permission_grid) {\n        _this.permission_grid.store.load({});\n    }\n}",
353         "render" : "function (_self)\n{\n    _this.permission_panel = this;\n}"
354        },
355        "Boolean fitContainer" : true,
356        "xtype" : "Grid",
357        "Boolean fitToFrame" : true,
358        "String region" : "center",
359        "$ xns" : "Roo.bootstrap.panel",
360        "String title" : "Permission List",
361        "Boolean background" : true,
362        "Boolean closable" : false,
363        "items" : [
364         {
365          "listeners" : {
366           "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}",
367           "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}"
368          },
369          "Boolean footerShow" : false,
370          "Boolean cellSelection" : true,
371          "String cls" : "table-fixed",
372          "boolean striped" : true,
373          "boolean hover" : true,
374          "xtype" : "Table",
375          "boolean responsive" : true,
376          "Boolean rowSelection" : true,
377          "$ xns" : "Roo.bootstrap",
378          "Boolean loadMask" : true,
379          "* prop" : "grid",
380          "items" : [
381           {
382            "Boolean singleSelect" : true,
383            "xtype" : "RowSelectionModel",
384            "$ xns" : "Roo.bootstrap.Table",
385            "* prop" : "sm"
386           },
387           {
388            "listeners" : {
389             "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}",
390             "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}"
391            },
392            "xtype" : "Store",
393            "boolean remoteSort" : true,
394            "$ xns" : "Roo.data",
395            "$ sortInfo" : "{ field: 'rightname', direction: 'ASC' }",
396            "* prop" : "store",
397            "items" : [
398             {
399              "$ 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]",
400              "xtype" : "JsonReader",
401              "String root" : "data",
402              "$ xns" : "Roo.data",
403              "String id" : "id",
404              "* prop" : "reader",
405              "String totalProperty" : "total"
406             },
407             {
408              "xtype" : "HttpProxy",
409              "$ xns" : "Roo.data",
410              "String method" : "GET",
411              "* prop" : "proxy",
412              "$ String url" : "baseURL + '/BAdmin/GroupRights.php'"
413             }
414            ]
415           },
416           {
417            "String header" : "[All]",
418            "String dataIndex" : "id",
419            "$ 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",
420            "xtype" : "ColumnModel",
421            "Number xs" : 1,
422            "String align" : "center",
423            "$ xns" : "Roo.grid",
424            "Boolean sortable" : false,
425            "* prop" : "cm[]"
426           },
427           {
428            "String header" : "Module",
429            "String dataIndex" : "rightname",
430            "$ Function renderer" : "function (v) {\n    return String.format('<span tooltip=\"{1}\">{0}</span>', v.split('.').shift(), v);\n}",
431            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 0 : 2",
432            "xtype" : "ColumnModel",
433            "$ xns" : "Roo.grid",
434            "$ Boolean hidden" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 1 : 0",
435            "* prop" : "cm[]"
436           },
437           {
438            "String header" : "Description",
439            "String dataIndex" : "descript",
440            "$ Function renderer" : "function (v) {\n    return String.format('{0}', v ? v : '');\n}",
441            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 6 : 4",
442            "xtype" : "ColumnModel",
443            "$ xns" : "Roo.grid",
444            "* prop" : "cm[]"
445           },
446           {
447            "String header" : "Add",
448            "String dataIndex" : "add",
449            "$ 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}",
450            "xtype" : "ColumnModel",
451            "Number xs" : 1,
452            "String align" : "center",
453            "$ xns" : "Roo.grid",
454            "Boolean sortable" : false,
455            "* prop" : "cm[]"
456           },
457           {
458            "String header" : "Edit",
459            "String dataIndex" : "edit",
460            "$ 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}",
461            "xtype" : "ColumnModel",
462            "Number xs" : 1,
463            "String align" : "center",
464            "$ xns" : "Roo.grid",
465            "Boolean sortable" : false,
466            "* prop" : "cm[]"
467           },
468           {
469            "String header" : "Delete",
470            "String dataIndex" : "delete",
471            "$ 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}",
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" : "List / View",
481            "String dataIndex" : "view",
482            "$ 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}",
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" : "Print / Export",
492            "String dataIndex" : "print",
493            "$ 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}",
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         }
503        ]
504       },
505       {
506        "listeners" : {
507         "activate" : "function (_self)\n{\n    if (_this.group_grid) {\n        _this.group_grid.store.load({});\n    }\n}",
508         "render" : "function (_self)\n{\n    _this.group_panel = _self;\n}"
509        },
510        "Boolean fitContainer" : true,
511        "xtype" : "Grid",
512        "Boolean fitToFrame" : true,
513        "String region" : "west",
514        "$ xns" : "Roo.bootstrap.panel",
515        "String title" : "Groups",
516        "Boolean background" : false,
517        "items" : [
518         {
519          "xtype" : "NavSimplebar",
520          "$ xns" : "Roo.bootstrap",
521          "* prop" : "toolbar",
522          "items" : [
523           {
524            "xtype" : "NavGroup",
525            "$ xns" : "Roo.bootstrap",
526            "items" : [
527             {
528              "String cls" : "account-management-group-nav-item",
529              "xtype" : "NavItem",
530              "$ xns" : "Roo.bootstrap",
531              "items" : [
532               {
533                "xtype" : "Button",
534                "$ xns" : "Roo.bootstrap",
535                "String html" : "Manage Groups",
536                "items" : [
537                 {
538                  "xtype" : "Menu",
539                  "$ xns" : "Roo.bootstrap",
540                  "* prop" : "menu",
541                  "items" : [
542                   {
543                    "listeners" : {
544                     "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminGroups.show({ id : 0 }, function(res){\n        _this.group_grid.store.load({});\n    });\n}"
545                    },
546                    "Boolean preventDefault" : true,
547                    "xtype" : "MenuItem",
548                    "String fa" : "fa fa-plus",
549                    "$ xns" : "Roo.bootstrap",
550                    "Boolean isContainer" : false,
551                    "String html" : "Add"
552                   },
553                   {
554                    "listeners" : {
555                     "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}"
556                    },
557                    "Boolean preventDefault" : true,
558                    "xtype" : "MenuItem",
559                    "String fa" : "fa fa-pencil",
560                    "$ xns" : "Roo.bootstrap",
561                    "Boolean isContainer" : false,
562                    "String html" : "Edit"
563                   },
564                   {
565                    "listeners" : {
566                     "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}"
567                    },
568                    "Boolean preventDefault" : true,
569                    "xtype" : "MenuItem",
570                    "String fa" : "fa fa-trash",
571                    "$ xns" : "Roo.bootstrap",
572                    "Boolean isContainer" : false,
573                    "String html" : "Delete"
574                   },
575                   {
576                    "listeners" : {
577                     "click" : "function (_self, e)\n{\n    _this.group_grid.store.load({});\n}"
578                    },
579                    "Boolean preventDefault" : true,
580                    "xtype" : "MenuItem",
581                    "String fa" : "fa fa-refresh",
582                    "$ xns" : "Roo.bootstrap",
583                    "Boolean isContainer" : false,
584                    "String html" : "Reload"
585                   }
586                  ]
587                 }
588                ]
589               }
590              ]
591             }
592            ]
593           }
594          ]
595         },
596         {
597          "listeners" : {
598           "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}",
599           "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}",
600           "render" : "function (_self)\n{\n    _this.group_grid = _self; \n\n    if (_this.group_panel.active) {\n        _this.group_grid.store.load({});\n    }\n}"
601          },
602          "String cls" : "table-fixed",
603          "Boolean footerShow" : false,
604          "boolean hover" : true,
605          "boolean striped" : true,
606          "xtype" : "Table",
607          "boolean responsive" : true,
608          "Boolean rowSelection" : true,
609          "$ xns" : "Roo.bootstrap",
610          "Boolean loadMask" : true,
611          "* prop" : "grid",
612          "items" : [
613           {
614            "listeners" : {
615             "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}"
616            },
617            "Boolean singleSelect" : true,
618            "xtype" : "RowSelectionModel",
619            "$ xns" : "Roo.bootstrap.Table",
620            "* prop" : "sm"
621           },
622           {
623            "listeners" : {
624             "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;\n\n}"
625            },
626            "xtype" : "Store",
627            "boolean remoteSort" : true,
628            "$ xns" : "Roo.data",
629            "$ sortInfo" : "{ field: 'name', direction: 'ASC'}",
630            "* prop" : "store",
631            "items" : [
632             {
633              "$ 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]",
634              "xtype" : "JsonReader",
635              "String root" : "data",
636              "$ xns" : "Roo.data",
637              "String id" : "id",
638              "* prop" : "reader",
639              "String totalProperty" : "total"
640             },
641             {
642              "$ url" : "baseURL + '/Roo/core_group'",
643              "xtype" : "HttpProxy",
644              "$ xns" : "Roo.data",
645              "String method" : "GET",
646              "* prop" : "proxy"
647             }
648            ]
649           },
650           {
651            "String header" : "Name",
652            "String cursor" : "pointer",
653            "Number md" : 12,
654            "String dataIndex" : "name",
655            "xtype" : "ColumnModel",
656            "Number xs" : 12,
657            "$ xns" : "Roo.grid",
658            "$ 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}",
659            "Boolean sortable" : false,
660            "* prop" : "cm[]",
661            "Number sm" : 12
662           }
663          ]
664         }
665        ]
666       }
667      ]
668     }
669    ]
670   }
671  ]
672 }