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                                     "fieldLabel" : "Phone",
58                                     "xtype" : "TextField",
59                                     "$ regex" : "/^[0-9 +-]+$/",
60                                     "width" : 150,
61                                     "$ xns" : "Roo.form",
62                                     "name" : "cntct_phone"
63                                 },
64                                 {
65                                     "fieldLabel" : "Phone (Alt)",
66                                     "xtype" : "TextField",
67                                     "$ regex" : "/^[0-9 +-]+$/",
68                                     "width" : 150,
69                                     "$ xns" : "Roo.form",
70                                     "name" : "cntct_phone1"
71                                 },
72                                 {
73                                     "fieldLabel" : "Email",
74                                     "vtype" : "email",
75                                     "xtype" : "TextField",
76                                     "width" : 200,
77                                     "$ xns" : "Roo.form",
78                                     "name" : "cntct_email"
79                                 },
80                                 {
81                                     "xtype" : "FieldSet",
82                                     "legend" : "Address",
83                                     "style" : "width:420px",
84                                     "$ xns" : "Roo.form",
85                                     "items" : [
86                                         {
87                                             "listeners" : {
88                                                 "keyup" : "function (_self, e)\n{\n    _this.form.findField('addr_number').sync();\n}"
89                                             },
90                                             "fieldLabel" : "Line 1",
91                                             "xtype" : "TextField",
92                                             "allowBlank" : false,
93                                             "width" : 300,
94                                             "$ xns" : "Roo.form",
95                                             "name" : "cntct_addr_id_addr_line1"
96                                         },
97                                         {
98                                             "fieldLabel" : "Line 2",
99                                             "xtype" : "TextField",
100                                             "width" : 300,
101                                             "$ xns" : "Roo.form",
102                                             "name" : "cntct_addr_id_addr_line2"
103                                         },
104                                         {
105                                             "fieldLabel" : "Line 3",
106                                             "xtype" : "TextField",
107                                             "width" : 300,
108                                             "$ xns" : "Roo.form",
109                                             "name" : "cntct_addr_id_addr_line3"
110                                         },
111                                         {
112                                             "listWidth" : 400,
113                                             "triggerAction" : "all",
114                                             "fieldLabel" : "State",
115                                             "selectOnFocus" : true,
116                                             "displayField" : "addr_state",
117                                             "emptyText" : "State",
118                                             "hiddenName" : "cntct_addr_id_addr_state",
119                                             "minChars" : 2,
120                                             "valueField" : "addr_state",
121                                             "xtype" : "ComboBox",
122                                             "allowBlank" : true,
123                                             "typeAhead" : true,
124                                             "editable" : true,
125                                             "width" : 200,
126                                             "$ xns" : "Roo.form",
127                                             "name" : "cntct_addr_id_addr_state",
128                                             "qtip" : "Select State",
129                                             "queryParam" : "query[addr_state]",
130                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b> </div>",
131                                             "loadingText" : "Searching...",
132                                             "items" : [
133                                                 {
134                                                     "listeners" : {
135                                                         "|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"
136                                                     },
137                                                     "xtype" : "Store",
138                                                     "remoteSort" : true,
139                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'addr_state' }",
140                                                     "$ xns" : "Roo.data",
141                                                     "* prop" : "store",
142                                                     "items" : [
143                                                         {
144                                                             "$ url" : "baseURL + '/Roo/addr.php'",
145                                                             "xtype" : "HttpProxy",
146                                                             "method" : "GET",
147                                                             "$ xns" : "Roo.data",
148                                                             "* prop" : "proxy"
149                                                         },
150                                                         {
151                                                             "id" : "addr_state",
152                                                             "root" : "data",
153                                                             "xtype" : "JsonReader",
154                                                             "$ fields" : "[ \"addr_state\"]",
155                                                             "$ xns" : "Roo.data",
156                                                             "* prop" : "reader",
157                                                             "totalProperty" : "total"
158                                                         }
159                                                     ]
160                                                 }
161                                             ]
162                                         },
163                                         {
164                                             "fieldLabel" : "City",
165                                             "xtype" : "TextField",
166                                             "width" : 300,
167                                             "$ xns" : "Roo.form",
168                                             "name" : "cntct_addr_id_addr_city"
169                                         },
170                                         {
171                                             "fieldLabel" : "Zip code",
172                                             "xtype" : "TextField",
173                                             "width" : 300,
174                                             "$ xns" : "Roo.form",
175                                             "name" : "cntct_addr_id_addr_postalcode"
176                                         },
177                                         {
178                                             "listWidth" : 400,
179                                             "triggerAction" : "all",
180                                             "fieldLabel" : "Country",
181                                             "selectOnFocus" : true,
182                                             "displayField" : "country_name",
183                                             "emptyText" : "Country",
184                                             "hiddenName" : "cntct_addr_id_addr_country",
185                                             "minChars" : 2,
186                                             "valueField" : "country_name",
187                                             "xtype" : "ComboBox",
188                                             "allowBlank" : true,
189                                             "typeAhead" : true,
190                                             "editable" : true,
191                                             "width" : 200,
192                                             "$ xns" : "Roo.form",
193                                             "name" : "cntct_addr_id_addr_country",
194                                             "qtip" : "Select Country",
195                                             "queryParam" : "query[country_name]",
196                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>",
197                                             "loadingText" : "Searching...",
198                                             "items" : [
199                                                 {
200                                                     "listeners" : {
201                                                         "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.limit = 999;\n}\n"
202                                                     },
203                                                     "xtype" : "Store",
204                                                     "remoteSort" : true,
205                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'country_name' }",
206                                                     "$ xns" : "Roo.data",
207                                                     "* prop" : "store",
208                                                     "items" : [
209                                                         {
210                                                             "$ url" : "baseURL + '/Roo/country.php'",
211                                                             "xtype" : "HttpProxy",
212                                                             "method" : "GET",
213                                                             "$ xns" : "Roo.data",
214                                                             "* prop" : "proxy"
215                                                         },
216                                                         {
217                                                             "id" : "country_id",
218                                                             "root" : "data",
219                                                             "xtype" : "JsonReader",
220                                                             "$ fields" : "[{\"name\":\"country_id\",\"type\":\"int\"},\"county_name\"]",
221                                                             "$ xns" : "Roo.data",
222                                                             "* prop" : "reader",
223                                                             "totalProperty" : "total"
224                                                         }
225                                                     ]
226                                                 }
227                                             ]
228                                         }
229                                     ]
230                                 },
231                                 {
232                                     "legend" : "Store Details (Delivery only)",
233                                     "xtype" : "FieldSet",
234                                     "$ xns" : "Roo.form",
235                                     "items" : [
236                                         {
237                                             "fieldLabel" : "Name",
238                                             "xtype" : "TextField",
239                                             "allowBlank" : true,
240                                             "readOnly" : true,
241                                             "width" : 300,
242                                             "$ xns" : "Roo.form",
243                                             "name" : "vend_name"
244                                         },
245                                         {
246                                             "fieldLabel" : "Code",
247                                             "xtype" : "TextField",
248                                             "allowBlank" : true,
249                                             "readOnly" : true,
250                                             "width" : 300,
251                                             "$ xns" : "Roo.form",
252                                             "name" : "vendaddr_code"
253                                         }
254                                     ]
255                                 },
256                                 {
257                                     "xtype" : "Hidden",
258                                     "width" : 100,
259                                     "$ xns" : "Roo.form",
260                                     "name" : "customer_id"
261                                 },
262                                 {
263                                     "xtype" : "Hidden",
264                                     "width" : 100,
265                                     "$ xns" : "Roo.form",
266                                     "name" : "cntct_addr_id"
267                                 },
268                                 {
269                                     "xtype" : "Hidden",
270                                     "$ xns" : "Roo.form",
271                                     "name" : "cntct_id"
272                                 }
273                             ]
274                         }
275                     ]
276                 },
277                 {
278                     "listeners" : {
279                         "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
280                     },
281                     "text" : "Cancel",
282                     "xtype" : "Button",
283                     "$ xns" : "Roo",
284                     "* prop" : "buttons[]"
285                 },
286                 {
287                     "listeners" : {
288                         "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n \n    _this.form.doAction(\"submit\");\n\n}"
289                     },
290                     "text" : "Save",
291                     "xtype" : "Button",
292                     "$ xns" : "Roo",
293                     "* prop" : "buttons[]"
294                 }
295             ]
296         }
297     ]
298 }