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