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