import {Component, EventEmitter, Input, Output} from '@angular/core'; import {SearchResult} from "../../../utils/entities/searchResult"; import {ErrorCodes} from "../../../utils/properties/errorCodes"; import {RouterHelper} from "../../../utils/routerHelper.class"; import {ResultPreview} from "../../../utils/result-preview/result-preview"; import {AlertModal} from "../../../utils/modal/alert"; import {EnvProperties} from "../../../utils/properties/env-properties"; @Component({ selector: 'modal-result', template: `
` }) export class ModalResultComponent { @Input() results: SearchResult[]; @Input() totalResults: number = 0; @Input() type: string; @Input() resultType: string; @Input() showOrganizations: boolean = true; @Input() showSubjects: boolean = false; @Input() modal: AlertModal; @Input() properties: EnvProperties; @Input() status: number; @Input() pageSize: number = 1; @Output() updatePage: EventEmitter = new EventEmitter(); public page: number = 1; public errorCodes: ErrorCodes = new ErrorCodes(); public routerHelper: RouterHelper = new RouterHelper(); public errorMessage: string = "No results found"; constructor() { } ngOnInit() { } public getResultPreview(result: SearchResult): ResultPreview { return ResultPreview.searchResultConvert(result, this.resultType); } public update(event) { this.page = event.value; this.updatePage.emit({ value: event.value }); } }