Project

General

Profile

1 44406 konstantin
import {Component, Input} from '@angular/core';
2 43926 konstantin
import {Observable}       from 'rxjs/Observable';
3 43785 argiro.kok
import { Router } from '@angular/router';
4 44614 konstantin
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
5 43769 argiro.kok
6 44406 konstantin
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
7
8 43769 argiro.kok
@Component({
9
    selector: 'deposit',
10
    template: `
11 45402 konstantin
        <div class="container uk-margin-top">
12 43785 argiro.kok
            <div class="page-header" >
13 44406 konstantin
                <h2>Deposit {{requestFor}}</h2>
14 43785 argiro.kok
            </div>
15 43769 argiro.kok
16 43785 argiro.kok
            <div>
17
                <p>
18
                    <i>
19
                        Are you a grant recipient from the following: H2020; FP7 with SC39; or ERC?
20
                    </i>
21
                    Then you are required to publish in
22 45402 konstantin
                    <a href="{{openAccess}}" target="_blank">open access ( <i class="uk-icon-external-link"></i> )</a>.
23 44893 konstantin
                    One way to do this is to deposit your {{requestFor}} into an
24 45402 konstantin
                    <a href="{{openAccessRepo}}" target="_blank">open access repository ( <i class="uk-icon-external-link"></i> )</a>.
25 43785 argiro.kok
                </p>
26
                <p>
27
                    Click the following to find more information:
28 45402 konstantin
                    <a href="{{fp7Guidlines}}" target="_blank">FP7 guidelines ( <i class="uk-icon-external-link"></i> )</a>,
29
                    <a href="{{h2020Guidlines}}" target="_blank">H2020 guidelines ( <i class="uk-icon-external-link"></i> )</a>,
30
                    <a href="{{ercGuidlines}}" target="_blank">ERC guidelines ( <i class="uk-icon-external-link"></i> )</a> OR
31
                    <a href="{{helpdesk}}" target="_blank">ask a question ( <i class="uk-icon-external-link"></i> )</a> to OpenAIRE’s national representative.
32 43785 argiro.kok
                </p>
33
34
                <h3>Locate data provider via your institution</h3>
35
36 45392 argiro.kok
                <form class= "uk-form uk-form-row">
37 45402 konstantin
                    <entities-autocomplete (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility   [selectedValue]=selectedId [showSelected]=true
38 44881 argiro.kok
                      [placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'"  [multipleSelections]=false
39 45402 konstantin
                      (selectedValueChanged)="valueChanged($event)">
40
                    </entities-autocomplete>
41 45404 konstantin
                    <button class="uk-button"  type="submit" (click)="organizationSelected(selectedId)" >
42 45429 konstantin
                        Locate
43 45404 konstantin
                    </button>
44 45402 konstantin
                    <div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
45 43785 argiro.kok
                </form>
46
            </div>
47
        </div>
48
    `
49 43769 argiro.kok
})
50
51
export class DepositComponent {
52 45404 konstantin
    @Input() keyword: string='';
53 44826 argiro.kok
    public openAccess: string;
54
    public openAccessRepo: string;
55
    public fp7Guidlines: string;
56
    public h2020Guidlines: string;
57
    public ercGuidlines: string;
58
    public helpdesk: string;
59 44406 konstantin
    @Input() compatibility: string = '';
60
    @Input() requestFor: string = "Publications";
61 43769 argiro.kok
62 44826 argiro.kok
    public status: number;
63
    public errorCodes:ErrorCodes = new ErrorCodes();
64 45402 konstantin
    public selectedId: string = "";
65 45442 argiro.kok
    public warningMessage: string = "";
66 44614 konstantin
67 44881 argiro.kok
    constructor (private _router: Router, private _searchOrganizationsService: SearchOrganizationsService) {
68 44274 konstantin
69 43926 konstantin
        this.openAccess = OpenaireProperties.getOpenAccess();
70
        this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
71
        this.fp7Guidlines = OpenaireProperties.getFP7Guidlines();
72
        this.h2020Guidlines = OpenaireProperties.getH2020Guidlines();
73
        this.ercGuidlines = OpenaireProperties.getERCGuidlines();
74
        this.helpdesk = OpenaireProperties.getHelpdesk();
75
    }
76 43769 argiro.kok
77 44614 konstantin
78
79 44406 konstantin
    organizationSelected(id: string) {
80 45402 konstantin
        console.info("organization selected");
81
        if(id && id.length > 0){
82
            if(this.requestFor == "Publications") {
83
                this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } );
84
            } else if(this.requestFor == "Research Data") {
85
                this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } );
86
            }
87
        } else {
88
            this.warningMessage = "No organization selected";
89 44406 konstantin
        }
90
    }
91 44862 argiro.kok
92
    valueChanged($event){
93
      this.selectedId = $event.value;
94
    }
95 43769 argiro.kok
}