diff --git a/.kontinuous/env/preprod/templates/pgadmin.sealed-secret.yaml b/.kontinuous/env/preprod/templates/pgadmin.sealed-secret.yaml deleted file mode 100644 index 34f5f6a5..00000000 --- a/.kontinuous/env/preprod/templates/pgadmin.sealed-secret.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: bitnami.com/v1alpha1 -kind: SealedSecret -metadata: - annotations: - sealedsecrets.bitnami.com/cluster-wide: 'true' - name: pgadmin -spec: - encryptedData: - PGADMIN_DEFAULT_PASSWORD: AgC4lnwAliiHTu4jrQtioJZRoDhtqytcC+iYSMUfEfbaij5sgwuc0yd4493HZyLRys4b4Hw5WHKNaRKW37bwHYXULuH0D5k6n4M6lWkt1n1EWt+uZHO1GUNMpAf17Fci30MTdXZyw+rgvfzpJns95Y+YCsiR+Xqcj9/C+RmotLgpgTxdXTUgMlQYNxEhCttFW8kqKcpmOkiuNHYig5srzNSUzy9udIkc8X5iuyZItatcN6mi/8GhLjbbWCTrwwB3mu8HlY/aHf8ioXrP77SFpSh/iccto1lNygMluZftomX7pPk/H1fsGL3DgOD4aLqNfxwo4UgMSEaBy73nEkI2V5lXzTQy8E7PKd37zt5JaJSnpvvp7rovytx4F6yZ8O49mx4Rjpaz5U1S3l3JV09K/jcuzvzx9MIIAQ49pNUjY3VrE6psjkkbo0QqA5p3AAdxX2dTatdM7WidkWgevmVixwodkQ+7yW7BonDYVKi8d/ljW1S1fwpZxkKdCfYQ6kc5vS3MpesIi2Qec+LSeffgQshkTgK7v6dm9g8/HIIZArx/Q7SFZH+0zn3x9v31SDTo9rjobYSdl+3ehC7apyZOFQ9PyPS7N0zxZhHY1SaBLs9rOTVSICCyT29WS+8TNUlyYLgqVB0JNQ1T3ZeW243Ia+x2ygtlzvoEyauZs+KYFaolZtkTf9AaKph895ugZvCmVZtdLTJinrxYHAVPx6AT7jzDFa+elw== - PGADMIN_DEFAULT_EMAIL: AgBCLotnM2nZfZMiHUgVN1FeU+RgXaq1J1YVku5XKBSX5p2qGJqaqpZJjYTF4400SGejpWVF9E2O7+eeGEqMfDpI23f0X7Bj0itOr0KsjFre/TV3a3BibaBiqLvFP9ZbGLIn+5mG3GhkYh4xdwzH4NGO1TFp1ub9qJ72LceUSjhOE0fXSwaO+qtMI2L8SwVv3nL4nhw8ZdEeOOZt7W8LLa+D96vJI/8IfHc6Wo2hrWvI7HIU8vWP04Dfhzu20HdhM31WjwxKX9ceMtFlLeTcrVtInxfKzFChwFNWqaDs+kFYQ8/h059eBtWGM7hV5LZHbqARmyllbpm/GQlX1szztUbFIX2Bb45yqL7SLI9o7tz+CNW3vxXVHO2uYmwu0XPIwJ2ZXm3cUq4VAwCkFAX0ZorFIXOaGeEpKiUO9JYX/YVsDCCjzUpcIqPUAHNJ2teV01lD4BTyIpkyUb4m0x7ver+DRli6fTrKfGW5nQNrfu96iNUNmy2fWE+lys0OtPlr73teVqs78aODggmZd/DLyKVUl8Xc9V+3BycYVmGyKlxPWNoHCrCColgw3P0dFDEyCos2Fx8CAVtMTNAL46k3gGVYDia3xG+42yGpYaUIXwyZmIwIFXrDfH9FGw97XLwxK5hrSh84GhcXW7WKNYfTK1cCnZY2+2hqT4DJN17N07W5ONu+0X4sCNKSlBbvCg3AYDycXhtck5UGcbwXhoQrMavmi1b/PiX5VdVWc5LqzOHaMiI= - template: - metadata: - annotations: - sealedsecrets.bitnami.com/cluster-wide: 'true' - name: pgadmin - type: Opaque diff --git a/src/client/src/components/DataSheets/Sections/Establishment/Establishment.js b/src/client/src/components/DataSheets/Sections/Establishment/Establishment.js index 975eaefc..71ec7fe2 100644 --- a/src/client/src/components/DataSheets/Sections/Establishment/Establishment.js +++ b/src/client/src/components/DataSheets/Sections/Establishment/Establishment.js @@ -14,6 +14,7 @@ import Controles from "./Direccte/Controles"; import Header from "./Header"; import Helps from "./Helps"; import ListEstablishment from "./ListEtablishments/ListEstablishment.jsx"; +import MarchesPublic from "./MarchesPublic/MarchesPublic.jsx"; import Muteco from "./Muteco"; import Relationship from "./Relationship"; @@ -33,6 +34,7 @@ const Establishment = ({ siret }) => { + diff --git a/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/MarchesPublic.jsx b/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/MarchesPublic.jsx new file mode 100644 index 00000000..871f47f1 --- /dev/null +++ b/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/MarchesPublic.jsx @@ -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 ( +
+ setAccordionOpen(!accordionOpen)} + text={" Appels d'offres"} + /> + + {accordionOpen && ( +
+ +
+ +
+
+ {data?.marches?.length > 0 && ( + 10} + > + + + Acheteur + Objet + CPV + Procédure + Montant + Notifié le + Durée + + + + {data?.marches?.map( + ({ + acheteur_id, + objet, + cpv_libelle, + procedure, + montant, + dateNotification, + dureeMois, + }) => ( + + + + + + + + + + + + + + + + + + + + + + + + + ) + )} + + + )} +
+ {data?.marches?.length === 0 && ( +
+ {"Aucun appel d'offres connu"} +
+ )} +
+
+ )} +
+ ); +}; + +MarchesPublic.propTypes = { + siret: PropTypes.string.isRequired, +}; +export default MarchesPublic; diff --git a/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/marchesPublic.gql.js b/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/marchesPublic.gql.js new file mode 100644 index 00000000..0719d4fd --- /dev/null +++ b/src/client/src/components/DataSheets/Sections/Establishment/MarchesPublic/marchesPublic.gql.js @@ -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 }, + }); diff --git a/src/client/src/components/DataSheets/Sidebar/Sidebar.js b/src/client/src/components/DataSheets/Sidebar/Sidebar.js index 4ccf0a3f..63e00c32 100644 --- a/src/client/src/components/DataSheets/Sidebar/Sidebar.js +++ b/src/client/src/components/DataSheets/Sidebar/Sidebar.js @@ -57,6 +57,7 @@ const Sidebar = ({ { label: "Mutations économiques", link: "#muteco" }, { label: "Aides", link: "#helps" }, { label: "Agréments", link: "#agrements" }, + { label: "Appels D'offres", link: "#marches" }, { label: "Autres etablissements", link: "#autres-etablissements" }, ]; diff --git a/src/client/src/components/DataSheets/dataSheets.scss b/src/client/src/components/DataSheets/dataSheets.scss index d4c3fa06..1d1008f4 100644 --- a/src/client/src/components/DataSheets/dataSheets.scss +++ b/src/client/src/components/DataSheets/dataSheets.scss @@ -265,6 +265,14 @@ .section-datas { padding: 0 $spacing-4; align-self: stretch; + &-marches { + display: flex; + justify-content: end; + + } + .is-centred { + text-align: center; + } .text { font-family: $marianne; font-size: 0.875rem; diff --git a/src/client/src/helpers/utils/utils.js b/src/client/src/helpers/utils/utils.js index c6e4b05e..4519be45 100644 --- a/src/client/src/helpers/utils/utils.js +++ b/src/client/src/helpers/utils/utils.js @@ -40,3 +40,19 @@ export const arraySum = (array) => export const range = (min, max) => min === max ? [min] : [min, ...range(min + 1, max)]; +export const convertirMoisEnAnnees = (mois) => { + const annees = Math.floor(mois / 12); + const moisRestants = mois % 12; + + let result = ""; + if (annees > 0) { + result += `${annees} an${annees > 1 ? "s" : ""}`; + } + if (moisRestants > 0) { + if (annees > 0) { + result += " "; + } + result += `${moisRestants} mois`; + } + return result || "__"; +};