Commit 5ff8f405 authored by Oleksii Savran's avatar Oleksii Savran
Browse files

Accession details: collCodes

parent 58e388f3
......@@ -31,7 +31,7 @@ import { ScrollToTopOnMount } from 'ui/common/page/scrollers';
import ReduxCheckbox from 'ui/common/checkbox';
import CropChips from 'crop/ui/c/CropChips';
import LocationMap from 'ui/common/LocationMap';
import {CountryLink, DatasetLink, InstituteLink, SubsetLink} from 'ui/genesys/Links';
import {CountryLink, DatasetLink, InstituteLink, SubsetLink, InstituteCodeLink} from 'ui/genesys/Links';
import PropertiesCard from 'ui/common/PropertiesCard';
import GridContainer from 'ui/layout/GridContainer';
import McpdDate from 'ui/common/time/McpdDate';
......@@ -283,7 +283,9 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
}
{ (accession.donorCode || accession.donorName) &&
<PropertiesItem title={ t('accessions.public.p.display.donorInstitute') }>
<div>{ accession.donorCode }</div>
<div>
<InstituteCodeLink to={ accession.donorCode }/>
</div>
<AuditedInfo info={ auditAccession.donorCode }/>
<div>{ accession.donorName }</div>
<AuditedInfo info={ auditAccession.donorName }/>
......@@ -297,7 +299,9 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
}
{ accession.duplSite && accession.duplSite.length > 0 && <PropertiesItem title={ t('accessions.public.p.display.safetyDuplicationInstitute') }>
{ accession.duplSite.map((duplSite, i) => (
<div key={ duplSite } style={ {width: '100%', paddingTop: '.25rem'} }>{ duplSite }</div>
<div key={ duplSite } style={ {width: '100%', paddingTop: '.25rem'} }>
<InstituteCodeLink to={ duplSite }/>
</div>
)) }
<AuditedInfo info={ auditAccessionId.duplSite }/>
</PropertiesItem> }
......@@ -342,7 +346,7 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
<Properties>
{ accession.donorCode && accession.donorNumb &&
<PropertiesItem title={ t('accessions.common.alias.DONORNUMB') }>
{ accession.donorNumb } <em>{ accession.donorCode }</em>
{ accession.donorNumb } <em><InstituteCodeLink to={ accession.donorCode }/></em>
<AuditedInfo info={ auditAccession.donorNumb }/>
<AuditedInfo info={ auditAccession.donorCode }/>
</PropertiesItem>
......@@ -429,15 +433,26 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
</PropertiesItem>
))
}
{ accession.coll &&
[ 'collCode', 'collName' ]
.filter((prop) => accession.coll[prop].length).map((prop) => (
<PropertiesItem key={ prop } title={ t(`accessions.common.coll.${prop}`) }>
{ accession.coll[prop] }
<AuditedInfo info={ auditAccessionCollect[prop] }/>
</PropertiesItem>
))
}
{ accession.coll && accession.coll.collCode && accession.coll.collCode.length > 0 && (
<PropertiesItem key={ 'collCode' } title={ t('accessions.common.coll.collCode') }>
{ accession.coll.collCode.map((collCode) => (
<div key={ collCode } style={ {width: '100%', paddingTop: '.25rem'} }>
<InstituteCodeLink to={ collCode }/>
</div>
)) }
<AuditedInfo info={ auditAccessionCollect.collCode }/>
</PropertiesItem>
) }
{ accession.coll && accession.coll.collName && accession.coll.collName.length > 0 && (
<PropertiesItem key={ 'collName' } title={ t('accessions.common.coll.collName') }>
{ accession.coll.collName.map((collName) => (
<div key={ collName } style={ {width: '100%', paddingTop: '.25rem'} }>
{ collName }
</div>
)) }
<AuditedInfo info={ auditAccessionCollect.collName }/>
</PropertiesItem>
) }
{ accession.geo &&
[ 'latitude', 'longitude', 'datum', 'method', 'uncertainty', 'elevation' ]
.filter((prop) => accession.geo[prop] !== null).map((prop) => (
......
......@@ -67,6 +67,14 @@ function InstituteLink({ to: institute, edit = false, children = null }
}
}
function InstituteCodeLink({ to: code, children = null }: { to: string, children?: any }) {
return (
<Link to={ `/wiews/${code}` }>
{ children || code }
</Link>
);
}
function RequestLink({ to: request, edit = false, children = null }
: { to: string | MaterialRequest, edit?: boolean, children?: any }) {
......@@ -207,4 +215,4 @@ const ActivityPostLink = ({ to: activityPost, edit = false, children = null }
};
export { SubsetLink, AccessionLink, InstituteLink, RequestLink, CountryLink, DatasetLink, UserLink, OAuthClientLink, RegionLink, ExecutionLink, ArticleLink, ActivityPostLink};
export { SubsetLink, AccessionLink, InstituteLink, RequestLink, CountryLink, DatasetLink, UserLink, OAuthClientLink, RegionLink, ExecutionLink, ArticleLink, ActivityPostLink, InstituteCodeLink};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment