Skip to content

Commit

Permalink
feat: harmonisation textuelle - Ref gestion-de-projet#2371
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored and aetchego committed Nov 19, 2024
1 parent 9454c0d commit c5fb815
Show file tree
Hide file tree
Showing 22 changed files with 277 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const AdvancedInputs = ({ sourceType, selectedCriteria, onChangeValue, onError }
}

return (
<>
<Grid container>
<Grid
item
container
Expand All @@ -61,7 +61,7 @@ const AdvancedInputs = ({ sourceType, selectedCriteria, onChangeValue, onError }
</IconButton>
</Grid>

<Collapse in={checked} unmountOnExit>
<Collapse in={checked} unmountOnExit style={{ width: '100%' }}>
<Grid container direction="column" padding="0 1em" gap="10px">
<InputWrapper>
<ExecutiveUnitsInput
Expand Down Expand Up @@ -135,7 +135,7 @@ const AdvancedInputs = ({ sourceType, selectedCriteria, onChangeValue, onError }
)}
</Grid>
</Collapse>
</>
</Grid>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const CcamForm = (props: CriteriaDrawerComponentProps) => {
remontées aux tutelles et disponibles dans le SNDS.
</Alert>
</Grid>
<Grid className={classes.inputContainer}>
<Grid className={classes.inputItem}>
<ValueSetField
value={currentCriteria.code}
references={ccamReferences}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const Cim10Form = (props: CriteriaDrawerComponentProps) => {
</Alert>
</Grid>

<Grid className={classes.inputContainer}>
<Grid className={classes.inputItem}>
<ValueSetField
value={currentCriteria.code}
references={cim10References}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const GhmForm = (props: CriteriaDrawerComponentProps) => {
/>
</BlockWrapper>

<Grid className={classes.inputContainer}>
<Grid className={classes.inputItem}>
<ValueSetField
value={currentCriteria.code}
references={ghmReferences}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreationCohort/DiagramView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const DiagramView = () => {
)}
<CohortCreationBreadcrumbs />

<Grid container justifyContent="center">
<Grid container justifyContent="center" alignItems="center">
{selectedPopulation && selectedPopulation.length > 0 && (
<PopulationCard
onEditDisabled={maintenanceIsActive}
Expand Down
6 changes: 6 additions & 0 deletions src/components/Filters/ExecutiveUnitsFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ScopeElement } from 'types'
import { SourceType } from 'types/scope'
import { Hierarchy } from 'types/hierarchy'
import ExecutiveUnitsInput from 'components/ui/Inputs/ExecutiveUnits'
import { Typography } from '@mui/material'

type ExecutiveUnitsFilterProps = {
value: Hierarchy<ScopeElement, string>[]
Expand All @@ -26,6 +27,11 @@ const ExecutiveUnitsFilter = ({ name, value, sourceType, disabled = false }: Exe
sourceType={sourceType}
disabled={disabled}
onChange={(selectedPopulation) => setPopulation(selectedPopulation)}
label={
<Typography variant="h3" alignSelf="center">
Unité exécutrice
</Typography>
}
/>
)
}
Expand Down
17 changes: 14 additions & 3 deletions src/components/Hierarchy/CodesWithSystems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ type CodesWithSystemsProps<T> = {
disabled?: boolean
isExtended?: boolean
onDelete: (node: Hierarchy<T>) => void
inSelectedCodes?: boolean
}

const CodesWithSystems = <T,>({ codes, disabled = false, isExtended = true, onDelete }: CodesWithSystemsProps<T>) => {
const CodesWithSystems = <T,>({
codes,
disabled = false,
isExtended = true,
onDelete,
inSelectedCodes
}: CodesWithSystemsProps<T>) => {
const groupedBySystem = useMemo(() => groupBySystem(codes), [codes])

const ChipGroup = ({ codes }: { codes: Hierarchy<T>[] }) => (
Expand All @@ -21,7 +28,11 @@ const CodesWithSystems = <T,>({ codes, disabled = false, isExtended = true, onDe
disabled={disabled}
key={code.id}
label={getLabelFromCode(code)}
sx={{ marginBottom: '2px', marginRight: '2px', color: '#00000099' }}
sx={{
marginBottom: '2px',
marginRight: '2px',
backgroundColor: inSelectedCodes ? '#FFF' : undefined
}}
onDelete={() => onDelete(code)}
/>
))}
Expand All @@ -35,7 +46,7 @@ const CodesWithSystems = <T,>({ codes, disabled = false, isExtended = true, onDe
{groupedBySystem.map((group) => (
<Grid item xs={12}>

Check failure on line 47 in src/components/Hierarchy/CodesWithSystems.tsx

View workflow job for this annotation

GitHub Actions / test

Missing "key" prop for element in iterator
{isDisplayedWithSystem(group.system) && (
<Typography fontWeight="700" marginRight="5px">
<Typography fontWeight="700" marginRight="5px" padding={'8px 0'}>
{`${getLabelFromSystem(group.system)} (${group.codes.length})`}
</Typography>
)}
Expand Down
39 changes: 22 additions & 17 deletions src/components/Hierarchy/SelectedCodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@ const SelectedCodes = <T,>({ values, onDelete }: SelectedCodesProps<T>) => {

return (
<Grid container>
<Collapse in={openSelectedCodesDrawer}>
<Grid
item
container
xs={12}
justifyContent="space-between"
style={{ maxHeight: 200, overflowX: 'hidden', overflowY: 'auto', marginBottom: 20 }}
>
<CodesWithSystems codes={values} onDelete={onDelete} />
</Grid>
</Collapse>
<Grid item xs={12} container alignItems="center" justifyContent="space-between">
<Grid item xs={4} container>
<Typography textAlign="center" fontWeight={900} color="#0063AF">
{values.length} sélectionné(s)
</Typography>
</Grid>
{values.length > 0 && (
<Collapse in={openSelectedCodesDrawer} style={{ width: '100%' }}>
<Grid
item
container
xs={12}
justifyContent="space-between"
style={{
maxHeight: 200,
overflowX: 'hidden',
overflowY: 'auto',
marginBottom: 20
}}
>
<CodesWithSystems codes={values} onDelete={onDelete} inSelectedCodes />
</Grid>
</Collapse>
)}
<Grid item xs={12} container alignItems="center" justifyContent="space-between" height={24}>
<Typography textAlign="center" fontWeight={900} color="#0063AF">
{values.length} sélectionné(s)
</Typography>
<Grid item xs={1} container justifyContent="flex-end">
{values.length > 0 && (
<>
Expand Down
18 changes: 10 additions & 8 deletions src/components/Hierarchy/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ type CellWrapperProps = {

export const RowContainerWrapper = styled(Grid)<RowContainerProps>(({ color }) => ({
backgroundColor: color,
borderBottom: '1px solid rgba(224, 224, 224, 1)'
borderBottom: '1px solid rgba(224, 224, 224, 1)',
padding: '0 8px'
}))

export const RowWrapper = styled(Grid)<RowWrapperProps>(({ size = '50px' }) => ({
height: size,
padding: 0
height: size
}))

export const CellWrapper = styled(Grid)<CellWrapperProps>(({ cursor = false, color = '#4F4F4f', fontWeight = 600 }) => ({
color: color,
cursor: cursor ? 'pointer' : '',
fontWeight: fontWeight
}))
export const CellWrapper = styled(Grid)<CellWrapperProps>(
({ cursor = false, color = '#4F4F4f', fontWeight = 600 }) => ({
color: color,
cursor: cursor ? 'pointer' : '',
fontWeight: fontWeight
})
)
9 changes: 7 additions & 2 deletions src/components/ScopeTree/ScopeTreeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const ScopeTreeTable = ({
<TableContainer style={{ overflowX: 'hidden', background: 'white' }}>
<Table>
<TableHead>
<RowContainerWrapper alignItems="center" container color="#e1e1e1" height={'60px'}>
<RowContainerWrapper alignItems="center" container color={'#d1e2f4'} height={'60px'}>
<CellWrapper item xs={1}></CellWrapper>
<CellWrapper item xs={5} color="#0063AF">
Nom
Expand Down Expand Up @@ -205,7 +205,12 @@ const ScopeTreeTable = ({
</TableRow>
)}
{loading.search !== LoadingStatus.FETCHING && (
<div style={{ maxHeight: '65vh', overflow: 'auto' }}>
<div
style={{
maxHeight: mode === SearchMode.EXPLORATION ? '65vh' : '60vh',
overflow: 'auto'
}}
>
{hierarchy.tree.map((item) =>
item ? (
<ScopeTreeRow
Expand Down
85 changes: 46 additions & 39 deletions src/components/ScopeTree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ type ScopeTreeProps = {
selectedNodes: Hierarchy<ScopeElement, string>[]
sourceType: SourceType
onSelect: (selectedItems: Hierarchy<ScopeElement, string>[]) => void
isCareSiteView?: boolean
}

const ScopeTree = ({ baseTree, selectedNodes, sourceType, onSelect }: ScopeTreeProps) => {
const ScopeTree = ({ baseTree, selectedNodes, sourceType, onSelect, isCareSiteView = false }: ScopeTreeProps) => {
const {
hierarchyData: { hierarchy, loadingStatus, selectAllStatus, selectedCodes },
hierarchyActions: { expand, select, selectAll },
Expand All @@ -31,56 +32,62 @@ const ScopeTree = ({ baseTree, selectedNodes, sourceType, onSelect }: ScopeTreeP
}, [selectedCodes])

return (
<>
<Grid container direction="column" wrap="nowrap" height="100%" overflow="hidden">
<Grid container padding={'30px 20px'}>
<Grid item xs={12}>
<Paper sx={{ padding: '20px', backgroundColor: 'transparent' }}>
<SearchInput value={searchInput} placeholder={'Rechercher'} onchange={onChangeSearchInput} />
</Paper>
</Grid>
</Grid>
<Grid container direction="column" wrap="wrap" height="100%" overflow="auto" padding={'0px 20px'}>
<Grid
item
container
direction="column"
justifyContent="space-between"
wrap="nowrap"
height="100%"
style={{ overflow: 'hidden' }}
>
<Grid>
<ScopeTreeTable
loading={loadingStatus}
selectAllStatus={selectAllStatus}
sourceType={sourceType}
mode={mode}
hierarchy={hierarchy}
onExpand={expand}
onSelect={select}
onSelectAll={selectAll}
/>
</Grid>
</Grid>
<Grid
container
direction="column"
wrap="nowrap"
height={'calc(100% - 20px)'}
overflow="hidden"
justifyContent={'space-between'}
>
<Grid container padding={'24px 20px'}>
<SearchInput value={searchInput} placeholder={'Rechercher'} onchange={onChangeSearchInput} />
</Grid>
<Grid container direction="column" wrap="wrap" height="100vh" overflow="auto" padding={'0px 20px'}>
<Grid
item
container
direction="column"
justifyContent="space-between"
wrap="nowrap"
height="100%"
style={{ overflow: 'hidden' }}
>
<ScopeTreeTable
loading={loadingStatus}
selectAllStatus={selectAllStatus}
sourceType={sourceType}
mode={mode}
hierarchy={hierarchy}
onExpand={expand}
onSelect={select}
onSelectAll={selectAll}
/>
</Grid>
</Grid>
<div>
<Grid container direction={'column'} style={{ backgroundColor: 'transparent' }}>
{loadingStatus.search === LoadingStatus.SUCCESS && hierarchy.count / LIMIT_PER_PAGE > 1 && (
<Paper sx={{ padding: '20px 0px' }}>
<Grid container justifyContent={'center'}>
<Pagination
count={Math.ceil(hierarchy.count / LIMIT_PER_PAGE)}
currentPage={hierarchy.page}
onPageChange={onChangePage}
color="#0063AF"
centered
/>
</Paper>
</Grid>
)}
<Paper sx={{ padding: '20px 30px', backgroundColor: '#D1E2F4' }}>
<Paper
elevation={isCareSiteView ? 0 : undefined}
sx={{
padding: '10px 30px',
backgroundColor: isCareSiteView ? '#E6F1FD' : '#D1E2F4'
}}
>
<SelectedCodes values={selectedCodes} onDelete={(code) => select(code, false)} />
</Paper>
</div>
</>
</Grid>
</Grid>
)
}

Expand Down
Loading

0 comments on commit c5fb815

Please sign in to comment.