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": 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": "comptype_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_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> </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}\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": "Address",
159                                             "name": "address",
160                                             "qtip": "Enter Address",
161                                             "width": 300,
162                                             "xtype": "TextField",
163                                             "|xns": "Roo.form"
164                                         },
165                                         {
166                                             "allowBlank": true,
167                                             "fieldLabel": "Remarks",
168                                             "height": 40,
169                                             "name": "remarks",
170                                             "qtip": "Enter remarks",
171                                             "width": 300,
172                                             "xtype": "TextArea",
173                                             "|xns": "Roo.form"
174                                         }
175                                     ]
176                                 },
177                                 {
178                                     "labelAlign": "top",
179                                     "width": 200,
180                                     "xtype": "Column",
181                                     "|xns": "Roo.form",
182                                     "items": [
183                                         {
184                                             "fieldLabel": "Background Colour",
185                                             "name": "background_color",
186                                             "xtype": "TextField",
187                                             "|xns": "Roo.form"
188                                         },
189                                         {
190                                             "fieldLabel": "Logo Image",
191                                             "height": 170,
192                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
193                                             "name": "logo_id",
194                                             "style": "border: 1px solid #ccc;",
195                                             "width": 170,
196                                             "xtype": "DisplayField",
197                                             "|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}",
198                                             "|xns": "Roo.form"
199                                         },
200                                         {
201                                             "listeners": {
202                                                 "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}"
203                                             },
204                                             "text": "Add Image",
205                                             "xtype": "Button",
206                                             "|xns": "Roo"
207                                         }
208                                     ]
209                                 },
210                                 {
211                                     "name": "isOwner",
212                                     "xtype": "Hidden",
213                                     "|xns": "Roo.form"
214                                 },
215                                 {
216                                     "name": "id",
217                                     "xtype": "Hidden",
218                                     "|xns": "Roo.form"
219                                 }
220                             ]
221                         }
222                     ]
223                 },
224                 {
225                     "listeners": {
226                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
227                     },
228                     "*prop": "buttons[]",
229                     "text": "Cancel",
230                     "xtype": "Button",
231                     "|xns": "Roo"
232                 },
233                 {
234                     "listeners": {
235                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
236                     },
237                     "*prop": "buttons[]",
238                     "text": "Save",
239                     "xtype": "Button",
240                     "|xns": "Roo"
241                 }
242             ]
243         }
244     ],
245     "permname": "",
246     "modOrder": "001"
247 }