Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleAddress.bjs
1 {
2  "name" : "Pman.Dialog.XtupleAddress",
3  "parent" : "Pman",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.Xtuple/Pman.Dialog.XtupleAddress.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "59716c97497eb9694541f7c3d37b1a4d" : "Country",
10   "3c1df4260ce594cb5594696461087f2f" : "Select Country",
11   "0dbd2559b7f2c43a6e5f0a649c4b172a" : "Edit Address",
12   "46a2a41cc6e552044816a2d04634545d" : "State",
13   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
14   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
15   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
16   "c9cc8cce247e49bae79f15173ce97354" : "Save",
17   "be2933038f93e25262400220080c111f" : "Select State"
18  },
19  "items" : [
20   {
21    "modal" : true,
22    "collapsible" : false,
23    "title" : "Edit Address",
24    "xtype" : "LayoutDialog",
25    "width" : 500,
26    "$ xns" : "Roo",
27    "closable" : false,
28    "resizable" : false,
29    "height" : 400,
30    "# builderCfg" : "{\"cols\":[{\"table\":\"addr\",\"column\":\"addr_id\",\"columnshort\":\"addr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\",\"display\":\"addr_id\"},{\"table\":\"addr\",\"column\":\"addr_active\",\"columnshort\":\"addr_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_city\",\"columnshort\":\"addr_city\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_state\",\"columnshort\":\"addr_state\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_postalcode\",\"columnshort\":\"addr_postalcode\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_notes\",\"columnshort\":\"addr_notes\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"addr_number\",\"columnshort\":\"addr_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"addr_id\"],\"table\":\"addr\",\"xtype\":\"LayoutDialog\",\"|xns\":\"Roo\"}",
31    "items" : [
32     {
33      "xtype" : "LayoutRegion",
34      "$ xns" : "Roo",
35      "* prop" : "center"
36     },
37     {
38      "region" : "center",
39      "xtype" : "ContentPanel",
40      "$ xns" : "Roo",
41      "items" : [
42       {
43        "xtype" : "Toolbar",
44        "$ xns" : "Roo",
45        "* prop" : "toolbar",
46        "items" : [
47         {
48          "xtype" : "Fill",
49          "$ xns" : "Roo.Toolbar"
50         },
51         {
52          "listeners" : {
53           "click" : "function()\n{\n    var id = _this.form.findField('addr_id').getValue() *1;\n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"You can not delete this, you have not created it yet\");\n        return;\n    }\n    \n    \n    Roo.MessageBox.confirm(\"Confirm\", \"You will only be able to delete this if it is not referenced anywhere<BR>\"+\n            \", are you sure you want to try that?\",\n            function (res) {\n                if(res!='yes') {\n                    return;\n                \n                }\n                new Pman.Request({\n                    method: 'POST',\n                    url: baseURL+ '/Roo/addr',\n                    params : {\n                        _delete : id\n                    },\n                    success : function() {\n                        _this.callback({ addr_id : 0, addr_line1 : '' });\n                        _this.dialog.hide();\n                    }\n                });\n        });\n        \n    \n    \n}\n        "
54          },
55          "text" : "Delete",
56          "xtype" : "Button",
57          "cls" : "x-btn-text-icon",
58          "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
59          "$ xns" : "Roo.Toolbar"
60         }
61        ]
62       },
63       {
64        "listeners" : {
65         "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        if (_this.data.addr_id) { \n            this.load({ method: 'GET', params: { '_id' : _this.data.addr_id }});\n        }\n       return;\n    }\n    if (action.type == 'load') {\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.hide();\n    \n         if (_this.callback) {\n             _this.form.setValues(action.result.data);\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
66         "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
67        },
68        "$ url" : "baseURL + '/Roo/addr.php'",
69        "xtype" : "Form",
70        "method" : "POST",
71        "style" : "margin:10px;",
72        "$ xns" : "Roo.form",
73        "items" : [
74         {
75          "listeners" : {
76           "keyup" : "function (_self, e)\n{\n    _this.form.findField('addr_number').sync();\n}"
77          },
78          "fieldLabel" : "Line 1",
79          "xtype" : "TextField",
80          "allowBlank" : false,
81          "width" : 300,
82          "$ xns" : "Roo.form",
83          "name" : "addr_line1"
84         },
85         {
86          "fieldLabel" : "Line 2",
87          "xtype" : "TextField",
88          "width" : 300,
89          "$ xns" : "Roo.form",
90          "name" : "addr_line2"
91         },
92         {
93          "fieldLabel" : "Line 3",
94          "xtype" : "TextField",
95          "width" : 300,
96          "$ xns" : "Roo.form",
97          "name" : "addr_line3"
98         },
99         {
100          "fieldLabel" : "City",
101          "xtype" : "TextField",
102          "width" : 300,
103          "$ xns" : "Roo.form",
104          "name" : "addr_city"
105         },
106         {
107          "listWidth" : 400,
108          "triggerAction" : "all",
109          "fieldLabel" : "State",
110          "selectOnFocus" : true,
111          "displayField" : "addr_state",
112          "emptyText" : "State",
113          "minChars" : 2,
114          "valueField" : "addr_state",
115          "xtype" : "ComboBox",
116          "allowBlank" : true,
117          "typeAhead" : false,
118          "editable" : true,
119          "width" : 200,
120          "$ xns" : "Roo.form",
121          "name" : "addr_state",
122          "qtip" : "Select State",
123          "queryParam" : "query[addr_state]",
124          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b></div>",
125          "loadingText" : "Searching...",
126          "items" : [
127           {
128            "listeners" : {
129             "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n   // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();\n    //if (!o.params.state_country_id_country_name.length) {\n    //    Roo.MessageBox.alert(\"Select Country First\");\n//        return false;\n  //  }\n  \n   o.params._distinct = 'addr_state';\n   o.params._columns = 'addr_state';\n   o.params.limit = 999;\n    // set more here\n}\n"
130            },
131            "xtype" : "Store",
132            "remoteSort" : true,
133            "$ sortInfo" : "{ direction : 'ASC', field: 'addr_state' }",
134            "$ xns" : "Roo.data",
135            "* prop" : "store",
136            "items" : [
137             {
138              "$ url" : "baseURL + '/Roo/addr.php'",
139              "xtype" : "HttpProxy",
140              "method" : "GET",
141              "$ xns" : "Roo.data",
142              "* prop" : "proxy"
143             },
144             {
145              "id" : "addr_state",
146              "root" : "data",
147              "xtype" : "JsonReader",
148              "$ fields" : "[ 'addr_state' ]",
149              "$ xns" : "Roo.data",
150              "* prop" : "reader",
151              "totalProperty" : "total"
152             }
153            ]
154           }
155          ]
156         },
157         {
158          "listWidth" : 400,
159          "triggerAction" : "all",
160          "fieldLabel" : "Country",
161          "selectOnFocus" : true,
162          "displayField" : "country_name",
163          "emptyText" : "Country",
164          "minChars" : 2,
165          "valueField" : "country_name",
166          "xtype" : "ComboBox",
167          "allowBlank" : true,
168          "typeAhead" : false,
169          "editable" : true,
170          "width" : 200,
171          "$ xns" : "Roo.form",
172          "name" : "addr_country",
173          "qtip" : "Select Country",
174          "queryParam" : "query[country_name]",
175          "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>",
176          "loadingText" : "Searching...",
177          "items" : [
178           {
179            "listeners" : {
180             "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.limit = 999;\n}\n"
181            },
182            "xtype" : "Store",
183            "remoteSort" : true,
184            "$ sortInfo" : "{ direction : 'ASC', field: 'country_name' }",
185            "$ xns" : "Roo.data",
186            "* prop" : "store",
187            "items" : [
188             {
189              "$ url" : "baseURL + '/Roo/country.php'",
190              "xtype" : "HttpProxy",
191              "method" : "GET",
192              "$ xns" : "Roo.data",
193              "* prop" : "proxy"
194             },
195             {
196              "id" : "country_id",
197              "root" : "data",
198              "xtype" : "JsonReader",
199              "$ fields" : "[{'name':'country_id','type':'int'},'county_name']",
200              "$ xns" : "Roo.data",
201              "* prop" : "reader",
202              "totalProperty" : "total"
203             }
204            ]
205           }
206          ]
207         },
208         {
209          "fieldLabel" : "postalcode",
210          "xtype" : "TextField",
211          "width" : 150,
212          "$ xns" : "Roo.form",
213          "name" : "addr_postalcode"
214         },
215         {
216          "fieldLabel" : "Unique#",
217          "xtype" : "TextField",
218          "width" : 150,
219          "$ sync" : "function() {\n    if (_this.form.findField('addr_id') * 1 > 0 ) {\n        return;\n    }\n    this.setValue('C' + _this.form.findField('customer_id').getValue() + '-' + \n        _this.form.findField('addr_line1').getValue()\n    );\n        \n}\n",
220          "$ xns" : "Roo.form",
221          "name" : "addr_number"
222         },
223         {
224          "fieldLabel" : "notes",
225          "xtype" : "TextArea",
226          "width" : 300,
227          "$ xns" : "Roo.form",
228          "name" : "addr_notes"
229         },
230         {
231          "xtype" : "Hidden",
232          "width" : 100,
233          "$ xns" : "Roo.form",
234          "name" : "customer_id"
235         },
236         {
237          "xtype" : "Hidden",
238          "width" : 100,
239          "$ xns" : "Roo.form",
240          "name" : "addr_id"
241         }
242        ]
243       }
244      ]
245     },
246     {
247      "listeners" : {
248       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
249      },
250      "text" : "Cancel",
251      "xtype" : "Button",
252      "$ xns" : "Roo",
253      "* prop" : "buttons[]"
254     },
255     {
256      "listeners" : {
257       "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n \n    _this.form.doAction('submit');\n\n}"
258      },
259      "text" : "Save",
260      "xtype" : "Button",
261      "$ xns" : "Roo",
262      "* prop" : "buttons[]"
263     }
264    ]
265   }
266  ]
267 }