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    \n   \n    if (act.type == 'load') {\n        \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                             "|xns": "Roo.form",
48                             "items": [
49                                 {
50                                     "width": 500,
51                                     "xtype": "Column",
52                                     "|xns": "Roo.form",
53                                     "items": [
54                                         {
55                                             "allowBlank": false,
56                                             "fieldLabel": "Company ID (for filing Ref.)",
57                                             "name": "code",
58                                             "qtip": "Enter code",
59                                             "width": 100,
60                                             "xtype": "TextField",
61                                             "|xns": "Roo.form"
62                                         },
63                                         {
64                                             "allowBlank": false,
65                                             "displayField": "desc",
66                                             "editable": false,
67                                             "emptyText": "Select Type",
68                                             "fieldLabel": "Type",
69                                             "hiddenName": "comptype",
70                                             "listWidth": 250,
71                                             "name": "comptype_name",
72                                             "qtip": "Select Company type",
73                                             "selectOnFocus": true,
74                                             "triggerAction": "all",
75                                             "typeAhead": false,
76                                             "valueField": "val",
77                                             "width": 200,
78                                             "xtype": "ComboBox",
79                                             "|xns": "Roo.form",
80                                             "items": [
81                                                 {
82                                                     "*prop": "store",
83                                                     "data": "[ 'CONSULTANT', \"Consultant\" ],[ 'CLIENT'    ,  \"Client\" ],[ 'CONTRACTOR' , \"Contractor\" ]",
84                                                     "fields": "['val', 'desc']",
85                                                     "xtype": "SimpleStore",
86                                                     "|xns": "Roo.data"
87                                                 }
88                                             ]
89                                         },
90                                         {
91                                             "allowBlank": true,
92                                             "fieldLabel": "Company Name",
93                                             "name": "name",
94                                             "qtip": "Enter Company Name",
95                                             "width": 300,
96                                             "xtype": "TextField",
97                                             "|xns": "Roo.form"
98                                         },
99                                         {
100                                             "allowBlank": true,
101                                             "fieldLabel": "Phone",
102                                             "name": "tel",
103                                             "qtip": "Enter Phone Number",
104                                             "width": 300,
105                                             "xtype": "TextField",
106                                             "|xns": "Roo.form"
107                                         },
108                                         {
109                                             "allowBlank": true,
110                                             "fieldLabel": "Fax",
111                                             "name": "fax",
112                                             "qtip": "Enter Fax Number",
113                                             "width": 300,
114                                             "xtype": "TextField",
115                                             "|xns": "Roo.form"
116                                         },
117                                         {
118                                             "allowBlank": true,
119                                             "fieldLabel": "Email",
120                                             "name": "email",
121                                             "qtip": "Enter Email Address",
122                                             "width": 300,
123                                             "xtype": "TextField",
124                                             "|xns": "Roo.form"
125                                         },
126                                         {
127                                             "allowBlank": true,
128                                             "fieldLabel": "Address",
129                                             "name": "address",
130                                             "qtip": "Enter Address",
131                                             "width": 300,
132                                             "xtype": "TextField",
133                                             "|xns": "Roo.form"
134                                         },
135                                         {
136                                             "allowBlank": true,
137                                             "fieldLabel": "Remarks",
138                                             "height": 40,
139                                             "name": "remarks",
140                                             "qtip": "Enter remarks",
141                                             "width": 300,
142                                             "xtype": "TextArea",
143                                             "|xns": "Roo.form"
144                                         }
145                                     ]
146                                 },
147                                 {
148                                     "labelAlign": "top",
149                                     "width": 200,
150                                     "xtype": "Column",
151                                     "|xns": "Roo.form",
152                                     "items": [
153                                         {
154                                             "fieldLabel": "Background Colour",
155                                             "name": "background_color",
156                                             "xtype": "TextField",
157                                             "|xns": "Roo.form"
158                                         },
159                                         {
160                                             "fieldLabel": "Logo Image",
161                                             "height": 170,
162                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
163                                             "style": "border: 1px solid #ccc;",
164                                             "width": 170,
165                                             "xtype": "DisplayField",
166                                             "|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}",
167                                             "|xns": "Roo.form"
168                                         },
169                                         {
170                                             "listeners": {
171                                                 "click": "function (_self, e)\n{\n    var _t = this;\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}"
172                                             },
173                                             "text": "Add Image",
174                                             "xtype": "Button",
175                                             "|xns": "Roo"
176                                         }
177                                     ]
178                                 },
179                                 {
180                                     "name": "isOwner",
181                                     "xtype": "Hidden",
182                                     "|xns": "Roo.form"
183                                 },
184                                 {
185                                     "name": "id",
186                                     "xtype": "Hidden",
187                                     "|xns": "Roo.form"
188                                 }
189                             ]
190                         }
191                     ]
192                 },
193                 {
194                     "*prop": "buttons[]",
195                     "text": "Cancel",
196                     "xtype": "Button",
197                     "|xns": "Roo"
198                 },
199                 {
200                     "*prop": "buttons[]",
201                     "text": "Save",
202                     "xtype": "Button",
203                     "|xns": "Roo"
204                 }
205             ]
206         }
207     ],
208     "permname": "",
209     "modOrder": "001"
210 }