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