<div>
  <div>
    <div class="animated fadeInRight stepContent">
      <div class="uk-alert uk-alert-danger" *ngIf="alertMessage" style="padding: 10px">
        {{ alertMessage }}
      </div>
      <div class="uk-alert uk-alert-info">

        <ng-container *ngIf="mode === 'repository'">
          Please make sure your repository is registered in <a href="https://v2.sherpa.ac.uk/opendoar/" target="_blank">OpenDOAR</a>,
          <a href="http://www.re3data.org/" target="_blank">Re3data</a> or <a href="https://fairsharing.org/search?fairsharingRegistry=Database" target="_blank">FAIRsharing</a>.
          <span *ngIf="opendoarlatestUpdate && (opendoarlatestUpdate !== 'null')">
            <br><b>Last Updated (OpenDOAR): </b>{{ opendoarlatestUpdate }}
          </span>
          <span *ngIf="re3datalatestUpdate && (re3datalatestUpdate !== 'null')">
            <br><b>Last Updated (Re3data): </b>{{ re3datalatestUpdate }}
          </span>
          <span *ngIf="fairsharinglatestUpdate && (fairsharinglatestUpdate !== 'null')">
            <br><b>Last Updated (FAIRsharing): </b>{{ fairsharinglatestUpdate }}
          </span>
        </ng-container>

        <ng-container *ngIf="mode === 'cris'">
          Please make sure your Research Information System is registered in <a href="https://eurocris.org" target="_blank">euroCRIS</a>.
          <a href="https://eurocris.org/dris/dris-form" target="_blank"><br><i class="fas fa-external-link-alt" style="margin-right:3px;"></i>euroCRIS DRIS</a>
          <span *ngIf="latestUpdate && (latestUpdate !== 'null')">
            <br><b>Last Updated: </b>{{ latestUpdate }}
          </span>
        </ng-container>
<!--        <span *ngIf="latestUpdate && (latestUpdate !== 'null')">-->
<!--          <ng-container *ngIf="mode==='repository'">-->
<!--                      <b>Last Updated (OpenDOAR): </b>{{ latestUpdate }}-->
<!--            <b>Last Updated (Re3data): </b>{{ latestUpdate }}-->
<!--            <b>Last Updated (FAIRsharing): </b>{{ latestUpdate }}-->
<!--          </ng-container>-->
<!--          <ng-container *ngIf="mode==='cris'">-->
<!--            -->
<!--          </ng-container>-->
<!--        </span>-->

      </div>
      <div class="uk-margin-medium-top">
        <div class="md-input-wrapper md-input-filled">
          <label style="top: -16px;" class="">Select country</label>
          <select class="md-input" (change)="getReposInCountry($event.target.value)">
            <option value="" disabled selected>-- none selected --</option>
            <option *ngFor="let country of countries; let i = index" value="{{ i }}">{{ country.name ? country.name :
              country.code }}
            </option>
          </select>
          <span class="md-input-bar"></span>
        </div>

      </div>
      <div *ngIf="selectedCountry">
        <div>
          <h2 class="heading_b uk-margin-bottom uk-margin-medium-top">{{ sourceTitle }}
            {{mode === 'cris' ? '- Research Information Systems' : 'Repositories'}} in
            {{selectedCountry.name ? selectedCountry.name : selectedCountry.code }}</h2>
        </div>
        <div *ngIf="loadingMessage" class="loading-big">
          <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
            {{ loadingMessage }}
          </div>
          <div class="whiteFilm"></div>
        </div>
        <div class="uk-alert uk-alert-warning" *ngIf="noRepositories">{{ noRepositories }}</div>
        <div class="radioButtonForm" *ngIf="countryRepos && !loadingMessage">


          <div class="md-input-wrapper md-input-filled uk-margin-medium-top uk-margin-bottom">
            <label class="">Name of repository</label>
            <input #searchInput id="searchInput" class="md-input" type="text"
                   [disabled]="(!hasSelectedCountry)" (keyup)="searchTerm($event)"/>
            <span class="md-input-bar"></span>
          </div>


          <div class="form-group" *ngFor="let repo of countryRepos | repoFilter: searchBox">
            <label for="{{ repo.id }}" class="uk-button uk-link-muted visible_uk_links" style="display: block; text-align: left;">
              <input type="radio" value="{{ repo.id }}" id="{{ repo.id }}" name="repositories"
                     (change)="onChooseRepository(repo.id)" [disabled]="repo.registeredby !== null">
              <span>{{(repo.officialname !== null) ? repo.officialname : repo.englishname }}
                <span *ngIf="repo.registeredby !== null"
                      class="uk-badge uk-badge-warning uk-margin-small-right uk-margin-small-left">Registered</span>
                <a target="_blank" href="{{ (repo.websiteurl !== null) ? repo.websiteurl : '' }}" [ngStyle]="">
                  <i class="fas fa-external-link-alt externalLink"></i>
                </a>
              </span>
              <!--TODO uncomment if we still need the next button everywhere-->
              <!--<div *ngIf="repoId == repo.id" class="uk-float-right">-->
              <!--<a class="uk-button uk-button-primary uk-border-rounded uk-vertical-align-middle"-->
              <!--style="border-color: grey;"-->
              <!--(click)="pushedNext()">NEXT</a>-->
              <!--</div>-->
            </label>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
