Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleAdjustmentGroup.bjs
1 {
2     "id": "roo-file-217",
3     "name": "Pman.Tab.XtupleAdjustmentGroup",
4     "parent": "Pman.Tab.XtupleAdjustmentTab",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Xtuple/Pman.Tab.XtupleAdjustmentGroup.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToframe": true,
15             "region": "center",
16             "tableName": "invadjgrp",
17             "title": "Inventroy Adjustment Groups",
18             "xtype": "GridPanel",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "listeners": {
23                         "|render": "function() \n{\n    _this.grid = this; \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
24                         "rowdblclick": "function (_self, rowIndex, e)\n{\n    var s = _this.grid.ds.getAt(rowIndex);\n    \n    Pman.Dialog.XtupleAdjustmentGroup.show( { invadjgrp_id : s.data.invadjgrp_id } , function() {\n        _this.grid.footer.onClick('first');\n   });\n}",
25                         "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var c = _this.grid.colModel.config[columnIndex];\n    var di = c.dataIndex;\n    \n    if (di != 'invadjgrp_posted') {\n        return;\n    }\n    \n    var r = _this.grid.ds.getAt(rowIndex);\n    if (r.data.invadjgrp_posted  ) { // nos ur\n        Roo.MessageBox.alert(\"Error\", \"Group is already posted\");\n        return;\n    }\n     if (r.data.invadjgrp_void * 1 )  {\n        Roo.MessageBox.alert(\"Error\", \"Group is already void\");\n        return;\n    }\n    Roo.MessageBox.confirm(\n        \"Confirm\",\n        \"Are you sure it's ready to post?\",\n        function(bu) {\n            if (bu != 'yes') {\n                return;\n            }\n            \n            new Pman.Request({\n                url : baseURL + '/Roo/Invadjgrp',\n                method  : 'POST',\n                mask : 'Posting',\n                timeout: 120000,\n                params : {\n                    invadjgrp_id : r.data.invadjgrp_id,\n                    invadjgrp_posted : 1,\n                    _post : 1\n                },\n                success : function(res) {\n                    _this.grid.footer.onClick('first');\n                },\n                failure : function (res) {\n                    Roo.log(res);\n                    Roo.MessageBox.alert(\"Error\",res.errorMsg || \"Error sending\");\n                    \n                }\n            });\n    });\n    \n}"
26                     },
27                     "*prop": "grid",
28                     "autoExpandColumn": "invadjgrp_comments",
29                     "loadMask": true,
30                     "xtype": "Grid",
31                     "|xns": "Roo.grid",
32                     "items": [
33                         {
34                             "*prop": "sm",
35                             "singleSelect": true,
36                             "xtype": "RowSelectionModel",
37                             "|xns": "Roo.grid"
38                         },
39                         {
40                             "listeners": {
41                                 "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params._with_qty_detail = 1;\n}"
42                             },
43                             "*prop": "dataSource",
44                             "remoteSort": true,
45                             "xtype": "Store",
46                             "|sortInfo": "{ field : 'invadjgrp_id', direction: 'DESC' }",
47                             "|xns": "Roo.data",
48                             "items": [
49                                 {
50                                     "*prop": "proxy",
51                                     "method": "GET",
52                                     "xtype": "HttpProxy",
53                                     "|url": "baseURL + '/Roo/Invadjgrp.php'",
54                                     "|xns": "Roo.data"
55                                 },
56                                 {
57                                     "*prop": "reader",
58                                     "id": "id",
59                                     "root": "data",
60                                     "totalProperty": "total",
61                                     "xtype": "JsonReader",
62                                     "|fields": "[\n    {\n        'name': 'invadjgrp_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invadjgrp_location_id',\n        'type': 'int'\n    }\n]",
63                                     "|xns": "Roo.data"
64                                 }
65                             ]
66                         },
67                         {
68                             "*prop": "footer",
69                             "displayInfo": true,
70                             "displayMsg": "Displaying Inventory Adjustment Groups{0} - {1} of {2}",
71                             "emptyMsg": "No Inventory Adjustment Groups found",
72                             "pageSize": 25,
73                             "xtype": "PagingToolbar",
74                             "|xns": "Roo"
75                         },
76                         {
77                             "*prop": "toolbar",
78                             "xtype": "Toolbar",
79                             "|xns": "Roo",
80                             "items": [
81                                 {
82                                     "listeners": {
83                                         "|click": "function()\n{\n    Pman.Dialog.XtupleAdjustmentGroup.show( { invadjgrp_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
84                                     },
85                                     "cls": "x-btn-text-icon",
86                                     "text": "Add",
87                                     "xtype": "Button",
88                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
89                                     "|xns": "Roo.Toolbar"
90                                 },
91                                 {
92                                     "|xns": "Roo.Toolbar",
93                                     "xtype": "Fill"
94                                 },
95                                 {
96                                     "listeners": {
97                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    if (!s || s.data.invadjgrp_id * 1 < 1 )  {\n        Roo.MessageBox.alert(\"Error\", \"Select a inventory adjustment group\");\n        return;\n    }\n     if (!s || s.data.invadjgrp_void * 1 )  {\n        Roo.MessageBox.alert(\"Error\", \"Group is already void\");\n        return;\n    }\n    \n    if (!s.data.invadjgrp_posted) {\n        Roo.MessageBox.alert('Error', 'This group has not been posted yet!');\n        return;\n    }\n    \n    var voidit = function(force){\n        new Pman.Request({\n            url : baseURL + '/Roo/Invadjgrp',\n            method  : 'POST',\n            mask : 'Voiding',\n            params : {\n                invadjgrp_id : s.data.invadjgrp_id,\n                _void : 1,\n                _force : force\n            },\n            success : function(res) {\n                _this.grid.footer.onClick('first');\n            },\n            failure : function (res) {\n                Roo.log(res);\n                try {\n                    if (res.errors.confirm) {\n                                      \n                        Roo.MessageBox.confirm(\n                            \"Confirm\", \n                            \"There are some adjustments have been voided of this group! Do you want to void this group anyway?\",\n                            function(x) {\n                                if (x != 'yes') {\n                                    return;\n                                }\n                                voidit(1);\n                            }\n                        );\n                        return;\n                    }\n                } catch(e) { }\n                Roo.MessageBox.alert(\"Error\", res.errorMsg);\n                \n            }\n        });\n    }\n    \n    voidit(0)\n}\n        "
98                                     },
99                                     "cls": "x-btn-text-icon",
100                                     "text": "Void",
101                                     "xtype": "Button",
102                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
103                                     "|xns": "Roo.Toolbar"
104                                 },
105                                 {
106                                     "listeners": {
107                                         "|click": "function()\n{ \n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if (!s || s.data.invadjgrp_id * 1 < 1 )  {\n        Roo.MessageBox.alert(\"Error\", \"Select a inventory adjustment group\");\n        return;\n    }\n    \n    if (s.data.invadjgrp_posted) {\n        Roo.MessageBox.alert('Error', 'You can not delete the posted adjustment, try void it');\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Invadjgrp',\n        method : 'POST',\n        params  : { _delete : s.data.invadjgrp_id },\n        mask : 'Deleteing',\n        success : function(res) {\n            _this.grid.footer.onClick('first');\n        }\n    \n    });\n}\n        "
108                                     },
109                                     "cls": "x-btn-text-icon",
110                                     "text": "Delete",
111                                     "xtype": "Button",
112                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
113                                     "|xns": "Roo.Toolbar"
114                                 }
115                             ]
116                         },
117                         {
118                             "*prop": "colModel[]",
119                             "dataIndex": "invadjgrp_id",
120                             "header": "Ref#",
121                             "width": 50,
122                             "xtype": "ColumnModel",
123                             "|renderer": "function(v,x,r) { return String.format(r.data.invadjgrp_void *1 ? '<s>{0}</s>' : '{0}', v); }",
124                             "|xns": "Roo.grid"
125                         },
126                         {
127                             "*prop": "colModel[]",
128                             "dataIndex": "invadjgrp_name",
129                             "header": "Name",
130                             "width": 150,
131                             "xtype": "ColumnModel",
132                             "|renderer": "function(v,x,r) { return String.format(r.data.invadjgrp_void *1 ? '<s>{0}</s>' : '{0}', v); }",
133                             "|xns": "Roo.grid"
134                         },
135                         {
136                             "*prop": "colModel[]",
137                             "dataIndex": "invadjgrp_transdate",
138                             "header": "Date",
139                             "width": 100,
140                             "xtype": "ColumnModel",
141                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
142                             "|xns": "Roo.grid"
143                         },
144                         {
145                             "*prop": "colModel[]",
146                             "dataIndex": "invadjgrp_neg_qty",
147                             "header": "Negative",
148                             "width": 75,
149                             "xtype": "ColumnModel",
150                             "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
151                             "|xns": "Roo.grid"
152                         },
153                         {
154                             "*prop": "colModel[]",
155                             "dataIndex": "invadjgrp_pos_qty",
156                             "header": "Positive",
157                             "width": 75,
158                             "xtype": "ColumnModel",
159                             "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
160                             "|xns": "Roo.grid"
161                         },
162                         {
163                             "*prop": "colModel[]",
164                             "dataIndex": "invadjgrp_location_id_location_name",
165                             "header": "Location",
166                             "width": 200,
167                             "xtype": "ColumnModel",
168                             "|renderer": "function(v) { return String.format('{0}', v); }",
169                             "|xns": "Roo.grid"
170                         },
171                         {
172                             "*prop": "colModel[]",
173                             "dataIndex": "invadjgrp_comments",
174                             "header": "Comments",
175                             "width": 200,
176                             "xtype": "ColumnModel",
177                             "|renderer": "function(v,x,r) { return String.format(r.data.invadjgrp_void *1 ? '<s>{0}</s>' : '{0}', v); }",
178                             "|xns": "Roo.grid"
179                         },
180                         {
181                             "*prop": "colModel[]",
182                             "dataIndex": "invadjgrp_posted",
183                             "header": "Posted",
184                             "width": 75,
185                             "xtype": "ColumnModel",
186                             "|renderer": "function(v,x,r) {  \n    \n   if  (r.data.invadjgrp_void *1) { \n    return '';\n    }\n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
187                             "|xns": "Roo.grid"
188                         }
189                     ]
190                 }
191             ]
192         }
193     ],
194     "permname": "",
195     "modOrder": "001"
196 }