Skip to content

Commit

Permalink
fix(kali ref): fix kali ref on contributions (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda authored Sep 25, 2023
1 parent 37c3093 commit 19d20c0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const ContributionsAnswer = ({
{answer && !isCodeDuTravail(answer) && (
<KaliReferenceInput
name="kaliReferences"
idcc={answer.agreement.id}
agreement={answer.agreement}
control={control}
disabled={isNotEditable(answer)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ query contribution_answer($id: uuid) {
agreement {
id
name
kaliId: kali_id
}
answerComments: answer_comments {
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { FormTextField } from "../../../forms";
import DeleteIcon from "@mui/icons-material/Delete";
import { useContributionSearchKaliReferenceQuery } from "./kaliReferencesSearch.query";
import { Answer, KaliArticle } from "../../type";
import { Agreement, Answer, KaliArticle } from "../../type";
import { Result } from "./ReferenceInput";
import { SimpleLink } from "../../../utils/SimpleLink";

Expand Down Expand Up @@ -79,14 +79,14 @@ const KaliReferenceSearch = ({

type Props = {
name: string;
idcc: string;
agreement: Agreement;
control: Control<any>;
disabled?: boolean;
};

export const KaliReferenceInput = ({
name,
idcc,
agreement,
control,
disabled = false,
}: Props): ReactElement | null => {
Expand All @@ -97,7 +97,7 @@ export const KaliReferenceInput = ({

return (
<TitleBox
title={`Références liées à la convention collective ${idcc}`}
title={`Références liées à la convention collective ${agreement.id}`}
disabled={disabled}
>
<Stack spacing={2} mt={4}>
Expand All @@ -120,7 +120,7 @@ export const KaliReferenceInput = ({
<Grid item xs={7}>
<SimpleLink
target="_blank"
href={`https://www.legifrance.gouv.fr/conv_coll/id/${ref.kaliArticle.cid}/?idConteneur=KALICONT000005635550`}
href={`https://www.legifrance.gouv.fr/conv_coll/id/${ref.kaliArticle.cid}/?idConteneur=${agreement.kaliId}`}
>
{ref.kaliArticle.path}
</SimpleLink>
Expand All @@ -138,7 +138,7 @@ export const KaliReferenceInput = ({
{!disabled && (
<KaliReferenceSearch
fetcher={useContributionSearchKaliReferenceQuery}
idcc={idcc}
idcc={agreement.id}
onAdd={(value) => {
if (value) {
append({ kaliArticle: value });
Expand Down
1 change: 1 addition & 0 deletions targets/frontend/src/components/contributions/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SourceRoute } from "@socialgouv/cdtn-sources";
export type Agreement = {
id: string;
name: string;
kaliId: string;
};

export type Status =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ select_permissions:
permission:
columns:
- id
- kali_id
- name
filter: {}
allow_aggregations: true

0 comments on commit 19d20c0

Please sign in to comment.