e374e850766be0204d57dc3bc9cf970a874dfba1
[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             "listeners": {
10                 "beforeshow": "function (_self)\n{\n    if (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        \n        \n        \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}"
11             },
12             "autoCreate": "true",
13             "closable": false,
14             "collapsible": false,
15             "draggable": false,
16             "height": 400,
17             "modal": true,
18             "shadow": "true",
19             "title": "Edit Companies",
20             "width": 750,
21             "xtype": "LayoutDialog",
22             "|xns": "Roo",
23             "items": [
24                 {
25                     "*prop": "center",
26                     "alwaysShowTabs": false,
27                     "autoScroll": false,
28                     "closeOnTab": true,
29                     "hideTabs": true,
30                     "titlebar": false,
31                     "xtype": "LayoutRegion",
32                     "|xns": "Roo"
33                 },
34                 {
35                     "autoCreate": "true",
36                     "fitToFrame": true,
37                     "region": "center",
38                     "xtype": "ContentPanel",
39                     "|xns": "Roo",
40                     "items": [
41                         {
42                             "listeners": {
43                                 "actionfailed": "function(f, act) {\n    _this.dialog.el.unmask();\n    // error msg???\n    Pman.standardActionFailed(f,act);\n              \n}",
44                                 "actioncomplete": "function(f, act) {\n    _this.dialog.el.unmask();\n    //console.log('load completed'); \n    // error messages?????\n    if(act.type == 'setdata'){\n        if (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 (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}",
45                                 "rendered": "function (form)\n{\n    _this.form = form;\n}"
46                             },
47                             "fileUpload": true,
48                             "labelWidth": 160,
49                             "xtype": "Form",
50                             "|url": "function() {\n    \n}\n",
51                             "|xns": "Roo.form",
52                             "items": [
53                                 {
54                                     "width": 500,
55                                     "xtype": "Column",
56                                     "|xns": "Roo.form",
57                                     "items": [
58                                         {
59                                             "allowBlank": false,
60                                             "fieldLabel": "Company ID (for filing Ref.)",
61                                             "name": "code",
62                                             "qtip": "Enter code",
63                                             "width": 100,
64                                             "xtype": "TextField",
65                                             "|xns": "Roo.form"
66                                         },
67                                         {
68                                             "allowBlank": false,
69                                             "displayField": "desc",
70                                             "editable": false,
71                                             "emptyText": "Select Type",
72                                             "fieldLabel": "Type",
73                                             "hiddenName": "comptype",
74                                             "listWidth": 250,
75                                             "name": "comptype_name",
76                                             "qtip": "Select Company type",
77                                             "selectOnFocus": true,
78                                             "triggerAction": "all",
79                                             "typeAhead": false,
80                                             "valueField": "val",
81                                             "width": 200,
82                                             "xtype": "ComboBox",
83                                             "|xns": "Roo.form",
84                                             "items": [
85                                                 {
86                                                     "*prop": "store",
87                                                     "data": "[ 'CONSULTANT', \"Consultant\" ],[ 'CLIENT'    ,  \"Client\" ],[ 'CONTRACTOR' , \"Contractor\" ]",
88                                                     "fields": "['val', 'desc']",
89                                                     "xtype": "SimpleStore",
90                                                     "|xns": "Roo.data"
91                                                 }
92                                             ]
93                                         },
94                                         {
95                                             "allowBlank": true,
96                                             "fieldLabel": "Company Name",
97                                             "name": "name",
98                                             "qtip": "Enter Company Name",
99                                             "width": 300,
100                                             "xtype": "TextField",
101                                             "|xns": "Roo.form"
102                                         },
103                                         {
104                                             "allowBlank": true,
105                                             "fieldLabel": "Phone",
106                                             "name": "tel",
107                                             "qtip": "Enter Phone Number",
108                                             "width": 300,
109                                             "xtype": "TextField",
110                                             "|xns": "Roo.form"
111                                         },
112                                         {
113                                             "allowBlank": true,
114                                             "fieldLabel": "Fax",
115                                             "name": "fax",
116                                             "qtip": "Enter Fax Number",
117                                             "width": 300,
118                                             "xtype": "TextField",
119                                             "|xns": "Roo.form"
120                                         },
121                                         {
122                                             "allowBlank": true,
123                                             "fieldLabel": "Email",
124                                             "name": "email",
125                                             "qtip": "Enter Email Address",
126                                             "width": 300,
127                                             "xtype": "TextField",
128                                             "|xns": "Roo.form"
129                                         },
130                                         {
131                                             "allowBlank": true,
132                                             "fieldLabel": "Address",
133                                             "name": "address",
134                                             "qtip": "Enter Address",
135                                             "width": 300,
136                                             "xtype": "TextField",
137                                             "|xns": "Roo.form"
138                                         },
139                                         {
140                                             "allowBlank": true,
141                                             "fieldLabel": "Remarks",
142                                             "height": 40,
143                                             "name": "remarks",
144                                             "qtip": "Enter remarks",
145                                             "width": 300,
146                                             "xtype": "TextArea",
147                                             "|xns": "Roo.form"
148                                         }
149                                     ]
150                                 },
151                                 {
152                                     "labelAlign": "top",
153                                     "width": 200,
154                                     "xtype": "Column",
155                                     "|xns": "Roo.form",
156                                     "items": [
157                                         {
158                                             "fieldLabel": "Background Colour",
159                                             "name": "background_color",
160                                             "xtype": "TextField",
161                                             "|xns": "Roo.form"
162                                         },
163                                         {
164                                             "fieldLabel": "Logo Image",
165                                             "height": 170,
166                                             "icon": "rootURL + 'images/default/dd/drop-add.gif'",
167                                             "name": "logo_id",
168                                             "style": "border: 1px solid #ccc;",
169                                             "width": 170,
170                                             "xtype": "DisplayField",
171                                             "|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}",
172                                             "|xns": "Roo.form"
173                                         },
174                                         {
175                                             "listeners": {
176                                                 "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}"
177                                             },
178                                             "text": "Add Image",
179                                             "xtype": "Button",
180                                             "|xns": "Roo"
181                                         }
182                                     ]
183                                 },
184                                 {
185                                     "name": "isOwner",
186                                     "xtype": "Hidden",
187                                     "|xns": "Roo.form"
188                                 },
189                                 {
190                                     "name": "id",
191                                     "xtype": "Hidden",
192                                     "|xns": "Roo.form"
193                                 }
194                             ]
195                         }
196                     ]
197                 },
198                 {
199                     "*prop": "buttons[]",
200                     "text": "Cancel",
201                     "xtype": "Button",
202                     "|xns": "Roo"
203                 },
204                 {
205                     "*prop": "buttons[]",
206                     "text": "Save",
207                     "xtype": "Button",
208                     "|xns": "Roo"
209                 }
210             ]
211         }
212     ],
213     "permname": "",
214     "modOrder": "001"
215 }