Pman.Dialog.CoreCompanies.bjs
[Pman.Core] / Pman.Dialog.CoreCompanies.bjs
1 {
2     "id": "roo-file-203",
3     "name": "Pman.Dialog.CoreCompanies",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/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": "Add / Edit Organization",
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.comptype == 'OWNER' ? '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": true,
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                                             "listeners": {
66                                                 "render": "function (_self)\n{\n    _this.etypeCombo = _self;\n}"
67                                             },
68                                             "alwaysQuery": true,
69                                             "displayField": "display_name",
70                                             "emptyText": "Select Type",
71                                             "fieldLabel": "Type",
72                                             "forceSelection": true,
73                                             "hiddenName": "comptype",
74                                             "listWidth": 250,
75                                             "loadingText": "Searching...",
76                                             "minChars": 2,
77                                             "name": "comptype_display_name",
78                                             "pageSize": 20,
79                                             "qtip": "Select type",
80                                             "queryParam": "query[name]",
81                                             "selectOnFocus": true,
82                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
83                                             "triggerAction": "all",
84                                             "typeAhead": false,
85                                             "valueField": "name",
86                                             "width": 200,
87                                             "xtype": "ComboBox",
88                                             "|xns": "Roo.form",
89                                             "items": [
90                                                 {
91                                                     "listeners": {
92                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    //o.params['query[empty_etype]'] = 1;\n    o.params.etype = 'COMPTYPE';\n}\n"
93                                                     },
94                                                     "*prop": "store",
95                                                     "remoteSort": true,
96                                                     "xtype": "Store",
97                                                     "|sortInfo": "{ direction : 'ASC', field: 'id' }",
98                                                     "|xns": "Roo.data",
99                                                     "items": [
100                                                         {
101                                                             "*prop": "proxy",
102                                                             "xtype": "HttpProxy",
103                                                             "method": "GET",
104                                                             "|xns": "Roo.data",
105                                                             "|url": "baseURL + '/Roo/core_enum.php'"
106                                                         },
107                                                         {
108                                                             "*prop": "reader",
109                                                             "id": "id",
110                                                             "root": "data",
111                                                             "totalProperty": "total",
112                                                             "xtype": "JsonReader",
113                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
114                                                             "|xns": "Roo.data"
115                                                         }
116                                                     ]
117                                                 }
118                                             ]
119                                         },
120                                         {
121                                             "allowBlank": true,
122                                             "fieldLabel": "Company Name",
123                                             "name": "name",
124                                             "qtip": "Enter Company Name",
125                                             "width": 300,
126                                             "xtype": "TextField",
127                                             "|xns": "Roo.form"
128                                         },
129                                         {
130                                             "allowBlank": true,
131                                             "fieldLabel": "Phone",
132                                             "name": "tel",
133                                             "qtip": "Enter Phone Number",
134                                             "width": 300,
135                                             "xtype": "TextField",
136                                             "|xns": "Roo.form"
137                                         },
138                                         {
139                                             "allowBlank": true,
140                                             "fieldLabel": "Fax",
141                                             "name": "fax",
142                                             "qtip": "Enter Fax Number",
143                                             "width": 300,
144                                             "xtype": "TextField",
145                                             "|xns": "Roo.form"
146                                         },
147                                         {
148                                             "allowBlank": true,
149                                             "fieldLabel": "Email",
150                                             "name": "email",
151                                             "qtip": "Enter Email Address",
152                                             "width": 300,
153                                             "xtype": "TextField",
154                                             "|xns": "Roo.form"
155                                         },
156                                         {
157                                             "allowBlank": true,
158                                             "fieldLabel": "Url",
159                                             "name": "url",
160                                             "qtip": "Enter Email Address",
161                                             "width": 300,
162                                             "xtype": "TextField",
163                                             "|xns": "Roo.form"
164                                         },
165                                         {
166                                             "allowBlank": true,
167                                             "fieldLabel": "Address",
168                                             "name": "address",
169                                             "qtip": "Enter Address",
170                                             "width": 300,
171                                             "xtype": "TextField",
172                                             "|xns": "Roo.form"
173                                         },
174                                         {
175                                             "allowBlank": true,
176                                             "fieldLabel": "Remarks",
177                                             "height": 120,
178                                             "name": "remarks",
179                                             "qtip": "Enter remarks",
180                                             "width": 300,
181                                             "xtype": "TextArea",
182                                             "|xns": "Roo.form"
183                                         }
184                                     ]
185                                 },
186                                 {
187                                     "labelAlign": "top",
188                                     "width": 200,
189                                     "xtype": "Column",
190                                     "|xns": "Roo.form",
191                                     "items": [
192                                         {
193                                             "fieldLabel": "Background Colour",
194                                             "name": "background_color",
195                                             "xtype": "ColorField",
196                                             "|xns": "Roo.form"
197                                         },
198                                         {
199                                             "fieldLabel": "Logo Image",
200                                             "height": 170,
201                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
202                                             "name": "logo_id",
203                                             "style": "border: 1px solid #ccc;",
204                                             "width": 170,
205                                             "xtype": "DisplayField",
206                                             "|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}",
207                                             "|xns": "Roo.form"
208                                         },
209                                         {
210                                             "listeners": {
211                                                 "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}"
212                                             },
213                                             "text": "Add Image",
214                                             "xtype": "Button",
215                                             "|xns": "Roo"
216                                         }
217                                     ]
218                                 },
219                                 {
220                                     "name": "id",
221                                     "xtype": "Hidden",
222                                     "|xns": "Roo.form"
223                                 }
224                             ]
225                         }
226                     ]
227                 },
228                 {
229                     "listeners": {
230                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
231                     },
232                     "*prop": "buttons[]",
233                     "text": "Cancel",
234                     "xtype": "Button",
235                     "|xns": "Roo"
236                 },
237                 {
238                     "listeners": {
239                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
240                     },
241                     "*prop": "buttons[]",
242                     "text": "Save",
243                     "xtype": "Button",
244                     "|xns": "Roo"
245                 }
246             ]
247         }
248     ],
249     "permname": "",
250     "modOrder": "001"
251 }