Skip to content

Commit

Permalink
feat(contribution): ajout des contributions conventionnelles dans la …
Browse files Browse the repository at this point in the history
…liste des documents (#1539)
  • Loading branch information
m-maillot authored Feb 3, 2025
1 parent de0a89d commit effc719
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
14 changes: 2 additions & 12 deletions targets/frontend/src/components/documents/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,37 +129,27 @@ DocumentListContainer.propTypes = {
const searchDocumentQuery = `
query documents($source: String, $search: String!, $published: [Boolean!]!, $available: [Boolean!]!, $offset: Int = 0, $limit: Int = 50) {
documents(where: {
_or: [
{ source: { _neq: "contributions" } }
{ source: { _eq: "contributions" }, document: { _contains: { idcc: "0000" } } }
]
_and: {
source: {_eq: $source, _neq: "code_du_travail"}
title: {_ilike: $search}
is_published: {_in: $published}
is_available: {_in: $available}
}
},
offset: $offset, limit: $limit, order_by: [{source: asc}, {slug: asc}]) {
id: initial_id
cdtnId: cdtn_id
title
source
idcc: document(path: "$idcc")
questionIndex: document(path: "$questionIndex")
isPublished: is_published
isAvailable: is_available
}
documents_aggregate(where: {
_or: [
{ source: { _neq: "contributions" } }
{ source: { _eq: "contributions" }, document: { _contains: { idcc: "0000" } } }
]
_and: {
source: {_eq: $source, _neq: "code_du_travail"}
title: {_ilike: $search},
is_published: {_in: $published}
is_available: {_in: $available}
}
}) {
aggregate {
count
Expand Down
21 changes: 19 additions & 2 deletions targets/frontend/src/components/documents/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ DocumentList.propTypes = {
};

const DocumentRow = function DocumentRow({
document: { cdtnId, id, source, title, isPublished, isAvailable },
document: {
cdtnId,
id,
source,
title,
idcc,
questionIndex,
isPublished,
isAvailable,
},
}) {
const [selectedItems, setSelectedItems] = useSelectionContext();
const updatePublishedRef = () => {
Expand Down Expand Up @@ -93,7 +102,15 @@ const DocumentRow = function DocumentRow({
textDecoration: isAvailable ? "none" : " line-through",
}}
>
{source}{title}
{source === SOURCES.CONTRIBUTIONS ? (
<>
{source}{questionIndex} - {title} (IDCC {idcc})
</>
) : (
<>
{source}{title}
</>
)}
</span>
</Link>
</TableCell>
Expand Down

0 comments on commit effc719

Please sign in to comment.