<h4>{{info.name}}</h4>

<div class="alert alert-success" ng-if="message">{{message}}</div>

<p class="text-muted" ng-if="!message">
	<b>ID: </b>{{info.id}}<br />
	<b>Created at</b> {{info.creationDate | date:'MMMM d, y HH:mm:ss'}} <b>by</b> {{info.createdBy}}<br />
	<b>Modified at</b> {{info.modificationDate | date:'MMMM d, y HH:mm:ss'}} <b>by</b> {{info.modifiedBy}}<br />
	<b>OA Graph Node ID: </b> {{info.openaireId}} <a href="/redirect/oa/{{info.openaireId}}" target="_blank">[try on OA Explore]</a>
	<span class="badge badge-info" title="It is probably related to an Institutional Dashboard" ng-show="info.persistent">persistent</span>	
	<br/>
</p>

<div class="card">
	<div class="card-header">
		<ul class="nav nav-tabs card-header-tabs">
			<li class="nav-item">
				<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 1}" ng-click="gotoTab(1)">Metadata Management</a>
			</li>
			<li class="nav-item" ng-show="org.status == 'approved' || (org.status == 'suggested')">
				<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 2}" ng-click="gotoTab(2)">Duplicates<span class="badge badge-danger ml-2" ng-if="info.nDuplicates > 0" title="{{info.nDuplicates}} duplicate(s) to validate">new</span></a>
			</li>
			<li class="nav-item" ng-show="org.status == 'approved' && adminMode">
				<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 3}" ng-click="gotoTab(3)">Conflicts<span class="badge badge-danger ml-2" ng-if="info.nConflicts > 0" title="the current organization seems in conflict with {{info.nConflicts}} other(s)">new</span></a>
			</li>
			<li class="nav-item">
				<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 4}" ng-click="gotoTab(4)">Note<i class="fas fa-paperclip ml-2" ng-if="info.note"></i></a>
			</li>
			<li class="nav-item pull-right" ng-show="adminMode">
				<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 5}" ng-click="gotoTab(5)">History<i class="fas fa-history ml-2"></i></a>
			</li>
		</ul>
	</div>

	<div class="card-body" ng-if="currentTab == 1 && org.status">	
		<org-form-metadata org="org" vocabularies="vocabularies" info-method="getInfo()" mode="update_full" ng-if="adminMode && org.status == 'approved'"></org-form-metadata>
		<org-form-metadata org="org" vocabularies="vocabularies" info-method="getInfo()" mode="update_simple" ng-if="!adminMode && org.status == 'approved'"></org-form-metadata>

		<org-form-metadata org="org" vocabularies="vocabularies" info-method="getInfo()" mode="approve" ng-if="adminMode && org.status == 'suggested'"></org-form-metadata>
		<org-form-metadata org="org" vocabularies="vocabularies" info-method="getInfo()" mode="not_authorized" ng-if="!adminMode && org.status == 'suggested'"></org-form-metadata>

		<org-form-metadata org="org" vocabularies="vocabularies" info-method="getInfo()" mode="readonly" ng-if="org.status != 'approved' && org.status != 'suggested'"></org-form-metadata>
	
	</div>

	<div class="card-body" ng-if="currentTab == 2 && org.status == 'approved'">
		<org-details org="org" org-title="Current organization" show="default"></org-details>
		<org-duplicates org-id="{{org.id}}" duplicates="duplicates" save-function="saveDuplicates()" show-buttons="1"></org-duplicates>
	</div>

	<div class="card-body" ng-if="currentTab == 2 && org.status == 'suggested'">
		<org-details org="org" org-title="Current organization" show="default"></org-details>
		<org-duplicates org-id="{{org.id}}" duplicates="duplicates" readonly="1"></org-duplicates>
	</div>

	<div class="card-body" ng-if="adminMode && currentTab == 3 && (org.status == 'approved' || org.status == 'suggested')">
		<org-conflicts org="org" conflicts="conflicts" show-buttons="1"></org-conflicts>
	</div>

	<div class="card-body" ng-if="currentTab == 4 && org.status">
		<org-note org="org" note="note" save-function="saveNote()"></org-note>
	</div>

	<div class="card-body" ng-if="adminMode && currentTab == 5">
		<org-journal org="org" logs="logs"></org-journal>
	</div>

</div>
