1 //<script type="text/javascript">
4 Pman.Dialog.Companies = new Roo.util.Observable({
6 'beforerender' : true, // trigger so we can add modules later..
7 'show' : true, // trigger on showing form.. - to load additiona data..
10 show : function (data, callback)
12 Pman.Dialog.CoreCompanies.show({id:data.id});
24 // this.dialog = new Ext.LayoutDialog(Ext.get(document.body).createChild({tag:'div'}), {
26 // title: "Edit Companies",
34 // collapsible : false,
40 // // tabPosition: 'top',
43 // alwaysShowTabs: false
46 // this.dialog.addKeyListener(27, this.dialog.hide, this.dialog);
47 // this.dialog.addButton("Cancel", this.dialog.hide, this.dialog);
49 // this.dialog.addButton("Save", this.save, this);
50 // this.layout = this.dialog.getLayout();
51 // this.layout.beginUpdate();
55 // this.form = new Ext.form.Form({
60 // actionfailed : function(f, act) {
61 // _this.dialog.el.unmask();
63 // Pman.standardActionFailed(f,act);
66 // actioncomplete: function(f, act) {
67 // _this.dialog.el.unmask();
68 // //console.log('load completed');
69 // // error messages?????
72 // if (act.type == 'load') {
74 // _this.data = act.result.data;
75 // var meth = _this.data.isOwner || !Pman.Login.isOwner() ? 'disable' : 'enable';
78 // if (_this.form.findField('comptype')) {
79 // _this.form.findField('comptype')[meth]();
87 // if (act.type == 'submit') { // only submitted here if we are
88 // _this.dialog.hide();
90 // if (_this.callback) {
91 // _this.callback.call(this, act.result.data);
103 // //?? will this work...
105 // this.form.addxtype.apply(this.form, this.getFormFields());
106 // this.fireEvent('beforeRender', this );
108 // var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'});
109 // ef.dom.style.margin = 10;
111 // this.form.render(ef.dom);
113 // var vp = this.dialog.getLayout().add('center', new Ext.ContentPanel(ef, {
114 // autoCreate : true,
115 // //title: 'Org Details',
116 // //toolbar: this.tb,
125 // this.layout.endUpdate();
127 // show : function (data, callback)
129 // this.callback = callback;
130 // this._id = data.id ? data.id : 0; // modify if you do not use ID !!!!
133 // this.form.reset();
134 // if (data._fetch) {
135 // this.dialog.show();
136 // this.dialog.el.mask("Loading");
137 // this.form.doAction('load', {
138 // url: baseURL + '/Roo/Companies.html',
142 // _ts : Math.random()
145 // this.fireEvent('show');
148 // this.form.setValues(data);
153 // this.dialog.show();
155 // if (data.isOwner || !Pman.Login.isOwner()) {
156 // this.dialog.setTitle("Your Company Details");
157 // if (this.form.findField('comptype')) {
158 // this.form.findField('comptype').disable();
165 // this.dialog.setTitle(data.id ? "Edit Company" : "Add Company");
166 // if (this.form.findField('comptype')) {
167 // this.form.findField('comptype').enable();
170 // this.fireEvent('show');
177 // this.form.fileUpload = this.form.findField('imageUpload') ? true : false;
178 // this.fireEvent('beforesave');
179 // this.form.doAction('submit', {
180 // url: baseURL + '/Roo/Companies.html',
184 // ts : Math.random()
189 // comptypeList : function()
191 // // should probably be system configurable..
194 // [ 'CONSULTANT', "Consultant" ],
195 // [ 'CLIENT' , "Client" ],
196 // [ 'CONTRACTOR' , "Contractor" ]
197 // // [ 'OWNER', "System Owner" ]
200 // comptypeListToString: function(v) {
204 // if (v== "OWNER") {
205 // return "System Owner";
207 // var a = this.comptypeList();
209 // Roo.each(a, function( ar) {
221 // getFormFields : function() {
228 // this.c_comptype_name(),
242 // labelAlign: 'top',
244 // this.c_background_color(),
245 // this.c_image_edit()
246 // //this.c_image_view(),
247 // //this.c_image_change(),
256 // c_code : function() {
259 // fieldLabel : "Company ID (for filing Ref.)",
261 // allowBlank : false,
262 // qtip : "Enter code",
263 // xtype : 'TextField',
267 // c_comptype_name : function() {
270 // fieldLabel : 'Type',
271 // disabled : Pman.Login.isOwner() ? false : true,
272 // name : 'comptype_name',
273 // xtype : 'ComboBox',
274 // allowBlank : false,
275 // qtip : 'Select Company type',
284 // xtype : 'SimpleStore',
285 // fields: ['val', 'desc'],
286 // data : this.comptypeList()
288 // displayField:'desc',
289 // valueField: 'val',
290 // hiddenName : 'comptype',
295 // triggerAction: 'all',
296 // emptyText: "Select Type",
297 // selectOnFocus: true
302 // c_name : function() {
306 // fieldLabel : "Company Name",
308 // allowBlank : true,
309 // qtip : "Enter Company Name",
310 // xtype : 'TextField',
314 // c_tel : function() {
318 // fieldLabel : "Phone",
320 // allowBlank : true,
321 // qtip : "Enter Phone Number",
322 // xtype : 'TextField',
326 // c_fax : function() {
330 // fieldLabel : "fax",
332 // allowBlank : true,
333 // qtip : "Enter fax Number",
334 // xtype : 'TextField',
338 // c_email : function() {
342 // fieldLabel : "Email",
344 // allowBlank : true,
345 // qtip : "Enter Email Address",
346 // xtype : 'TextField',
350 // c_address : function() {
354 // fieldLabel : "Address",
356 // allowBlank : true,
357 // qtip : "Enter Address",
358 // xtype : 'TextArea',
363 // c_remarks : function() {
367 // fieldLabel : "Remarks",
369 // allowBlank : true,
370 // qtip : "Enter remarks",
371 // xtype : 'TextArea',
376 // c_background_color : function() {
378 // xtype: 'ColorField',
379 // name : 'background_color',
380 // fieldLabel: "Background Colour"
383 // c_image_view : function() {
386 // xtype : 'FieldSetEx',
387 // name : 'image-view',
388 // collapseGroup : 'companies-image',
392 // style: 'width:420px;',
393 // legend : "Logo Image",
396 // xtype : 'DisplayImage', // image preview...
398 // fieldLabel : 'Logo Image',
401 // renderer : function(v) {
402 // return v ? String.format('<img src="{0}" height="{1}">',
403 // baseURL + '/Images/' + v + '/' + _this.data.logo_id_filename,
404 // Math.min(this.height, _this.data.logo_id_height)) : "No Image Attached";
412 // c_image_edit : function() {
416 // fieldLabel : "Logo Image",
418 // allowBlank : true,
419 // style: 'border: 1px solid #ccc;',
420 // xtype : 'DisplayImage',
423 // addTitle : "Change / Add Image",
424 // icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
425 // handler : function() {
428 // Pman.Dialog.Image.show({
429 // onid :_this.data.id,
430 // ontable : 'Companies',
432 // }, function(data) {
434 // _t.setValue(data.id);
439 // renderer : function(v) {
440 // //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
442 // return "No Image Available" + '<BR/>';
444 // return String.format('<img src="{0}" width="150">',
445 // baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
452 // c_image_change: function() {
454 // xtype : 'FieldSetEx',
455 // collapseGroup : 'companies-image',
456 // name : 'image-change',
460 // style: 'width:420px;',
461 // legend : "Add / Change Image",
464 // xtype : 'TextField',
465 // name : 'imageUpload',
466 // fieldLabel : "Upload Image",
467 // inputType : 'file'
472 // c_isOwner : function() {
479 // c_id : function() {