-
Notifications
You must be signed in to change notification settings - Fork 22
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ import { EnterpriseApiResponse, ApiEnterpriseData, Convention } from "./types"; | |
import { IDCC_TO_REPLACE } from "../../config"; | ||
|
||
const toAgreement = (convention: Convention): Agreement => ({ | ||
id: convention.id, | ||
id: convention.id ?? convention.idcc, | ||
num: convention.idcc, | ||
shortTitle: convention.shortTitle, | ||
shortTitle: convention.shortTitle ?? "Convention collective non reconnue", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. je mets un titre par défaut dans l'api parce qu'on s'en sert partout notamment dans le cookie |
||
title: convention.title, | ||
...(convention.url ? { url: convention.url } : {}), | ||
}); | ||
|
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"; | ||
|
@@ -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; | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
@@ -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 |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ça c'est le fix de la query quand on fait back There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }); | ||
}; | ||
|
There was a problem hiding this comment.
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