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'){
85 if (act.data._fetch) {
86 _this.dialog.el.mask("Loading");
87 _this.form.doAction('load', {
88 url: baseURL + '/Roo/Companies.html',
97 _this.form.setValues(data);
100 if (act.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)
144 url : baseURL + '/Roo/Person.php',
155 fieldLabel : 'Company ID (for filing Ref.)',
164 displayField : 'desc',
166 emptyText : "Select Type",
168 hiddenName : 'comptype',
170 name : 'comptype_name',
171 qtip : "Select Company type",
172 selectOnFocus : true,
173 triggerAction : 'all',
178 xtype: 'SimpleStore',
180 data : '[ \'CONSULTANT\', "Consultant" ],[ \'CLIENT\' , "Client" ],[ \'CONTRACTOR\' , "Contractor" ]',
181 fields : '[\'val\', \'desc\']'
188 fieldLabel : 'Company Name',
190 qtip : "Enter Company Name",
197 fieldLabel : 'Phone',
199 qtip : "Enter Phone Number",
208 qtip : "Enter Fax Number",
215 fieldLabel : 'Email',
217 qtip : "Enter Email Address",
224 fieldLabel : 'Address',
226 qtip : "Enter Address",
233 fieldLabel : 'Remarks',
236 qtip : "Enter remarks",
250 fieldLabel : 'Background Colour',
251 name : 'background_color'
254 xtype: 'DisplayField',
256 fieldLabel : 'Logo Image',
258 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
260 style : 'border: 1px solid #ccc;',
262 valueRenderer : function(v) {
263 //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
265 return "No Image Available" + '<BR/>';
267 return String.format('<img src="{0}" width="150">',
268 baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
276 click : function (_self, e)
278 var _t = _this.form.findField('logo_id');
280 Pman.Dialog.Image.show({
282 ontable : 'Companies',
286 _t.setValue(data.id);
312 xtype: 'LayoutRegion',
314 alwaysShowTabs : false,