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