Skip to content

Commit

Permalink
Hydrate pass config form with existing data (#1824)
Browse files Browse the repository at this point in the history
* init (#1747)

* Cnft2 2763 data elements table setup (#1754)

* styling (#1762)

* Empty layouts for dedup (#1767)

* init

* remaining styling

* fix conflicts

* adds mock configuration list and functionality (#1771)

* Data Elements Table rows (#1776)

* CNFT2-2767 Error tooltips (#1786)

* Pass config init layout (#1784)

* [FIX] Patient sorting (#1766)

* local environment

* adds support for legalname sorting

* Clear county when state value is cleared. Hook error fix (#1756)

* Clear county when state value is cleared. Hook error fix

* Make better

---------

Co-authored-by: Michael Peels <michaelpeels@Michael-Peels.local>

* [CNFT1-2939] List view sort options (#1769)

* sorting preferences

* saving list sorting

* passing down size prop (#1773)

* init

* fix linting

---------

Co-authored-by: Adam Loup <124325935+adamloup-enquizit@users.noreply.github.com>
Co-authored-by: Michael Peels <109251240+mpeels@users.noreply.github.com>
Co-authored-by: Michael Peels <michaelpeels@Michael-Peels.local>
Co-authored-by: Henry Clark <111446161+hclarkEnq@users.noreply.github.com>

* CNFT2-2768 Data Elements submit, redirect, context updates (#1791)

* CNFT2-2769 Patient Match refactor (#1802)

* Store data elements locally (#1805)

* init

* fix merge

* more unexplainable conflicts

* init (#1806)

* CNFT2-2770 Blocking Criteria modal, Form setup (#1808)

* CNFT2-2771 Blocking criteria rows (#1810)

* Move types (#1812)

* init

* add pass config type

* Configure pass config fetch (#1815)

* init

* add saving

* CNFT2-2772 Matching Criteria section (#1819)

* Config load bug (#1821)

* init

* remove log

* init

---------

Co-authored-by: John Lee <124739504+jlee-enquizit@users.noreply.github.com>
Co-authored-by: Adam Loup <124325935+adamloup-enquizit@users.noreply.github.com>
Co-authored-by: Michael Peels <109251240+mpeels@users.noreply.github.com>
Co-authored-by: Michael Peels <michaelpeels@Michael-Peels.local>
Co-authored-by: Henry Clark <111446161+hclarkEnq@users.noreply.github.com>
  • Loading branch information
6 people authored Sep 17, 2024
1 parent 4c96495 commit b0d5cb3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DataElementsConfiguration from '../DataElementsConfiguration/DataElements
import { useDedupeContext } from '../context/DedupeContext';
import { useDataElementsContext } from '../context/DataElementsContext';
import NoDataElements from './NoDataElementsContent';
import PassConfiguration from './PatientMatchConfigurationPage/PatientMatchConfigurationPage';
import PassConfigurationPage from './PatientMatchConfigurationPage/PatientMatchConfigurationPage';

const PatientMatchConfiguration = () => {
const { mode, setMode } = useDedupeContext();
Expand All @@ -27,7 +27,11 @@ const PatientMatchConfiguration = () => {
</Button>
</div>
<div className={styles.body}>
{!dataElements ? <NoDataElements onConfigClick={handleSetDataMode} /> : <PassConfiguration />}
{!dataElements ? (
<NoDataElements onConfigClick={handleSetDataMode} />
) : (
<PassConfigurationPage />
)}
</div>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const PatientMatchConfigurationPage = () => {
const [configurations, setConfigurations] = useState<PassConfiguration[]>([]);
const [selectedConfigurationIndex, setSelectedConfigurationIndex] = useState<number | null>(null);
const [isEditingConfiguration, setIsEditingConfiguration] = useState<boolean>(false);
const { setBlockingCriteria } = usePatientMatchContext();
const { setBlockingCriteria, setMatchingCriteria } = usePatientMatchContext();

const handleAddConfiguration = () => {
const configs = [...configurations];
configs.push({
name: `New configuration (${configurations.length})`,
description: 'a description will go here',
active: false,
active: true,
blockingCriteria: [],
matchingCriteria: []
});
Expand All @@ -38,6 +38,12 @@ const PatientMatchConfigurationPage = () => {
} else {
setBlockingCriteria([]);
}

if (selectedConfig.matchingCriteria?.length) {
setMatchingCriteria(selectedConfig.matchingCriteria);
} else {
setMatchingCriteria([]);
}
};

const showConfiguration = isEditingConfiguration && configurations.length && selectedConfigurationIndex !== null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { useForm, FormProvider, Controller } from 'react-hook-form';
import { Toggle } from 'design-system/toggle/Toggle';
import { Button } from 'components/button';
import { PassConfiguration } from 'apps/dedup-config/types';
import { usePatientMatchContext } from 'apps/dedup-config/context/PatientMatchContext';

type Props = {
passConfiguration: PassConfiguration;
};

const PatientMatchForm = ({ passConfiguration }: Props) => {
const { blockingCriteria, matchingCriteria } = usePatientMatchContext();
const patientMatchForm = useForm({
mode: 'onBlur',
defaultValues: {
Expand All @@ -20,7 +22,10 @@ const PatientMatchForm = ({ passConfiguration }: Props) => {
});

const saveConfiguration = () => {
localStorage.setItem('passConfigurations', JSON.stringify(patientMatchForm.getValues()));
const formValues = patientMatchForm.getValues();
const formValuesString = JSON.stringify([{ ...formValues, blockingCriteria, matchingCriteria }]);

localStorage.setItem('passConfigurations', formValuesString);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

.configurationDetails {
width: calc( 100% - 19.75rem );
width: calc(100% - 19.75rem);
padding-top: 1rem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
margin-bottom: 1rem;
border: 1px solid colors.$base-lighter;
border-radius: 0.3125rem;

.criteriaHeadingContainer {
position: relative;
padding: 1rem 1.5rem;
Expand Down Expand Up @@ -47,26 +47,26 @@
}
}
}

.criteriaContentContainer {
padding: 0 1rem 0 1rem;
button {
padding-left: 0;
text-decoration: none;
padding: 1rem 0;
&:disabled {
&:disabled {
background-color: unset !important;
color: colors.$disabled;
border: none;
}
}

.criteriaRequest {
border-bottom: 1px solid colors.$base-lighter;
padding: 1rem 0;
margin: 0;
}

.progressBar {
width: 100%;
}
Expand All @@ -91,14 +91,15 @@
}
}
}

&.disabled {
background-color: colors.$disabled-lighter;
color: colors.$base-darkest;
border-color: colors.$base-light;
.criteriaHeadingContainer {
border-color: colors.$base-light;
h4, p {
h4,
p {
color: colors.$disabled-darkest;
}
.labels {
Expand All @@ -114,7 +115,7 @@
border-color: colors.$base-light;
}
button {
color: colors.$disabled-darkest !important
color: colors.$disabled-darkest !important;
}
}
}
Expand All @@ -136,7 +137,7 @@
@extend %thin-top;
position: fixed;
background-color: colors.$base-white;
width: calc( 100% - 18.75rem );
width: calc(100% - 18.75rem);
bottom: 0;
margin-left: -1rem;
.saveButton {
Expand All @@ -145,4 +146,4 @@
justify-content: flex-end;
}
}
}
}

0 comments on commit b0d5cb3

Please sign in to comment.