pgsql/x-dragon-accnt.sql
[Pman.Xtuple] / Pman.Dialog.XtupleAddress.bjs
1 {
2     "id": "roo-file-0",
3     "name": "Pman.Dialog.XtupleAddress",
4     "parent": "Pman",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleAddress.bjs",
7     "items": [
8         {
9             ".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\"}",
10             "closable": false,
11             "collapsible": false,
12             "height": 400,
13             "modal": true,
14             "resizable": false,
15             "title": "Edit Address",
16             "width": 500,
17             "xtype": "LayoutDialog",
18             "|xns": "Roo",
19             "items": [
20                 {
21                     "|xns": "Roo",
22                     "xtype": "LayoutRegion",
23                     "*prop": "center"
24                 },
25                 {
26                     "region": "center",
27                     "xtype": "ContentPanel",
28                     "|xns": "Roo",
29                     "items": [
30                         {
31                             "|xns": "Roo",
32                             "xtype": "Toolbar",
33                             "*prop": "toolbar",
34                             "items": [
35                                 {
36                                     "|xns": "Roo.Toolbar",
37                                     "xtype": "Fill"
38                                 },
39                                 {
40                                     "listeners": {
41                                         "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        "
42                                     },
43                                     "cls": "x-btn-text-icon",
44                                     "text": "Delete",
45                                     "xtype": "Button",
46                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
47                                     "|xns": "Roo.Toolbar"
48                                 }
49                             ]
50                         },
51                         {
52                             "listeners": {
53                                 "|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",
54                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
55                             },
56                             "method": "POST",
57                             "style": "margin:10px;",
58                             "xtype": "Form",
59                             "|url": "baseURL + '/Roo/addr.php'",
60                             "|xns": "Roo.form",
61                             "items": [
62                                 {
63                                     "listeners": {
64                                         "keyup": "function (_self, e)\n{\n    _this.form.findField('addr_number').sync();\n}"
65                                     },
66                                     "allowBlank": false,
67                                     "fieldLabel": "Line 1",
68                                     "name": "addr_line1",
69                                     "width": 300,
70                                     "xtype": "TextField",
71                                     "|xns": "Roo.form"
72                                 },
73                                 {
74                                     "fieldLabel": "Line 2",
75                                     "name": "addr_line2",
76                                     "width": 300,
77                                     "xtype": "TextField",
78                                     "|xns": "Roo.form"
79                                 },
80                                 {
81                                     "fieldLabel": "Line 3",
82                                     "name": "addr_line3",
83                                     "width": 300,
84                                     "xtype": "TextField",
85                                     "|xns": "Roo.form"
86                                 },
87                                 {
88                                     "fieldLabel": "City",
89                                     "name": "addr_city",
90                                     "width": 300,
91                                     "xtype": "TextField",
92                                     "|xns": "Roo.form"
93                                 },
94                                 {
95                                     "allowBlank": true,
96                                     "displayField": "addr_state",
97                                     "editable": true,
98                                     "emptyText": "State",
99                                     "fieldLabel": "State",
100                                     "listWidth": 400,
101                                     "loadingText": "Searching...",
102                                     "minChars": 2,
103                                     "name": "addr_state",
104                                     "qtip": "Select State",
105                                     "queryParam": "query[addr_state]",
106                                     "selectOnFocus": true,
107                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b></div>",
108                                     "triggerAction": "all",
109                                     "typeAhead": false,
110                                     "valueField": "addr_state",
111                                     "width": 200,
112                                     "xtype": "ComboBox",
113                                     "|xns": "Roo.form",
114                                     "items": [
115                                         {
116                                             "listeners": {
117                                                 "|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"
118                                             },
119                                             "*prop": "store",
120                                             "remoteSort": true,
121                                             "xtype": "Store",
122                                             "|sortInfo": "{ direction : 'ASC', field: 'addr_state' }",
123                                             "|xns": "Roo.data",
124                                             "items": [
125                                                 {
126                                                     "*prop": "proxy",
127                                                     "method": "GET",
128                                                     "xtype": "HttpProxy",
129                                                     "|url": "baseURL + '/Roo/addr.php'",
130                                                     "|xns": "Roo.data"
131                                                 },
132                                                 {
133                                                     "*prop": "reader",
134                                                     "id": "addr_state",
135                                                     "root": "data",
136                                                     "totalProperty": "total",
137                                                     "xtype": "JsonReader",
138                                                     "|fields": "[ 'addr_state' ]",
139                                                     "|xns": "Roo.data"
140                                                 }
141                                             ]
142                                         }
143                                     ]
144                                 },
145                                 {
146                                     "allowBlank": true,
147                                     "displayField": "country_name",
148                                     "editable": true,
149                                     "emptyText": "Country",
150                                     "fieldLabel": "Country",
151                                     "listWidth": 400,
152                                     "loadingText": "Searching...",
153                                     "minChars": 2,
154                                     "name": "addr_country",
155                                     "qtip": "Select Country",
156                                     "queryParam": "query[country_name]",
157                                     "selectOnFocus": true,
158                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>",
159                                     "triggerAction": "all",
160                                     "typeAhead": false,
161                                     "valueField": "country_name",
162                                     "width": 200,
163                                     "xtype": "ComboBox",
164                                     "|xns": "Roo.form",
165                                     "items": [
166                                         {
167                                             "listeners": {
168                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.limit = 999;\n}\n"
169                                             },
170                                             "*prop": "store",
171                                             "remoteSort": true,
172                                             "xtype": "Store",
173                                             "|sortInfo": "{ direction : 'ASC', field: 'country_name' }",
174                                             "|xns": "Roo.data",
175                                             "items": [
176                                                 {
177                                                     "*prop": "proxy",
178                                                     "method": "GET",
179                                                     "xtype": "HttpProxy",
180                                                     "|url": "baseURL + '/Roo/country.php'",
181                                                     "|xns": "Roo.data"
182                                                 },
183                                                 {
184                                                     "*prop": "reader",
185                                                     "id": "country_id",
186                                                     "root": "data",
187                                                     "totalProperty": "total",
188                                                     "xtype": "JsonReader",
189                                                     "|fields": "[{'name':'country_id','type':'int'},'county_name']",
190                                                     "|xns": "Roo.data"
191                                                 }
192                                             ]
193                                         }
194                                     ]
195                                 },
196                                 {
197                                     "fieldLabel": "postalcode",
198                                     "name": "addr_postalcode",
199                                     "width": 150,
200                                     "xtype": "TextField",
201                                     "|xns": "Roo.form"
202                                 },
203                                 {
204                                     "fieldLabel": "Unique#",
205                                     "name": "addr_number",
206                                     "width": 150,
207                                     "xtype": "TextField",
208                                     "|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",
209                                     "|xns": "Roo.form"
210                                 },
211                                 {
212                                     "fieldLabel": "notes",
213                                     "name": "addr_notes",
214                                     "width": 300,
215                                     "xtype": "TextArea",
216                                     "|xns": "Roo.form"
217                                 },
218                                 {
219                                     "name": "customer_id",
220                                     "width": 100,
221                                     "xtype": "Hidden",
222                                     "|xns": "Roo.form"
223                                 },
224                                 {
225                                     "name": "addr_id",
226                                     "width": 100,
227                                     "xtype": "Hidden",
228                                     "|xns": "Roo.form"
229                                 }
230                             ]
231                         }
232                     ]
233                 },
234                 {
235                     "listeners": {
236                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
237                     },
238                     "*prop": "buttons[]",
239                     "text": "Cancel",
240                     "xtype": "Button",
241                     "|xns": "Roo"
242                 },
243                 {
244                     "listeners": {
245                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n \n    _this.form.doAction('submit');\n\n}"
246                     },
247                     "*prop": "buttons[]",
248                     "text": "Save",
249                     "xtype": "Button",
250                     "|xns": "Roo"
251                 }
252             ]
253         }
254     ],
255     "permname": "",
256     "modOrder": "001"
257 }