From: Mike Risher Date: Tue, 10 Sep 2019 17:45:30 +0000 (+0000) Subject: lp1840287-floating-groups-extend X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fmrisher%2Flp1840287-floating-groups-extend;p=working%2FEvergreen.git lp1840287-floating-groups-extend Signed-off-by: Mike Risher --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/edit-floating-group.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/edit-floating-group.component.ts index bd7370ee63..369254e2eb 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/edit-floating-group.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/edit-floating-group.component.ts @@ -1,33 +1,56 @@ -import {Component, Input} from '@angular/core'; -import {Router} from '@angular/router'; +import {Component, Input, ViewChild} from '@angular/core'; +import {Router, Routes} from '@angular/router'; import {GridDataSource} from '@eg/share/grid/grid'; import {Pager} from '@eg/share/util/pager'; import {PcrudService} from '@eg/core/pcrud.service'; +import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; +import {StringComponent} from '@eg/share/string/string.component'; +import {ToastService} from '@eg/share/toast/toast.service'; +import {GridComponent} from '@eg/share/grid/grid.component'; +import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component'; +import {OrgService} from '@eg/core/org.service'; +import {PermService} from '@eg/core/perm.service'; +import {AuthService} from '@eg/core/auth.service'; +import {IdlService, IdlObject} from '@eg/core/idl.service'; @Component({ templateUrl: './edit-floating-group.component.html' }) - export class EditFloatingGroupComponent { + export class EditFloatingGroupComponent extends AdminPageComponent { @Input() idlClass = 'cfgm'; @Input() sortField: string; @Input() dataSource: GridDataSource; @Input() dialogSize: 'sm' | 'lg' = 'lg'; - + @ViewChild('grid') grid: GridComponent; + @ViewChild('editDialog') editDialog: FmRecordEditorComponent; + @ViewChild('createString') createString: StringComponent; + + // This is the ID of the floating group being edited currently currentId: string; + translatableFields: string[]; + createNew: () => void; constructor( - private pcrud: PcrudService, - private router: Router + pcrud: PcrudService, + toast: ToastService, + idl: IdlService, + org: OrgService, + auth: AuthService, + perm: PermService, + private router: Router, ) { + super( idl, org, auth, pcrud, perm, toast ) + } ngOnInit() { - let url = this.router.routerState.snapshot.url; - let slash = url.lastIndexOf('/'); - this.currentId = url.substring(slash+1); + // super.ngOnInit(); + let currentUrl = this.router.routerState.snapshot.url; + let slash = currentUrl.lastIndexOf('/'); + this.currentId = currentUrl.substring(slash+1); this.dataSource = new GridDataSource(); this.dataSource.getRows = (pager: Pager, sort: any[]) => { const searchOps = { @@ -37,5 +60,20 @@ import {PcrudService} from '@eg/core/pcrud.service'; }; return this.pcrud.search(this.idlClass, {floating_group: this.currentId}, searchOps); }; + + this.createNew = () => { + // super.createNew(); + console.log("create new") + this.editDialog.mode = 'create'; + // this.editDialog.open({size: this.dialogSize}).then( + // ok => { + // this.createString.current() + // .then(str => this.toast.success(str)); + // this.grid.reload(); + // }, + // err => {} + // ); + }; + } } \ No newline at end of file