Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(affichage des cc): quand une cc est inconnue sur une entreprise #5284

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,4 @@ describe("Conventions collectives", () => {
"/convention-collective/29-hospitalisation-privee-etablissements-prives-dhospitalisation-de-soins-d"
);
});
it("je vois une 404 si l'iddc n'existe pas", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce tests est déjà couvert par le not-found.spec

cy.request({
failOnStatusCode: false,
method: "GET",
url: "/convention-collective/1234",
}).then((response) => {
expect(response.status).to.equal(404);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SOURCES } from "@socialgouv/cdtn-utils";
import { getLabelBySource, SOURCES } from "@socialgouv/cdtn-utils";
import { Button, FlatList, Paragraph, theme } from "@socialgouv/cdtn-ui";
import Link from "next/link";
import React from "react";
Expand All @@ -9,6 +9,7 @@ import { ScreenType, useNavContext } from "../common/NavContext";
import { TrackingProps } from "../types";
import { AgreementTile } from "../../common/Agreement/AgreementSearch/AgreementInput/AgreementTile";
import { useRouter } from "next/router";
import { Tile } from "@socialgouv/cdtn-ui/lib";

type EnterpriseSearchStepProps = {
onBackClick: () => void;
Expand All @@ -32,27 +33,40 @@ const AgreementSelectionStep = ({
return (
<>
<SectionTitle>Convention collective</SectionTitle>
<Paragraph noMargin variant="primary">
{(enterprise?.conventions?.length ?? 0) > 1
? `${enterprise?.conventions.length} conventions collectives trouvées pour `
<Paragraph variant="primary">
{(enterprise.conventions.length ?? 0) > 1
? `${enterprise.conventions.length} conventions collectives trouvées pour `
: `${
enterprise?.conventions.length ?? 0
enterprise.conventions.length ?? 0
} convention collective trouvée pour `}
<strong>
« {enterprise?.simpleLabel}
{enterprise?.address &&
` , ${enterprise?.firstMatchingEtablissement?.address}`}{" "}
« {enterprise.simpleLabel}
{enterprise.address &&
` , ${enterprise.firstMatchingEtablissement?.address}`}{" "}
»
</strong>
</Paragraph>
<FlatList>
{enterprise?.conventions.map((agreement) => (
{enterprise.conventions.map((agreement) => (
<Li key={agreement.id}>
<AgreementTile
onUserAction={onUserAction}
agreement={agreement}
isWidgetMode={isWidgetMode}
/>
{agreement.slug ? (
<AgreementTile
onUserAction={onUserAction}
agreement={agreement}
isWidgetMode={isWidgetMode}
/>
) : (
<DisabledTile
wide
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ça c'est pour afficher les CC que l'on ne connait pas

subtitle={getLabelBySource(SOURCES.CCN)}
title={`IDCC${agreement.num}`}
>
<p>
Cette convention collective déclarée par l’entreprise n’est
pas reconnue par notre site
</p>
</DisabledTile>
)}
</Li>
))}
</FlatList>
Expand Down Expand Up @@ -93,3 +107,12 @@ const Li = styled.li`
margin-bottom: ${theme.spacings.large};
}
`;

const DisabledTile = styled(Tile)`
cursor: auto;
color: ${theme.colors.placeholder};
:hover {
transform: none;
color: ${theme.colors.placeholder};
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const SearchEnterpriseInput = ({
searchParams.query,
searchParams.address
);
const [query, setQuery] = useState("");
const [address, setAddress] = useState("");
const [query, setQuery] = useState(searchParams.query);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ça c'est le fix de la query quand on fait back

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bien vu !

const [address, setAddress] = useState(searchParams.address);
const searchInputHandler = () => {
onSearchParamsChange({ ...searchParams, query: query, address: address });
};
Expand Down
Loading