diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts index c9c1b3959..a31a14e75 100644 --- a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts +++ b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts @@ -182,7 +182,7 @@ describe('OcrTemplateEditorComponent', () => { expect(templates.update).toHaveBeenCalledWith(component.template) expect(templates.create).not.toHaveBeenCalled() expect(succeeded).toHaveBeenCalledWith(saved) - expect(activeModal.close).toHaveBeenCalledWith(saved) + expect(activeModal.close).toHaveBeenCalled() }) it('searches across document metadata even when a template document type is set', () => { @@ -527,7 +527,7 @@ describe('OcrTemplateEditorComponent', () => { pending.next(saved) pending.complete() expect(succeeded).toHaveBeenCalledWith(saved) - expect(activeModal.close).toHaveBeenCalledWith(saved) + expect(activeModal.close).toHaveBeenCalled() }) it('stops an active move and unlocks editing without losing changes after a failed save', () => { diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts index a59ced798..7d37c5907 100644 --- a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts +++ b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts @@ -153,6 +153,7 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy { @Input() object: OcrTemplate @Output() succeeded = new EventEmitter() + @Output() failed = new EventEmitter() @ViewChild('zoneOverlay') overlayRef: ElementRef imageRef: ElementRef @@ -856,13 +857,12 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy { obs.pipe(takeUntil(this.destroy$)).subscribe({ next: (saved) => { - this.toastService.showInfo($localize`OCR template saved.`) + this.activeModal.close() this.succeeded.emit(saved) - this.activeModal.close(saved) }, error: (e) => { this.saving.set(false) - this.toastService.showError($localize`Error saving OCR template.`, e) + this.failed.emit(e) }, }) } diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-templates.component.html b/src-ui/src/app/components/manage/ocr-templates/ocr-templates.component.html index 85709cb4d..a78e77a32 100644 --- a/src-ui/src/app/components/manage/ocr-templates/ocr-templates.component.html +++ b/src-ui/src/app/components/manage/ocr-templates/ocr-templates.component.html @@ -4,8 +4,8 @@ info="Define extraction zones on document types to automatically populate custom fields via OCR." i18n-info > - @@ -28,17 +28,17 @@ } - @for (t of templates(); track t.id) { + @for (template of templates(); track template.id) {
  • -
    -
    {{getDocumentTypeName(t)}}
    -
    {{t.zones?.length || 0}}
    +
    +
    {{getDocumentTypeName(template)}}
    +
    {{template.zones.length}}
    - -
    @@ -46,21 +46,21 @@
    - -
    - - +
    + +