1 import {Component, Input} from '@angular/core';
2 import {Router, ActivatedRoute} from '@angular/router';
3 import {GridDataSource} from '@eg/share/grid/grid';
4 import {Pager} from '@eg/share/util/pager';
5 import {PcrudService} from '@eg/core/pcrud.service';
6 import {IdlObject, IdlService } from '@eg/core/idl.service';
9 templateUrl: './edit-floating-group.component.html'
12 export class EditFloatingGroupComponent {
14 @Input() sortField: string;
15 @Input() dataSource: GridDataSource;
16 @Input() dialogSize: 'sm' | 'lg' = 'lg';
18 // defaultNewRecord is used when creating a new entry to give a default floating_group
19 defaultNewRecord: IdlObject;
21 // This is the ID of the floating group being edited currently
25 private route: ActivatedRoute,
26 private pcrud: PcrudService,
27 private idl: IdlService,
32 this.currentId = parseInt(this.route.snapshot.paramMap.get('id'));
33 this.defaultNewRecord = this.idl.create('cfgm');
34 this.defaultNewRecord.floating_group(this.currentId);
35 this.dataSource = new GridDataSource();
36 this.dataSource.getRows = (pager: Pager, sort: any[]) => {
42 return this.pcrud.search("cfgm", {floating_group: this.currentId}, searchOps);