mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
107 lines
2.7 KiB
TypeScript
107 lines
2.7 KiB
TypeScript
|
|
import {
|
|
Component,
|
|
EventEmitter,
|
|
Input,
|
|
OnInit,
|
|
Output,
|
|
} from '@angular/core';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
import { Suggestion } from 'src/app/core/notifications/suggestions/models/suggestion.model';
|
|
|
|
import { Item } from '../../../core/shared/item.model';
|
|
import { fadeIn } from '../../../shared/animations/fade';
|
|
import { isNotEmpty } from '../../../shared/empty.util';
|
|
import { ItemSearchResultListElementComponent } from '../../../shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
|
|
import { SuggestionActionsComponent } from '../actions/suggestion-actions.component';
|
|
import { SuggestionApproveAndImport } from './suggestion-approve-and-import';
|
|
import { SuggestionEvidencesComponent } from './suggestion-evidences/suggestion-evidences.component';
|
|
|
|
/**
|
|
* Show all the suggestions by researcher
|
|
*/
|
|
@Component({
|
|
selector: 'ds-suggestion-list-item',
|
|
styleUrls: ['./suggestion-list-element.component.scss'],
|
|
templateUrl: './suggestion-list-element.component.html',
|
|
animations: [fadeIn],
|
|
imports: [
|
|
TranslateModule,
|
|
ItemSearchResultListElementComponent,
|
|
SuggestionActionsComponent,
|
|
SuggestionEvidencesComponent,
|
|
],
|
|
standalone: true,
|
|
})
|
|
export class SuggestionListElementComponent implements OnInit {
|
|
|
|
@Input() object: Suggestion;
|
|
|
|
@Input() isSelected = false;
|
|
|
|
@Input() isCollectionFixed = false;
|
|
|
|
public listableObject: any;
|
|
|
|
public seeEvidence = false;
|
|
|
|
/**
|
|
* The component is used to Delete suggestion
|
|
*/
|
|
@Output() ignoreSuggestionClicked = new EventEmitter();
|
|
|
|
/**
|
|
* The component is used to approve & import
|
|
*/
|
|
@Output() approveAndImport = new EventEmitter();
|
|
|
|
/**
|
|
* New value whether the element is selected
|
|
*/
|
|
@Output() selected = new EventEmitter<boolean>();
|
|
|
|
ngOnInit() {
|
|
this.listableObject = {
|
|
indexableObject: Object.assign(new Item(), { id: this.object.id, metadata: this.object.metadata }),
|
|
hitHighlights: {},
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Approve and import the suggestion
|
|
*/
|
|
onApproveAndImport(event: SuggestionApproveAndImport) {
|
|
this.approveAndImport.emit(event);
|
|
}
|
|
|
|
/**
|
|
* Delete the suggestion
|
|
*/
|
|
onIgnoreSuggestion(suggestionId: string) {
|
|
this.ignoreSuggestionClicked.emit(suggestionId);
|
|
}
|
|
|
|
/**
|
|
* Change is selected value.
|
|
*/
|
|
changeSelected(event) {
|
|
this.isSelected = event.target.checked;
|
|
this.selected.next(this.isSelected);
|
|
}
|
|
|
|
/**
|
|
* See the Evidence
|
|
*/
|
|
hasEvidences() {
|
|
return isNotEmpty(this.object.evidences);
|
|
}
|
|
|
|
/**
|
|
* Set the see evidence variable.
|
|
*/
|
|
onSeeEvidences(seeEvidence: boolean) {
|
|
this.seeEvidence = seeEvidence;
|
|
}
|
|
|
|
}
|