<div class="uk-margin-medium-top uk-margin">
  <no-load-paging *ngIf="totalResults > 0 && previewResults && previewResults.length > 0" type="Orcid links"
                  (pageChange)="pageChanged($event)"
                  [page]="currentPage" [pageSize]="resultsPerPage"
                  [totalResults]="totalResults">
  </no-load-paging>
  <ul class="uk-list search-results uk-margin-medium-top">
    <errorMessages [status]="[status]" [type]="'results'"></errorMessages>

    <li *ngFor="let resultGroup of previewResults">
      <div class="uk-card uk-card-default uk-padding">
        <div class="uk-grid uk-grid-divider">
        <div class="uk-width-expand@m uk-width-1-1 uk-first-column">
          <div *ngIf="resultGroup['results'].length > 1" class="uk-alert uk-alert-warning uk-text-small">{{resultGroup['results'].length}} results found in OpenAIRE
            for PIDs "{{resultGroup['work']['pids'].join("\", \"")}}"
            <div>You can update your ORCID work with the most preferred result.</div>
          </div>
          <div *ngIf="resultGroup['results'].length == 0" class="uk-alert uk-alert-warning uk-text-small"> No results  found in OpenAIRE
            for PIDs "{{resultGroup['work']['pids'].join("\", \"")}}"
            <div>You can remove the entry from your ORCID profile as well.</div>
          </div>
          <div *ngFor="let result of resultGroup['results']">
            <div class = "uk-position-relative">
              <div class = "uk-width-1-1">
            <result-preview [properties]="properties" [showOrcid]="false" [showOrganizations]="true"
                            [showSubjects]="true" [result]="result"
                                                      [isCard]="false">
            </result-preview>
              </div>
              <div class = "uk-position-right uk-margin-large-top">
            <orcid-work *ngIf="resultGroup['results'].length > 1" [resultId]="result.relcanId"
                        [resultTitle]="result.title"
                        [type]="result.resultType" [pageType]="'my_search'"
                        [putCodes]="result.orcidPutCodes" [givenPutCode]="true"
                        [identifiers]="result.identifiers"
                        [creationDates]="result.orcidCreationDates" [updateDates]="result.orcidUpdateDates"
            [showOnlyUpdateButton]="true"
                  >
            </orcid-work>
              </div>
            </div>
          </div>
        </div>

        <div class="uk-width-auto@m uk-width-1-1">
          <div class="uk-height-1-1 uk-padding-small uk-flex uk-flex-center uk-flex-column uk-flex-middle">
            <orcid-work *ngIf="resultGroup['results'][0]" [resultId]="resultGroup['results'][0].relcanId" [resultTitle]="resultGroup['results'][0].title"
                        [type]="resultGroup['results'][0].resultType" [pageType]="'my_search'"
                        [putCodes]="resultGroup['results'][0].orcidPutCodes" [givenPutCode]="true"
                        [identifiers]="resultGroup['results'][0].identifiers"
                        [creationDates]="resultGroup['results'][0].orcidCreationDates" [updateDates]="resultGroup['results'][0].orcidUpdateDates"
                        [showUpdateButton]="resultGroup['results'].length == 1"
            >
            </orcid-work>
            <orcid-work *ngIf="resultGroup['results'].length ==0"   [pageType]="'my_search'"
                        [putCodes]="[resultGroup.work['putCode']]" [givenPutCode]="true"
                        [identifiers]="resultGroup.work['pids']"
                        [creationDates]="[resultGroup.work['creationDate']]" [updateDates]="resultGroup.work['updateDates']"
                        [showUpdateButton]="false"
            >
            </orcid-work>
          </div>
        </div>
        </div>
      </div>
    </li>
  </ul>

<!--  <no-load-paging *ngIf="totalResults > 0 && previewResults && previewResults.length" [type]="openaireEntities.RESULTS"-->
<!--                  (pageChange)="pageChanged($event)"-->
<!--                  [page]="currentPage" [pageSize]="resultsPerPage"-->
<!--                  [totalResults]="totalResults">-->
<!--  </no-load-paging>-->
  <paging-no-load *ngIf="totalResults > 0 && previewResults && previewResults.length > 0"
                  [totalResults]="totalResults" [currentPage]="currentPage" [size]="resultsPerPage"
                  (pageChange)="pageChanged($event)" class="uk-float-right"></paging-no-load>
</div>