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