Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleSalesOrderNew.bjs
1 {
2     "id": "roo-file-29",
3     "name": "Pman.Dialog.XtupleSalesOrderNew",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleSalesOrderNew.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    _this.form.findField('cohead_cust_id').focus();\n}"
11             },
12             "closable": false,
13             "height": 180,
14             "modal": true,
15             "resizable": false,
16             "title": "Create new Sales Order",
17             "width": 500,
18             "xtype": "LayoutDialog",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "|xns": "Roo",
23                     "xtype": "LayoutRegion",
24                     "*prop": "center"
25                 },
26                 {
27                     "region": "center",
28                     "xtype": "ContentPanel",
29                     "|xns": "Roo",
30                     "items": [
31                         {
32                             "listeners": {
33                                 "rendered": "function (form)\n{\n  _this.form = form;\n}"
34                             },
35                             "xtype": "Form",
36                             "|xns": "Roo.form",
37                             "items": [
38                                 {
39                                     "listeners": {
40                                         "add": "function (combo)\n{\n \n    Pman.Dialog.XtupleCustomer.show( { id : 0 } , function(res) {\n        Roo.log(res);\n        // fill in customer\n        _this.form.setValues({\n            cohead_cust_id: res.cust_id,\n            cohead_cust_id_cust_name : res.cust_name,\n            cohead_curr_id : res.cust_curr_id,\n            cohead_curr_id_curr_name : res.cust_curr_id_curr_name\n        });\n        \n        \n    })\n    \n}\n\n",
41                                         "select": "function (combo, record, index)\n{\n   \n   Roo.log(record);\n    _this.form.setValues({\n        cohead_curr_id : record.data.cust_curr_id,\n        cohead_curr_id_curr_name : record.data.cust_curr_id_curr_name\n    \n    });\n}"
42                                     },
43                                     "allowBlank": false,
44                                     "displayField": "cust_name",
45                                     "editable": true,
46                                     "fieldLabel": "Select Customer",
47                                     "forceSelection": true,
48                                     "hiddenName": "cohead_cust_id",
49                                     "listWidth": 400,
50                                     "loadingText": "Searching...",
51                                     "minChars": 2,
52                                     "name": "cohead_cust_id_cust_name",
53                                     "pageSize": 20,
54                                     "qtip": "Select custinfo",
55                                     "queryParam": "query[cust_name_begin]",
56                                     "selectOnFocus": true,
57                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b>  ({cust_number})</div>",
58                                     "triggerAction": "all",
59                                     "typeAhead": true,
60                                     "valueField": "cust_id",
61                                     "width": 300,
62                                     "xtype": "ComboBox",
63                                     "|xns": "Roo.form",
64                                     "items": [
65                                         {
66                                             "listeners": {
67                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n\n  //  o.params['search[with_location]'] = 1;\n}\n"
68                                             },
69                                             "*prop": "store",
70                                             "remoteSort": true,
71                                             "xtype": "Store",
72                                             "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
73                                             "|xns": "Roo.data",
74                                             "items": [
75                                                 {
76                                                     "*prop": "proxy",
77                                                     "xtype": "HttpProxy",
78                                                     "method": "GET",
79                                                     "|xns": "Roo.data",
80                                                     "|url": "baseURL + '/Roo/custinfo.php'"
81                                                 },
82                                                 {
83                                                     "*prop": "reader",
84                                                     "xtype": "JsonReader",
85                                                     "|xns": "Roo.data",
86                                                     "id": "cust_id",
87                                                     "root": "data",
88                                                     "totalProperty": "total",
89                                                     "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
90                                                 }
91                                             ]
92                                         }
93                                     ]
94                                 },
95                                 {
96                                     "allowBlank": false,
97                                     "displayField": "curr_name",
98                                     "editable": false,
99                                     "emptyText": "Select Currency",
100                                     "fieldLabel": "Currency",
101                                     "forceSelection": true,
102                                     "hiddenName": "cohead_curr_id",
103                                     "listWidth": 400,
104                                     "loadingText": "Searching...",
105                                     "minChars": 2,
106                                     "name": "cohead_curr_id_curr_name",
107                                     "pageSize": 20,
108                                     "qtip": "Select Currency",
109                                     "queryParam": "query[curr_name]",
110                                     "selectOnFocus": true,
111                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
112                                     "triggerAction": "all",
113                                     "typeAhead": true,
114                                     "valueField": "curr_id",
115                                     "width": 285,
116                                     "xtype": "ComboBox",
117                                     "|xns": "Roo.form",
118                                     "items": [
119                                         {
120                                             "listeners": {
121                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    \n}\n"
122                                             },
123                                             "*prop": "store",
124                                             "remoteSort": true,
125                                             "xtype": "Store",
126                                             "|sortInfo": "{ direction : 'ASC', field: 'curr_symbol' }",
127                                             "|xns": "Roo.data",
128                                             "items": [
129                                                 {
130                                                     "*prop": "proxy",
131                                                     "xtype": "HttpProxy",
132                                                     "method": "GET",
133                                                     "|xns": "Roo.data",
134                                                     "|url": "baseURL + '/Roo/curr_symbol.php'"
135                                                 },
136                                                 {
137                                                     "*prop": "reader",
138                                                     "xtype": "JsonReader",
139                                                     "|xns": "Roo.data",
140                                                     "id": "curr_id",
141                                                     "root": "data",
142                                                     "totalProperty": "total",
143                                                     "|fields": "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]"
144                                                 }
145                                             ]
146                                         }
147                                     ]
148                                 }
149                             ]
150                         }
151                     ]
152                 },
153                 {
154                     "listeners": {
155                         "click": "function (_self, e)\n{\n   _this.dialog.hide();\n \n }"
156                     },
157                     "*prop": "buttons[]",
158                     "text": "Cancel",
159                     "xtype": "Button",
160                     "|xns": "Roo"
161                 },
162                 {
163                     "listeners": {
164                         "click": "function (_self, e)\n{\n   //_this.findField('cuinfo_\n   \n   // check if customer is filled in.\n   if (_this.form.findField('cohead_cust_id').getValue() < 1) {\n        Roo.MessageBox.alert(\"Error\", \"Select a customer\");\n        return;\n   }\n   \n   var data = _this.form.getFieldValues();\n   var c = _this.form.findField('cohead_cust_id').lastData;\n\n   var cur = _this.form.findField('cohead_curr_id').lastData;   \n   \n   data.cohead_curr_id      = cur.curr_id;\n//   data.cohead_curr_id_curr_name = cur.cust_curr_id_curr_name;\n   data.cohead_curr_id_curr_name = cur.curr_name;\n   \n   data.cohead_terms_id      = c.cust_terms_id;\n   data.cohead_terms_id_terms_descrip = c.cust_terms_id_terms_descrip;\n   \n   // fill in staff in/c..\n   \n   data.cohead_salesrep_id =  Pman.Login.authUser.salesrep.salesrep_id;\n   data.cohead_salesrep_id_salesrep_name =  Pman.Login.authUser.salesrep.salesrep_name;\n   \n   data.cohead_display_salesrep_id = c.cust_salesrep_id;\n   data.cohead_display_salesrep_id_salesrep_name = c.cust_salesrep_id_salesrep_name;\n   \n   data.cohead_orderdate = new Date();\n   \n   \n   data.cohead_location_src = c.default_location_id;\n   data.cohead_location_src_location_name = c.default_location_name;\n   \n   data.cohead_taxzone_id = c.cust_taxzone_id_taxzone_id;\n   data.cohead_taxzone_id_taxzone_descrip = c.cust_taxzone_id_taxzone_descrip;\n   \n   // if customer is online .. .then do not fill this stuff in..\n   \n   if (c.cust_custtype_id_custtype_code == 'ONLINE') {\n         Pman.Dialog.XtupleSalesOrder.show(data, function() {\n            _this.dialog.hide();\n            _this.callback()\n         });    \n         return;\n     }\n   \n   new Pman.Request({\n        url : baseURL + '/Roo/cntct.php',\n        method : 'GET',\n        params : {\n            '_id' : c.cust_cntct_id\n        },\n        success : function (res){\n            if(res.data){\n                for(var i in res.data) {\n                    data['cohead_billto_cntct_id_' + i] = res.data[i];\n                }\n             }\n             Pman.Dialog.XtupleSalesOrder.show(data, function() {\n                _this.dialog.hide();\n                _this.callback()\n             }); \n        }\n    });\n   \n   \n   \n}"
165                     },
166                     "*prop": "buttons[]",
167                     "text": "OK",
168                     "xtype": "Button",
169                     "|xns": "Roo"
170                 }
171             ]
172         }
173     ],
174     "permname": "",
175     "modOrder": "001"
176 }