import {Component, Input} from '@angular/core';
import {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
import {ClaimContextComponent} from './claimContext/claimContext.component';
import {ClaimPublicationComponent} from './claimPublication/claimPublication.component';
import {ClaimDatasetComponent} from './claimDataset/claimDataset.component';
import {ClaimSelectedComponent} from './selected/selected.component';
import {ClaimInsertComponent} from './insertClaim/insertClaim.component';
import {ClaimProjectsComponent} from './claimProject/claimProject.component';
import {LinkingHomeComponent} from './linkingHome.component';
// import { MD_RADIO_DIRECTIVES, MdRadioDispatcher } from '@angular2-material/radio';
// import { MD_INPUT_DIRECTIVES } from '@angular2-material/input';
@Component({
selector: 'linking',
//providers: [MdRadioDispatcher],
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimPublicationComponent, ClaimSelectedComponent, ClaimInsertComponent,ClaimDatasetComponent, ClaimProjectsComponent, LinkingHomeComponent],
template: `
`
})
//[(ngModel)]="date"
export class LinkingComponent {
constructor ( private _router: Router ) {
}
sourceType:string;
targetType:string;
step:number = 1;
contexts=[];
projects=[];
publications=[];
datasets=[];
show = "home";
searchType="publication";
date='8-6-2016';
keyword: string = "";
chosenType:string ="project";
ngOnInit() {
}
next(){
if((this.show == 'project' || this.show == 'context' || this.show == 'software')){
this.show='result';
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
this.show='claim';
}else if(this.show == 'result' ){
if(this.searchType == 'publication' ){
this.show="publication";
}else{
this.show="dataset";
}
}
}
prev(){
if(this.show == 'result'){
if(this.chosenType == 'project'){
this.show='project';
}else if(this.chosenType == 'context'){
this.show='context';
}else if(this.chosenType == 'software'){
this.show='software';
}else{
this.show='home';
}
}else if(this.show == 'context' || this.show == 'project' || this.show == 'software' ){
this.show='home';
}else if(this.show == 'dataset' || this.show == 'publication'){
this.show='result';
} else if(this.show == 'claim'){
this.show='result';
}
}
goto(term: string) {
this._router.navigate( ['Search', { keyword: term }] );
}
search() {
if(this.searchType == 'publication' ){
this.show="publication";
}else{
this.show="dataset";
}
}
sourceTypeChange($event) {
this.sourceType=$event.value;
console.log($event.value);
}
targetTypeChange($event) {
this.targetType=$event.value;
console.log($event.value);
}
contextsChange($event) {
this.contexts=$event.value;
console.log($event.value);
}
publicationsChange($event) {
this.publications=$event.value;
}
datasetsChange($event) {
this.datasets=$event.value;
}
projectsChange($event) {
this.projects=$event.value;
}
typeChanged(type:string) {
this.searchType = type;
}
chosenTypeChange($event) {
this.chosenType = this.show;
this.show=$event.value;
}
}