Skip to content
Closed
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
84 changes: 42 additions & 42 deletions src/components/Encounter/CreateEncounterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default function CreateEncounterForm({
</Button>
)}
</SheetTrigger>
<SheetContent className="overflow-y-auto">
<SheetContent className="overflow-y-auto min-w-lg">
<SheetHeader>
<SheetTitle>{t("initiate_encounter")}</SheetTitle>
<SheetDescription>
Expand All @@ -179,7 +179,27 @@ export default function CreateEncounterForm({
onSubmit={form.handleSubmit(onSubmit)}
className="mt-4 space-y-2"
>
<div className="space-y-5">
<div className="space-y-6">
<FormField
control={form.control}
name="organizations"
render={({ field }) => (
<FormItem>
<FacilityOrganizationSelector
facilityId={facilityId}
value={field.value}
onChange={(value) => {
if (value === null) {
form.setValue("organizations", []);
} else {
form.setValue("organizations", value);
}
}}
/>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="start_date"
Expand Down Expand Up @@ -341,49 +361,29 @@ export default function CreateEncounterForm({
</FormItem>
)}
/>
<FormField
control={form.control}
name="organizations"
render={({ field }) => (
<FormItem>
<FacilityOrganizationSelector
facilityId={facilityId}
value={field.value}
onChange={(value) => {
if (value === null) {
form.setValue("organizations", []);
} else {
form.setValue("organizations", value);
}
}}
/>
<FormMessage />
</FormItem>
)}
/>
</div>
<div className="flex justify-end mt-6 space-x-2">
<Button
type="button"
onClick={() => {
setIsOpen(false);
form.reset();
}}
className="bg-white text-gray-800 border border-gray-300 hover:bg-gray-100"
>
{t("cancel")}
<ShortcutBadge actionId="cancel-action" />
</Button>
<Button
type="submit"
disabled={isPending || !form.watch("organizations").length}
>
{isPending ? t("creating") : t("create_encounter")}
<ShortcutBadge actionId="submit-action" className="bg-white" />
</Button>
</div>
</form>
</Form>
<div className="flex justify-end sticky -bottom-5 gap-2 bg-white py-5">
Comment on lines 365 to +367
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form closing tags are now positioned above the submit buttons, placing the buttons outside the form element. This breaks the form structure and will prevent the submit button from functioning correctly. The </form> and </Form> tags should remain after the button container to keep the buttons within the form.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negative bottom offset (-bottom-5) in sticky positioning appears unusual and may cause layout issues. Consider using bottom-0 instead, or if you need offset, verify this achieves the intended visual effect across different container heights.

Suggested change
<div className="flex justify-end sticky -bottom-5 gap-2 bg-white py-5">
<div className="flex justify-end sticky bottom-0 gap-2 bg-white py-5">

Copilot uses AI. Check for mistakes.
<Button
type="button"
onClick={() => {
setIsOpen(false);
form.reset();
}}
className="bg-white text-gray-800 border border-gray-300 hover:bg-gray-100"
>
{t("cancel")}
<ShortcutBadge actionId="cancel-action" />
</Button>
<Button
type="submit"
disabled={isPending || !form.watch("organizations").length}
>
{isPending ? t("creating") : t("create_encounter")}
<ShortcutBadge actionId="submit-action" className="bg-white" />
</Button>
</div>
</SheetContent>
</Sheet>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export default function FacilityOrganizationSelector(
}, [currentSelection, currentOrganizations, selectedOrganizations]);

return (
<div className="space-y-4">
<div className="space-y-3">
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<div className="space-y-1">
<Label>
Expand Down
Loading