From ce22e01a9b752a5bdb534b3fd2b395bd583fc602 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 2 Feb 2022 11:59:38 -0500 Subject: [PATCH] Revert "LP1952931 ASN Receiving UI / Li Table Experiment" Staff prefer the scaled down grid view. This reverts commit 8ee71edbe02fb9b1e3fd0a8846a46b90cf5f4f52. --- .../src/app/staff/acq/asn/receive.component.html | 53 +++++++++++++- .../eg2/src/app/staff/acq/asn/receive.component.ts | 81 ++++++++++++++-------- .../eg2/src/app/staff/acq/asn/routing.module.ts | 19 +---- .../staff/acq/lineitem/lineitem-list.component.ts | 7 +- 4 files changed, 108 insertions(+), 52 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html index 0d6f2837a3..68d400581f 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html @@ -86,4 +86,55 @@ across different vendors to match a container code. - + + + + + {{row.title}} + + + + + {{row.lineitem.id()}} + + + + + {{row.lineitem.purchase_order().name()}} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts index 55dbca66ef..0f5ad15af2 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core'; +import {Component, OnInit, ViewChild} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {Location} from '@angular/common'; import {Observable, Observer, of, from} from 'rxjs'; @@ -7,12 +7,13 @@ import {IdlObject} from '@eg/core/idl.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {LineitemService} from '../lineitem/lineitem.service'; import {Pager} from '@eg/share/util/pager'; -import {LineitemListComponent} from '../lineitem/lineitem-list.component'; +import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; +import {GridComponent} from '@eg/share/grid/grid.component'; @Component({ templateUrl: 'receive.component.html' }) -export class AsnReceiveComponent implements OnInit, AfterViewInit { +export class AsnReceiveComponent implements OnInit { barcode = ''; @@ -20,7 +21,9 @@ export class AsnReceiveComponent implements OnInit, AfterViewInit { container: IdlObject; entries: IdlObject[] = []; containers: IdlObject[] = []; - liList: LineitemListComponent; + + @ViewChild('grid') private grid: GridComponent; + gridDataSource: GridDataSource = new GridDataSource(); constructor( private route: ActivatedRoute, @@ -32,21 +35,30 @@ export class AsnReceiveComponent implements OnInit, AfterViewInit { ngOnInit() { this.barcode = this.route.snapshot.paramMap.get('containerCode') || ''; - } - - ngAfterViewInit() { if (this.barcode) { - setTimeout(() => this.findContainer()); + this.findContainer(); } - } - onListActivate(liList: LineitemListComponent) { - this.liList = liList; + this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { + return from(this.entries.map(e => this.gridifyEntry(e))); + }; } - isBasePage(): boolean { - return !this.route.firstChild || - this.route.firstChild.snapshot.url.length === 0; + gridifyEntry(entry: IdlObject): any { + const li = entry.lineitem(); + const sum = li.order_summary(); + return { + entry: entry, + lineitem: li, + title: this.li.getFirstAttributeValue(li, 'title'), + author: this.li.getFirstAttributeValue(li, 'author'), + isbn: this.li.getFirstAttributeValue(li, 'isbn'), + issn: this.li.getFirstAttributeValue(li, 'issn'), + upc: this.li.getFirstAttributeValue(li, 'upc'), + recievable_count: sum.item_count() - ( + sum.recv_count() + sum.cancel_count() + ) + }; } findContainer() { @@ -58,19 +70,19 @@ export class AsnReceiveComponent implements OnInit, AfterViewInit { {container_code: this.barcode}, {flesh: 1, flesh_fields: {acqsn: ['entries', 'provider']}} ).subscribe( - sn => this.containers.push(sn), - _ => {}, - () => { - - // TODO handle multiple containers w/ same code - if (this.containers.length === 1) { - this.container = this.containers[0]; - this.loadContainer(); - } - - const node = document.getElementById('barcode-search-input'); - (node as HTMLInputElement).select(); - } + sn => this.containers.push(sn), + _ => {}, + () => { + + // TODO handle multiple containers w/ same code + if (this.containers.length === 1) { + this.container = this.containers[0]; + this.loadContainer(); + } + + const node = document.getElementById('barcode-search-input'); + (node as HTMLInputElement).select(); + } ); } @@ -81,8 +93,19 @@ export class AsnReceiveComponent implements OnInit, AfterViewInit { if (entries.length === 0) { return; } - this.liList.fromLineitemIds = entries.map(e => e.lineitem()); - this.liList.load(); + this.li.getFleshedLineitems(entries.map(e => e.lineitem()), {}) + .subscribe( + li_struct => { + // Flesh the lineitems directly in the shipment entry + const entry = entries.filter(e => e.lineitem() === li_struct.id)[0]; + entry.lineitem(li_struct.lineitem); + }, + _ => {}, + () => { + this.entries = entries; + this.grid.reload(); + } + ); } openLi(row: any) { diff --git a/Open-ILS/src/eg2/src/app/staff/acq/asn/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/asn/routing.module.ts index 811018ec21..b4d0f67414 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/asn/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/asn/routing.module.ts @@ -14,23 +14,8 @@ const routes: Routes = [{ component: AsnReceiveComponent }, { path: 'receive/:containerCode', - component: AsnReceiveComponent, - children : [{ - path: '', - component: LineitemListComponent - }, { - path: 'lineitem/:lineitemId/detail', - component: LineitemDetailComponent - }, { - path: 'lineitem/:lineitemId/history', - component: LineitemHistoryComponent - }, { - path: 'lineitem/:lineitemId/items', - component: LineitemCopiesComponent - }, { - path: 'lineitem/:lineitemId/worksheet', - component: LineitemWorksheetComponent - }] + component: AsnReceiveComponent + }]; @NgModule({ diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts index aa007b5fef..c739bb3f00 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts @@ -45,7 +45,6 @@ export class LineitemListComponent implements OnInit { picklistId: number = null; poId: number = null; recordId: number = null; // lineitems related to a bib. - fromLineitemIds: number[] = null; loading = false; pager: Pager = new Pager(); @@ -240,8 +239,8 @@ export class LineitemListComponent implements OnInit { load(): Promise { this.pageOfLineitems = []; - if (!this.loading && this.pager.limit && (this.poId || - this.picklistId || this.recordId || this.fromLineitemIds)) { + if (!this.loading && this.pager.limit && + (this.poId || this.picklistId || this.recordId)) { this.loading = true; @@ -264,8 +263,6 @@ export class LineitemListComponent implements OnInit { if (this.picklistId) { Object.assign(searchTerms, { jub: [ { picklist: this.picklistId } ] }); - } else if (this.fromLineitemIds) { - Object.assign(searchTerms, { jub: [ { id: this.fromLineitemIds } ] }); } else if (this.recordId) { Object.assign(searchTerms, { jub: [ { eg_bib_id: this.recordId } ] }); } else { -- 2.11.0