1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.CoreCompanies = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 beforeshow : function (_self)
36 if (data.isOwner || !Pman.Login.isOwner()) {
37 this.dialog.setTitle("Your Company Details");
38 if (_this.form.findField('comptype')) {
39 _this.form.findField('comptype').disable();
46 this.dialog.setTitle(data.id ? "Edit Company" : "Add Company");
47 if (_this.form.findField('comptype')) {
48 _this.form.findField('comptype').enable();
60 title : "Edit Companies",
64 xtype: 'ContentPanel',
74 actionfailed : function(f, act) {
75 _this.dialog.el.unmask();
77 Pman.standardActionFailed(f,act);
80 actioncomplete : function(f, act) {
81 _this.dialog.el.unmask();
82 //console.log('load completed');
83 // error messages?????
84 if(act.type == 'setdata'){
86 _this.dialog.el.mask("Loading");
87 _this.form.doAction('load', {
88 url: baseURL + '/Roo/Companies.html',
97 _this.form.setValues(data);
100 if (data.isOwner || !Pman.Login.isOwner()) {
101 _this.dialog.setTitle("Your Company Details");
102 if (_this.form.findField('comptype')) {
103 _this.form.findField('comptype').disable();
106 _this.dialog.setTitle(data.id ? "Edit Company" : "Add Company");
107 if (_this.form.findField('comptype')) {
108 _this.form.findField('comptype').enable();
113 if (act.type == 'load') {
114 _this.data = act.result.data;
115 var meth = _this.data.isOwner || !Pman.Login.isOwner() ? 'disable' : 'enable';
118 if (_this.form.findField('comptype')) {
119 _this.form.findField('comptype')[meth]();
127 if (act.type == 'submit') { // only submitted here if we are
130 if (_this.callback) {
131 _this.callback.call(this, act.result.data);
137 rendered : function (form)
154 fieldLabel : 'Company ID (for filing Ref.)',
163 displayField : 'desc',
165 emptyText : "Select Type",
167 hiddenName : 'comptype',
169 name : 'comptype_name',
170 qtip : "Select Company type",
171 selectOnFocus : true,
172 triggerAction : 'all',
177 xtype: 'SimpleStore',
179 data : '[ \'CONSULTANT\', "Consultant" ],[ \'CLIENT\' , "Client" ],[ \'CONTRACTOR\' , "Contractor" ]',
180 fields : '[\'val\', \'desc\']'
187 fieldLabel : 'Company Name',
189 qtip : "Enter Company Name",
196 fieldLabel : 'Phone',
198 qtip : "Enter Phone Number",
207 qtip : "Enter Fax Number",
214 fieldLabel : 'Email',
216 qtip : "Enter Email Address",
223 fieldLabel : 'Address',
225 qtip : "Enter Address",
232 fieldLabel : 'Remarks',
235 qtip : "Enter remarks",
249 fieldLabel : 'Background Colour',
250 name : 'background_color'
253 xtype: 'DisplayField',
255 fieldLabel : 'Logo Image',
257 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
259 style : 'border: 1px solid #ccc;',
261 valueRenderer : function(v) {
262 //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
264 return "No Image Available" + '<BR/>';
266 return String.format('<img src="{0}" width="150">',
267 baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
275 click : function (_self, e)
277 var _t = _this.form.findField('logo_id');
279 Pman.Dialog.Image.show({
281 ontable : 'Companies',
285 _t.setValue(data.id);
311 xtype: 'LayoutRegion',
313 alwaysShowTabs : false,