From: Bill Erickson Date: Wed, 30 Jun 2021 20:36:20 +0000 (-0400) Subject: LP1929741 Standalone brief record UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1f5e5337ada97740d4d9d1ce3f943b5d18b6576d;p=evergreen%2Fmasslnc.git LP1929741 Standalone brief record UI Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.html b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.html index 0dbe6db09c..7308e1c849 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.html @@ -1,10 +1,26 @@ -

Add A Brief Record

+ +

Add A Brief Record

+
+ + + + -
-
{{attr.description()}}
-
- +
+
+
Add To Selection List
+
+ + +
+
+
+
{{attr.description()}}
+
+ +
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts index 623d305561..c2103691fb 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts @@ -2,9 +2,11 @@ import {Component, OnInit, Input, Output} from '@angular/core'; import {ActivatedRoute, Router, ParamMap} from '@angular/router'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; +import {EventService} from '@eg/core/event.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AuthService} from '@eg/core/auth.service'; import {LineitemService} from './lineitem.service'; +import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; const MARC_NS = 'http://www.loc.gov/MARC21/slim'; @@ -29,12 +31,16 @@ export class BriefRecordComponent implements OnInit { attrs: IdlObject[] = []; values: {[attr: string]: string} = {}; + // From the inline PL selector + selectedPl: ComboboxEntry; + constructor( private router: Router, private route: ActivatedRoute, private idl: IdlService, private auth: AuthService, private net: NetService, + private evt: EventService, private pcrud: PcrudService, private liService: LineitemService ) { } @@ -87,6 +93,37 @@ export class BriefRecordComponent implements OnInit { } save() { + this.saveManualPicklist() + .then(ok => { if (ok) { this.createLineitem(); } }); + } + + saveManualPicklist(): Promise { + if (!this.selectedPl) { return Promise.resolve(false); } + + if (!this.selectedPl.freetext) { + // An existing PL was selected + this.targetPicklist = this.selectedPl.id; + return Promise.resolve(true); + } + + const pl = this.idl.create('acqpl'); + pl.name(this.selectedPl.label); + pl.owner(this.auth.user().id()); + + return this.net.request( + 'open-ils.acq', + 'open-ils.acq.picklist.create', this.auth.token(), pl).toPromise() + + .then(plId => { + const evt = this.evt.parse(plId); + if (evt) { alert(evt); return false; } + this.targetPicklist = plId; + return true; + }); + } + + createLineitem() { + const xml = this.compile(); const li = this.idl.create('jub'); @@ -104,12 +141,25 @@ export class BriefRecordComponent implements OnInit { this.net.request('open-ils.acq', 'open-ils.acq.lineitem.create', this.auth.token(), li - ).toPromise().then(_ => { + ).toPromise().then(liId => { + + const evt = this.evt.parse(liId); + if (evt) { alert(evt); return; } + this.liService.activateStateChange.emit(); - this.router.navigate(['../'], { - relativeTo: this.route, - queryParamsHandling: 'merge' - }); + + if (this.selectedPl) { + // Brief record was added to a picklist that is not + // currently focused in the UI. Jump to it. + const url = `/staff/acq/picklist/${this.targetPicklist}`; + this.router.navigate([url], {fragment: liId}); + } else { + + this.router.navigate(['../'], { + relativeTo: this.route, + queryParamsHandling: 'merge' + }); + } }); } } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/picklist/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/picklist/routing.module.ts index f641e5127c..d943cab01c 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/picklist/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/picklist/routing.module.ts @@ -10,6 +10,9 @@ import {BriefRecordComponent} from '../lineitem/brief-record.component'; import {LineitemHistoryComponent} from '../lineitem/history.component'; const routes: Routes = [{ + path: 'brief-record', + component: BriefRecordComponent +}, { path: ':picklistId', component: PicklistComponent, children : [{