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,
}
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) {
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.
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',
showSearchFilters = false;
copyLocations: IdlObject[];
searchTab: string;
- orgCopyLoc: ComboboxEntry;
+ orgCopyLoc: OrgCopyLocEntry;
constructor(
private renderer: Renderer2,