Skip to content

Commit

Permalink
change wording from disable to allow
Browse files Browse the repository at this point in the history
  • Loading branch information
kajambiya committed Oct 29, 2024
1 parent 32486f2 commit e1aa33b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/esm-patient-registration-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface FieldDefinition {
label?: string;
uuid: string;
placeholder?: string;
disableFutureDates?: boolean;
disablePastDates?: boolean;
allowFutureDates?: boolean;
allowPastDates?: boolean;
showHeading: boolean;
validation?: {
required: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export function ObsField({ fieldDefinition }: ObsFieldProps) {
concept={concept}
label={fieldDefinition.label}
required={fieldDefinition.validation.required}
disablePastDates={fieldDefinition.disablePastDates}
disableFutureDates={fieldDefinition.disableFutureDates}
allowPastDates={fieldDefinition.allowPastDates}
allowFutureDates={fieldDefinition.allowFutureDates}
/>
);
case 'Coded':
Expand Down Expand Up @@ -159,14 +159,16 @@ interface DateObsFieldProps {
concept: ConceptResponse;
label: string;
required?: boolean;
disablePastDates?: boolean;
disableFutureDates?: boolean;
allowPastDates?: boolean;
allowFutureDates?: boolean;
}

function DateObsField({ concept, label, required, disablePastDates, disableFutureDates }: DateObsFieldProps) {
function DateObsField({ concept, label, required, allowPastDates, allowFutureDates }: DateObsFieldProps) {
const { t } = useTranslation();
const fieldName = `obs.${concept.uuid}`;
const { setFieldValue } = useContext(PatientRegistrationContext);
const futureDatesAllowed = allowFutureDates ?? true;
const pastDatesAllowed = allowPastDates ?? true;

const onDateChange = (date: Date) => {
setFieldValue(fieldName, date);
Expand All @@ -188,8 +190,8 @@ function DateObsField({ concept, label, required, disablePastDates, disableFutur
isInvalid={errors[fieldName] && touched[fieldName]}
invalidText={t(meta.error)}
value={field.value}
minDate={disablePastDates ? new Date() : undefined}
maxDate={disableFutureDates ? new Date() : undefined}
minDate={!pastDatesAllowed ? new Date() : undefined}
maxDate={!futureDatesAllowed ? new Date() : undefined}
/>
</>
);
Expand Down

0 comments on commit e1aa33b

Please sign in to comment.