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        "Boolean hideTabs" : true,
35        "xtype" : "Region",
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    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                "listeners" : {
77                 "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}"
78                },
79                "String weight" : "default",
80                "xtype" : "Button",
81                "$ xns" : "Roo.bootstrap",
82                "String html" : "Add",
83                "String style" : "margin: 10px;",
84                "String glyphicon" : "plus"
85               }
86              ]
87             }
88            ]
89           }
90          ]
91         },
92         {
93          "listeners" : {
94           "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}",
95           "render" : "function (_self)\n{\n    _this.type_grid = _self; \n   \n}"
96          },
97          "String cls" : "table-fixed",
98          "Boolean cellSelection" : true,
99          "boolean hover" : true,
100          "boolean striped" : false,
101          "xtype" : "Table",
102          "boolean responsive" : true,
103          "Boolean rowSelection" : true,
104          "$ xns" : "Roo.bootstrap",
105          "Boolean loadMask" : true,
106          "* prop" : "grid",
107          "items" : [
108           {
109            "listeners" : {
110             "selectionchange" : "function (_self)\n{\n    _this.option_grid.store.load({});\n}"
111            },
112            "Boolean singleSelect" : true,
113            "xtype" : "RowSelectionModel",
114            "$ xns" : "Roo.bootstrap.Table",
115            "* prop" : "sm"
116           },
117           {
118            "listeners" : {
119             "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params['query[empty_etype]'] = 1;\n    \n}"
120            },
121            "$ Object sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
122            "xtype" : "Store",
123            "boolean remoteSort" : true,
124            "$ xns" : "Roo.data",
125            "* prop" : "store",
126            "items" : [
127             {
128              "$ 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]",
129              "xtype" : "JsonReader",
130              "String root" : "data",
131              "$ xns" : "Roo.data",
132              "String id" : "id",
133              "* prop" : "reader",
134              "String totalProperty" : "total"
135             },
136             {
137              "$ url" : "baseURL + '/Roo/core_enum.php'",
138              "xtype" : "HttpProxy",
139              "$ xns" : "Roo.data",
140              "String method" : "GET",
141              "* prop" : "proxy"
142             }
143            ]
144           },
145           {
146            "String header" : "Name",
147            "String cursor" : "pointer",
148            "String dataIndex" : "display_name",
149            "xtype" : "ColumnModel",
150            "Number xs" : 12,
151            "$ xns" : "Roo.grid",
152            "$ 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}",
153            "Boolean sortable" : true,
154            "* prop" : "cm[]"
155           },
156           {
157            "Number pageSize" : 100,
158            "Boolean displayInfo" : false,
159            "xtype" : "PagingToolbar",
160            "$ xns" : "Roo.bootstrap",
161            "* prop" : "footer",
162            "string name" : "footer"
163           }
164          ]
165         }
166        ]
167       },
168       {
169        "listeners" : {
170         "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}",
171         "render" : "function (_self)\n{\n    _this.option_panel = _self;\n}"
172        },
173        "Boolean fitContainer" : true,
174        "xtype" : "Grid",
175        "Boolean fitToFrame" : true,
176        "String region" : "center",
177        "$ xns" : "Roo.bootstrap.panel",
178        "String title" : "Options",
179        "Boolean background" : false,
180        "items" : [
181         {
182          "xtype" : "NavSimplebar",
183          "$ xns" : "Roo.bootstrap",
184          "* prop" : "toolbar",
185          "items" : [
186           {
187            "xtype" : "NavGroup",
188            "$ xns" : "Roo.bootstrap",
189            "items" : [
190             {
191              "xtype" : "NavItem",
192              "$ xns" : "Roo.bootstrap",
193              "items" : [
194               {
195                "listeners" : {
196                 "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}"
197                },
198                "String weight" : "default",
199                "xtype" : "Button",
200                "$ xns" : "Roo.bootstrap",
201                "String html" : "Add",
202                "String style" : "margin: 10px;",
203                "String glyphicon" : "plus"
204               },
205               {
206                "listeners" : {
207                 "render" : "function (_self)\n{\n    _this.edit_btn = this;\n    \n    this.hide();\n}",
208                 "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}"
209                },
210                "String weight" : "default",
211                "xtype" : "Button",
212                "$ xns" : "Roo.bootstrap",
213                "String html" : "Edit",
214                "String style" : "margin: 10px;",
215                "String glyphicon" : "edit"
216               },
217               {
218                "listeners" : {
219                 "render" : "function (_self)\n{\n    _this.delete_btn = this;\n    \n    this.hide();\n}",
220                 "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}"
221                },
222                "String weight" : "primary",
223                "xtype" : "Button",
224                "$ xns" : "Roo.bootstrap",
225                "String html" : "Delete",
226                "String style" : "margin: 10px;",
227                "String glyphicon" : "trash"
228               }
229              ]
230             }
231            ]
232           }
233          ]
234         },
235         {
236          "listeners" : {
237           "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}",
238           "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}",
239           "render" : "function (_self)\n{\n    _this.option_grid = _self; \n\n}"
240          },
241          "Boolean cellSelection" : true,
242          "String cls" : "table-fixed",
243          "Boolean footerShow" : false,
244          "boolean hover" : true,
245          "boolean striped" : true,
246          "xtype" : "Table",
247          "boolean responsive" : true,
248          "Boolean rowSelection" : true,
249          "$ xns" : "Roo.bootstrap",
250          "Boolean loadMask" : true,
251          "* prop" : "grid",
252          "items" : [
253           {
254            "listeners" : {
255             "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}"
256            },
257            "Boolean singleSelect" : true,
258            "xtype" : "RowSelectionModel",
259            "$ xns" : "Roo.bootstrap.Table",
260            "* prop" : "sm"
261           },
262           {
263            "listeners" : {
264             "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}",
265             "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}",
266             "load" : "function (_self, records, options)\n{\n    _this.edit_btn.hide();\n    _this.delete_btn.hide();\n}"
267            },
268            "xtype" : "Store",
269            "boolean remoteSort" : true,
270            "$ xns" : "Roo.data",
271            "$ sortinfo" : "{ field : 'display_name', direction: 'ASC' }",
272            "* prop" : "store",
273            "items" : [
274             {
275              "$ 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]",
276              "xtype" : "JsonReader",
277              "String root" : "data",
278              "$ xns" : "Roo.data",
279              "String id" : "id",
280              "* prop" : "reader",
281              "String totalProperty" : "total"
282             },
283             {
284              "$ url" : "baseURL + '/Roo/core_enum.php'",
285              "xtype" : "HttpProxy",
286              "$ xns" : "Roo.data",
287              "String method" : "GET",
288              "* prop" : "proxy"
289             }
290            ]
291           },
292           {
293            "String header" : "#",
294            "String cursor" : "pointer",
295            "String dataIndex" : "id",
296            "Number md" : 2,
297            "xtype" : "ColumnModel",
298            "Number xs" : 2,
299            "$ xns" : "Roo.grid",
300            "$ 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}",
301            "Boolean sortable" : false,
302            "* prop" : "cm[]",
303            "Number sm" : 2
304           },
305           {
306            "String header" : "Name",
307            "String cursor" : "pointer",
308            "Number md" : 4,
309            "String dataIndex" : "name",
310            "xtype" : "ColumnModel",
311            "Number xs" : 4,
312            "$ xns" : "Roo.grid",
313            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
314            "Boolean sortable" : false,
315            "* prop" : "cm[]",
316            "Number sm" : 4
317           },
318           {
319            "String header" : "Display Name",
320            "String cursor" : "pointer",
321            "String dataIndex" : "display_name",
322            "Number md" : 4,
323            "xtype" : "ColumnModel",
324            "Number xs" : 4,
325            "$ xns" : "Roo.grid",
326            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? v : '');\n}",
327            "Boolean sortable" : false,
328            "* prop" : "cm[]",
329            "Number sm" : 4
330           },
331           {
332            "String header" : "Active",
333            "String cursor" : "pointer",
334            "Number md" : 2,
335            "String dataIndex" : "active",
336            "xtype" : "ColumnModel",
337            "Number xs" : 2,
338            "$ xns" : "Roo.grid",
339            "$ 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}",
340            "Boolean sortable" : false,
341            "* prop" : "cm[]",
342            "Number sm" : 2
343           }
344          ]
345         }
346        ]
347       }
348      ]
349     }
350    ]
351   }
352  ]
353 }