Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Nov 14, 2023
2 parents e674580 + 6078810 commit d80e243
Show file tree
Hide file tree
Showing 39 changed files with 899 additions and 490 deletions.
Binary file modified public/models/BulkImportStructures.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions src/components/blocs/documents/weblinks-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const mapping = {
hceres: "Rapport d'évaluation HCERES",
jorfsearch: 'Page JORFSearch',
PiaWEB: 'Données PiaWEB',
RechercheDataGouv: 'Recherche data gouv',
DataWarehouse: 'Entrepôt de données institutionnel',
};

export default function WeblinksResources({ resourceId }) {
Expand Down
10 changes: 0 additions & 10 deletions src/components/blocs/evenements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import TagList from '../../tag-list';
import useEditMode from '../../../hooks/useEditMode';
import useFetch from '../../../hooks/useFetch';
import useNotice from '../../../hooks/useNotice';
import { getComparableNow } from '../../../utils/dates';

import api from '../../../utils/api';
import { saveError, saveSuccess, deleteError, deleteSuccess } from '../../../utils/notice-contents';
Expand Down Expand Up @@ -67,15 +66,6 @@ export default function AgendaOutlet() {
<Row className="flex--space-between">
<BadgeGroup>
<Badge text={event.type} />
{event.eventDate < getComparableNow() ? (
<div className="fr-card__start ">
<Badge text="terminé" colorFamily="brown-opera" />
</div>
) : (
<div>
<Badge text="A venir" type="info" />
</div>
) }
</BadgeGroup>
{editMode && <Button onClick={() => onOpenModalHandler(event)} size="sm" icon="ri-edit-line" title="Editer l'évènement" tertiary borderless rounded />}
</Row>
Expand Down
1 change: 0 additions & 1 deletion src/components/blocs/geographical-tags/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { GEOGRAPHICAL_CATEGORIES_LABELS_MAPPER } from '../../../utils/constants'

export default function GeographicalTags({ data }) {
const navigate = useNavigate();

const sortedLevels = ['country', 'region', 'department', 'city', 'academy', 'urbanUnity'];
data?.sort((a, b) => sortedLevels.indexOf(a?.level) - sortedLevels.indexOf(b?.level));

Expand Down
96 changes: 1 addition & 95 deletions src/components/blocs/identifiers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
saveError,
saveSuccess,
} from '../../../utils/notice-contents';
import getLink from '../../../utils/get-links';

export default function IdentifiersComponent() {
const { notice } = useNotice();
Expand Down Expand Up @@ -73,101 +74,6 @@ export default function IdentifiersComponent() {
setShowModal(true);
};

const getLink = (el) => {
let linkTo = '';
switch (el.type) {
case 'annelis':
linkTo = `https://dgesip-annelis.adc.education.fr/etablissement/${el.value}`;
break;
case 'bnf':
linkTo = `https://catalogue.bnf.fr/ark:/12148/cb${el.value}`;
break;
case 'cnrs-grafilabo':
linkTo = `https://www2.cnrs.fr/graflabo/unite.php?cod_uni=${el.value}`;
break;
case 'cnrs-unit':
linkTo = `https://web-ast.dsi.cnrs.fr/l3c/owa/structure.infos_admin?&p_lab=${el.value}&p_origine_appel=u`;
break;
case 'crunchbase':
linkTo = `https://www.crunchbase.com/organization/${el.value}`;
break;
case 'euTransparency':
linkTo = `https://ec.europa.eu/transparencyregister/public/consultation/displaylobbyist.do?id=${el.value}&isListLobbyistView=true&locale=fr#fr`;
break;
case 'dealroom':
linkTo = `https://app.dealroom.co/companies/${el.value}`;
break;
case 'fundref':
linkTo = `https://search.crossref.org/funding?q=${el.value}`;
break;
case 'hatvp':
linkTo = `https://www.hatvp.fr/fiche-organisation/?organisation=${el.value}`;
break;
case 'idhal':
linkTo = `https://aurehal.archives-ouvertes.fr/structure/read/id/${el.value}`;
break;
case 'idref':
linkTo = `https://www.idref.fr/${el.value}`;
break;
case 'isni':
linkTo = `http://www.isni.org/${el.value.split(' ').join('')}`;
break;
case 'nnt':
linkTo = `http://www.theses.fr/${el.value}`;
break;
case 'oc':
linkTo = `https://opencorporates.com/companies/${el.value}`;
break;
case 'orcid':
linkTo = `https://orcid.org/${el.value}`;
break;
case 'pia':
linkTo = `https://anr.fr/ProjetIA-${el.value}`;
break;
case 'pic':
linkTo = `https://ec.europa.eu/info/funding-tenders/opportunities/portal/screen/how-to-participate/org-details/${el.value}`;
break;
case 'researchgate':
linkTo = `https://www.researchgate.net/profile/${el.value}`;
break;
case 'rcr':
linkTo = `http://www.sudoc.abes.fr//DB=2.2/SET=1/TTL=3/CMD?ACT=SRCHA&IKT=8888&SRT=RLV&TRM=${el.value}`;
break;
case 'rna':
linkTo = `https://entreprise.data.gouv.fr/etablissement/${el.value}`;
break;
case 'rnsr':
linkTo = `https://appliweb.dgri.education.fr/rnsr/PresenteStruct.jsp?numNatStruct=${el.value}&PUBLIC=OK`;
break;
case 'ror':
linkTo = `https://ror.org/${el.value}`;
break;
case 'scopus':
linkTo = `https://www.scopus.com/authid/detail.uri?authorId=${el.value}`;
break;
case 'siren':
linkTo = `https://annuaire-entreprises.data.gouv.fr/entreprise/${el.value.split(' ').join('')}`;
break;
case 'siret':
linkTo = `https://annuaire-entreprises.data.gouv.fr/etablissement/${el.value.split(' ').join('')}`;
break;
case 'univ-droit':
linkTo = `https://univ-droit.fr/universitaires/${el.value}`;
break;
case 'wikidata':
linkTo = `https://wikidata.org/wiki/${el.value}`;
break;
case 'wikidata_json':
linkTo = `https://www.wikidata.org/wiki/Special:EntityData/${el.value}.json`;
break;
case 'wos':
linkTo = `https://publons.com/researcher/${el.value}/`;
break;
default:
}
return linkTo;
};

const renderCards = () => {
if (!data) return null;
const list = [];
Expand Down
159 changes: 85 additions & 74 deletions src/components/blocs/localisations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import api from '../../../utils/api';
import { formatDescriptionDates } from '../../../utils/dates';
import { deleteError, deleteSuccess, saveError, saveSuccess } from '../../../utils/notice-contents';
import GeographicalTags from '../geographical-tags';
import { PageSpinner } from '../../spinner';

export default function LocalisationsComponent() {
const { editMode } = useEditMode();
Expand Down Expand Up @@ -57,46 +58,52 @@ export default function LocalisationsComponent() {
};

const renderAddress = (localisation) => {
let address = '';
const phoneNumberWithoutSpaces = localisation?.phonenumber?.replace(/\s/g, '');
if (localisation.distributionStatement) { address += `${localisation.distributionStatement},\n`; }
if (localisation.address) { address += `${localisation.address},\n`; }
if (localisation.place) { address += `${localisation.place},\n`; }
if (localisation.postOfficeBoxNumber) { address += `${localisation.postOfficeBoxNumber},\n`; }
if (localisation.postalCode) { address += `${localisation.postalCode},\n`; }
if (localisation.locality) { address += `${localisation.locality},\n`; }
if (localisation.country) { address += `${localisation.country}\n`; }
const elements = [
localisation.distributionStatement,
localisation.address,
localisation.place,
localisation.postOfficeBoxNumber,
localisation.postalCode,
localisation.locality,
localisation.country,
];

const addressText = elements
.filter((element) => element)
.map((element) => element.split(' ').join('\n'))
.filter((element) => element)
.join(', ');

return (
<div className="fr-card fr-card--grey fr-card--no-border">
<div className="fr-card__content ">
<p className="fr-card__title">
<span className="fr-pr-1w">
{address}
</span>
<CopyButton
copyText={address}
size="sm"
/>
{addressText && (
<span className="fr-pr-1w">
{addressText}
<CopyButton
copyText={addressText}
size="sm"
/>
</span>
)}
</p>
{localisation.phonenumber && (
<Text className="fr-card__title">
<Icon name="ri-phone-line" size="xl" />
<span className="fr-pr-1w">
{phoneNumberWithoutSpaces}
{localisation.phonenumber.replace(/\s/g, '')}
</span>
<CopyButton
copyText={{ phoneNumberWithoutSpaces }}
copyText={localisation.phonenumber.replace(/\s/g, '')}
size="sm"
/>
</Text>
)}
<div className="fr-card__start">
<p className="fr-card__detail fr-text--sm fr-mb-0">
<Icon name="ri-map-pin-fill" size="1x" />
Adresse
{' '}
{localisation.current ? 'actuelle' : 'historique'}
{localisation.current ? 'Dernière adresse connue' : 'Adresse historique'}
</p>
<div className="fr-card__end fr-mt-0 fr-pt-0">
<p className="fr-card__detail">
Expand All @@ -111,7 +118,15 @@ export default function LocalisationsComponent() {
};

if (error) return <div>Erreur</div>;
if (isLoading) return <div>Chargement</div>;
if (isLoading) {
return (
<Row className="flex--space-between">
<Col>
<PageSpinner />
</Col>
</Row>
);
}

const currentLocalisation = data.data.find((item) => item.current === true);
const inactives = data.data.filter((el) => (el.current === false)).sort((a, b) => a.startDate - b.startDate);
Expand All @@ -126,36 +141,44 @@ export default function LocalisationsComponent() {
</BlocActionButton>
<BlocContent>
<Row gutters>
{currentLocalisation?.coordinates?.lat && currentLocalisation?.coordinates?.lng && (
<Col n="6">
<Map
lat={currentLocalisation?.coordinates?.lat}
lng={currentLocalisation?.coordinates?.lng}
markers={[
{
address: `{${currentLocalisation?.address || ''}, ${currentLocalisation?.postalCode || ''} ${currentLocalisation?.locality || ''}, ${currentLocalisation?.country}}`,
latLng: [
currentLocalisation?.coordinates?.lat,
currentLocalisation?.coordinates?.lng,
],
},
]}
/>
</Col>
)}
<Col n="6">
<Col n="12">
<Tabs>
{data && (
<Tab
className={`fr-card fr-card--xs fr-card--horizontal fr-card--grey fr-card--no-border card-${apiObject}`}
label="Adresse actuelle"
>
<Row>
<Col>
{currentLocalisation?.country ? renderAddress(currentLocalisation) : null}
<Row gutters>
<Col n="8">
{currentLocalisation.coordinates && (
<Map
lat={currentLocalisation?.coordinates?.lat}
lng={currentLocalisation?.coordinates?.lng}
markers={[
{
address: `${currentLocalisation?.address || ''}, ${currentLocalisation?.postalCode || ''} ${currentLocalisation?.locality || ''}, ${currentLocalisation?.country}`,
latLng: [
currentLocalisation?.coordinates?.lat,
currentLocalisation?.coordinates?.lng,
],
},
]}
/>
)}
</Col>
<Col n="4">
{currentLocalisation?.country
? renderAddress(currentLocalisation) : null}
</Col>
{data && (
<Row className="fr-mt-3w">
<Col>
<BlocTitle as="h3" look="h6">Catégories géographiques de l'adresse actuelle</BlocTitle>
<GeographicalTags data={currentLocalisation?.geoCategories} />
</Col>
</Row>
)}
</Row>
{/* <GeographicalTags data={currentLocalisation?.geoCategories} /> */}
</Tab>
)}
{data.totalCount > 1 && (
Expand All @@ -166,50 +189,38 @@ export default function LocalisationsComponent() {
<Row style={{ overflowY: 'scroll' }}>
<style>
{`
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-vertical {
width: 8px;
}
::-webkit-scrollbar-thumb:vertical {
background-color: gray;
}
::-webkit-scrollbar-track:vertical {
background-color: transparent;
}
`}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-vertical {
width: 8px;
}
::-webkit-scrollbar-thumb:vertical {
background-color: gray;
}
::-webkit-scrollbar-track:vertical {
background-color: transparent;
}
`}
</style>

{orderedList.length > 1 && (
{orderedList.length > 2 && (
<Text style={{ textAlign: 'center', color: 'gray' }}>
Défiler pour voir plus de contenu
</Text>
)}
{orderedList.map((item) => (
<>
<Col n="12" key={`HistoriqueLocalisation${item.id}`}>
{renderAddress(item)}
</Col>
{/* <GeographicalTags data={item.geoCategories} /> */}
</>
<Col n="12" key={`HistoriqueLocalisation${item.id}`}>
{renderAddress(item)}
</Col>
))}
</Row>
</Tab>
)}
</Tabs>
</Col>
</Row>
{data && (
<Row className="fr-mt-3w">
<Col>
<BlocTitle as="h3" look="h6">Catégories géographiques de l'adresse actuelle</BlocTitle>
<GeographicalTags data={currentLocalisation?.geoCategories} />
</Col>
</Row>
)}

</BlocContent>
<BlocModal>
<Modal isOpen={showModal} size="lg" hide={() => setShowModal(false)}>
Expand Down
Loading

0 comments on commit d80e243

Please sign in to comment.