Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) fix failing procedure form and update peer dependency #56

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"dependencies": {
"@carbon/react": "^1.33.1",
"@hookform/resolvers": "^3.3.4",
"@openmrs/esm-patient-common-lib": "^8.0.1",
"fuzzy": "^0.1.3",
"lodash-es": "^4.17.21",
"react-hook-form": "^7.51.1",
Expand All @@ -57,6 +56,7 @@
},
"peerDependencies": {
"@openmrs/esm-framework": "*",
"@openmrs/esm-patient-common-lib": "8.x",
"dayjs": "1.x",
"react": "18.x",
"react-i18next": "11.x",
Expand Down
21 changes: 14 additions & 7 deletions src/form/post-procedures/post-procedure-form.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import { type ConfigObject, StringPath } from "../../config-schema";
import { updateOrder } from "../../procedures-ordered/pick-procedure-order/add-to-worklist-dialog.resource";
import { mutate } from "swr";
import { closeWorkspace } from "@openmrs/esm-patient-common-lib";

Check warning on line 40 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

'closeWorkspace' is defined but never used

const validationSchema = z.object({
startDatetime: z.date({ required_error: "Start datetime is required" }),
Expand Down Expand Up @@ -66,8 +67,8 @@
const { providerSearchResults, isProviderSearching } = useProvidersSearch(
debouncedProviderSearchTerm
);
const [selectedProvider, setSelectedProvider] = useState<CodedProvider>(null);

Check warning on line 70 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

'selectedProvider' is assigned a value but never used
const handleProviderSearchTermChange = (

Check warning on line 71 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

'handleProviderSearchTermChange' is assigned a value but never used
event: React.ChangeEvent<HTMLInputElement>
) => setProviderSearchTerm(event.target.value);

Expand All @@ -75,7 +76,7 @@
const debouncedSearchTerm = useDebounce(searchTerm);
const { searchResults, isSearching } =
useConditionsSearch(debouncedSearchTerm);
const [selectedCondition, setSelectedCondition] =

Check warning on line 79 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

'selectedCondition' is assigned a value but never used
useState<CodedCondition>(null);

const handleParticipantSearchInputChange = (event) => {
Expand Down Expand Up @@ -130,7 +131,7 @@
resolver: zodResolver(validationSchema),
});

const handleProviderChange = useCallback(

Check warning on line 134 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

'handleProviderChange' is assigned a value but never used
(selectedProvider: CodedProvider) => {
setSelectedProvider(selectedProvider);
},
Expand Down Expand Up @@ -238,7 +239,7 @@
}
};

const onError = (error: any) => {

Check warning on line 242 in src/form/post-procedures/post-procedure-form.component.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
console.error(error);
};

Expand All @@ -260,9 +261,12 @@
value={value}
id="startDatetime"
labelText={t("startDatetime", "Start Datetime")}
onChange={onChange}
invalid={!!errors.startDatetime}
invalidText={errors.startDatetime?.message}
onChange={(calendar) =>
onChange(
new Date(calendar.year, calendar.month, calendar.day, 0, 0)
)
}
isInvalid={!!errors.startDatetime}
/>
)}
/>
Expand All @@ -276,9 +280,12 @@
value={value}
id="endDatetime"
labelText={t("endDatetime", "End Datetime")}
onChange={onChange}
invalid={!!errors.endDatetime}
invalidText={errors.endDatetime?.message}
onChange={(calendar) =>
onChange(
new Date(calendar.year, calendar.month, calendar.day, 0, 0)
)
}
isInvalid={!!errors.endDatetime}
/>
)}
/>
Expand Down Expand Up @@ -500,7 +507,7 @@
</Layer>
</Stack>
<ButtonSet className={styles.buttonSetContainer}>
<Button size="lg" kind="secondary">
<Button onClick={() => closeOverlay()} size="lg" kind="secondary">
{t("discard", "Discard")}
</Button>
<Button type="submit" size="lg" kind="primary">
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4945,6 +4945,7 @@ __metadata:
zod: ^3.22.4
peerDependencies:
"@openmrs/esm-framework": "*"
"@openmrs/esm-patient-common-lib": 8.x
dayjs: 1.x
react: 18.x
react-i18next: 11.x
Expand Down
Loading