remove template
[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    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 responsive" : true,
236          "Boolean rowSelection" : true,
237          "$ xns" : "Roo.bootstrap",
238          "Boolean loadMask" : true,
239          "* prop" : "grid",
240          "bool auto_hide_footer" : true,
241          "items" : [
242           {
243            "listeners" : {
244             "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}"
245            },
246            "xtype" : "RowSelectionModel",
247            "$ xns" : "Roo.bootstrap.Table",
248            "* prop" : "sm"
249           },
250           {
251            "listeners" : {
252             "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}",
253             "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]'] =    _this.searchBox.getValue();\n    \n    options.params['query[in_group]'] = group.data.id;\n  \n}",
254             "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}"
255            },
256            "xtype" : "Store",
257            "boolean remoteSort" : true,
258            "$ xns" : "Roo.data",
259            "$ sortInfo" : "{ field: 'name', direction: 'ASC' }",
260            "* prop" : "store",
261            "items" : [
262             {
263              "xtype" : "JsonReader",
264              "String root" : "data",
265              "$ xns" : "Roo.data",
266              "String id" : "id",
267              "* prop" : "reader",
268              "String totalProperty" : "total"
269             },
270             {
271              "$ url" : "baseURL + '/Roo/core_person'",
272              "xtype" : "HttpProxy",
273              "$ xns" : "Roo.data",
274              "String method" : "GET",
275              "* prop" : "proxy"
276             }
277            ]
278           },
279           {
280            "String cursor" : "pointer",
281            "String header" : "Active",
282            "Number md" : 1,
283            "String dataIndex" : "active",
284            "xtype" : "ColumnModel",
285            "Number xs" : 1,
286            "String align" : "center",
287            "$ xns" : "Roo.grid",
288            "$ 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 }",
289            "Boolean sortable" : true,
290            "* prop" : "cm[]",
291            "Number sm" : 1
292           },
293           {
294            "String header" : "Name",
295            "String cursor" : "pointer",
296            "Number md" : 3,
297            "String dataIndex" : "name",
298            "xtype" : "ColumnModel",
299            "Number xs" : 3,
300            "$ xns" : "Roo.grid",
301            "$ 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}",
302            "Boolean sortable" : true,
303            "* prop" : "cm[]",
304            "Number sm" : 3
305           },
306           {
307            "String header" : "Role / Position",
308            "String cursor" : "pointer",
309            "Number md" : 2,
310            "String dataIndex" : "role",
311            "xtype" : "ColumnModel",
312            "Number xs" : 2,
313            "$ xns" : "Roo.grid",
314            "$ renderer" : "function(v) { return String.format('{0}', v); }",
315            "Boolean sortable" : true,
316            "* prop" : "cm[]",
317            "Number sm" : 2
318           },
319           {
320            "String header" : "Groups",
321            "String cursor" : "pointer",
322            "Number md" : 2,
323            "String dataIndex" : "member_of",
324            "xtype" : "ColumnModel",
325            "Number xs" : 2,
326            "$ xns" : "Roo.grid",
327            "$ renderer" : "function(v) {\n     return String.format('{0}', v).split(\"\\n\").join(\"<br/>\"); \n }",
328            "* prop" : "cm[]",
329            "Number sm" : 2
330           },
331           {
332            "String header" : "Email",
333            "String cursor" : "pointer",
334            "Number md" : 4,
335            "String dataIndex" : "email",
336            "xtype" : "ColumnModel",
337            "Number xs" : 4,
338            "$ xns" : "Roo.grid",
339            "$ 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}",
340            "Boolean sortable" : true,
341            "* prop" : "cm[]",
342            "Number sm" : 2
343           },
344           {
345            "Number pageSize" : 25,
346            "Boolean displayInfo" : false,
347            "xtype" : "PagingToolbar",
348            "$ xns" : "Roo.bootstrap",
349            "* prop" : "footer",
350            "string name" : "footer",
351            "items" : [
352             {
353              "listeners" : {
354               "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}",
355               "render" : "function (_self)\n{\n    _this.footerActiveBtn = this;\n}"
356              },
357              "String cls" : "roo-toolbar-button",
358              "String _offtext" : "Show Inactive",
359              "String weight" : "default",
360              "bool pressed" : false,
361              "xtype" : "Button",
362              "String _ontext" : "Hide Inactive",
363              "$ xns" : "Roo.bootstrap",
364              "String html" : "Show Inactive",
365              "* prop" : "buttons[]",
366              "string name" : "activeButton"
367             }
368            ]
369           }
370          ]
371         }
372        ]
373       },
374       {
375        "listeners" : {
376         "activate" : "function (_self)\n{\n    if(_this.permission_grid) {\n        _this.permission_grid.store.load({});\n    }\n}",
377         "render" : "function (_self)\n{\n    _this.permission_panel = this;\n}"
378        },
379        "Boolean fitContainer" : true,
380        "xtype" : "Grid",
381        "Boolean fitToFrame" : true,
382        "String region" : "center",
383        "$ xns" : "Roo.bootstrap.panel",
384        "String title" : "Permission List",
385        "Boolean background" : true,
386        "Boolean closable" : false,
387        "items" : [
388         {
389          "listeners" : {
390           "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}",
391           "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}"
392          },
393          "Boolean footerShow" : false,
394          "Boolean cellSelection" : true,
395          "String cls" : "table-fixed",
396          "boolean striped" : true,
397          "boolean hover" : true,
398          "xtype" : "Table",
399          "boolean responsive" : true,
400          "Boolean rowSelection" : true,
401          "$ xns" : "Roo.bootstrap",
402          "Boolean loadMask" : true,
403          "* prop" : "grid",
404          "items" : [
405           {
406            "Boolean singleSelect" : true,
407            "xtype" : "RowSelectionModel",
408            "$ xns" : "Roo.bootstrap.Table",
409            "* prop" : "sm"
410           },
411           {
412            "listeners" : {
413             "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}",
414             "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}"
415            },
416            "xtype" : "Store",
417            "boolean remoteSort" : true,
418            "$ xns" : "Roo.data",
419            "$ sortInfo" : "{ field: 'rightname', direction: 'ASC' }",
420            "* prop" : "store",
421            "items" : [
422             {
423              "$ 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]",
424              "xtype" : "JsonReader",
425              "String root" : "data",
426              "$ xns" : "Roo.data",
427              "String id" : "id",
428              "* prop" : "reader",
429              "String totalProperty" : "total"
430             },
431             {
432              "xtype" : "HttpProxy",
433              "$ xns" : "Roo.data",
434              "String method" : "GET",
435              "* prop" : "proxy",
436              "$ String url" : "baseURL + '/BAdmin/GroupRights.php'"
437             }
438            ]
439           },
440           {
441            "String header" : "[All]",
442            "String dataIndex" : "id",
443            "$ 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",
444            "xtype" : "ColumnModel",
445            "Number xs" : 1,
446            "String align" : "center",
447            "$ xns" : "Roo.grid",
448            "Boolean sortable" : false,
449            "* prop" : "cm[]"
450           },
451           {
452            "String header" : "Module",
453            "String dataIndex" : "rightname",
454            "$ Function renderer" : "function (v) {\n    return String.format('<span tooltip=\"{1}\">{0}</span>', v.split('.').shift(), v);\n}",
455            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 0 : 2",
456            "xtype" : "ColumnModel",
457            "$ xns" : "Roo.grid",
458            "$ Boolean hidden" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 1 : 0",
459            "* prop" : "cm[]"
460           },
461           {
462            "String header" : "Description",
463            "String dataIndex" : "descript",
464            "$ Function renderer" : "function (v) {\n    return String.format('{0}', v ? v : '');\n}",
465            "$ Number xs" : "appDisabled.indexOf('Core.SuperAdmin') > 0 ? 6 : 4",
466            "xtype" : "ColumnModel",
467            "$ xns" : "Roo.grid",
468            "* prop" : "cm[]"
469           },
470           {
471            "String header" : "Add",
472            "String dataIndex" : "add",
473            "$ 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}",
474            "xtype" : "ColumnModel",
475            "Number xs" : 1,
476            "String align" : "center",
477            "$ xns" : "Roo.grid",
478            "Boolean sortable" : false,
479            "* prop" : "cm[]"
480           },
481           {
482            "String header" : "Edit",
483            "String dataIndex" : "edit",
484            "$ 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}",
485            "xtype" : "ColumnModel",
486            "Number xs" : 1,
487            "String align" : "center",
488            "$ xns" : "Roo.grid",
489            "Boolean sortable" : false,
490            "* prop" : "cm[]"
491           },
492           {
493            "String header" : "Delete",
494            "String dataIndex" : "delete",
495            "$ 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}",
496            "xtype" : "ColumnModel",
497            "Number xs" : 1,
498            "String align" : "center",
499            "$ xns" : "Roo.grid",
500            "Boolean sortable" : false,
501            "* prop" : "cm[]"
502           },
503           {
504            "String header" : "List / View",
505            "String dataIndex" : "view",
506            "$ 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}",
507            "xtype" : "ColumnModel",
508            "Number xs" : 1,
509            "String align" : "center",
510            "$ xns" : "Roo.grid",
511            "Boolean sortable" : false,
512            "* prop" : "cm[]"
513           },
514           {
515            "String header" : "Print / Export",
516            "String dataIndex" : "print",
517            "$ 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}",
518            "xtype" : "ColumnModel",
519            "Number xs" : 1,
520            "String align" : "center",
521            "$ xns" : "Roo.grid",
522            "Boolean sortable" : false,
523            "* prop" : "cm[]"
524           }
525          ]
526         }
527        ]
528       },
529       {
530        "listeners" : {
531         "activate" : "function (_self)\n{\n    if (_this.group_grid) {\n        _this.group_grid.store.load({});\n    }\n}",
532         "render" : "function (_self)\n{\n    _this.group_panel = _self;\n}"
533        },
534        "Boolean fitContainer" : true,
535        "xtype" : "Grid",
536        "Boolean fitToFrame" : true,
537        "String region" : "west",
538        "$ xns" : "Roo.bootstrap.panel",
539        "String title" : "Groups",
540        "Boolean background" : false,
541        "items" : [
542         {
543          "xtype" : "NavSimplebar",
544          "$ xns" : "Roo.bootstrap",
545          "* prop" : "toolbar",
546          "items" : [
547           {
548            "xtype" : "NavGroup",
549            "$ xns" : "Roo.bootstrap",
550            "items" : [
551             {
552              "String cls" : "account-management-group-nav-item",
553              "xtype" : "NavItem",
554              "$ xns" : "Roo.bootstrap",
555              "items" : [
556               {
557                "xtype" : "Button",
558                "$ xns" : "Roo.bootstrap",
559                "String html" : "Manage Groups",
560                "items" : [
561                 {
562                  "xtype" : "Menu",
563                  "$ xns" : "Roo.bootstrap",
564                  "* prop" : "menu",
565                  "items" : [
566                   {
567                    "listeners" : {
568                     "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminGroups.show({ id : 0 }, function(res){\n        _this.group_grid.store.load({});\n    });\n}"
569                    },
570                    "Boolean preventDefault" : true,
571                    "xtype" : "MenuItem",
572                    "String fa" : "fa fa-plus",
573                    "$ xns" : "Roo.bootstrap",
574                    "Boolean isContainer" : false,
575                    "String html" : "Add"
576                   },
577                   {
578                    "listeners" : {
579                     "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}"
580                    },
581                    "Boolean preventDefault" : true,
582                    "xtype" : "MenuItem",
583                    "String fa" : "fa fa-pencil",
584                    "$ xns" : "Roo.bootstrap",
585                    "Boolean isContainer" : false,
586                    "String html" : "Edit"
587                   },
588                   {
589                    "listeners" : {
590                     "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}"
591                    },
592                    "Boolean preventDefault" : true,
593                    "xtype" : "MenuItem",
594                    "String fa" : "fa fa-trash",
595                    "$ xns" : "Roo.bootstrap",
596                    "Boolean isContainer" : false,
597                    "String html" : "Delete"
598                   },
599                   {
600                    "listeners" : {
601                     "click" : "function (_self, e)\n{\n    _this.group_grid.store.load({});\n}"
602                    },
603                    "Boolean preventDefault" : true,
604                    "xtype" : "MenuItem",
605                    "String fa" : "fa fa-refresh",
606                    "$ xns" : "Roo.bootstrap",
607                    "Boolean isContainer" : false,
608                    "String html" : "Reload"
609                   }
610                  ]
611                 }
612                ]
613               }
614              ]
615             }
616            ]
617           }
618          ]
619         },
620         {
621          "listeners" : {
622           "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}",
623           "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}",
624           "render" : "function (_self)\n{\n    _this.group_grid = _self; \n\n    if (_this.group_panel.active) {\n        _this.group_grid.store.load({});\n    }\n}"
625          },
626          "String cls" : "table-fixed",
627          "Boolean footerShow" : false,
628          "boolean hover" : true,
629          "boolean striped" : true,
630          "xtype" : "Table",
631          "boolean responsive" : true,
632          "Boolean rowSelection" : true,
633          "$ xns" : "Roo.bootstrap",
634          "Boolean loadMask" : true,
635          "* prop" : "grid",
636          "items" : [
637           {
638            "listeners" : {
639             "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}"
640            },
641            "Boolean singleSelect" : true,
642            "xtype" : "RowSelectionModel",
643            "$ xns" : "Roo.bootstrap.Table",
644            "* prop" : "sm"
645           },
646           {
647            "listeners" : {
648             "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}"
649            },
650            "xtype" : "Store",
651            "boolean remoteSort" : true,
652            "$ xns" : "Roo.data",
653            "$ sortInfo" : "{ field: 'name', direction: 'ASC'}",
654            "* prop" : "store",
655            "items" : [
656             {
657              "$ 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]",
658              "xtype" : "JsonReader",
659              "String root" : "data",
660              "$ xns" : "Roo.data",
661              "String id" : "id",
662              "* prop" : "reader",
663              "String totalProperty" : "total"
664             },
665             {
666              "$ url" : "baseURL + '/Roo/core_group'",
667              "xtype" : "HttpProxy",
668              "$ xns" : "Roo.data",
669              "String method" : "GET",
670              "* prop" : "proxy"
671             }
672            ]
673           },
674           {
675            "String header" : "Name",
676            "String cursor" : "pointer",
677            "Number md" : 12,
678            "String dataIndex" : "name",
679            "xtype" : "ColumnModel",
680            "Number xs" : 12,
681            "$ xns" : "Roo.grid",
682            "$ 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}",
683            "Boolean sortable" : false,
684            "* prop" : "cm[]",
685            "Number sm" : 12
686           }
687          ]
688         }
689        ]
690       }
691      ]
692     }
693    ]
694   }
695  ]
696 }