Skip to content

Commit

Permalink
Add support for re-populating "deletions"
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Jun 14, 2024
1 parent 6b24e48 commit 7f0e247
Show file tree
Hide file tree
Showing 18 changed files with 7,079 additions and 1,556 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import cloneDeep from 'lodash.clonedeep';

interface RepopulateGridGroupProps {
qItem: QuestionnaireItem;
newQRItem: QuestionnaireResponseItem;
newQRItem?: QuestionnaireResponseItem;
oldQRItem?: QuestionnaireResponseItem;
}

Expand All @@ -34,7 +34,8 @@ function RepopulateGridGroup(props: RepopulateGridGroupProps) {
oldQRItem ??
cloneDeep({
...newQRItem,
item: newQRItem.item?.map((item) => ({
linkId: newQRItem?.linkId ?? '',
item: newQRItem?.item?.map((item) => ({
...item,
item: item.item?.map((subItem) => ({
...subItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { GroupTable } from '@aehrc/smart-forms-renderer';

interface RepopulateRepeatGroupProps {
qItem: QuestionnaireItem;
newQRItems: QuestionnaireResponseItem[];
newQRItems?: QuestionnaireResponseItem[];
oldQRItems?: QuestionnaireResponseItem[];
}

Expand Down Expand Up @@ -49,7 +49,7 @@ function RepopulateGroupTable(props: RepopulateRepeatGroupProps) {
</Typography>
<GroupTable
qItem={qItem}
qrItems={newQRItems}
qrItems={newQRItems ?? []}
groupCardElevation={1}
showMinimalView={true}
parentIsReadOnly={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import RepopulateGridGroup from './RepopulateGridGroup.tsx';

interface RepopulateItemSwitcherProps {
qItem: QuestionnaireItem;
newQRItem: QuestionnaireResponseItem;
newQRItem?: QuestionnaireResponseItem;
oldQRItem?: QuestionnaireResponseItem;
newQRItems: QuestionnaireResponseItem[];
newQRItems?: QuestionnaireResponseItem[];
oldQRItems?: QuestionnaireResponseItem[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import RepopulateItemSwitcher from './RepopulateItemSwitcher.tsx';
interface RepopulateListItemProps {
checkedIds: string[];
qItem: QuestionnaireItem;
newQRItem: QuestionnaireResponseItem;
newQRItem?: QuestionnaireResponseItem;
oldQRItem?: QuestionnaireResponseItem;
newQRItems: QuestionnaireResponseItem[];
newQRItems?: QuestionnaireResponseItem[];
oldQRItems?: QuestionnaireResponseItem[];
onCheckItem: () => void;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { RepeatGroup } from '@aehrc/smart-forms-renderer';

interface RepopulateRepeatGroupProps {
qItem: QuestionnaireItem;
newQRItems: QuestionnaireResponseItem[];
newQRItems?: QuestionnaireResponseItem[];
oldQRItems?: QuestionnaireResponseItem[];
}

Expand Down Expand Up @@ -49,7 +49,7 @@ function RepopulateRepeatGroup(props: RepopulateRepeatGroupProps) {
</Typography>
<RepeatGroup
qItem={qItem}
qrItems={newQRItems}
qrItems={newQRItems ?? []}
groupCardElevation={1}
showMinimalView={true}
parentIsReadOnly={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { RepeatItem } from '@aehrc/smart-forms-renderer';
interface RepopulateRepeatItemProps {
qItem: QuestionnaireItem;
oldQRItem?: QuestionnaireResponseItem;
newQRItem: QuestionnaireResponseItem;
newQRItem?: QuestionnaireResponseItem;
}

function RepopulateRepeatItem(props: RepopulateRepeatItemProps) {
Expand Down Expand Up @@ -53,7 +53,7 @@ function RepopulateRepeatItem(props: RepopulateRepeatItemProps) {
</Typography>
<RepeatItem
qItem={qItem}
qrItem={newQRItem}
qrItem={newQRItem ?? null}
groupCardElevation={1}
showMinimalView={true}
onQrItemChange={() => void 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
interface RepopulateSingleItemProps {
qItem: QuestionnaireItem;
oldQRItem?: QuestionnaireResponseItem;
newQRItem: QuestionnaireResponseItem;
newQRItem?: QuestionnaireResponseItem;
}

function RepopulateSingleItem(props: RepopulateSingleItemProps) {
Expand Down Expand Up @@ -58,7 +58,7 @@ function RepopulateSingleItem(props: RepopulateSingleItemProps) {
</Typography>
<SingleItem
qItem={qItem}
qrItem={newQRItem}
qrItem={newQRItem ?? null}
isRepeated={true}
isTabled={false}
groupCardElevation={1}
Expand Down
Loading

0 comments on commit 7f0e247

Please sign in to comment.