50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { FormBuilder } from '@angular/forms';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import { ValidationErrorModel } from '../../../../common/forms/validation/error-model/validation-error-model';
|
|
import { ProjectStateType } from '../../../../core/common/enum/project-state-type';
|
|
import { ProjectCriteria } from '../../../../core/query/project/project-criteria';
|
|
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
|
|
import { BaseCriteriaComponent } from '../../../misc/criteria/base-criteria.component';
|
|
|
|
@Component({
|
|
selector: 'app-project-criteria-component',
|
|
templateUrl: './project-criteria.component.html',
|
|
styleUrls: ['./project-criteria.component.scss']
|
|
})
|
|
export class ProjectCriteriaComponent extends BaseCriteriaComponent implements OnInit {
|
|
|
|
public ProjectStateType = ProjectStateType;
|
|
public criteria: ProjectCriteria = new ProjectCriteria();
|
|
|
|
constructor(
|
|
public language: TranslateService,
|
|
public formBuilder: FormBuilder,
|
|
public languageResolver: LanguageResolverService
|
|
) {
|
|
super(new ValidationErrorModel());
|
|
}
|
|
|
|
ngOnInit() {
|
|
super.ngOnInit();
|
|
if (this.criteria == null) { this.criteria = new ProjectCriteria(); }
|
|
}
|
|
|
|
setCriteria(criteria: ProjectCriteria): void {
|
|
this.criteria = criteria;
|
|
}
|
|
|
|
onCallbackError(error: any) {
|
|
this.setErrorModel(error.error);
|
|
}
|
|
|
|
controlModified(): void {
|
|
this.clearErrorModel();
|
|
if (this.refreshCallback != null &&
|
|
(this.criteria.like == null || this.criteria.like.length === 0 || this.criteria.like.length > 2)
|
|
) {
|
|
this.refreshCallback();
|
|
}
|
|
}
|
|
}
|