Skip to content

Commit

Permalink
ref: 2490-refacto filters - Ref gestion-de-projet#2371
Browse files Browse the repository at this point in the history
refacto filter components

remove wrong config file
  • Loading branch information
aetchego committed Dec 10, 2024
1 parent 10a68cd commit 3de84b2
Show file tree
Hide file tree
Showing 47 changed files with 628 additions and 909 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const EpisodeConstraints: React.FC<EpisodeConstraintsProps> = ({ constraints, on
</Grid>
<RadioGroup
row
selectedValue={radioValues}
onchange={(e) => {
value={radioValues}
onChange={(e) => {
if (
radioValues === TemporalConstraintsKind.PARTIAL_EPISODE_CONSTRAINT &&
constraints.find(
Expand All @@ -101,7 +101,7 @@ const EpisodeConstraints: React.FC<EpisodeConstraintsProps> = ({ constraints, on
onChangeValue(e as TemporalConstraintsKind)
}
}}
items={episodesTemporalConstraintsTypes}
options={episodesTemporalConstraintsTypes}
style={{ margin: '1em', justifyContent: 'space-around' }}
/>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ const StayConstraints: React.FC<StayConstraintsProps> = ({ constraints, onChange
<Typography variant="h3">Contraintes sur les séjours</Typography>
<RadioGroup
row
selectedValue={radioValues}
onchange={(e) => {
value={radioValues}
onChange={(e) => {
if (
radioValues === TemporalConstraintsKind.PARTIAL_CONSTRAINT &&
constraints.find((constraint) => constraint.constraintType === TemporalConstraintsKind.SAME_ENCOUNTER)
Expand All @@ -91,7 +91,7 @@ const StayConstraints: React.FC<StayConstraintsProps> = ({ constraints, onChange
onChangeValue(e as TemporalConstraintsKind)
}
}}
items={temporalConstraintsTypes}
options={temporalConstraintsTypes}
style={{ margin: '1em', justifyContent: 'space-around' }}
/>
</Grid>
Expand Down
38 changes: 26 additions & 12 deletions src/components/Dashboard/BiologyList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import { BlockWrapper } from 'components/ui/Layout'
import Button from 'components/ui/Button'
import DatesRangeFilter from 'components/Filters/DatesRangeFilter'
import DisplayDigits from 'components/ui/Display/DisplayDigits'
import EncounterStatusFilter from 'components/Filters/EncounterStatusFilter'
import ExecutiveUnitsFilter from 'components/Filters/ExecutiveUnitsFilter'
import IppFilter from 'components/Filters/IppFilter'
import List from 'components/ui/List'
import Modal from 'components/ui/Modal'
import NdaFilter from 'components/Filters/NdaFilter'
import SearchInput from 'components/ui/Searchbar/SearchInput'
import TextInput from 'components/Filters/TextInput'

Expand All @@ -37,6 +34,7 @@ import {
fetchAnabioCodes as fetchAnabioCodesApi
} from 'services/aphp/serviceBiology'
import { checkIfPageAvailable, cleanSearchParams, handlePageError } from 'utils/paginationUtils'
import MultiSelectInput from 'components/Filters/MultiSelectInput'

type BiologyListProps = {
deidentified?: boolean
Expand Down Expand Up @@ -82,6 +80,7 @@ const BiologyList = ({ deidentified }: BiologyListProps) => {
},
{ changeOrderBy, changeSearchInput, addFilters, removeFilter, addSearchCriterias }
] = useSearchCriterias(initBioSearchCriterias)
console.log("test filters", filters)

Check failure on line 83 in src/components/Dashboard/BiologyList/index.tsx

View workflow job for this annotation

GitHub Actions / test

Replace `"test·filters"` with `'test·filters'`
const filtersAsArray = useMemo(
() =>
selectFiltersAsArray({
Expand Down Expand Up @@ -317,8 +316,17 @@ const BiologyList = ({ deidentified }: BiologyListProps) => {
onClose={() => setToggleFilterByModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
{!deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
{!deidentified && <IppFilter name={FilterKeys.IPP} value={ipp ?? ''} />}
{!deidentified && (
<TextInput name={FilterKeys.NDA} value={nda} label="NDA :" placeholder="Exemple: 6601289264,141740347" />
)}
{!deidentified && (
<TextInput
name={FilterKeys.IPP}
value={ipp}
label="IPP :"
placeholder="'Exemple: 8000000000001,8000000000002'"
/>
)}
<AnabioFilter name={FilterKeys.ANABIO} value={anabio} onFetch={fetchAnabioCodesApi} />
<LoincFilter name={FilterKeys.LOINC} value={loinc} onFetch={fetchLoincCodesApi} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
Expand All @@ -327,10 +335,11 @@ const BiologyList = ({ deidentified }: BiologyListProps) => {
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
/>
<EncounterStatusFilter
<MultiSelectInput
value={encounterStatus}
name={FilterKeys.ENCOUNTER_STATUS}
encounterStatusList={encounterStatusList}
options={encounterStatusList}
label="Statut de la visite associée :"
/>
</Modal>
<Modal
Expand Down Expand Up @@ -428,19 +437,23 @@ const BiologyList = ({ deidentified }: BiologyListProps) => {
</Grid>
{!deidentified && (
<Grid item xs={12}>
<NdaFilter
<TextInput
name="nda"
disabled={isReadonlyFilterInfoModal}
value={selectedSavedFilter?.filterParams.filters.nda ?? ''}
value={selectedSavedFilter?.filterParams.filters.nda || ''}
label="NDA :"
placeholder="Exemple: 6601289264,141740347"
/>
</Grid>
)}
{!deidentified && (
<Grid item xs={12}>
<IppFilter
<TextInput
disabled={isReadonlyFilterInfoModal}
name={FilterKeys.IPP}
value={selectedSavedFilter?.filterParams.filters.ipp ?? ''}
label="IPP :"
placeholder="'Exemple: 8000000000001,8000000000002'"
/>
</Grid>
)}
Expand Down Expand Up @@ -479,11 +492,12 @@ const BiologyList = ({ deidentified }: BiologyListProps) => {
/>
</Grid>
<Grid item xs={12}>
<EncounterStatusFilter
<MultiSelectInput
disabled={isReadonlyFilterInfoModal}
value={selectedSavedFilter?.filterParams.filters.encounterStatus || []}
name={FilterKeys.ENCOUNTER_STATUS}
encounterStatusList={encounterStatusList}
options={encounterStatusList}
label="Statut de la visite associée :"
/>
</Grid>
</Grid>
Expand Down
55 changes: 38 additions & 17 deletions src/components/Dashboard/Documents/Documents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,21 @@ import useSearchCriterias, { initAllDocsSearchCriterias } from 'reducers/searchC
import { AlertWrapper } from 'components/ui/Alert'
import DatesRangeFilter from 'components/Filters/DatesRangeFilter'
import DocTypesFilter from 'components/Filters/DocTypesFilter'
import DocStatusFilter from 'components/Filters/DocStatusFilter'
import ExecutiveUnitsFilter from 'components/Filters/ExecutiveUnitsFilter'
import IppFilter from 'components/Filters/IppFilter'
import NdaFilter from 'components/Filters/NdaFilter'
import { ResourceType } from 'types/requestCriterias'
import { Save, SavedSearch } from '@mui/icons-material'
import TextInput from 'components/Filters/TextInput'
import { useSavedFilters } from 'hooks/filters/useSavedFilters'
import List from 'components/ui/List'
import { useAppDispatch, useAppSelector } from 'state'
import Modal from 'components/ui/Modal'
import EncounterStatusFilter from 'components/Filters/EncounterStatusFilter'
import { SourceType } from 'types/scope'
import { Hierarchy } from 'types/hierarchy'
import { useSearchParams } from 'react-router-dom'
import { checkIfPageAvailable, cleanSearchParams, handlePageError } from 'utils/paginationUtils'
import { CanceledError } from 'axios'
import { DocumentReference } from 'fhir/r4'
import MultiSelectInput from 'components/Filters/MultiSelectInput'

type DocumentsProps = {
deidentified: boolean
Expand Down Expand Up @@ -129,7 +126,10 @@ const Documents: React.FC<DocumentsProps> = ({ deidentified }) => {
const controllerRef = useRef<AbortController>(new AbortController())
const isFirstRender = useRef(true)

const docStatusesList = [FilterByDocumentStatus.VALIDATED, FilterByDocumentStatus.NOT_VALIDATED]
const docStatusesList = [
{ id: FilterByDocumentStatus.VALIDATED, label: FilterByDocumentStatus.VALIDATED },
{ id: FilterByDocumentStatus.NOT_VALIDATED, label: FilterByDocumentStatus.NOT_VALIDATED }
]

const fetchDocumentsList = async () => {
try {
Expand Down Expand Up @@ -382,20 +382,35 @@ const Documents: React.FC<DocumentsProps> = ({ deidentified }) => {
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
color="secondary"
>
{!deidentified && <NdaFilter name={FilterKeys.NDA} value={nda} />}
{!deidentified && <IppFilter name={FilterKeys.IPP} value={ipp || ''} />}
<DocStatusFilter docStatusesList={docStatusesList} name={FilterKeys.DOC_STATUSES} value={docStatuses} />
{!deidentified && (
<TextInput name={FilterKeys.NDA} value={nda} label="NDA :" placeholder="Exemple: 6601289264,141740347" />
)}
{!deidentified && (
<TextInput
name={FilterKeys.IPP}
value={ipp}
label="IPP :"
placeholder="'Exemple: 8000000000001,8000000000002'"
/>
)}
<MultiSelectInput
options={docStatusesList}
name={FilterKeys.DOC_STATUSES}
value={docStatuses}
label="Statut de documents :"
/>
<DocTypesFilter allDocTypesList={allDocTypesList.docTypes} value={docTypes} name={FilterKeys.DOC_TYPES} />
<DatesRangeFilter values={[startDate, endDate]} names={[FilterKeys.START_DATE, FilterKeys.END_DATE]} />
<ExecutiveUnitsFilter
sourceType={SourceType.DOCUMENT}
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
/>
<EncounterStatusFilter
<MultiSelectInput
value={encounterStatus}
name={FilterKeys.ENCOUNTER_STATUS}
encounterStatusList={encounterStatusList}
options={encounterStatusList}
label="Statut de la visite associée :"
/>
</Modal>
<Modal
Expand Down Expand Up @@ -505,28 +520,33 @@ const Documents: React.FC<DocumentsProps> = ({ deidentified }) => {

<Grid item>
{!deidentified && (
<NdaFilter
<TextInput
name="nda"
disabled={isReadonlyFilterInfoModal}
name={FilterKeys.NDA}
value={selectedSavedFilter?.filterParams.filters.nda || ''}
label="NDA :"
placeholder="Exemple: 6601289264,141740347"
/>
)}
</Grid>
<Grid item>
{!deidentified && (
<IppFilter
<TextInput
disabled={isReadonlyFilterInfoModal}
name={FilterKeys.IPP}
value={selectedSavedFilter?.filterParams.filters.ipp || ''}
label="IPP :"
placeholder="'Exemple: 8000000000001,8000000000002'"
/>
)}
</Grid>
<Grid item>
<DocStatusFilter
<MultiSelectInput
disabled={isReadonlyFilterInfoModal}
docStatusesList={docStatusesList}
options={docStatusesList}
value={selectedSavedFilter?.filterParams.filters.docStatuses || []}
name={FilterKeys.DOC_STATUSES}
label="Statut de documents :"
/>
</Grid>
<Grid item>
Expand Down Expand Up @@ -556,11 +576,12 @@ const Documents: React.FC<DocumentsProps> = ({ deidentified }) => {
/>
</Grid>
<Grid item>
<EncounterStatusFilter
<MultiSelectInput
label="Statut de la visite associée :"
disabled={isReadonlyFilterInfoModal}
value={selectedSavedFilter?.filterParams.filters.encounterStatus || []}
name={FilterKeys.ENCOUNTER_STATUS}
encounterStatusList={encounterStatusList}
options={encounterStatusList}
/>
</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/ExportModal/exportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ const fetchDocumentsCount = async (cohortId: string, documentsFilters?: SearchCr
size: 0,
_list: [cohortId],
searchBy: documentsFilters.searchBy,
docStatuses: docStatuses,
docStatuses: docStatuses.map((obj) => obj.id),
_text: documentsFilters.searchInput,
type: docTypes.map((docType) => docType.code).join(),
'encounter-identifier': nda,
Expand Down
16 changes: 11 additions & 5 deletions src/components/Dashboard/FormsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { CircularProgress, Grid, useMediaQuery, useTheme } from '@mui/material'
import { FilterList } from '@mui/icons-material'
import Button from 'components/ui/Button'
import DisplayDigits from 'components/ui/Display/DisplayDigits'
import EncounterStatusFilter from 'components/Filters/EncounterStatusFilter'
import ExecutiveUnitsFilter from 'components/Filters/ExecutiveUnitsFilter'
import IppFilter from 'components/Filters/IppFilter'
import Modal from 'components/ui/Modal'
import { Hierarchy } from 'types/hierarchy'
import { DTTB_ResultsType as ResultsType, LoadingStatus } from 'types'
Expand All @@ -24,6 +22,8 @@ import DataTableForms from 'components/DataTable/DataTableForms'
import { useSearchParams } from 'react-router-dom'
import { checkIfPageAvailable, cleanSearchParams, handlePageError } from 'utils/paginationUtils'
import Chip from 'components/ui/Chip'
import TextInput from 'components/Filters/TextInput'
import MultiSelectInput from 'components/Filters/MultiSelectInput'

const FormsList = () => {
const theme = useTheme()
Expand Down Expand Up @@ -206,17 +206,23 @@ const FormsList = () => {
onClose={() => setToggleFilterByModal(false)}
onSubmit={(newFilters) => addFilters({ ...filters, ...newFilters })}
>
<IppFilter name={FilterKeys.IPP} value={ipp ?? ''} />
<TextInput
name={FilterKeys.IPP}
value={ipp}
label="IPP :"
placeholder="'Exemple: 8000000000001,8000000000002'"
/>
<MaternityFormFilter name={FilterKeys.FORM_NAME} value={formName} />
<ExecutiveUnitsFilter
sourceType={SourceType.FORM_RESPONSE}
value={executiveUnits}
name={FilterKeys.EXECUTIVE_UNITS}
/>
<EncounterStatusFilter
<MultiSelectInput
label="Statut de la visite associée :"
value={encounterStatus}
name={FilterKeys.ENCOUNTER_STATUS}
encounterStatusList={encounterStatusList}
options={encounterStatusList}
/>
</Modal>
</Grid>
Expand Down
Loading

0 comments on commit 3de84b2

Please sign in to comment.