Pman.Tab.BAdminCoreEnum.bjs
[Pman.BAdmin] / Pman.Tab.BAdminCoreEnum.bjs
1 {
2  "name" : "Pman.Tab.BAdminCoreEnum",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "",
5  "path" : "/home/edward/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 responsive" : true,
135          "Boolean rowSelection" : true,
136          "$ xns" : "Roo.bootstrap",
137          "Boolean loadMask" : true,
138          "* prop" : "grid",
139          "items" : [
140           {
141            "listeners" : {
142             "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}"
143            },
144            "Boolean singleSelect" : true,
145            "xtype" : "RowSelectionModel",
146            "$ xns" : "Roo.bootstrap.Table",
147            "* prop" : "sm"
148           },
149           {
150            "listeners" : {
151             "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params['query[empty_etype]'] = 1;\n    \n}",
152             "load" : "function (_self, records, options)\n{\n    _this.type_edit_btn.hide();\n}"
153            },
154            "$ Object sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
155            "xtype" : "Store",
156            "boolean remoteSort" : true,
157            "$ xns" : "Roo.data",
158            "* prop" : "store",
159            "items" : [
160             {
161              "$ 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]",
162              "xtype" : "JsonReader",
163              "String root" : "data",
164              "$ xns" : "Roo.data",
165              "String id" : "id",
166              "* prop" : "reader",
167              "String totalProperty" : "total"
168             },
169             {
170              "$ url" : "baseURL + '/Roo/core_enum.php'",
171              "xtype" : "HttpProxy",
172              "$ xns" : "Roo.data",
173              "String method" : "GET",
174              "* prop" : "proxy"
175             }
176            ]
177           },
178           {
179            "String header" : "Name",
180            "String cursor" : "pointer",
181            "String dataIndex" : "display_name",
182            "xtype" : "ColumnModel",
183            "Number xs" : 12,
184            "$ xns" : "Roo.grid",
185            "$ 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}",
186            "Boolean sortable" : true,
187            "* prop" : "cm[]"
188           },
189           {
190            "Number pageSize" : 100,
191            "Boolean displayInfo" : false,
192            "xtype" : "PagingToolbar",
193            "$ xns" : "Roo.bootstrap",
194            "* prop" : "footer",
195            "string name" : "footer"
196           }
197          ]
198         }
199        ]
200       },
201       {
202        "listeners" : {
203         "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}",
204         "render" : "function (_self)\n{\n    _this.option_panel = _self;\n}"
205        },
206        "Boolean fitContainer" : true,
207        "xtype" : "Grid",
208        "Boolean fitToFrame" : true,
209        "String region" : "center",
210        "$ xns" : "Roo.bootstrap.panel",
211        "String title" : "Options",
212        "Boolean background" : false,
213        "items" : [
214         {
215          "xtype" : "NavSimplebar",
216          "$ xns" : "Roo.bootstrap",
217          "* prop" : "toolbar",
218          "items" : [
219           {
220            "xtype" : "NavGroup",
221            "$ xns" : "Roo.bootstrap",
222            "items" : [
223             {
224              "xtype" : "NavItem",
225              "$ xns" : "Roo.bootstrap",
226              "items" : [
227               {
228                "listeners" : {
229                 "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}"
230                },
231                "String weight" : "default",
232                "xtype" : "Button",
233                "$ xns" : "Roo.bootstrap",
234                "String html" : "Add",
235                "String style" : "margin: 10px;",
236                "String glyphicon" : "plus"
237               },
238               {
239                "listeners" : {
240                 "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.hide();\n}",
241                 "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}"
242                },
243                "String weight" : "default",
244                "xtype" : "Button",
245                "$ xns" : "Roo.bootstrap",
246                "String html" : "Edit",
247                "String style" : "margin: 10px;",
248                "String glyphicon" : "edit"
249               },
250               {
251                "listeners" : {
252                 "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.hide();\n}",
253                 "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}"
254                },
255                "String weight" : "primary",
256                "xtype" : "Button",
257                "$ xns" : "Roo.bootstrap",
258                "String html" : "Delete",
259                "String style" : "margin: 10px;",
260                "String glyphicon" : "trash"
261               }
262              ]
263             }
264            ]
265           }
266          ]
267         },
268         {
269          "listeners" : {
270           "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}",
271           "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}",
272           "render" : "function (_self)\n{\n    _this.option_grid = _self; \n\n}"
273          },
274          "Boolean footerShow" : false,
275          "Boolean cellSelection" : true,
276          "String cls" : "table-fixed",
277          "boolean hover" : true,
278          "boolean striped" : true,
279          "xtype" : "Table",
280          "boolean responsive" : true,
281          "Boolean rowSelection" : true,
282          "$ xns" : "Roo.bootstrap",
283          "Boolean loadMask" : true,
284          "* prop" : "grid",
285          "items" : [
286           {
287            "listeners" : {
288             "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}"
289            },
290            "Boolean singleSelect" : true,
291            "xtype" : "RowSelectionModel",
292            "$ xns" : "Roo.bootstrap.Table",
293            "* prop" : "sm"
294           },
295           {
296            "listeners" : {
297             "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}",
298             "beforeload" : "function (_self, o)\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}",
299             "load" : "function (_self, records, options)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n}"
300            },
301            "xtype" : "Store",
302            "boolean remoteSort" : true,
303            "$ xns" : "Roo.data",
304            "$ sortinfo" : "{ field : 'display_name', direction: 'ASC' }",
305            "* prop" : "store",
306            "items" : [
307             {
308              "$ 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]",
309              "xtype" : "JsonReader",
310              "String root" : "data",
311              "$ xns" : "Roo.data",
312              "String id" : "id",
313              "* prop" : "reader",
314              "String totalProperty" : "total"
315             },
316             {
317              "$ url" : "baseURL + '/Roo/core_enum.php'",
318              "xtype" : "HttpProxy",
319              "$ xns" : "Roo.data",
320              "String method" : "GET",
321              "* prop" : "proxy"
322             }
323            ]
324           },
325           {
326            "String header" : "#",
327            "String cursor" : "pointer",
328            "String dataIndex" : "id",
329            "Number md" : 2,
330            "xtype" : "ColumnModel",
331            "Number xs" : 2,
332            "$ xns" : "Roo.grid",
333            "$ 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}",
334            "Boolean sortable" : false,
335            "* prop" : "cm[]",
336            "Number sm" : 2
337           },
338           {
339            "String header" : "Name",
340            "String cursor" : "pointer",
341            "Number md" : 4,
342            "String dataIndex" : "name",
343            "xtype" : "ColumnModel",
344            "Number xs" : 4,
345            "$ xns" : "Roo.grid",
346            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
347            "Boolean sortable" : false,
348            "* prop" : "cm[]",
349            "Number sm" : 4
350           },
351           {
352            "String header" : "Display Name",
353            "String cursor" : "pointer",
354            "String dataIndex" : "display_name",
355            "Number md" : 4,
356            "xtype" : "ColumnModel",
357            "Number xs" : 4,
358            "$ xns" : "Roo.grid",
359            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
360            "Boolean sortable" : false,
361            "* prop" : "cm[]",
362            "Number sm" : 4
363           },
364           {
365            "String header" : "Active",
366            "String cursor" : "pointer",
367            "Number md" : 2,
368            "String dataIndex" : "active",
369            "xtype" : "ColumnModel",
370            "Number xs" : 2,
371            "$ xns" : "Roo.grid",
372            "$ renderer" : "function(v,x,r) { \n    var state = v > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
373            "Boolean sortable" : false,
374            "* prop" : "cm[]",
375            "Number sm" : 2
376           }
377          ]
378         }
379        ]
380       }
381      ]
382     }
383    ]
384   }
385  ]
386 }