From: Jane Sandberg Date: Tue, 1 Sep 2020 18:58:33 +0000 (-0700) Subject: LP1849212: more of the same X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=213538e42351a4c8dd3c4f4c36f6cb8daa04633f;p=working%2FEvergreen.git LP1849212: more of the same Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html index c6bbf23017..aeecb1c55e 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html @@ -4,12 +4,12 @@
-
- +
diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts index 9cb39a42b9..2675f259cd 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts @@ -28,6 +28,8 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { addField: (field: MarcField) => void; + editorFieldIdentifier: (field: MarcField, subfield: Array) => string; + constructor( private tagTable: TagTableService ) {} @@ -41,17 +43,23 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { this.addField = (field: MarcField) => { field.fieldId = this.fieldIndex; this.fields.push(field); - this.editor.addControl(String(this.fieldIndex), new FormControl(null, [])); + field.subfields.forEach((subfield) => { + this.editor.addControl(this.editorFieldIdentifier(field, subfield), new FormControl(null, [])); + }) this.fieldIndex++; }; + this.editorFieldIdentifier = (field: MarcField, subfield: Array) => { + return field.tag + subfield[0]; // e.g. 245a + } + } ngAfterViewInit() { this.tagTable.loadTags({marcRecordType: 'biblio', ffType: 'BKS'}).then(table => { this.fields.forEach((field) => { field.subfields.forEach((subfield) => { - this.subfieldLabels[field.tag + subfield[0]] = table.getSubfieldLabel(field.tag, subfield[0]); + this.subfieldLabels[this.editorFieldIdentifier(field, subfield)] = table.getSubfieldLabel(field.tag, subfield[0]); }) }); }); @@ -63,7 +71,7 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { this.fields.forEach((field) => { field.subfields.forEach((subfield) => { if (subfield[1] === '') { // Default value has not been applied - subfield[1] = this.editor.get(String(field.fieldId)).value; + subfield[1] = this.editor.get(this.editorFieldIdentifier(field, subfield)).value; } }) });