Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleCurrency.bjs
1 {
2     "name" : "Pman.Tab.XtupleCurrency",
3     "parent" : "Pman.Tab.XtupleAccountsTab",
4     "title" : "Pman.Tab.XtupleCurrency",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCurrency.bjs",
6     "permname" : "",
7     "modOrder" : "600",
8     "items" : [
9         {
10             "background" : true,
11             "region" : "center",
12             "title" : "Currency / Rates",
13             "xtype" : "NestedLayoutPanel",
14             "$ xns" : "Roo",
15             "items" : [
16                 {
17                     "xtype" : "BorderLayout",
18                     "$ xns" : "Roo",
19                     "* prop" : "layout",
20                     "items" : [
21                         {
22                             "xtype" : "LayoutRegion",
23                             "width" : 300,
24                             "$ xns" : "Roo",
25                             "split" : true,
26                             "* prop" : "west"
27                         },
28                         {
29                             "xtype" : "LayoutRegion",
30                             "$ xns" : "Roo",
31                             "* prop" : "center"
32                         },
33                         {
34                             "listeners" : {
35                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
36                             },
37                             "fitToframe" : true,
38                             "background" : false,
39                             "region" : "west",
40                             "title" : "curr_symbol",
41                             "xtype" : "GridPanel",
42                             "fitContainer" : true,
43                             "$ xns" : "Roo",
44                             "tableName" : "curr_symbol",
45                             "items" : [
46                                 {
47                                     "listeners" : {
48                                         "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    Pman.Dialog.XtupleCurrency.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
49                                         "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
50                                     },
51                                     "autoExpandColumn" : "curr_name",
52                                     "xtype" : "Grid",
53                                     "loadMask" : true,
54                                     "$ xns" : "Roo.grid",
55                                     "* prop" : "grid",
56                                     "items" : [
57                                         {
58                                             "listeners" : {
59                                                 "afterselectionchange" : "function (_self)\n{\n    _this.rgrid.footer.onClick('first');\n}"
60                                             },
61                                             "xtype" : "RowSelectionModel",
62                                             "singleSelect" : true,
63                                             "$ xns" : "Roo.grid",
64                                             "* prop" : "sm"
65                                         },
66                                         {
67                                             "remoteSort" : true,
68                                             "xtype" : "Store",
69                                             "$ sortInfo" : "{ field : 'curr_name', direction: 'ASC' }",
70                                             "$ xns" : "Roo.data",
71                                             "* prop" : "dataSource",
72                                             "items" : [
73                                                 {
74                                                     "$ url" : "baseURL + '/Roo/curr_symbol.php'",
75                                                     "method" : "GET",
76                                                     "xtype" : "HttpProxy",
77                                                     "$ xns" : "Roo.data",
78                                                     "* prop" : "proxy"
79                                                 },
80                                                 {
81                                                     "id" : "id",
82                                                     "root" : "data",
83                                                     "xtype" : "JsonReader",
84                                                     "$ fields" : "[\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_abbr',\n        'type': 'string'\n    }\n]",
85                                                     "$ xns" : "Roo.data",
86                                                     "* prop" : "reader",
87                                                     "totalProperty" : "total"
88                                                 }
89                                             ]
90                                         },
91                                         {
92                                             "pageSize" : 25,
93                                             "xtype" : "PagingToolbar",
94                                             "emptyMsg" : "Nothing found",
95                                             "$ xns" : "Roo",
96                                             "displayMsg" : "{0} - {1} of {2}",
97                                             "displayInfo" : true,
98                                             "* prop" : "footer"
99                                         },
100                                         {
101                                             "xtype" : "Toolbar",
102                                             "$ xns" : "Roo",
103                                             "* prop" : "toolbar",
104                                             "items" : [
105                                                 {
106                                                     "listeners" : {
107                                                         "|click" : "function()\n{\n    Pman.Dialog.XtupleCurrency.show( { curr_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
108                                                     },
109                                                     "text" : "Add",
110                                                     "xtype" : "Button",
111                                                     "cls" : "x-btn-text-icon",
112                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
113                                                     "$ xns" : "Roo.Toolbar"
114                                                 },
115                                                 {
116                                                     "xtype" : "Fill",
117                                                     "$ xns" : "Roo.Toolbar"
118                                                 },
119                                                 {
120                                                     "listeners" : {
121                                                         "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a currency!\");\n        return;\n    }\n        \n    new Pman.Request({\n        method: 'POST',\n        url: baseURL+ '/Roo/curr_symbol',\n        params : {\n            curr_id : s.data.curr_id,\n            _load_rates : 1\n        },\n        success : function() {\n            _this.rgrid.footer.onClick('first');\n        }\n    });\n}\n"
122                                                     },
123                                                     "text" : "Get this months rates",
124                                                     "xtype" : "Button",
125                                                     "cls" : "x-btn-text-icon",
126                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
127                                                     "$ xns" : "Roo.Toolbar"
128                                                 }
129                                             ]
130                                         },
131                                         {
132                                             "xtype" : "ColumnModel",
133                                             "header" : "Name",
134                                             "width" : 80,
135                                             "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
136                                             "$ xns" : "Roo.grid",
137                                             "* prop" : "colModel[]",
138                                             "dataIndex" : "curr_name"
139                                         },
140                                         {
141                                             "xtype" : "ColumnModel",
142                                             "header" : "Symbol",
143                                             "width" : 80,
144                                             "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
145                                             "$ xns" : "Roo.grid",
146                                             "* prop" : "colModel[]",
147                                             "dataIndex" : "curr_symbol"
148                                         },
149                                         {
150                                             "xtype" : "ColumnModel",
151                                             "header" : "Abbr.",
152                                             "width" : 80,
153                                             "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
154                                             "$ xns" : "Roo.grid",
155                                             "* prop" : "colModel[]",
156                                             "dataIndex" : "curr_abbr"
157                                         }
158                                     ]
159                                 }
160                             ]
161                         },
162                         {
163                             "listeners" : {
164                                 "|activate" : "function() {\n    _this.rpanel = this;\n    if (_this.rgrid) {\n        _this.rgrid.footer.onClick('first');\n    }\n}"
165                             },
166                             "fitToframe" : true,
167                             "background" : false,
168                             "region" : "center",
169                             "title" : "curr_rate",
170                             "xtype" : "GridPanel",
171                             "fitContainer" : true,
172                             "$ xns" : "Roo",
173                             "tableName" : "curr_rate",
174                             "items" : [
175                                 {
176                                     "listeners" : {
177                                         "|render" : "function() \n{\n    _this.rgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.rpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
178                                     },
179                                     "autoExpandColumn" : "curr_rate",
180                                     "xtype" : "Grid",
181                                     "loadMask" : true,
182                                     "$ xns" : "Roo.grid",
183                                     "* prop" : "grid",
184                                     "items" : [
185                                         {
186                                             "xtype" : "RowSelectionModel",
187                                             "singleSelect" : true,
188                                             "$ xns" : "Roo.grid",
189                                             "* prop" : "sm"
190                                         },
191                                         {
192                                             "xtype" : "Toolbar",
193                                             "$ xns" : "Roo",
194                                             "* prop" : "toolbar",
195                                             "items" : [
196                                                 {
197                                                     "xtype" : "Fill",
198                                                     "$ xns" : "Roo.Toolbar"
199                                                 },
200                                                 {
201                                                     "listeners" : {
202                                                         "|click" : "function ()\n{\n\n     var sel  = _this.rgrid.getSelectionModel().getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a rate\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to delete this rate?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Deleting',\n                url : baseURL + '/Roo/curr_rate',\n                method : 'POST',\n                params :  {\n                    _delete : sel.data.curr_rate_id\n                },\n                success : function() {\n                    _this.rgrid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
203                                                     },
204                                                     "text" : "Delete",
205                                                     "xtype" : "Button",
206                                                     "cls" : "x-btn-text-icon",
207                                                     "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
208                                                     "$ xns" : "Roo.Toolbar"
209                                                 }
210                                             ]
211                                         },
212                                         {
213                                             "listeners" : {
214                                                 "beforeload" : "function (_self, options)\n{\n    var s = _this.grid.selModel.getSelected();\n    if (!s) { \n        this.removeAll();\n        return false;\n    }\n    options.params.curr_id = s.data.curr_id;\n    options.params._with_base_symbol  = 1;\n}"
215                                             },
216                                             "xtype" : "Store",
217                                             "remoteSort" : true,
218                                             "$ sortInfo" : "{ field : 'curr_effective', direction: 'DESC' }",
219                                             "$ xns" : "Roo.data",
220                                             "* prop" : "dataSource",
221                                             "items" : [
222                                                 {
223                                                     "$ url" : "baseURL + '/Roo/curr_rate.php'",
224                                                     "method" : "GET",
225                                                     "xtype" : "HttpProxy",
226                                                     "$ xns" : "Roo.data",
227                                                     "* prop" : "proxy"
228                                                 },
229                                                 {
230                                                     "id" : "id",
231                                                     "root" : "data",
232                                                     "xtype" : "JsonReader",
233                                                     "$ xns" : "Roo.data",
234                                                     "$ fields" : "[\n    {\n        'name': 'curr_rate_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_rate',\n        'type': 'float'\n    },\n    {\n        'name': 'curr_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'curr_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    }\n]",
235                                                     "* prop" : "reader",
236                                                     "totalProperty" : "total"
237                                                 }
238                                             ]
239                                         },
240                                         {
241                                             "pageSize" : 25,
242                                             "xtype" : "PagingToolbar",
243                                             "emptyMsg" : "No curr_rate found",
244                                             "$ xns" : "Roo",
245                                             "displayMsg" : "Displaying curr_rate {0} - {1} of {2}",
246                                             "displayInfo" : true,
247                                             "* prop" : "footer"
248                                         },
249                                         {
250                                             "xtype" : "ColumnModel",
251                                             "header" : "From",
252                                             "width" : 150,
253                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
254                                             "$ xns" : "Roo.grid",
255                                             "* prop" : "colModel[]",
256                                             "dataIndex" : "curr_effective"
257                                         },
258                                         {
259                                             "xtype" : "ColumnModel",
260                                             "header" : "To",
261                                             "width" : 150,
262                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
263                                             "$ xns" : "Roo.grid",
264                                             "* prop" : "colModel[]",
265                                             "dataIndex" : "curr_expires"
266                                         },
267                                         {
268                                             "align" : "right",
269                                             "xtype" : "ColumnModel",
270                                             "header" : "Rate",
271                                             "width" : 75,
272                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
273                                             "$ xns" : "Roo.grid",
274                                             "* prop" : "colModel[]",
275                                             "dataIndex" : "curr_rate"
276                                         },
277                                         {
278                                             "align" : "right",
279                                             "xtype" : "ColumnModel",
280                                             "header" : "Rate",
281                                             "width" : 150,
282                                             "$ renderer" : "function(v,x,r) {\n\n     return String.format('{1}1 = {2}{0}', \n        Roo.util.Format.number(r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n    \n}",
283                                             "$ xns" : "Roo.grid",
284                                             "* prop" : "colModel[]",
285                                             "dataIndex" : "curr_rate1"
286                                         },
287                                         {
288                                             "align" : "right",
289                                             "xtype" : "ColumnModel",
290                                             "header" : "Rate",
291                                             "width" : 150,
292                                             "$ renderer" : "function(v,x,r) {    \n     return String.format('{2}1 = {1}{0}', \n        Roo.util.Format.number(1.0/r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n}",
293                                             "$ xns" : "Roo.grid",
294                                             "* prop" : "colModel[]",
295                                             "dataIndex" : "curr_rate2"
296                                         }
297                                     ]
298                                 }
299                             ]
300                         }
301                     ]
302                 }
303             ]
304         }
305     ]
306 }