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": "name",
98                                             "editable": "false",
99                                             "emptyText": "Select Type",
100                                             "fieldLabel": "Type",
101                                             "forceSelection": true,
102                                             "listWidth": 250,
103                                             "loadingText": "Searching...",
104                                             "minChars": 2,
105                                             "name": "comptype_name",
106                                             "pageSize": 20,
107                                             "qtip": "Select type",
108                                             "queryParam": "query[name]",
109                                             "selectOnFocus": true,
110                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>",
111                                             "triggerAction": "all",
112                                             "typeAhead": false,
113                                             "valueField": "val",
114                                             "width": 200,
115                                             "xtype": "ComboBox",
116                                             "|xns": "Roo.form",
117                                             "items": [
118                                                 {
119                                                     "listeners": {
120                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[empty_etype]'] = 1;\n}\n"
121                                                     },
122                                                     "*prop": "store",
123                                                     "remoteSort": true,
124                                                     "xtype": "Store",
125                                                     "|sortInfo": "{ direction : 'ASC', field: 'id' }",
126                                                     "|xns": "Roo.data",
127                                                     "items": [
128                                                         {
129                                                             "*prop": "proxy",
130                                                             "xtype": "HttpProxy",
131                                                             "method": "GET",
132                                                             "|xns": "Roo.data",
133                                                             "|url": "baseURL + '/Roo/core_enum.php'"
134                                                         },
135                                                         {
136                                                             "*prop": "reader",
137                                                             "xtype": "JsonReader",
138                                                             "|xns": "Roo.data",
139                                                             "id": "id",
140                                                             "root": "data",
141                                                             "totalProperty": "total",
142                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
143                                                         }
144                                                     ]
145                                                 }
146                                             ]
147                                         },
148                                         {
149                                             "allowBlank": true,
150                                             "fieldLabel": "Company Name",
151                                             "name": "name",
152                                             "qtip": "Enter Company Name",
153                                             "width": 300,
154                                             "xtype": "TextField",
155                                             "|xns": "Roo.form"
156                                         },
157                                         {
158                                             "allowBlank": true,
159                                             "fieldLabel": "Phone",
160                                             "name": "tel",
161                                             "qtip": "Enter Phone Number",
162                                             "width": 300,
163                                             "xtype": "TextField",
164                                             "|xns": "Roo.form"
165                                         },
166                                         {
167                                             "allowBlank": true,
168                                             "fieldLabel": "Fax",
169                                             "name": "fax",
170                                             "qtip": "Enter Fax Number",
171                                             "width": 300,
172                                             "xtype": "TextField",
173                                             "|xns": "Roo.form"
174                                         },
175                                         {
176                                             "allowBlank": true,
177                                             "fieldLabel": "Email",
178                                             "name": "email",
179                                             "qtip": "Enter Email Address",
180                                             "width": 300,
181                                             "xtype": "TextField",
182                                             "|xns": "Roo.form"
183                                         },
184                                         {
185                                             "allowBlank": true,
186                                             "fieldLabel": "Address",
187                                             "name": "address",
188                                             "qtip": "Enter Address",
189                                             "width": 300,
190                                             "xtype": "TextField",
191                                             "|xns": "Roo.form"
192                                         },
193                                         {
194                                             "allowBlank": true,
195                                             "fieldLabel": "Remarks",
196                                             "height": 40,
197                                             "name": "remarks",
198                                             "qtip": "Enter remarks",
199                                             "width": 300,
200                                             "xtype": "TextArea",
201                                             "|xns": "Roo.form"
202                                         }
203                                     ]
204                                 },
205                                 {
206                                     "labelAlign": "top",
207                                     "width": 200,
208                                     "xtype": "Column",
209                                     "|xns": "Roo.form",
210                                     "items": [
211                                         {
212                                             "fieldLabel": "Background Colour",
213                                             "name": "background_color",
214                                             "xtype": "TextField",
215                                             "|xns": "Roo.form"
216                                         },
217                                         {
218                                             "fieldLabel": "Logo Image",
219                                             "height": 170,
220                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
221                                             "name": "logo_id",
222                                             "style": "border: 1px solid #ccc;",
223                                             "width": 170,
224                                             "xtype": "DisplayField",
225                                             "|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}",
226                                             "|xns": "Roo.form"
227                                         },
228                                         {
229                                             "listeners": {
230                                                 "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}"
231                                             },
232                                             "text": "Add Image",
233                                             "xtype": "Button",
234                                             "|xns": "Roo"
235                                         }
236                                     ]
237                                 },
238                                 {
239                                     "name": "isOwner",
240                                     "xtype": "Hidden",
241                                     "|xns": "Roo.form"
242                                 },
243                                 {
244                                     "name": "id",
245                                     "xtype": "Hidden",
246                                     "|xns": "Roo.form"
247                                 }
248                             ]
249                         }
250                     ]
251                 },
252                 {
253                     "listeners": {
254                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
255                     },
256                     "*prop": "buttons[]",
257                     "text": "Cancel",
258                     "xtype": "Button",
259                     "|xns": "Roo"
260                 },
261                 {
262                     "listeners": {
263                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
264                     },
265                     "*prop": "buttons[]",
266                     "text": "Save",
267                     "xtype": "Button",
268                     "|xns": "Roo"
269                 }
270             ]
271         }
272     ],
273     "permname": "",
274     "modOrder": "001"
275 }