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