Skip to content

Commit

Permalink
feat: ajout des conventions collectives sans page legifrance
Browse files Browse the repository at this point in the history
  • Loading branch information
m-maillot committed Sep 28, 2023
1 parent ac61c63 commit 130fa69
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const getAgreements = (idccList: number[]): SearchAgreementsBody => {
filter: [
{ terms: { num: idccList } },
{ term: { source: SOURCES.CCN } },
{ term: { isPublished: true } },
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ export function getIdccBody({ query, idccQuery }) {
],
query: {
bool: {
filter: [
{ term: { source: SOURCES.CCN } },
{ term: { isPublished: true } },
],
filter: [{ term: { source: SOURCES.CCN } }],
must: {
bool: {
should: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SOURCES } from "@socialgouv/cdtn-utils";
import { Wrapper } from "@socialgouv/cdtn-ui";
import { Wrapper, Modal, Button, Paragraph } from "@socialgouv/cdtn-ui";
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import styled from "styled-components";
Expand Down Expand Up @@ -36,6 +36,7 @@ function AgreementSearchTool({
const [screen, setScreen] = useState<ScreenType | null>(
widgetMode ? ScreenType.enterprise : null
);
const [isAgreementModalOpened, showAgreementModal] = useState(false);

useEffect(() => {
const slug = router.query.slug;
Expand Down Expand Up @@ -107,19 +108,47 @@ function AgreementSearchTool({
switch (screen) {
case ScreenType.agreement:
Step = (
<Steps.AgreementSearchStep
onBackClick={clearSearchType}
onSelectAgreement={(agreement) => {
trackEvent(
MatomoSearchAgreementCategory.AGREEMENT_SELECT_P1,
title,
`idcc${agreement.num.toString()}`,
uuid
);
router.push(`/convention-collective/${agreement.slug}`);
}}
onUserAction={onUserAction}
/>
<>
<Steps.AgreementSearchStep
onBackClick={clearSearchType}
onSelectAgreement={(agreement) => {
if (agreement.url !== undefined) {
trackEvent(
MatomoSearchAgreementCategory.AGREEMENT_SELECT_P1,
title,
`idcc${agreement.num.toString()}`,
uuid
);
router.push(`/convention-collective/${agreement.slug}`);
} else {
showAgreementModal(true);
}
}}
onUserAction={onUserAction}
/>
<Modal
title="Covention collective"
isOpen={isAgreementModalOpened}
onDismiss={() => {
showAgreementModal(false);
}}
>
<Paragraph>
Nous n&apos;avons pas d&apos;informations concernant cette
convention collective.
</Paragraph>
<Center>
<Button
variant="primary"
onClick={() => {
showAgreementModal(false);
}}
>
Fermer
</Button>
</Center>
</Modal>
</>
);
break;
case ScreenType.enterprise:
Expand Down Expand Up @@ -187,4 +216,10 @@ const WizardWrapper = styled(Wrapper)`
width: 100%;
margin: 0 auto;
`;

const Center = styled.div`
width: 100%;
text-align: center;
`;

export { AgreementSearchWithContext as AgreementSearch };
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,24 @@ const AgreementSelectionStep = ({
{enterprise.conventions.map((agreement) => (
<Li key={agreement.id}>
{agreement.slug ? (
<AgreementTile
onUserAction={onUserAction}
agreement={agreement}
isWidgetMode={isWidgetMode}
/>
agreement.url ? (
<AgreementTile
onUserAction={onUserAction}
agreement={agreement}
isWidgetMode={isWidgetMode}
/>
) : (
<DisabledTile
wide
subtitle={getLabelBySource(SOURCES.CCN)}
title={`${agreement.shortTitle} IDCC${agreement.num}`}
>
<p>
Cette convention collective déclarée par l’entreprise n’est
pas reconnue par notre site
</p>
</DisabledTile>
)
) : (
<DisabledTile
wide
Expand Down Expand Up @@ -111,6 +124,7 @@ const Li = styled.li`
const DisabledTile = styled(Tile)`
cursor: auto;
color: ${theme.colors.placeholder};
:hover {
transform: none;
color: ${theme.colors.placeholder};
Expand Down

0 comments on commit 130fa69

Please sign in to comment.