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": 290,
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                    office_id_name : data.name,\n                    office_id : data.id\n            });\n        }); \n    \n    \n}",
99                                         "beforequery": "function (combo, query, forceAll, cancel, e)\n{\n        var coid = _this.form.findField('company_id').getValue();\n        if (coid < 1 ) {\n            Ext.MessageBox.alert(\"Error\", \"Select An Company First\");\n            return false;\n        }\n}"
100                                     },
101                                     "allowBlank": "false",
102                                     "displayField": "name",
103                                     "editable": "false",
104                                     "emptyText": "Select Office",
105                                     "fieldLabel": "Office",
106                                     "forceSelection": true,
107                                     "hiddenName": "office_id",
108                                     "listWidth": 400,
109                                     "loadingText": "Searching...",
110                                     "minChars": 2,
111                                     "name": "office_id_name",
112                                     "pageSize": 20,
113                                     "qtip": "Select Office",
114                                     "queryParam": "query[name]",
115                                     "selectOnFocus": true,
116                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
117                                     "triggerAction": "all",
118                                     "typeAhead": true,
119                                     "valueField": "id",
120                                     "width": 300,
121                                     "xtype": "ComboBox",
122                                     "|xns": "Roo.form",
123                                     "items": [
124                                         {
125                                             "listeners": {
126                                                 "|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"
127                                             },
128                                             "*prop": "store",
129                                             "remoteSort": true,
130                                             "xtype": "Store",
131                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
132                                             "|xns": "Roo.data",
133                                             "items": [
134                                                 {
135                                                     "*prop": "proxy",
136                                                     "xtype": "HttpProxy",
137                                                     "method": "GET",
138                                                     "|xns": "Roo.data",
139                                                     "|url": "baseURL + '/Roo/Office.php'"
140                                                 },
141                                                 {
142                                                     "*prop": "reader",
143                                                     "xtype": "JsonReader",
144                                                     "|xns": "Roo.data",
145                                                     "id": "id",
146                                                     "root": "data",
147                                                     "totalProperty": "total",
148                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]"
149                                                 }
150                                             ]
151                                         }
152                                     ]
153                                 },
154                                 {
155                                     "fieldLabel": "Name",
156                                     "name": "name",
157                                     "width": 300,
158                                     "xtype": "TextField",
159                                     "|xns": "Roo.form",
160                                     "allowBlank": true,
161                                     "listeners": {}
162                                 },
163                                 {
164                                     "fieldLabel": "Role",
165                                     "name": "role",
166                                     "width": 200,
167                                     "|xns": "Roo.form",
168                                     "xtype": "TextField"
169                                 },
170                                 {
171                                     "fieldLabel": "Phone",
172                                     "name": "phone",
173                                     "width": 200,
174                                     "|xns": "Roo.form",
175                                     "xtype": "TextField"
176                                 },
177                                 {
178                                     "fieldLabel": "Fax",
179                                     "name": "fax",
180                                     "width": 200,
181                                     "|xns": "Roo.form",
182                                     "xtype": "TextField"
183                                 },
184                                 {
185                                     "allowBlank": false,
186                                     "fieldLabel": "Email",
187                                     "name": "email",
188                                     "width": 200,
189                                     "xtype": "TextField",
190                                     "|xns": "Roo.form"
191                                 },
192                                 {
193                                     "name": "id",
194                                     "|xns": "Roo.form",
195                                     "xtype": "Hidden"
196                                 }
197                             ]
198                         }
199                     ]
200                 },
201                 {
202                     "listeners": {
203                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
204                     },
205                     "*prop": "buttons[]",
206                     "text": "Cancel",
207                     "xtype": "Button",
208                     "|xns": "Roo"
209                 },
210                 {
211                     "listeners": {
212                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
213                     },
214                     "*prop": "buttons[]",
215                     "text": "Save",
216                     "xtype": "Button",
217                     "|xns": "Roo"
218                 }
219             ]
220         }
221     ],
222     "permname": ""
223 }