Pman.Dialog.CoreCompanies.bjs
[Pman.Core] / Pman.Dialog.CoreCompanies.bjs
1 {
2     "id": "roo-file-160",
3     "name": "Pman.Dialog.CoreCompanies",
4     "parent": "",
5     "title": "",
6     "path": "/home/chris/gitlive/Pman.Core/Pman.Dialog.CoreCompanies.bjs",
7     "items": [
8         {
9             "autoCreate": "true",
10             "closable": false,
11             "collapsible": false,
12             "draggable": false,
13             "height": 400,
14             "modal": true,
15             "shadow": "true",
16             "title": "Edit Companies",
17             "width": 750,
18             "xtype": "LayoutDialog",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "*prop": "center",
23                     "alwaysShowTabs": false,
24                     "autoScroll": false,
25                     "closeOnTab": true,
26                     "hideTabs": true,
27                     "titlebar": false,
28                     "xtype": "LayoutRegion",
29                     "|xns": "Roo"
30                 },
31                 {
32                     "autoCreate": "true",
33                     "fitToFrame": true,
34                     "region": "center",
35                     "xtype": "ContentPanel",
36                     "|xns": "Roo",
37                     "items": [
38                         {
39                             "listeners": {
40                                 "actionfailed": "function(f, act) {\n    _this.dialog.el.unmask();\n    // error msg???\n    Pman.standardActionFailed(f,act);\n              \n}",
41                                 "actioncomplete": "function(f, act) {\n    _this.dialog.el.unmask();\n    //console.log('load completed'); \n    // error messages?????\n    if(act.type == 'setdata'){\n        this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n        return;\n    }\n   \n    if (act.type == 'load') {\n        _this.data = act.result.data;\n        var meth = _this.data.isOwner || !Pman.Login.isOwner() ? 'disable' : 'enable';\n     \n            \n        if (_this.form.findField('comptype')) {\n            _this.form.findField('comptype')[meth]();\n        }\n         \n       // _this.loaded();\n        return;\n    }\n    \n    \n    if (act.type == 'submit') { // only submitted here if we are \n        _this.dialog.hide();\n       \n        if (_this.callback) {\n            _this.callback.call(this, act.result.data);\n        }\n        return; \n    }\n    // unmask?? \n}",
42                                 "rendered": "function (form)\n{\n    _this.form = form;\n}"
43                             },
44                             "fileUpload": true,
45                             "labelWidth": 160,
46                             "xtype": "Form",
47                             "|url": "baseURL + '/Roo/Companies.php'",
48                             "|xns": "Roo.form",
49                             "items": [
50                                 {
51                                     "width": 500,
52                                     "xtype": "Column",
53                                     "|xns": "Roo.form",
54                                     "items": [
55                                         {
56                                             "allowBlank": false,
57                                             "fieldLabel": "Company ID (for filing Ref.)",
58                                             "name": "code",
59                                             "qtip": "Enter code",
60                                             "width": 100,
61                                             "xtype": "TextField",
62                                             "|xns": "Roo.form"
63                                         },
64                                         {
65                                             "allowBlank": false,
66                                             "displayField": "desc",
67                                             "editable": false,
68                                             "emptyText": "Select Type",
69                                             "fieldLabel": "Type",
70                                             "hiddenName": "comptype",
71                                             "listWidth": 250,
72                                             "name": "comptype_name",
73                                             "qtip": "Select Company type",
74                                             "selectOnFocus": true,
75                                             "triggerAction": "all",
76                                             "typeAhead": false,
77                                             "valueField": "val",
78                                             "width": 200,
79                                             "xtype": "ComboBox",
80                                             "|xns": "Roo.form",
81                                             "items": [
82                                                 {
83                                                     "*prop": "store",
84                                                     "data": "[ 'CONSULTANT', \"Consultant\" ],[ 'CLIENT'    ,  \"Client\" ],[ 'CONTRACTOR' , \"Contractor\" ]",
85                                                     "fields": "['val', 'desc']",
86                                                     "xtype": "SimpleStore",
87                                                     "|xns": "Roo.data"
88                                                 }
89                                             ]
90                                         },
91                                         {
92                                             "listeners": {
93                                                 "render": "function (_self)\n{\n    _this.etypeCombo = _self;\n}",
94                                                 "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
95                                             },
96                                             "alwaysQuery": true,
97                                             "displayField": "comptype_name",
98                                             "editable": "false",
99                                             "emptyText": "Select Type",
100                                             "fieldLabel": "Type",
101                                             "forceSelection": true,
102                                             "listWidth": 250,
103                                             "loadingText": "Searching...",
104                                             "minChars": 2,
105                                             "pageSize": 20,
106                                             "qtip": "Select type",
107                                             "queryParam": "query[name]",
108                                             "selectOnFocus": true,
109                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
110                                             "triggerAction": "all",
111                                             "typeAhead": false,
112                                             "valueField": "name",
113                                             "width": 200,
114                                             "xtype": "ComboBox",
115                                             "|xns": "Roo.form",
116                                             "items": [
117                                                 {
118                                                     "listeners": {
119                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[empty_etype]'] = 1;\n}\n"
120                                                     },
121                                                     "*prop": "store",
122                                                     "remoteSort": true,
123                                                     "xtype": "Store",
124                                                     "|sortInfo": "{ direction : 'ASC', field: 'id' }",
125                                                     "|xns": "Roo.data",
126                                                     "items": [
127                                                         {
128                                                             "*prop": "proxy",
129                                                             "xtype": "HttpProxy",
130                                                             "method": "GET",
131                                                             "|xns": "Roo.data",
132                                                             "|url": "baseURL + '/Roo/core_enum.php'"
133                                                         },
134                                                         {
135                                                             "*prop": "reader",
136                                                             "xtype": "JsonReader",
137                                                             "|xns": "Roo.data",
138                                                             "id": "id",
139                                                             "root": "data",
140                                                             "totalProperty": "total",
141                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
142                                                         }
143                                                     ]
144                                                 }
145                                             ]
146                                         },
147                                         {
148                                             "allowBlank": true,
149                                             "fieldLabel": "Company Name",
150                                             "name": "name",
151                                             "qtip": "Enter Company Name",
152                                             "width": 300,
153                                             "xtype": "TextField",
154                                             "|xns": "Roo.form"
155                                         },
156                                         {
157                                             "allowBlank": true,
158                                             "fieldLabel": "Phone",
159                                             "name": "tel",
160                                             "qtip": "Enter Phone Number",
161                                             "width": 300,
162                                             "xtype": "TextField",
163                                             "|xns": "Roo.form"
164                                         },
165                                         {
166                                             "allowBlank": true,
167                                             "fieldLabel": "Fax",
168                                             "name": "fax",
169                                             "qtip": "Enter Fax Number",
170                                             "width": 300,
171                                             "xtype": "TextField",
172                                             "|xns": "Roo.form"
173                                         },
174                                         {
175                                             "allowBlank": true,
176                                             "fieldLabel": "Email",
177                                             "name": "email",
178                                             "qtip": "Enter Email Address",
179                                             "width": 300,
180                                             "xtype": "TextField",
181                                             "|xns": "Roo.form"
182                                         },
183                                         {
184                                             "allowBlank": true,
185                                             "fieldLabel": "Address",
186                                             "name": "address",
187                                             "qtip": "Enter Address",
188                                             "width": 300,
189                                             "xtype": "TextField",
190                                             "|xns": "Roo.form"
191                                         },
192                                         {
193                                             "allowBlank": true,
194                                             "fieldLabel": "Remarks",
195                                             "height": 40,
196                                             "name": "remarks",
197                                             "qtip": "Enter remarks",
198                                             "width": 300,
199                                             "xtype": "TextArea",
200                                             "|xns": "Roo.form"
201                                         }
202                                     ]
203                                 },
204                                 {
205                                     "labelAlign": "top",
206                                     "width": 200,
207                                     "xtype": "Column",
208                                     "|xns": "Roo.form",
209                                     "items": [
210                                         {
211                                             "fieldLabel": "Background Colour",
212                                             "name": "background_color",
213                                             "xtype": "TextField",
214                                             "|xns": "Roo.form"
215                                         },
216                                         {
217                                             "fieldLabel": "Logo Image",
218                                             "height": 170,
219                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
220                                             "name": "logo_id",
221                                             "style": "border: 1px solid #ccc;",
222                                             "width": 170,
223                                             "xtype": "DisplayField",
224                                             "|valueRenderer": "function(v) {\n    //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';\n    if (!v) {\n        return \"No Image Available\" + '<BR/>';\n    }\n    return String.format('<img src=\"{0}\" width=\"150\">', \n            baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'\n    );\n}",
225                                             "|xns": "Roo.form"
226                                         },
227                                         {
228                                             "listeners": {
229                                                 "click": "function (_self, e)\n{\n    var _t = _this.form.findField('logo_id');\n                         \n    Pman.Dialog.Image.show({\n        onid :_this.data.id,\n        ontable : 'Companies',\n        imgtype : 'LOGO'\n    }, function(data) {\n        if  (data) {\n            _t.setValue(data.id);\n        }\n        \n    });\n}"
230                                             },
231                                             "text": "Add Image",
232                                             "xtype": "Button",
233                                             "|xns": "Roo"
234                                         }
235                                     ]
236                                 },
237                                 {
238                                     "name": "isOwner",
239                                     "xtype": "Hidden",
240                                     "|xns": "Roo.form"
241                                 },
242                                 {
243                                     "name": "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    _this.dialog.el.mask(\"Saving\");\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 }