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).data, 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 ;
95 sortInfo : { field : 'name', direction: 'ASC' },
100 url : baseURL + '/Roo/Office.php'
105 totalProperty : 'total',
114 'name': 'company_id',
142 'name': 'company_id_code',
146 'name': 'company_id_name',
150 'name': 'company_id_remarks',
154 'name': 'company_id_owner_id',
158 'name': 'company_id_address',
162 'name': 'company_id_tel',
166 'name': 'company_id_fax',
170 'name': 'company_id_email',
174 'name': 'company_id_id',
178 'name': 'company_id_isOwner',
182 'name': 'company_id_logo_id',
186 'name': 'company_id_background_color',
190 'name': 'company_id_comptype',
194 'name': 'company_id_url',
198 'name': 'company_id_main_office_id',
202 'name': 'company_id_created_by',
206 'name': 'company_id_created_dt',
210 'name': 'company_id_updated_by',
214 'name': 'company_id_updated_dt',
218 'name': 'company_id_passwd',
222 'name': 'company_id_dispatch_port',
226 'name': 'company_id_province',
230 'name': 'company_id_country',
237 xtype: 'PagingToolbar',
241 displayMsg : 'Displaying Office{0} - {1} of {2}',
242 emptyMsg : 'No Office found'
254 if (!_this.dialog) return;
256 var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;
259 company_name : cdata.name,
260 company_id : cdata.id,
261 address : cdata.address,
266 _this.grid.footer.onClick('first');
270 cls : 'x-btn-text-icon',
272 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
280 var s = _this.grid.getSelectionModel().getSelections();
281 if (!s.length || (s.length > 1)) {
282 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
285 if (!_this.dialog) return;
286 s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;
287 _this.dialog.show(s[0].data, function() {
288 _this.grid.footer.onClick('first');
293 cls : 'x-btn-text-icon',
295 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
301 cls : 'x-btn-text-icon',
302 icon : rootURL + '/Pman/templates/images/trash.gif',
306 Pman.genericDelete(_this, 'Office');
314 xtype: 'ColumnModel',
317 header : 'Name / Department / Sub Comp.',
320 renderer : function(v) { return String.format('{0}', v); }
323 xtype: 'ColumnModel',
328 renderer : function(v) { return String.format('{0}', v); }
331 xtype: 'ColumnModel',
336 renderer : function(v) { return String.format('{0}', v); }
339 xtype: 'ColumnModel',
344 renderer : function (v) {
345 return (v.length && v.indexOf('@') > 0 ) ?
346 String.format('<a href="mailto:{0}">{0}</a>',v) : v;
351 xtype: 'ColumnModel',
353 dataIndex : 'address',
356 renderer : function(v) { return String.format('{0}', v); }
361 this.layout = this.panel.layout;