<div class="col-xs-12" ng-show="page">
	<p class="small">
		<b>Datasource:</b> {{page.datasource}}<br />
		<b>Topic:</b> {{page.topic}}<br />
		<b>Total:</b> {{page.total}}<br />
		<b>Page:</b> {{page.currPage + 1}} / {{page.totalPages}}<br />
	</p>

	<p ng-if="page.values.length == 0">
		<b>No records</b>
	</p>

	<div ng-if="page.values.length > 0">
		<div class="text-center">
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage <= 0" disabled="disabled">&larr; Prev</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage > 0" ng-click="gotoPage(page.currPage - 1)">&larr; Prev</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.totalPages <= page.currPage + 1" disabled="disabled">Next &rarr;</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage + 1 < page.totalPages" ng-click="gotoPage(page.currPage + 1)">Next &rarr;</button>
		</div>
		
		<div ng-repeat="val in page.values">
			<p class="text-right"><span class="badge badge-primary"><b>Trust:</b> {{val.trust}}</span></p>
			<table class="table table-sm table-striped small">
				<tr>
					<th style="width: 200px">ID</th>
					<td>{{val.result.openaireId}}</td>
				</tr>
				<tr>
					<th>Title(s)</th>
					<td>
						<span ng-repeat="t in val.result.titles track by $index">
							<br ng-if="$index > 0"/>
							{{t}}
						</span>
					</td>
				</tr>
				<tr>
					<th>Type</th>
					<td>{{val.result.typology}}</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.creators && val.highlight.creators.length > 0}">Author(s)</th>
					<td>
						<span ng-repeat="a in val.result.creators track by $index">
							<br ng-if="$index > 0"/>
							{{a.fullname}}<span ng-if="a.orcid"> (ORCID: {{a.orcid}})</span>
						</span>
						<span ng-if="val.highlight.creators && isAuthorHighlighted(a, val.highlight.creators)">
							<span class="badge badge-success">added</span>
							<span class="float-right">
								<b>from: </b> 
								<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
								<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
								<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
							</span>
						</span>
					</td>
				</tr>

				<tr>
					<th ng-class="{'text-success' : val.highlight.pids && val.highlight.pids.length > 0}">PID(s)</th>
					<td>
						<span ng-repeat="pid in val.result.pids">
							<br ng-if="$index > 0"/>
							{{pid.value}} <b>({{pid.type}})</b> 
							
							<span ng-if="val.highlight.pids && isPidHighlighted(pid, val.highlight.pids)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b> 
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
						</span>
						
					</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.abstracts && val.highlight.abstracts.length > 0}">Abstract(s)</th>
					<td>
						<span ng-repeat="d in val.result.abstracts track by $index">
							<br ng-if="$index > 0"/>
							{{d}}
						</span>
						<span class="float-right" ng-if="val.highlight.abstracts">
							<b>from: </b> 
							<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
							<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
							<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
						</span>
					</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.subjects && val.highlight.subjects.length > 0}">Subject(s)</th>
					<td>
						<span ng-repeat="s in val.result.subjects track by $index">
							<br ng-if="$index > 0"/>
							{{s.value}}<b ng-if="s.type"> ({{s.type}})</b>
							<span ng-if="val.highlight.subjects && isSubjectHighlighted(s, val.highlight.subjects)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
						</span>
					</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.publicationdate }">Publication date</th>
					<td>
						{{val.result.publicationdate}}
						<span class="float-right" ng-if="val.highlight.publicationdate">
							<b>from: </b> 
							<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
							<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
							<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
						</span>
					</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.instances && val.highlight.instances.length > 0}">Rights</th>
					<td>
						<span ng-repeat="i in val.result.instances">
							<br ng-if="$index > 0"/>
							{{i.license}} <b>({{i.hostedby}})</b> 
							<span ng-if="val.highlight.instances && isInstanceHighlighted(i, val.highlight.instances)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
							<br />
							<a href="{{i.url}}" target="_blank">{{i.url}}</a>
						</span>
					</td>
				</tr>
				<tr>
					<th ng-class="{'text-success' : val.highlight.projects && val.highlight.projects.length > 0}">Related project(s)</th>
					<td>
						<span ng-repeat="p in val.result.projects">
							<br ng-if="$index > 0"/>
							{{p.title}} 
							<span ng-if="val.highlight.projects && isProjectHighlighted(p, val.highlight.projects)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
							<ul>
								<li ng-if="p.acronym">acronym: <i>{{p.acronym}}</i></li> 
								<li ng-if="p.code">code: <i>{{p.code}}</i></li> 
								<li ng-if="p.funder">funder: <i>{{p.funder}}</i></li> 
								<li ng-if="p.fundingProgram">fundingProgram: <i>{{p.fundingProgram}}</i></li>
								<li ng-if="p.jurisdiction">jurisdiction: <i>{{p.jurisdiction}}</i></li> 
							</ul>
						</span>
					</td>
				</tr>
				
				<!-- DATASETS, PUBLICATIONS AND SOFTWARES  -->
				<tr>
					<th ng-class="{'text-success' : val.highlight.datasets && val.highlight.datasets.length > 0}">Related dataset(s)</th>
					<td>
						<span ng-repeat="d in val.result.datasets">
							<br ng-if="$index > 0"/>
							{{d.title}} 
							<span ng-if="val.highlight.datasets && isDatasetHighlighted(d, val.highlight.datasets)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
							<ul class="small">
								<li ng-repeat="pid in d.pids"><b>{{pid.type}}:</b> {{pid.value}}</li>
							</ul>
						</span>
					</td>
				</tr>
				
				<tr>
					<th ng-class="{'text-success' : val.highlight.publications && val.highlight.publications.length > 0}">Related publications(s)</th>
					<td>
						<span ng-repeat="p in val.result.publications">
							<br ng-if="$index > 0"/>
							{{p.title}} 
							<span ng-if="val.highlight.publications && isRelatedPublicationHighlighted(p, val.highlight.publications)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
							<ul class="small">
								<li ng-repeat="pid in p.pids"><b>{{pid.type}}:</b> {{pid.value}}</li> 
							</ul>
						</span>
					</td>
				</tr>
				
				<tr>
					<th ng-class="{'text-success' : val.highlight.softwares && val.highlight.softwares.length > 0}">Related softwares(s)</th>
					<td>
						<span ng-repeat="sw in val.result.softwares">
							<br ng-if="$index > 0"/>
							{{sw}} 
							<span ng-if="val.highlight.softwares && isSoftwareHighlighted(sw, val.highlight.softwares)">
								<span class="badge badge-success">added</span>
								<span class="float-right">
									<b>from: </b>
									<a href="{{val.provenance.url}}" target="_blank" ng-if="val.provenance.url">{{val.provenance.repositoryName}}</a>
									<span ng-if="!val.provenance.url">{{val.provenance.repositoryName}}</span>
									<span ng-if="val.provenance.id">(ID: {{val.provenance.id}})</span>
								</span>
							</span>
							<ul class="small">
								<li ng-repeat="pid in d.pids"><b>{{pid.type}}:</b> {{pid.value}}</li>
							</ul>
						</span>
					</td>
				</tr>
				
			</table>
		</div>
		
		<div class="text-center">
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage <= 0" disabled="disabled">&larr; Prev</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage > 0" ng-click="gotoPage(page.currPage - 1)">&larr; Prev</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.totalPages <= page.currPage + 1" disabled="disabled">Next &rarr;</button>
			<button class="btn btn-sm btn-outline-primary" ng-if="page.currPage + 1 < page.totalPages" ng-click="gotoPage(page.currPage + 1)">Next &rarr;</button>
		</div>
	</div>
</div>

<back-top><i class="fas fa-chevron-up"></i> top</back-top>
