From: Bill Erickson Date: Mon, 3 Feb 2020 19:22:59 +0000 (-0500) Subject: LP1861701 Staff catalog copy location groups WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fberick%2Flp1861701-staffcat-copy-loc-groups;p=working%2FEvergreen.git LP1861701 Staff catalog copy location groups WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/catalog/eg-org-copy-loc-select.html b/Open-ILS/src/eg2/src/app/share/catalog/eg-org-copy-loc-select.html deleted file mode 100644 index 6a0d0875ce..0000000000 --- a/Open-ILS/src/eg2/src/app/share/catalog/eg-org-copy-loc-select.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.html b/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.html new file mode 100644 index 0000000000..6a0d0875ce --- /dev/null +++ b/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.html @@ -0,0 +1,2 @@ + + diff --git a/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.ts b/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.ts index 0f8db6533e..ff1587eb32 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/org-copy-loc-select.component.ts @@ -11,9 +11,14 @@ import {ComboboxComponent, ComboboxEntry} from '@eg/share/combobox/combobox.comp const PAD_SPACE = ' '; // U+2007 +export interface OrgCopyLocEntry { + org?: number; // org unit ID + grp?: number; // copy location group ID +} + @Component({ selector: 'eg-org-copy-loc-select', - templateUrl: 'eg-org-copy-loc-select.html', + templateUrl: 'org-copy-loc-select.component.html', providers: [ { provide: NG_VALUE_ACCESSOR, @@ -95,13 +100,30 @@ export class OrgCopyLocSelectComponent implements AfterViewInit { } cboxChange(entry: ComboboxEntry) { + let value: OrgCopyLocEntry = null; + if (entry) { + value = {}; + const org = entry.id.match(/org_(\d+)/); + const grp = entry.id.match(/grp_(\d+)/); + value.org = org ? org[1] : null; + value.grp = grp ? grp[1] : null; + } this.propagateChange(entry); } - writeValue(entry: ComboboxEntry) { - if (this.cbox) { - this.cbox.selectedId = entry ? entry.id : null; + writeValue(entry: OrgCopyLocEntry) { + if (!this.cbox) { return; } + let id: string = null; + + if (entry) { + if (entry.org) { + id = 'org_' + entry.org; + } else if (entry.grp) { + id = 'grp_' + entry.grp; + } } + + this.cbox.selectedId = id; } registerOnChange(fn) { diff --git a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts index 041d710a4b..54876b334e 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts @@ -2,6 +2,7 @@ import {OrgService} from '@eg/core/org.service'; import {IdlObject} from '@eg/core/idl.service'; import {Pager} from '@eg/share/util/pager'; import {ArrayUtil} from '@eg/share/util/array'; +import {OrgCopyLocEntry} from '@eg/share/catalog/org-copy-loc-select.component'; // CCVM's we care about in a catalog context // Don't fetch them all because there are a lot. diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts index 3287e1d301..b55bf3cad5 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts @@ -6,7 +6,7 @@ import {CatalogService} from '@eg/share/catalog/catalog.service'; import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context'; import {StaffCatalogService} from './catalog.service'; import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap'; -import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; +import {OrgCopyLocEntry} from '@eg/share/catalog/org-copy-loc-select.component'; @Component({ selector: 'eg-catalog-search-form', @@ -21,7 +21,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit { showSearchFilters = false; copyLocations: IdlObject[]; searchTab: string; - orgCopyLoc: ComboboxEntry; + orgCopyLoc: OrgCopyLocEntry; constructor( private renderer: Renderer2,