1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 modKey : '001-Pman.Tab.AdminOffice',
12 module : Pman.Tab.AdminOffice,
14 parent : Pman.Tab.AdminCompanies,
15 name : "Pman.Tab.AdminOffice",
21 Pman.Tab.AdminOffice = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
37 activate : function() {
40 _this.grid.footer.onClick('first');
49 title : "Offices / Departments / Sub-Companies",
57 _this.dialog =Pman.Dialog.Office;
58 if (_this.panel.active) {
59 this.footer.onClick('first');
62 rowdblclick : function (_self, rowIndex, e)
64 if (!_this.dialog) return;
65 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
66 _this.grid.footer.onClick('first');
70 autoExpandColumn : 'name',
76 beforeload : function (_self, o)
79 var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();
80 sm = sm.getSelected();
81 if (!sm || !sm.data.id) {
86 o.params.company_id = sm.data.id ;
94 sortInfo : { field : 'name', direction: 'ASC' },
99 url : baseURL + '/Roo/Office.php'
104 totalProperty : 'total',
113 'name': 'company_id',
141 'name': 'company_id_code',
145 'name': 'company_id_name',
149 'name': 'company_id_remarks',
153 'name': 'company_id_owner_id',
157 'name': 'company_id_address',
161 'name': 'company_id_tel',
165 'name': 'company_id_fax',
169 'name': 'company_id_email',
173 'name': 'company_id_id',
177 'name': 'company_id_isOwner',
181 'name': 'company_id_logo_id',
185 'name': 'company_id_background_color',
189 'name': 'company_id_comptype',
193 'name': 'company_id_url',
197 'name': 'company_id_main_office_id',
201 'name': 'company_id_created_by',
205 'name': 'company_id_created_dt',
209 'name': 'company_id_updated_by',
213 'name': 'company_id_updated_dt',
217 'name': 'company_id_passwd',
221 'name': 'company_id_dispatch_port',
225 'name': 'company_id_province',
229 'name': 'company_id_country',
236 xtype: 'PagingToolbar',
240 displayMsg : 'Displaying Office{0} - {1} of {2}',
241 emptyMsg : 'No Office found'
253 if (!_this.dialog) return;
255 var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;
258 company_name : cdata.name,
259 company_id : cdata.id,
260 address : cdata.address,
265 _this.grid.footer.onClick('first');
269 cls : 'x-btn-text-icon',
271 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
279 var s = _this.grid.getSelectionModel().getSelections();
280 if (!s.length || (s.length > 1)) {
281 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
284 if (!_this.dialog) return;
285 s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;
286 _this.dialog.show(s[0].data, function() {
287 _this.grid.footer.onClick('first');
292 cls : 'x-btn-text-icon',
294 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
300 cls : 'x-btn-text-icon',
301 icon : rootURL + '/Pman/templates/images/trash.gif',
305 Pman.genericDelete(_this, 'Office');
313 xtype: 'ColumnModel',
316 header : 'Name / Department / Sub Comp.',
319 renderer : function(v) { return String.format('{0}', v); }
322 xtype: 'ColumnModel',
327 renderer : function(v) { return String.format('{0}', v); }
330 xtype: 'ColumnModel',
335 renderer : function(v) { return String.format('{0}', v); }
338 xtype: 'ColumnModel',
343 renderer : function (v) {
344 return (v.length && v.indexOf('@') > 0 ) ?
345 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
350 xtype: 'ColumnModel',
352 dataIndex : 'address',
355 renderer : function(v) { return String.format('{0}', v); }
360 this.layout = this.panel.layout;