PHP8
[Pman.BAdmin] / Pman.Tab.BAdminCoreEnum.bjs
1 {
2  "name" : "Pman.Tab.BAdminCoreEnum",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Tab.BAdminCoreEnum.bjs",
6  "permname" : "",
7  "modOrder" : "005",
8  "strings" : {
9   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
10   "2df80d5febcde0c10a66818488622b7c" : "Pulldown Options",
11   "7dce122004969d56ae2e0245cb754d35" : "Edit",
12   "01abfc750a0c942167651c40d088531d" : "#",
13   "dae8ace18bdcbcc6ae5aece263e14fe8" : "Options",
14   "b48968e1c912da07df5e8d6d246291ec" : "Display Name",
15   "f2d346b1bb7c1c85ab6f7f21e3666b9f" : "Types",
16   "49ee3087348e8d44e1feda1917443987" : "Name",
17   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
18   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active"
19  },
20  "items" : [
21   {
22    "xtype" : "Nest",
23    "$ xns" : "Roo.bootstrap.panel",
24    "String title" : "Pulldown Options",
25    "Boolean background" : true,
26    "items" : [
27     {
28      "xtype" : "Border",
29      "$ xns" : "Roo.bootstrap.layout",
30      "* prop" : "layout",
31      "items" : [
32       {
33        "String tabPosition" : "top",
34        "xtype" : "Region",
35        "Boolean hideTabs" : true,
36        "$ xns" : "Roo.bootstrap.layout",
37        "* prop" : "center"
38       },
39       {
40        "String tabPosition" : "top",
41        "Number width" : 350,
42        "xtype" : "Region",
43        "Boolean hideTabs" : true,
44        "$ xns" : "Roo.bootstrap.layout",
45        "* prop" : "west",
46        "Boolean split" : true
47       },
48       {
49        "listeners" : {
50         "activate" : "function (_self)\n{\n    _this.type_edit_btn.hide();\n    \n    if(_this.type_grid) {\n        _this.type_grid.footer.onClick('first');\n    }\n}",
51         "render" : "function (_self)\n{\n    _this.type_panel = _self; \n}"
52        },
53        "Boolean fitContainer" : true,
54        "xtype" : "Grid",
55        "Boolean fitToFrame" : true,
56        "String region" : "west",
57        "$ xns" : "Roo.bootstrap.panel",
58        "String title" : "Types",
59        "Boolean background" : false,
60        "Boolean closable" : false,
61        "items" : [
62         {
63          "xtype" : "NavSimplebar",
64          "$ xns" : "Roo.bootstrap",
65          "* prop" : "toolbar",
66          "items" : [
67           {
68            "xtype" : "NavGroup",
69            "$ xns" : "Roo.bootstrap",
70            "items" : [
71             {
72              "xtype" : "NavItem",
73              "$ xns" : "Roo.bootstrap",
74              "items" : [
75               {
76                "xtype" : "Element",
77                "$ xns" : "Roo.bootstrap",
78                "items" : [
79                 {
80                  "String cls" : "roo-toolbar",
81                  "xtype" : "Row",
82                  "$ xns" : "Roo.bootstrap",
83                  "items" : [
84                   {
85                    "Number md" : 12,
86                    "xtype" : "Column",
87                    "$ xns" : "Roo.bootstrap",
88                    "items" : [
89                     {
90                      "listeners" : {
91                       "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n\n}"
92                      },
93                      "String cls" : "roo-toolbar-button",
94                      "String weight" : "default",
95                      "xtype" : "Button",
96                      "$ xns" : "Roo.bootstrap",
97                      "String html" : "Add",
98                      "String glyphicon" : "plus"
99                     },
100                     {
101                      "listeners" : {
102                       "render" : "function (_self)\n{\n    _this.type_edit_btn = this;\n    \n    this.hide();\n}",
103                       "click" : "function (_self, e)\n{\n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n}"
104                      },
105                      "String cls" : "roo-toolbar-button",
106                      "String weight" : "default",
107                      "xtype" : "Button",
108                      "$ xns" : "Roo.bootstrap",
109                      "String html" : "Edit",
110                      "String glyphicon" : "edit"
111                     }
112                    ]
113                   }
114                  ]
115                 }
116                ]
117               }
118              ]
119             }
120            ]
121           }
122          ]
123         },
124         {
125          "listeners" : {
126           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    var r = _this.type_grid.store.getAt(rowIndex);\n    \n    if(!r || r.data.id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : r.data.id\n    }, function(res) {\n        _this.type_grid.footer.onClick('first');\n    });\n}",
127           "render" : "function (_self)\n{\n    _this.type_grid = _self; \n   \n}"
128          },
129          "String cls" : "table-fixed",
130          "Boolean cellSelection" : true,
131          "boolean hover" : true,
132          "boolean striped" : false,
133          "xtype" : "Table",
134          "Boolean rowSelection" : true,
135          "$ xns" : "Roo.bootstrap",
136          "Boolean loadMask" : true,
137          "* prop" : "grid",
138          "items" : [
139           {
140            "listeners" : {
141             "selectionchange" : "function (_self)\n{\n    _this.type_edit_btn.hide();\n    \n    if(this.getSelected()){\n        _this.type_edit_btn.show();\n    }\n    \n    _this.option_grid.store.load({});\n}"
142            },
143            "Boolean singleSelect" : true,
144            "xtype" : "RowSelectionModel",
145            "$ xns" : "Roo.bootstrap.Table",
146            "* prop" : "sm"
147           },
148           {
149            "listeners" : {
150             "beforeload" : "function (_self, o)\n{\n      if (!Pman.buildCompleted) {\n        return false;\n    }\n    \n    o.params = o.params || {};\n    \n    o.params['query[empty_etype]'] = 1;\n    \n}",
151             "load" : "function (_self, records, options)\n{\n    _this.type_edit_btn.hide();\n}"
152            },
153            "$ Object sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
154            "xtype" : "Store",
155            "boolean remoteSort" : true,
156            "$ xns" : "Roo.data",
157            "* prop" : "store",
158            "items" : [
159             {
160              "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'etype',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'display_name',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'seqid',\n        'type': 'int'\n    }\n]",
161              "xtype" : "JsonReader",
162              "String root" : "data",
163              "$ xns" : "Roo.data",
164              "String id" : "id",
165              "* prop" : "reader",
166              "String totalProperty" : "total"
167             },
168             {
169              "$ url" : "baseURL + '/Roo/core_enum.php'",
170              "xtype" : "HttpProxy",
171              "$ xns" : "Roo.data",
172              "String method" : "GET",
173              "* prop" : "proxy"
174             }
175            ]
176           },
177           {
178            "String header" : "Name",
179            "String cursor" : "pointer",
180            "String dataIndex" : "display_name",
181            "xtype" : "ColumnModel",
182            "Number xs" : 12,
183            "$ xns" : "Roo.grid",
184            "$ renderer" : "function(v,x,r) {\n    if (v.match(/Coba/g) || v.match(/Risk Question/g)) {\n        return String.format('<span tooltip=\"{1}\">Coba: {0}</span>', v, r.data.name);\n    }\n    \n    return String.format('<span tooltip=\"{1}\">{0}</span>', v, r.data.name); \n}",
185            "Boolean sortable" : true,
186            "* prop" : "cm[]"
187           },
188           {
189            "Number pageSize" : 100,
190            "Boolean displayInfo" : false,
191            "xtype" : "PagingToolbar",
192            "$ xns" : "Roo.bootstrap",
193            "* prop" : "footer",
194            "string name" : "footer"
195           }
196          ]
197         }
198        ]
199       },
200       {
201        "listeners" : {
202         "activate" : "function (_self)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n    \n    if (_this.option_grid) {\n        _this.option_grid.store.load({});\n    }\n}",
203         "render" : "function (_self)\n{\n    _this.option_panel = _self;\n}"
204        },
205        "Boolean fitContainer" : true,
206        "xtype" : "Grid",
207        "Boolean fitToFrame" : true,
208        "String region" : "center",
209        "$ xns" : "Roo.bootstrap.panel",
210        "String title" : "Options",
211        "Boolean background" : false,
212        "items" : [
213         {
214          "xtype" : "NavSimplebar",
215          "$ xns" : "Roo.bootstrap",
216          "* prop" : "toolbar",
217          "items" : [
218           {
219            "xtype" : "NavGroup",
220            "$ xns" : "Roo.bootstrap",
221            "items" : [
222             {
223              "xtype" : "NavItem",
224              "$ xns" : "Roo.bootstrap",
225              "items" : [
226               {
227                "xtype" : "Element",
228                "$ xns" : "Roo.bootstrap",
229                "items" : [
230                 {
231                  "String cls" : "roo-toolbar",
232                  "xtype" : "Row",
233                  "$ xns" : "Roo.bootstrap",
234                  "items" : [
235                   {
236                    "Number md" : 12,
237                    "xtype" : "Column",
238                    "$ xns" : "Roo.bootstrap",
239                    "items" : [
240                     {
241                      "listeners" : {
242                       "click" : "function (_self, e)\n{\n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : 0,\n        etype : sel.data.name\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
243                      },
244                      "String cls" : "roo-toolbar-button",
245                      "String weight" : "default",
246                      "xtype" : "Button",
247                      "$ xns" : "Roo.bootstrap",
248                      "String html" : "Add",
249                      "String glyphicon" : "plus"
250                     },
251                     {
252                      "listeners" : {
253                       "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.hide();\n}",
254                       "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n\n}"
255                      },
256                      "String cls" : "roo-toolbar-button",
257                      "String weight" : "default",
258                      "xtype" : "Button",
259                      "$ xns" : "Roo.bootstrap",
260                      "String html" : "Edit",
261                      "String glyphicon" : "edit"
262                     },
263                     {
264                      "listeners" : {
265                       "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.hide();\n}",
266                       "click" : "function (_self, e)\n{\n    var sel = _this.option_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');\n        return;\n    }\n\n    new Pman.Request({\n        url: baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            _delete : sel.data.id\n        }, \n        success : function(res) {\n            _this.option_grid.store.load({});\n        }\n    });\n\n}"
267                      },
268                      "String cls" : "roo-toolbar-button",
269                      "String weight" : "primary",
270                      "xtype" : "Button",
271                      "$ xns" : "Roo.bootstrap",
272                      "String html" : "Delete",
273                      "String glyphicon" : "trash"
274                     }
275                    ]
276                   }
277                  ]
278                 }
279                ]
280               }
281              ]
282             }
283            ]
284           }
285          ]
286         },
287         {
288          "listeners" : {
289           "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    var sel = _this.option_grid.store.getAt(rowIndex);\n    \n    if(!sel || sel.data.id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.BAdminCoreEnum.show({ \n        id : sel.data.id\n    }, function(res) {\n        _this.option_grid.store.load({});\n    });\n    \n}",
290           "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n    var di = _this.option_grid.colModel.getDataIndex(columnIndex);\n    \n    if (di != 'active') {\n        return;\n    }\n     \n    var rec = _this.option_grid.store.getAt(rowIndex);\n    \n    rec.set('active', rec.data.active ? 0 : 1);\n    \n    rec.commit();\n    \n    /*if(rec.data.active * 1 != 1){\n        var el = _this.option_grid.getRowDom(rowIndex);\n        \n        el.addClass('x-grid-row-fadeout');\n        \n        el.on('transitionend',function(){\n            _this.option_grid.ds.remove(rec);\n            el.remove();\n        },this,{single:true});\n    }*/\n}",
291           "render" : "function (_self)\n{\n    _this.option_grid = _self; \n\n}"
292          },
293          "Boolean cellSelection" : true,
294          "String cls" : "table-fixed",
295          "Boolean footerShow" : false,
296          "boolean hover" : true,
297          "boolean striped" : true,
298          "xtype" : "Table",
299          "Boolean rowSelection" : true,
300          "$ xns" : "Roo.bootstrap",
301          "Boolean loadMask" : true,
302          "* prop" : "grid",
303          "items" : [
304           {
305            "listeners" : {
306             "selectionchange" : "function (_self)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n    \n    if (!this.getSelected()) {\n        return;\n    }\n    \n    _this.edit_btn.show();\n    _this.delete_btn.show();\n    \n}"
307            },
308            "Boolean singleSelect" : true,
309            "xtype" : "RowSelectionModel",
310            "$ xns" : "Roo.bootstrap.Table",
311            "* prop" : "sm"
312           },
313           {
314            "listeners" : {
315             "update" : "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_enum',\n        method :'POST',\n        params : {\n            id : record.data.id,\n            active: record.data.active\n        },\n        success : function() {\n\n        },\n        failure : function() \n        {\n            Roo.bootstrap.MessageBox.alert(\"Error\", \"saving failed\", function() {\n                _this.grid.footer.onClick('first');\n            });\n        }\n    });\n}",
316             "beforeload" : "function (_self, o)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n    \n    o.params = o.params || {};\n    \n    var sel = _this.type_grid.getSelectionModel().getSelected();\n    \n    if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){\n        this.removeAll();\n        return false;\n    }\n    \n    o.params.etype = sel.data.name;\n    \n}",
317             "load" : "function (_self, records, options)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n}"
318            },
319            "xtype" : "Store",
320            "boolean remoteSort" : true,
321            "$ xns" : "Roo.data",
322            "$ sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
323            "* prop" : "store",
324            "items" : [
325             {
326              "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'etype',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'display_name',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'seqid',\n        'type': 'int'\n    }\n]",
327              "xtype" : "JsonReader",
328              "String root" : "data",
329              "$ xns" : "Roo.data",
330              "String id" : "id",
331              "* prop" : "reader",
332              "String totalProperty" : "total"
333             },
334             {
335              "$ url" : "baseURL + '/Roo/core_enum.php'",
336              "xtype" : "HttpProxy",
337              "$ xns" : "Roo.data",
338              "String method" : "GET",
339              "* prop" : "proxy"
340             }
341            ]
342           },
343           {
344            "String header" : "#",
345            "String cursor" : "pointer",
346            "String dataIndex" : "id",
347            "Number md" : 2,
348            "xtype" : "ColumnModel",
349            "Number xs" : 2,
350            "$ xns" : "Roo.grid",
351            "$ renderer" : "function(v,x,r) {\n    //console.log(r.data.seqid);\n    //return String.format('{0}', v ? v : '');\n    \n    return \n        String.format('{0}', r.data.seqid ? r.data.seqid : '')\n        +\" <span style='color:lightgrey'>\"\n        + String.format('{0}', r.data.id ? r.data.id : '')\n        +\"</span>\";\n}",
352            "Boolean sortable" : false,
353            "* prop" : "cm[]",
354            "Number sm" : 2
355           },
356           {
357            "String header" : "Name",
358            "String cursor" : "pointer",
359            "Number md" : 4,
360            "String dataIndex" : "name",
361            "xtype" : "ColumnModel",
362            "Number xs" : 4,
363            "$ xns" : "Roo.grid",
364            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
365            "Boolean sortable" : false,
366            "* prop" : "cm[]",
367            "Number sm" : 4
368           },
369           {
370            "String header" : "Display Name",
371            "String cursor" : "pointer",
372            "String dataIndex" : "display_name",
373            "Number md" : 4,
374            "xtype" : "ColumnModel",
375            "Number xs" : 4,
376            "$ xns" : "Roo.grid",
377            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
378            "Boolean sortable" : false,
379            "* prop" : "cm[]",
380            "Number sm" : 4
381           },
382           {
383            "String header" : "Active",
384            "String cursor" : "pointer",
385            "Number md" : 2,
386            "String dataIndex" : "active",
387            "xtype" : "ColumnModel",
388            "Number xs" : 2,
389            "$ xns" : "Roo.grid",
390            "$ renderer" : "function(v,x,r) { \n    \n    var state = v > 0 ? 'check-' : '';\n    \n    //return '<img class=\\\"x-grid-check-icon' + state + '\\\" src=\\\"' + Roo.BLANK_IMAGE_URL + '\\\"/>';\n    return '<i class=\"far fa-'+ state + 'square-o fa-2x\" aria-hidden=\"true\"></i>';\n}",
391            "Boolean sortable" : false,
392            "* prop" : "cm[]",
393            "Number sm" : 2
394           }
395          ]
396         }
397        ]
398       }
399      ]
400     }
401    ]
402   }
403  ]
404 }