-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add establishment section Appels d'offres
- Loading branch information
1 parent
5cea28e
commit 049f319
Showing
7 changed files
with
171 additions
and
16 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
.kontinuous/env/preprod/templates/pgadmin.sealed-secret.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/MarchesPublic.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import PropTypes from "prop-types"; | ||
import React, { useState } from "react"; | ||
|
||
import Source from "../../../../../containers/Source/Source.js"; | ||
import { formatSiret } from "../../../../../helpers/utils/format.js"; | ||
import { convertirMoisEnAnnees } from "../../../../../helpers/utils/utils.js"; | ||
import { formatChiffre } from "../../../../../utils/donnees-ecofi/donnees-ecofi.js"; | ||
import { formatUpperCase } from "../../../../../utils/entreprise/entreprise.js"; | ||
import Value from "../../../../shared/Value/index.js"; | ||
import BlocTitle from "../../SharedComponents/BlocTitle/BlocTitle.jsx"; | ||
import NonBorderedTable from "../../SharedComponents/NonBorderedTable/NonBorderedTable.js"; | ||
import SeeDetailsLink from "../../SharedComponents/SeeDetailsLink/SeeDetailsLink.js"; | ||
import Subcategory from "../../SharedComponents/Subcategory/index.js"; | ||
import { useMarchesPublic } from "./marchesPublic.gql.js"; | ||
|
||
const MarchesPublic = ({ siret }) => { | ||
const { loading, data, error } = useMarchesPublic(siret); | ||
const [accordionOpen, setAccordionOpen] = useState(true); | ||
|
||
if (loading || error || !siret) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<section id="marches" className="data-sheet__bloc_section"> | ||
<BlocTitle | ||
isOpen={accordionOpen} | ||
toggleAccordion={() => setAccordionOpen(!accordionOpen)} | ||
text={" Appels d'offres"} | ||
/> | ||
|
||
{accordionOpen && ( | ||
<div className="section-datas"> | ||
<Subcategory> | ||
<div className="section-datas-marches"> | ||
<Source | ||
si={"DECP"} | ||
hasDateImport={false} | ||
sourceCustom={null} | ||
sourceDate={null} | ||
/> | ||
</div> | ||
<div className="data-sheet--table data-sheet--table-to-left"> | ||
{data?.marches?.length > 0 && ( | ||
<NonBorderedTable | ||
className="direccte-interactions-establishment__table" | ||
isScrollable={data?.marches?.length > 10} | ||
> | ||
<thead> | ||
<tr> | ||
<th>Acheteur</th> | ||
<th>Objet</th> | ||
<th>CPV</th> | ||
<th>Procédure</th> | ||
<th>Montant</th> | ||
<th>Notifié le</th> | ||
<th>Durée</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data?.marches?.map( | ||
({ | ||
acheteur_id, | ||
objet, | ||
cpv_libelle, | ||
procedure, | ||
montant, | ||
dateNotification, | ||
dureeMois, | ||
}) => ( | ||
<tr key={acheteur_id + dateNotification}> | ||
<td className="table-cell--nowrap"> | ||
<SeeDetailsLink | ||
text={formatSiret(acheteur_id)} | ||
link={`/establishment/${acheteur_id}/`} | ||
/> | ||
</td> | ||
|
||
<td> | ||
<Value value={formatUpperCase(objet)} /> | ||
</td> | ||
<td> | ||
<Value value={formatUpperCase(cpv_libelle)} /> | ||
</td> | ||
<td> | ||
<Value value={formatUpperCase(procedure)} /> | ||
</td> | ||
<td> | ||
<Value value={formatChiffre(montant)} /> | ||
</td> | ||
<td> | ||
<Value value={dateNotification} /> | ||
</td> | ||
<td> | ||
<Value value={convertirMoisEnAnnees(dureeMois)} /> | ||
</td> | ||
</tr> | ||
) | ||
)} | ||
</tbody> | ||
</NonBorderedTable> | ||
)} | ||
</div> | ||
{data?.marches?.length === 0 && ( | ||
<div className="data-value is-centred"> | ||
{"Aucun appel d'offres connu"} | ||
</div> | ||
)} | ||
</Subcategory> | ||
</div> | ||
)} | ||
</section> | ||
); | ||
}; | ||
|
||
MarchesPublic.propTypes = { | ||
siret: PropTypes.string.isRequired, | ||
}; | ||
export default MarchesPublic; |
25 changes: 25 additions & 0 deletions
25
...lient/src/components/DataSheets/Sections/Establishment/MarchesPublic/marchesPublic.gql.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { gql, useQuery } from "@apollo/client"; | ||
|
||
import { BCE_CLIENT } from "../../../../../services/GraphQL/GraphQL"; | ||
|
||
const marchesPublicQuery = gql` | ||
query getMarchesPublic($siret: String!) { | ||
marches: fce_marches_valides(where: { siret: { _eq: $siret } }) { | ||
acheteur_id | ||
codeCPV | ||
cpv_libelle | ||
dateNotification | ||
dureeMois | ||
montant | ||
objet | ||
procedure | ||
sousTraitanceDeclaree | ||
} | ||
} | ||
`; | ||
|
||
export const useMarchesPublic = (siret) => | ||
useQuery(marchesPublicQuery, { | ||
context: { clientName: BCE_CLIENT }, | ||
variables: { siret }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters