Skip to content

Commit

Permalink
Self review
Browse files Browse the repository at this point in the history
  • Loading branch information
gigxz committed Dec 24, 2024
1 parent 1508583 commit d06ff7b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
56 changes: 27 additions & 29 deletions src/modules/form/components/DynamicFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import DynamicField from './DynamicField';
import DynamicGroup from './DynamicGroup';

import SentryErrorBoundary from '@/modules/errors/components/SentryErrorBoundary';
import DynamicViewField from '@/modules/form/components/viewable/DynamicViewField';
import {
DisabledDisplay,
Expand Down Expand Up @@ -146,34 +145,33 @@ const DynamicFormFields: React.FC<Props> = ({
/>
</Grid>
) : (
<SentryErrorBoundary key={item.linkId}>
<DynamicField
key={item.linkId}
item={item}
itemChanged={itemChanged}
value={
isDisabled &&
item.disabledDisplay !== DisabledDisplay.ProtectedWithValue
? undefined
: values[item.linkId]
}
errors={getFieldErrors(item)}
horizontal={horizontal}
pickListArgs={pickListArgs}
warnIfEmpty={warnIfEmpty}
localConstants={localConstants}
{...props}
inputProps={{
...props?.inputProps,
...buildCommonInputProps({
item,
values,
localConstants: localConstants || {},
}),
disabled: isDisabled || locked || undefined,
}}
/>
</SentryErrorBoundary>
<DynamicField
key={item.linkId}
item={item}
itemChanged={itemChanged}
value={
isDisabled &&
item.disabledDisplay !== DisabledDisplay.ProtectedWithValue
? undefined
: values[item.linkId]
}
errors={getFieldErrors(item)}
horizontal={horizontal}
pickListArgs={pickListArgs}
warnIfEmpty={warnIfEmpty}
// Needed to support referencing local constants in expression evaluation (DynamicDisplay)
localConstants={localConstants}
{...props}
inputProps={{
...props?.inputProps,
...buildCommonInputProps({
item,
values,
localConstants: localConstants || {},
}),
disabled: isDisabled || locked || undefined,
}}
/>
);
if (renderFn) {
return renderFn(itemComponent);
Expand Down
4 changes: 3 additions & 1 deletion src/modules/form/util/formUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,8 @@ export const parseOccurrencePointFormDefinition = (
user?: HmisUser
) => {
let displayTitle = definition.title;

// Whether this form as any fields that are editable to the current user
let isEditable = false;

function matchesTitle(item: FormItem, title: string) {
Expand All @@ -1505,7 +1507,7 @@ export const parseOccurrencePointFormDefinition = (
);
}

// Modify form definition into a "read only definition" by removing
// Created modified "definition for display" that will be used to render values in a DynamicView inside the Enrollment/Client details card
const definitionForDisplay = modifyFormDefinition(
definition.definition,
(item) => {
Expand Down

0 comments on commit d06ff7b

Please sign in to comment.