Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleTerms.bjs
1 {
2     "name" : "Pman.Tab.XtupleTerms",
3     "parent" : "Pman.Tab.XtupleAccountsTab",
4     "title" : "",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleTerms.bjs",
6     "permname" : "",
7     "modOrder" : "700",
8     "items" : [
9         {
10             "background" : false,
11             "region" : "center",
12             "title" : "Terms",
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                             "$ xns" : "Roo",
24                             "* prop" : "center"
25                         },
26                         {
27                             "listeners" : {
28                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
29                             },
30                             "region" : "center",
31                             "fitToframe" : true,
32                             "background" : false,
33                             "title" : "Terms",
34                             "xtype" : "GridPanel",
35                             "fitContainer" : true,
36                             "$ xns" : "Roo",
37                             "tableName" : "terms",
38                             "items" : [
39                                 {
40                                     "listeners" : {
41                                         "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var id = this.getDataSource().getAt(rowIndex).data.terms_id * 1;\n\n    if(id < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n    }\n    \n    Pman.Dialog.XtupleTerms.show( {id : id}, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n}\n",
42                                         "|render" : "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
43                                     },
44                                     "autoExpandColumn" : "terms_descrip",
45                                     "xtype" : "Grid",
46                                     "loadMask" : true,
47                                     "$ xns" : "Roo.grid",
48                                     "* prop" : "grid",
49                                     "items" : [
50                                         {
51                                             "Boolean singleSelect" : true,
52                                             "xtype" : "RowSelectionModel",
53                                             "$ xns" : "Roo.grid",
54                                             "* prop" : "sm"
55                                         },
56                                         {
57                                             "xtype" : "Toolbar",
58                                             "$ xns" : "Roo",
59                                             "* prop" : "toolbar",
60                                             "items" : [
61                                                 {
62                                                     "listeners" : {
63                                                         "specialkey" : "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
64                                                         "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
65                                                     },
66                                                     "xtype" : "TextField",
67                                                     "$ xns" : "Roo.form"
68                                                 },
69                                                 {
70                                                     "listeners" : {
71                                                         "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
72                                                     },
73                                                     "xtype" : "Button",
74                                                     "cls" : "x-btn-icon",
75                                                     "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
76                                                     "$ xns" : "Roo.Toolbar"
77                                                 },
78                                                 {
79                                                     "listeners" : {
80                                                         "click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\r\n\r\n    _this.grid.footer.onClick('first');\r\n}"
81                                                     },
82                                                     "xtype" : "Button",
83                                                     "cls" : "x-btn-icon",
84                                                     "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
85                                                     "$ xns" : "Roo.Toolbar"
86                                                 },
87                                                 {
88                                                     "xtype" : "Fill",
89                                                     "$ xns" : "Roo.Toolbar"
90                                                 },
91                                                 {
92                                                     "listeners" : {
93                                                         "|click" : "function()\n{\n\n   Pman.Dialog.XtupleTerms.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
94                                                     },
95                                                     "text" : "Add",
96                                                     "xtype" : "Button",
97                                                     "cls" : "x-btn-text-icon",
98                                                     "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
99                                                     "$ xns" : "Roo.Toolbar"
100                                                 },
101                                                 {
102                                                     "xtype" : "Separator",
103                                                     "$ xns" : "Roo.Toolbar"
104                                                 },
105                                                 {
106                                                     "listeners" : {
107                                                         "|click" : "function()\n{\n    var sel = _this.grid.getSelectionModel().getSelected();\n\n    if(!sel || sel.data.terms_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Please select a terms\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete the terms?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n           new Pman.Request({\n                url : baseURL + '/Roo/terms.php',\n                method : 'POST',\n                params : {\n                    _delete : sel.data.terms_id * 1\n                }, \n                success : function(res) {\n                    _this.grid.footer.onClick('first');\n                }\n            }); \n            \n            return;\n        }\n    );\n    \n}\n        "
108                                                     },
109                                                     "text" : "Delete",
110                                                     "xtype" : "Button",
111                                                     "cls" : "x-btn-text-icon",
112                                                     "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
113                                                     "$ xns" : "Roo.Toolbar"
114                                                 }
115                                             ]
116                                         },
117                                         {
118                                             "listeners" : {
119                                                 "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var s = _this.searchBox.getValue();\n    \n    if(s.length){\n        o.params['search[name]'] = s;\n    }\n    \n  \n}"
120                                             },
121                                             "xtype" : "Store",
122                                             "remoteSort" : true,
123                                             "$ sortInfo" : "{ field : 'terms_id', direction: 'ASC' }",
124                                             "$ xns" : "Roo.data",
125                                             "* prop" : "dataSource",
126                                             "items" : [
127                                                 {
128                                                     "$ url" : "baseURL + '/Roo/terms.php'",
129                                                     "method" : "GET",
130                                                     "xtype" : "HttpProxy",
131                                                     "$ xns" : "Roo.data",
132                                                     "* prop" : "proxy"
133                                                 },
134                                                 {
135                                                     "id" : "id",
136                                                     "root" : "data",
137                                                     "xtype" : "JsonReader",
138                                                     "$ xns" : "Roo.data",
139                                                     "$ fields" : "[\n    {\n        'name': 'terms_id',\n        'type': 'int'\n    },\n    {\n        'name': 'terms_code',\n        'type': 'string'\n    },\n    {\n        'name': 'terms_descrip',\n        'type': 'string',\n    }\n]",
140                                                     "* prop" : "reader",
141                                                     "totalProperty" : "total"
142                                                 }
143                                             ]
144                                         },
145                                         {
146                                             "pageSize" : 25,
147                                             "xtype" : "PagingToolbar",
148                                             "emptyMsg" : "No terms found",
149                                             "$ xns" : "Roo",
150                                             "displayInfo" : true,
151                                             "displayMsg" : "Displaying Terms{0} - {1} of {2}",
152                                             "* prop" : "footer"
153                                         },
154                                         {
155                                             "xtype" : "ColumnModel",
156                                             "width" : 75,
157                                             "header" : "ID#",
158                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
159                                             "$ xns" : "Roo.grid",
160                                             "Boolean sortable" : true,
161                                             "* prop" : "cm[]",
162                                             "dataIndex" : "terms_id"
163                                         },
164                                         {
165                                             "xtype" : "ColumnModel",
166                                             "header" : "Code",
167                                             "width" : 150,
168                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
169                                             "$ xns" : "Roo.grid",
170                                             "Boolean sortable" : true,
171                                             "* prop" : "cm[]",
172                                             "dataIndex" : "terms_code"
173                                         },
174                                         {
175                                             "xtype" : "ColumnModel",
176                                             "width" : 150,
177                                             "header" : "Description",
178                                             "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
179                                             "$ xns" : "Roo.grid",
180                                             "Boolean sortable" : true,
181                                             "* prop" : "cm[]",
182                                             "dataIndex" : "terms_descrip"
183                                         },
184                                         {
185                                             "xtype" : "ColumnModel",
186                                             "header" : "Type",
187                                             "width" : 75,
188                                             "$ renderer" : "function(v) { \n    var t = (v == 'D') ? 'Days' : 'Proximo';\n    \n    return String.format('{0}', t); \n}",
189                                             "$ xns" : "Roo.grid",
190                                             "Boolean sortable" : true,
191                                             "* prop" : "cm[]",
192                                             "dataIndex" : "terms_type"
193                                         },
194                                         {
195                                             "xtype" : "ColumnModel",
196                                             "header" : "Due Days",
197                                             "width" : 100,
198                                             "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
199                                             "$ xns" : "Roo.grid",
200                                             "Boolean sortable" : true,
201                                             "* prop" : "cm[]",
202                                             "dataIndex" : "terms_duedays"
203                                         },
204                                         {
205                                             "xtype" : "ColumnModel",
206                                             "header" : "Discount Days",
207                                             "width" : 100,
208                                             "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
209                                             "$ xns" : "Roo.grid",
210                                             "Boolean sortable" : true,
211                                             "* prop" : "cm[]",
212                                             "dataIndex" : "terms_discdays"
213                                         },
214                                         {
215                                             "xtype" : "ColumnModel",
216                                             "header" : "Cut Off Days",
217                                             "width" : 100,
218                                             "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n    \n}",
219                                             "$ xns" : "Roo.grid",
220                                             "Boolean sortable" : true,
221                                             "* prop" : "cm[]",
222                                             "dataIndex" : "terms_cutoffday"
223                                         },
224                                         {
225                                             "xtype" : "ColumnModel",
226                                             "header" : "Used in Payables",
227                                             "width" : 150,
228                                             "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
229                                             "$ xns" : "Roo.grid",
230                                             "Boolean sortable" : true,
231                                             "* prop" : "cm[]",
232                                             "dataIndex" : "terms_ap"
233                                         },
234                                         {
235                                             "xtype" : "ColumnModel",
236                                             "width" : 150,
237                                             "header" : "Used in Receivables",
238                                             "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
239                                             "$ xns" : "Roo.grid",
240                                             "Boolean sortable" : true,
241                                             "* prop" : "cm[]",
242                                             "dataIndex" : "terms_ar"
243                                         }
244                                     ]
245                                 }
246                             ]
247                         }
248                     ]
249                 }
250             ]
251         }
252     ]
253 }