From 37affa1e11aff60cd0b995d2ab04c42b9671e7f8 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sun, 11 Aug 2019 07:48:36 -0700 Subject: [PATCH] add combobox --- .../staff/cat/authorities/authorities.module.ts | 4 ++- .../staff/cat/authorities/manage.component.html | 9 +++++ .../app/staff/cat/authorities/manage.component.ts | 40 +++++++++++++++------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/authorities/authorities.module.ts b/Open-ILS/src/eg2/src/app/staff/cat/authorities/authorities.module.ts index 26412b307f..e5f138b04a 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/authorities/authorities.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/authorities/authorities.module.ts @@ -1,3 +1,4 @@ +import { ReactiveFormsModule } from '@angular/forms'; import {NgModule} from '@angular/core'; import {StaffCommonModule} from '@eg/staff/common.module'; import {ManageAuthoritiesComponent} from './manage.component'; @@ -9,7 +10,8 @@ import {AuthoritiesRoutingModule} from './routing.module'; ], imports: [ AuthoritiesRoutingModule, - StaffCommonModule + StaffCommonModule, + ReactiveFormsModule ], }) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.html b/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.html index bbba1cea46..3fd775b9d6 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.html @@ -1,3 +1,12 @@ +
+ + + + +
+{{field}} diff --git a/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.ts index 2a2acc1343..57edd83a80 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.ts @@ -1,34 +1,48 @@ +import {FormGroup, FormControl} from '@angular/forms'; import {PcrudService} from '@eg/core/pcrud.service'; import {Component} from '@angular/core'; import {GridDataSource} from '@eg/share/grid/grid'; import {Pager} from '@eg/share/util/pager'; +import { IdlObject } from '@eg/core/idl.service'; @Component({ templateUrl: './manage.component.html', }) export class ManageAuthoritiesComponent { gridSource: GridDataSource; + search: FormGroup; + authorityFields: IdlObject[] = []; constructor( private pcrud: PcrudService - ) { + ) { + this.search = new FormGroup({ + field: new FormControl() + }); + + this.pcrud.search('acsaf', {'main_entry': null}) + .subscribe((field) => this.authorityFields.push(field)); this.gridSource = new GridDataSource(); this.gridSource.getRows = (pager: Pager) => { - return this.pcrud.search('ash', { - 'record': { 'in': { - 'from': 'are', 'select': {'are': ['id']}, 'where': {'deleted': 'false'}}}, - 'atag': { 'in': { - 'from': 'acsaf', 'select': {'acsaf': ['id']}, 'where': {'main_entry': null}}}, - }, - {flesh: 2, - flesh_fields: { - are: ['creator', 'editor', 'owner'], - ash: ['record'] - } - }); + if (this.field.value) { + return this.pcrud.search('ash', { + 'record': { 'in': { + 'from': 'are', 'select': {'are': ['id']}, 'where': {'deleted': 'false'}}}, + 'atag': this.field.value.id, + }, + {flesh: 2, + flesh_fields: { + are: ['creator', 'editor', 'owner'], + ash: ['record'] + } + }); + } }; } + get field() { + return this.search.get('field'); + } } -- 2.11.0