From: Bill Erickson Date: Thu, 5 Aug 2021 16:01:36 +0000 (-0400) Subject: LP1936233 Respond to broadcast item updates; title link X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6ad1fc16f9c0632f54aab9c99a55c8e1a51d900e;p=working%2FEvergreen.git LP1936233 Respond to broadcast item updates; title link Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html index 15235dbc5d..acebc24089 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html @@ -26,6 +26,8 @@ text="There is no corresponding purchase order for this item."> + +
@@ -192,9 +194,23 @@ {{r.call_number().suffix().label()}} + + + {{r.dummy_title()}} + + + + {{r.call_number().record().simple_record().title()}} + + + + + @@ -335,8 +351,8 @@ - + diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts index 3be53f38ad..101b903682 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts @@ -44,13 +44,16 @@ import {MarkMissingDialogComponent import {AnonCacheService} from '@eg/share/util/anon-cache.service'; import {ToastService} from '@eg/share/toast/toast.service'; import {StringService} from '@eg/share/string/string.service'; +import {StringComponent} from '@eg/share/string/string.component'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {MarkItemsDialogComponent } from '@eg/staff/share/holdings/mark-items-dialog.component'; -import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; +import {GridDataSource, GridColumn, GridCellTextGenerator, + GridRowFlairEntry} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; import {Pager} from '@eg/share/util/pager'; import {ItemStatusService} from './item.service'; +import {BroadcastService} from '@eg/share/util/broadcast.service'; @Component({ templateUrl: 'status.component.html' @@ -68,6 +71,7 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { tab: string; preloadCopyIds: number[]; + rowFlair: (row: IdlObject) => GridRowFlairEntry; cellTextGenerator: GridCellTextGenerator; dataSource: GridDataSource = new GridDataSource(); @ViewChild('grid') private grid: GridComponent; @@ -102,6 +106,8 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { private cancelTransitDialog: CancelTransitDialogComponent; @ViewChild('markItemsDialog') private markItemsDialog: MarkItemsDialogComponent; + @ViewChild('itemModified') + private itemModified: StringComponent; constructor( private router: Router, @@ -121,6 +127,7 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { private toast: ToastService, private strings: StringService, private anonCache: AnonCacheService, + private broadcaster: BroadcastService, private itemService: ItemStatusService ) {} @@ -144,11 +151,41 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { } } + this.broadcaster.listen('eg.holdings.update').subscribe(data => { + if (data && data.copies) { + const copies = []; + this.itemService.scannedItems.forEach(item => { + if (data.copies.includes(item.id())) { + item.ischanged(true); // for grid flair + copies.push(item); + } + }); + + if (copies.length > 0) { + this.refreshSelectCopies(copies); + } + } + }); + + this.rowFlair = (row: IdlObject) => { + if (row.ischanged()) { + return {icon: 'save', title: this.itemModified.text} + } + }; + this.dataSource.getRows = (pager: Pager, sort: any[]) => { return from(this.itemService.scannedItems); }; this.cellTextGenerator = { + + title: row => { + if (row.call_number().id() === -1) { + return row.dummy_title(); + } else { + return row.call_number().record().simple_record().title(); + } + }, call_number_label: row => { return row.call_number().prefix().label() + ' ' + row.call_number().label() + ' ' + @@ -208,6 +245,7 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { // Retain the original grid index value so row // selection can persist. updatedCopy._index = item._index; + updatedCopy.ischanged(item.ischanged()); this.itemService.scannedItems.splice(idx, 1, updatedCopy); } });