Pman.Dialog.CorePersonContact.bjs
[Pman.Core] / Pman.Dialog.CorePersonContact.bjs
1 {
2     "id": "roo-file-129",
3     "name": "Pman.Dialog.CorePersonContact",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CorePersonContact.bjs",
7     "items": [
8         {
9             "closable": false,
10             "collapsible": false,
11             "height": 350,
12             "resizable": false,
13             "title": "Edit / Create Contact Details",
14             "width": 500,
15             "xtype": "LayoutDialog",
16             "|xns": "Roo",
17             "items": [
18                 {
19                     "|xns": "Roo",
20                     "xtype": "LayoutRegion",
21                     "*prop": "center"
22                 },
23                 {
24                     "region": "center",
25                     "xtype": "ContentPanel",
26                     "|xns": "Roo",
27                     "items": [
28                         {
29                             "|xns": "Roo.form",
30                             "xtype": "Form",
31                             "listeners": {
32                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\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                             "method": "POST",
36                             "style": "margin:10px;",
37                             "|url": "baseURL + '/Roo/Person.php'",
38                             "items": [
39                                 {
40                                     "listeners": {
41                                         "add": "function (combo)\n{\n\n    Pman.Dialog.Companies.show( {  id: 0 },  function(data) {\n            _this.form.setValues({\n                    company_id_name : data.name,\n                    company_id : data.id\n            });\n    }); \n}"
42                                     },
43                                     "allowBlank": "false",
44                                     "displayField": "code",
45                                     "editable": "false",
46                                     "emptyText": "Select Companies",
47                                     "fieldLabel": "Company",
48                                     "forceSelection": true,
49                                     "hiddenName": "company_id",
50                                     "listWidth": 400,
51                                     "loadingText": "Searching...",
52                                     "minChars": 2,
53                                     "name": "company_id_code",
54                                     "pageSize": 20,
55                                     "qtip": "Select Companies",
56                                     "queryParam": "query[code]",
57                                     "selectOnFocus": true,
58                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{code}</b> </div>",
59                                     "triggerAction": "all",
60                                     "typeAhead": true,
61                                     "valueField": "id",
62                                     "width": 300,
63                                     "xtype": "ComboBox",
64                                     "|xns": "Roo.form",
65                                     "items": [
66                                         {
67                                             "*prop": "store",
68                                             "xtype": "Store",
69                                             "|xns": "Roo.data",
70                                             "remoteSort": true,
71                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
72                                             "listeners": {
73                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
74                                             },
75                                             "items": [
76                                                 {
77                                                     "*prop": "proxy",
78                                                     "xtype": "HttpProxy",
79                                                     "method": "GET",
80                                                     "|xns": "Roo.data",
81                                                     "|url": "baseURL + '/Roo/Companies.php'"
82                                                 },
83                                                 {
84                                                     "*prop": "reader",
85                                                     "xtype": "JsonReader",
86                                                     "|xns": "Roo.data",
87                                                     "id": "id",
88                                                     "root": "data",
89                                                     "totalProperty": "total",
90                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"code\",\"type\":\"string\"}]"
91                                                 }
92                                             ]
93                                         }
94                                     ]
95                                 },
96                                 {
97                                     "listeners": {
98                                         "add": "function (combo)\n{\n    var coid = _this.form.findField('company_id').getValue();\n    if (!coid ) {\n    \n         Ext.MessageBox.alert(\"Error\", \"Select An Company First\");\n        return false;\n\n    }\n    Pman.Dialog.Office.show(cfg, function(data) {\n                _this.form.setValues({\n                    company_id_name : data.name,\n                    company_id : data.id\n            });\n        }); \n    \n    \n}"
99                                     },
100                                     "allowBlank": "false",
101                                     "displayField": "name",
102                                     "editable": "false",
103                                     "emptyText": "Select Office",
104                                     "fieldLabel": "Office",
105                                     "forceSelection": true,
106                                     "hiddenName": "office_id",
107                                     "listWidth": 400,
108                                     "loadingText": "Searching...",
109                                     "minChars": 2,
110                                     "name": "office_id_name",
111                                     "pageSize": 20,
112                                     "qtip": "Select Office",
113                                     "queryParam": "query[name]",
114                                     "selectOnFocus": true,
115                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
116                                     "triggerAction": "all",
117                                     "typeAhead": true,
118                                     "valueField": "id",
119                                     "width": 300,
120                                     "xtype": "ComboBox",
121                                     "|xns": "Roo.form",
122                                     "items": [
123                                         {
124                                             "listeners": {
125                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    var coid = _this.form.findField('company_id').getValue();\n    o.params.company_id = coid;\n}\n"
126                                             },
127                                             "*prop": "store",
128                                             "remoteSort": true,
129                                             "xtype": "Store",
130                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
131                                             "|xns": "Roo.data",
132                                             "items": [
133                                                 {
134                                                     "*prop": "proxy",
135                                                     "xtype": "HttpProxy",
136                                                     "method": "GET",
137                                                     "|xns": "Roo.data",
138                                                     "|url": "baseURL + '/Roo/Office.php'"
139                                                 },
140                                                 {
141                                                     "*prop": "reader",
142                                                     "xtype": "JsonReader",
143                                                     "|xns": "Roo.data",
144                                                     "id": "id",
145                                                     "root": "data",
146                                                     "totalProperty": "total",
147                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]"
148                                                 }
149                                             ]
150                                         }
151                                     ]
152                                 },
153                                 {
154                                     "fieldLabel": "Name",
155                                     "name": "name",
156                                     "width": 300,
157                                     "xtype": "TextField",
158                                     "|xns": "Roo.form"
159                                 },
160                                 {
161                                     "fieldLabel": "Role",
162                                     "name": "role",
163                                     "width": 200,
164                                     "|xns": "Roo.form",
165                                     "xtype": "TextField"
166                                 },
167                                 {
168                                     "fieldLabel": "Phone",
169                                     "name": "phone",
170                                     "width": 200,
171                                     "|xns": "Roo.form",
172                                     "xtype": "TextField"
173                                 },
174                                 {
175                                     "fieldLabel": "Fax",
176                                     "name": "fax",
177                                     "width": 200,
178                                     "|xns": "Roo.form",
179                                     "xtype": "TextField"
180                                 },
181                                 {
182                                     "fieldLabel": "Email",
183                                     "name": "email",
184                                     "width": 200,
185                                     "|xns": "Roo.form",
186                                     "xtype": "TextField"
187                                 },
188                                 {
189                                     "name": "id",
190                                     "|xns": "Roo.form",
191                                     "xtype": "Hidden"
192                                 }
193                             ]
194                         }
195                     ]
196                 },
197                 {
198                     "listeners": {
199                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
200                     },
201                     "*prop": "buttons[]",
202                     "text": "Cancel",
203                     "xtype": "Button",
204                     "|xns": "Roo"
205                 },
206                 {
207                     "listeners": {
208                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
209                     },
210                     "*prop": "buttons[]",
211                     "text": "Save",
212                     "xtype": "Button",
213                     "|xns": "Roo"
214                 }
215             ]
216         }
217     ],
218     "permname": ""
219 }