- // should probably be system configurable..
- return [
-
- [ 'CONSULTANT', "Consultant" ],
- [ 'CLIENT' , "Client" ],
- [ 'CONTRACTOR' , "Contractor" ]
- // [ 'OWNER', "System Owner" ]
- ];
- },
- comptypeListToString: function(v) {
- if (!v.length) {
- return '';
- }
- if (v== "OWNER") {
- return "System Owner";
- }
- var a = this.comptypeList();
- var ret = '';
- Roo.each(a, function( ar) {
- if (ar[0] == v) {
- ret = ar[1];
- return false;
- }
- });
- return ret;
-
-
-
- },
-
- getFormFields : function() {
- return [
- {
- xtype : 'Column',
- width: 500,
- items: [
- this.c_code(),
- this.c_comptype_name(),
- this.c_name(),
- this.c_tel(),
- this.c_fax(),
- this.c_email(),
-
-
- this.c_address(),
- this.c_remarks()
- ]
- },
- {
- xtype : 'Column',
- width: 200,
- labelAlign: 'top',
- items : [
- this.c_background_color(),
- this.c_image_edit()
- //this.c_image_view(),
- //this.c_image_change(),
- ]
- },
- this.c_isOwner(),
- this.c_id()
- ];
- },
-
-
- c_code : function() {
- return {
- name : 'code',
- fieldLabel : "Company ID (for filing Ref.)",
- value : '',
- allowBlank : false,
- qtip : "Enter code",
- xtype : 'TextField',
- width : 100
- }
- },
- c_comptype_name : function() {
- return {
-
- fieldLabel : 'Type',
- disabled : Pman.Login.isOwner() ? false : true,
- name : 'comptype_name',
- xtype : 'ComboBox',
- allowBlank : false,
- qtip : 'Select Company type',
-
- width: 200,
- xns : Roo.form,
-
- listWidth : 250,
-
-
- store: {
- xtype : 'SimpleStore',
- fields: ['val', 'desc'],
- data : this.comptypeList()
- },
- displayField:'desc',
- valueField: 'val',
- hiddenName : 'comptype',
-
- typeAhead: false,
- editable: false,
- //mode: 'local',
- triggerAction: 'all',
- emptyText: "Select Type",
- selectOnFocus: true
-
-
- }
- },
- c_name : function() {
- return {
-
- name : 'name',
- fieldLabel : "Company Name",
- value : '',
- allowBlank : true,
- qtip : "Enter Company Name",
- xtype : 'TextField',
- width : 300
- }
- },
- c_tel : function() {
- return {
-
- name : 'tel',
- fieldLabel : "Phone",
- value : '',
- allowBlank : true,
- qtip : "Enter Phone Number",
- xtype : 'TextField',
- width : 300
- }
- },
- c_fax : function() {
- return {
-
- name : 'fax',
- fieldLabel : "fax",
- value : '',
- allowBlank : true,
- qtip : "Enter fax Number",
- xtype : 'TextField',
- width : 300
- }
- },
- c_email : function() {
- return {
-
- name : 'email',
- fieldLabel : "Email",
- value : '',
- allowBlank : true,
- qtip : "Enter Email Address",
- xtype : 'TextField',
- width : 300
- }
- },
- c_address : function() {
- return {
-
- name : 'address',
- fieldLabel : "Address",
- value : '',
- allowBlank : true,
- qtip : "Enter Address",
- xtype : 'TextArea',
- height : 70,
- width : 300
- }
- },
- c_remarks : function() {
- return {
-
- name : 'remarks',
- fieldLabel : "Remarks",
- value : '',
- allowBlank : true,
- qtip : "Enter remarks",
- xtype : 'TextArea',
- height : 40,
- width : 300
- }
- },
- c_background_color : function() {
- return {
- xtype: 'ColorField',
- name : 'background_color',
- fieldLabel: "Background Colour"
- }
- },
- c_image_view : function() {
- var _this = this;
- return {
- xtype : 'FieldSetEx',
- name : 'image-view',
- collapseGroup : 'companies-image',
- value: 0,
- labelWidth: 100,
- expanded: true,
- style: 'width:420px;',
- legend : "Logo Image",
- items: [
- {
- xtype : 'DisplayImage', // image preview...
- name : 'logo_id',
- fieldLabel : 'Logo Image',
- width: 300,
- height: 50,
- renderer : function(v) {
- return v ? String.format('<img src="{0}" height="{1}">',
- baseURL + '/Images/' + v + '/' + _this.data.logo_id_filename,
- Math.min(this.height, _this.data.logo_id_height)) : "No Image Attached";
-
- }
- }
- ]
-
- }
- },
- c_image_edit : function() {
- var _this = this;
- return {
- name : 'logo_id',
- fieldLabel : "Logo Image",
- value : '',
- allowBlank : true,
- style: 'border: 1px solid #ccc;',
- xtype : 'DisplayImage',
- width : 170,
- height: 170,
- addTitle : "Change / Add Image",
- icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
- handler : function() {
- var _t = this;
-
- Pman.Dialog.Image.show({
- onid :_this.data.id,
- ontable : 'Companies',
- imgtype : '-LOGO'
- }, function(data) {
- if (data) {
- _t.setValue(data.id);
- }
-
- });
- },
- renderer : function(v) {
- //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
- if (!v) {
- return "No Image Available" + '<BR/>';
- }
- return String.format('<img src="{0}" width="150">',
- baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
- );
- }
-
- } ;
-
- },
- c_image_change: function() {
- return {
- xtype : 'FieldSetEx',
- collapseGroup : 'companies-image',
- name : 'image-change',
- value: 0,
- labelWidth: 100,
- expanded: false,
- style: 'width:420px;',
- legend : "Add / Change Image",
- items : [
- {
- xtype : 'TextField',
- name : 'imageUpload',
- fieldLabel : "Upload Image",
- inputType : 'file'
- }
- ]
- }
- },
- c_isOwner : function() {
- return {
- name : 'isOwner',
- value : '',
- xtype : 'Hidden'
- }
- },
- c_id : function() {
- return {
- name : 'id',
- value : '',
- xtype : 'Hidden'
- }