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',
40 title : "Edit Companies",
44 xtype: 'ContentPanel',
54 actionfailed : function(f, act) {
55 _this.dialog.el.unmask();
57 Pman.standardActionFailed(f,act);
60 actioncomplete : function(f, act) {
61 _this.dialog.el.unmask();
62 //console.log('load completed');
63 // error messages?????
64 if(act.type == 'setdata'){
65 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
69 if (act.type == 'load') {
70 _this.data = act.result.data;
71 var meth = _this.data.isOwner || !Pman.Login.isOwner() ? 'disable' : 'enable';
74 if (_this.form.findField('comptype')) {
75 _this.form.findField('comptype')[meth]();
83 if (act.type == 'submit') { // only submitted here if we are
87 _this.callback.call(this, act.result.data);
93 rendered : function (form)
100 url : baseURL + '/Roo/Companies.php',
111 fieldLabel : 'Company ID (for filing Ref.)',
120 displayField : 'desc',
122 emptyText : "Select Type",
124 hiddenName : 'comptype',
126 name : 'comptype_name',
127 qtip : "Select Company type",
128 selectOnFocus : true,
129 triggerAction : 'all',
134 xtype: 'SimpleStore',
136 data : '[ \'CONSULTANT\', "Consultant" ],[ \'CLIENT\' , "Client" ],[ \'CONTRACTOR\' , "Contractor" ]',
137 fields : '[\'val\', \'desc\']'
144 render : function (_self)
146 _this.etypeCombo = _self;
148 select : function (combo, record, index)
150 _this.grid.footer.onClick('first');
154 displayField : 'name',
156 emptyText : "Select Type",
158 forceSelection : true,
159 hiddenName : 'comptype',
161 loadingText : "Searching...",
163 name : 'comptype_name',
165 qtip : "Select type",
166 queryParam : 'query[name]',
167 selectOnFocus : true,
168 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
169 triggerAction : 'all',
177 beforeload : function (_self, o){
178 o.params = o.params || {};
180 o.params['query[empty_etype]'] = 1;
184 sortInfo : { direction : 'ASC', field: 'id' },
189 url : baseURL + '/Roo/core_enum.php'
196 totalProperty : 'total',
197 fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
205 fieldLabel : 'Company Name',
207 qtip : "Enter Company Name",
214 fieldLabel : 'Phone',
216 qtip : "Enter Phone Number",
225 qtip : "Enter Fax Number",
232 fieldLabel : 'Email',
234 qtip : "Enter Email Address",
241 fieldLabel : 'Address',
243 qtip : "Enter Address",
250 fieldLabel : 'Remarks',
253 qtip : "Enter remarks",
267 fieldLabel : 'Background Colour',
268 name : 'background_color'
271 xtype: 'DisplayField',
273 fieldLabel : 'Logo Image',
275 icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
277 style : 'border: 1px solid #ccc;',
279 valueRenderer : function(v) {
280 //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
282 return "No Image Available" + '<BR/>';
284 return String.format('<img src="{0}" width="150">',
285 baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
293 click : function (_self, e)
295 var _t = _this.form.findField('logo_id');
297 Pman.Dialog.Image.show({
299 ontable : 'Companies',
303 _t.setValue(data.id);
329 xtype: 'LayoutRegion',
331 alwaysShowTabs : false,
342 click : function (_self, e)
353 click : function (_self, e)
358 _this.dialog.el.mask("Saving");
359 _this.form.doAction("submit");