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)
157 fieldLabel : 'Company ID (for filing Ref.)',
166 displayField : 'desc',
168 emptyText : "Select Type",
170 hiddenName : 'comptype',
172 name : 'comptype_name',
173 qtip : "Select Company type",
174 selectOnFocus : true,
175 triggerAction : 'all',
180 xtype: 'SimpleStore',
182 data : '[ \'CONSULTANT\', "Consultant" ],[ \'CLIENT\' , "Client" ],[ \'CONTRACTOR\' , "Contractor" ]',
183 fields : '[\'val\', \'desc\']'
190 fieldLabel : 'Company Name',
192 qtip : "Enter Company Name",
199 fieldLabel : 'Phone',
201 qtip : "Enter Phone Number",
210 qtip : "Enter Fax Number",
217 fieldLabel : 'Email',
219 qtip : "Enter Email Address",
226 fieldLabel : 'Address',
228 qtip : "Enter Address",
235 fieldLabel : 'Remarks',
238 qtip : "Enter remarks",
252 fieldLabel : 'Background Colour',
253 name : 'background_color'
256 xtype: 'DisplayField',
258 fieldLabel : 'Logo Image',
260 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
262 style : 'border: 1px solid #ccc;',
264 valueRenderer : function(v) {
265 //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
267 return "No Image Available" + '<BR/>';
269 return String.format('<img src="{0}" width="150">',
270 baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
278 click : function (_self, e)
280 var _t = _this.form.findField('logo_id');
282 Pman.Dialog.Image.show({
284 ontable : 'Companies',
288 _t.setValue(data.id);
314 xtype: 'LayoutRegion',
316 alwaysShowTabs : false,