Pman.Dialog.CoreCompanies.bjs.2MU1LX
[Pman.Core] / Pman.Dialog.CoreCompanies.bjs
1 {
2     "name" : "Pman.Dialog.CoreCompanies",
3     "parent" : "",
4     "title" : "",
5     "path" : "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreCompanies.bjs",
6     "permname" : "",
7     "modOrder" : "001",
8     "items" : [
9         {
10             "modal" : true,
11             "shadow" : true,
12             "collapsible" : false,
13             "title" : "Add / Edit Organization",
14             "xtype" : "LayoutDialog",
15             "autoCreate" : true,
16             "width" : 750,
17             "$ xns" : "Roo",
18             "closable" : false,
19             "height" : 400,
20             "draggable" : false,
21             "items" : [
22                 {
23                     "alwaysShowTabs" : false,
24                     "autoScroll" : false,
25                     "xtype" : "LayoutRegion",
26                     "hideTabs" : true,
27                     "$ xns" : "Roo",
28                     "* prop" : "center",
29                     "closeOnTab" : true,
30                     "titlebar" : false
31                 },
32                 {
33                     "region" : "center",
34                     "fitToFrame" : true,
35                     "xtype" : "ContentPanel",
36                     "autoCreate" : true,
37                     "$ xns" : "Roo",
38                     "items" : [
39                         {
40                             "listeners" : {
41                                 "actionfailed" : "function(f, act) {\n    _this.dialog.el.unmask();\n    // error msg???\n    Pman.standardActionFailed(f,act);\n              \n}",
42                                 "rendered" : "function (form)\n{\n    _this.form = form;\n}",
43                                 "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}"
44                             },
45                             "$ url" : "baseURL + '/Roo/Companies.php'",
46                             "fileUpload" : true,
47                             "xtype" : "Form",
48                             "labelWidth" : 160,
49                             "$ xns" : "Roo.form",
50                             "items" : [
51                                 {
52                                     "xtype" : "Column",
53                                     "$ xns" : "Roo.form",
54                                     "width" : 500,
55                                     "items" : [
56                                         {
57                                             "fieldLabel" : "Company ID (for filing Ref.)",
58                                             "xtype" : "TextField",
59                                             "allowBlank" : true,
60                                             "width" : 100,
61                                             "$ xns" : "Roo.form",
62                                             "name" : "code",
63                                             "qtip" : "Enter code"
64                                         },
65                                         {
66                                             "listeners" : {
67                                                 "render" : "function (_self)\n{\n    _this.etypeCombo = _self;\n}"
68                                             },
69                                             "alwaysQuery" : true,
70                                             "listWidth" : 250,
71                                             "triggerAction" : "all",
72                                             "fieldLabel" : "Type",
73                                             "forceSelection" : true,
74                                             "selectOnFocus" : true,
75                                             "pageSize" : 20,
76                                             "emptyText" : "Select Type",
77                                             "displayField" : "display_name",
78                                             "hiddenName" : "comptype",
79                                             "minChars" : 2,
80                                             "valueField" : "name",
81                                             "xtype" : "ComboBox",
82                                             "typeAhead" : false,
83                                             "width" : 200,
84                                             "$ xns" : "Roo.form",
85                                             "name" : "comptype_display_name",
86                                             "qtip" : "Select type",
87                                             "queryParam" : "query[name]",
88                                             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
89                                             "loadingText" : "Searching...",
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    o.params.etype = 'COMPTYPE';\n}\n"
94                                                     },
95                                                     "xtype" : "Store",
96                                                     "remoteSort" : true,
97                                                     "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
98                                                     "$ xns" : "Roo.data",
99                                                     "* prop" : "store",
100                                                     "items" : [
101                                                         {
102                                                             "$ url" : "baseURL + '/Roo/core_enum.php'",
103                                                             "method" : "GET",
104                                                             "xtype" : "HttpProxy",
105                                                             "$ xns" : "Roo.data",
106                                                             "* prop" : "proxy"
107                                                         },
108                                                         {
109                                                             "id" : "id",
110                                                             "root" : "data",
111                                                             "xtype" : "JsonReader",
112                                                             "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
113                                                             "$ xns" : "Roo.data",
114                                                             "* prop" : "reader",
115                                                             "totalProperty" : "total"
116                                                         }
117                                                     ]
118                                                 }
119                                             ]
120                                         },
121                                         {
122                                             "fieldLabel" : "Company Name",
123                                             "xtype" : "TextField",
124                                             "allowBlank" : true,
125                                             "width" : 300,
126                                             "$ xns" : "Roo.form",
127                                             "name" : "name",
128                                             "qtip" : "Enter Company Name"
129                                         },
130                                         {
131                                             "fieldLabel" : "Phone",
132                                             "xtype" : "TextField",
133                                             "allowBlank" : true,
134                                             "width" : 300,
135                                             "$ xns" : "Roo.form",
136                                             "name" : "tel",
137                                             "qtip" : "Enter Phone Number"
138                                         },
139                                         {
140                                             "fieldLabel" : "Fax",
141                                             "xtype" : "TextField",
142                                             "allowBlank" : true,
143                                             "width" : 300,
144                                             "$ xns" : "Roo.form",
145                                             "name" : "fax",
146                                             "qtip" : "Enter Fax Number"
147                                         },
148                                         {
149                                             "fieldLabel" : "Email",
150                                             "xtype" : "TextField",
151                                             "allowBlank" : true,
152                                             "width" : 300,
153                                             "$ xns" : "Roo.form",
154                                             "name" : "email",
155                                             "qtip" : "Enter Email Address"
156                                         },
157                                         {
158                                             "fieldLabel" : "Url",
159                                             "xtype" : "TextField",
160                                             "allowBlank" : true,
161                                             "width" : 300,
162                                             "$ xns" : "Roo.form",
163                                             "name" : "url",
164                                             "qtip" : "Enter Url"
165                                         },
166                                         {
167                                             "fieldLabel" : "Address",
168                                             "xtype" : "TextField",
169                                             "allowBlank" : true,
170                                             "width" : 300,
171                                             "$ xns" : "Roo.form",
172                                             "name" : "address",
173                                             "qtip" : "Enter Address"
174                                         },
175                                         {
176                                             "fieldLabel" : "Remarks",
177                                             "xtype" : "TextArea",
178                                             "allowBlank" : true,
179                                             "width" : 300,
180                                             "$ xns" : "Roo.form",
181                                             "height" : 120,
182                                             "name" : "remarks",
183                                             "qtip" : "Enter remarks"
184                                         }
185                                     ]
186                                 },
187                                 {
188                                     "labelAlign" : "top",
189                                     "xtype" : "Column",
190                                     "width" : 200,
191                                     "$ xns" : "Roo.form",
192                                     "items" : [
193                                         {
194                                             "fieldLabel" : "Background Colour",
195                                             "xtype" : "ColorField",
196                                             "$ xns" : "Roo.form",
197                                             "name" : "background_color"
198                                         },
199                                         {
200                                             "fieldLabel" : "Logo Image",
201                                             "style" : "border: 1px solid #ccc;",
202                                             "xtype" : "DisplayField",
203                                             "$ 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('<a target=\"_new\" href=\"{1}\"><img src=\"{0}\" width=\"150\"></a>', \n            baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg',\n            baseURL + '/Images/Thumb/'+v+'/logo.jpg'           \n    );\n}",
204                                             "icon" : "rootURL + 'images/default/dd/drop-add.gif'",
205                                             "width" : 170,
206                                             "$ xns" : "Roo.form",
207                                             "height" : 170,
208                                             "name" : "logo_id"
209                                         },
210                                         {
211                                             "listeners" : {
212                                                 "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}"
213                                             },
214                                             "text" : "Add Image",
215                                             "xtype" : "Button",
216                                             "$ xns" : "Roo"
217                                         }
218                                     ]
219                                 },
220                                 {
221                                     "xtype" : "Hidden",
222                                     "$ xns" : "Roo.form",
223                                     "name" : "id"
224                                 }
225                             ]
226                         }
227                     ]
228                 },
229                 {
230                     "listeners" : {
231                         "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
232                     },
233                     "text" : "Cancel",
234                     "xtype" : "Button",
235                     "$ xns" : "Roo",
236                     "* prop" : "buttons[]"
237                 },
238                 {
239                     "listeners" : {
240                         "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
241                     },
242                     "text" : "Save",
243                     "xtype" : "Button",
244                     "$ xns" : "Roo",
245                     "* prop" : "buttons[]"
246                 }
247             ]
248         }
249     ]
250 }