Repository: ohcnetwork/care_fe
Pull request #12289: fix: Reset form on cancel button click in schedule template sheet
Author: login: siva222003
Labels: name: Tested
name: reviewed
description: reviewed by a core member
Created: 2025-05-12T17:31:43Z | Merged: 2025-05-24T04:54:47Z

## Proposed Changes

- Fixes #12224 
- Added form reset on cancel to prevent stale data when reopening the schedule template form.

[Screencast from 2025-05-12 23-00-52.webm](https://github.com/user-attachments/assets/aefc79cf-883f-4e9e-89c3-71c08217647a)


@ohcnetwork/care-fe-code-reviewers

## Merge Checklist

- [ ] Add specs that demonstrate bug / test a new feature.
- [ ] Update [product documentation](https://docs.ohc.network).
- [x] Ensure that UI text is kept in I18n files.
- [x] Prep screenshot or demo video for changelog entry, and attach it to issue.
- [x] Request for Peer Reviews
- [ ] Completion of QA in Mobile Devices
- [x] Completion of QA in Desktop Devices


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
  - Improved the "Cancel" button in the schedule template creation sheet to clear form fields when clicked, ensuring the form resets to its default state.
  - Enhanced cancel buttons across multiple forms to reset input fields and UI states upon cancellation.
  - Updated form sheets to separate form reset logic from sheet open/close events, triggering resets only on user-initiated cancel actions.
  - Added clearing of search inputs and selections when closing relevant sheets.
  - Ensured device selection is cleared when opening or closing the associate device sheet.
- **New Features**
  - Introduced explicit cancel buttons alongside submit buttons in various forms for clearer user control.
  - Improved button layouts with grouped cancel and submit buttons for better usability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Linked issue #12224: Schedule Template value clears only on reload
**Describe the bug**
When we enter values in the Create Schedule Template, and click on the cancel button or outside the Sheet, the values are still present. The user has to manually clear all values or reload the page to get a fresh sheet.

**To Reproduce**
Steps to reproduce the behavior:

1.Go to Users page in any facility
2. Select any user and create template for them
3. Click the cancel button or outside the sheet 
4. Again click on create template, the same values will be present

**Expected behavior**
When the user clicks on cancel button or outside the sheet and then again clicks on Create Template, they must get a new sheet rather than the old one. This should happen without them having to refresh the page.

**Screenshots**

https://github.com/user-attachments/assets/d75c07b1-70a0-4855-98e3-5c12ba0a9525

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.

---

### 🚨 DO NOT EDIT BELOW THIS LINE 🚨

### Instructions for Requesting Assignment:

To request assignment, please clearly outline your solution and timeline by commenting on the issue using the format below:

**Describe your solution clearly:**
Provide a detailed explanation of your proposed solution, including your approach, key implementation steps, and relevant examples or references. Mention any dependencies, assumptions, or risks you foresee that might affect your timeline or implementation.

**Expected Timeline:**
- End date: [Expected submission date of a completed Pull Request]

**Additional Context:**
Include any other relevant context, links, screenshots, or resources that support your proposed solution.

> 🚨 Your assignment may be unassigned if there is no activity or progress within the stated timeline unless communicated clearly and agreed upon.

Linked issue comments: user: login: Spandan-Mishra
created_at: 2025-05-05T10:29:29Z
body: @bodhish @rithviknishad @Jacobjeevan I would like to work on this issue if it is valid
ETA: 1 Day
Approach: Track the clicking on Cancel button, or outside the sheet and change the value of `form` to its default value when this happens.
author_association: CONTRIBUTOR
user: login: siva222003
created_at: 2025-05-05T12:01:21Z
body: @Spandan-Mishra I feel the current functionality might actually be more user-friendly. If a user accidentally clicks outside the sheet, they won’t lose the data they’ve already entered , which is helpful, especially since the form is a bit complex.

Also, if the user intentionally clicks the Cancel button, it’s unlikely they’ll want to fill out the form again immediately. And even if they do, they still have the option to manually update the fields from the start which is like creating a new one.

Would love to hear your thoughts on this.
cc: @rithviknishad @Jacobjeevan 

ETA : 17/05/2025
author_association: CONTRIBUTOR
user: login: Spandan-Mishra
created_at: 2025-05-05T13:14:38Z
body: @siva222003 I think clicking on cancel and then creating a new template should show an empty one. Because if the user does this, most likely they want to create one from scratch.

As for the clicking outside one, your reasoning is better and would reduce errors.
author_association: CONTRIBUTOR
user: login: rithviknishad
created_at: 2025-05-12T05:52:14Z
body: Clear the form only when cancel button is clicked. When sheet is closes by clicking outside, we shouldn't be clearing the form.
author_association: MEMBER

Diff:
diff --git a/src/components/Consent/ConsentFormSheet.tsx b/src/components/Consent/ConsentFormSheet.tsx
index 49abad1e9f1..7896441c20d 100644
--- a/src/components/Consent/ConsentFormSheet.tsx
+++ b/src/components/Consent/ConsentFormSheet.tsx
@@ -277,15 +277,7 @@ export default function ConsentFormSheet({
   };
 
   return (
-    <Sheet
-      open={isOpen}
-      onOpenChange={(open) => {
-        setIsOpen(open);
-        if (!open) {
-          form.reset();
-        }
-      }}
-    >
+    <Sheet open={isOpen} onOpenChange={setIsOpen}>
       <SheetTrigger asChild>
         <Button variant={isEdit ? "outline" : "primary"} className="gap-2">
           {isEdit ? (
@@ -567,7 +559,10 @@ export default function ConsentFormSheet({
             <div className="flex justify-end mt-6 space-x-2">
               <Button
                 type="button"
-                onClick={() => setIsOpen(false)}
+                onClick={() => {
+                  setIsOpen(false);
+                  form.reset();
+                }}
                 className="bg-white text-gray-800 border border-gray-300 hover:bg-gray-100"
               >
                 {t("cancel")}
diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx
index a10febe1546..2c4712ac215 100644
--- a/src/components/Encounter/CreateEncounterForm.tsx
+++ b/src/components/Encounter/CreateEncounterForm.tsx
@@ -127,15 +127,7 @@ export default function CreateEncounterForm({
   }
 
   return (
-    <Sheet
-      open={isOpen}
-      onOpenChange={(open) => {
-        setIsOpen(open);
-        if (!open) {
-          form.reset();
-        }
-      }}
-    >
+    <Sheet open={isOpen} onOpenChange={setIsOpen}>
       <SheetTrigger asChild>
         {trigger || (
           <Button
@@ -340,13 +332,24 @@ export default function CreateEncounterForm({
                 </FormItem>
               )}
             />
-            <Button
-              type="submit"
-              className="w-full"
-              disabled={isPending || !form.watch("organizations").length}
-            >
-              {isPending ? t("creating") : t("create_encounter")}
-            </Button>
+            <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")}
+              </Button>
+              <Button
+                type="submit"
+                disabled={isPending || !form.watch("organizations").length}
+              >
+                {isPending ? t("creating") : t("create")}
+              </Button>
+            </div>
           </form>
         </Form>
       </SheetContent>
diff --git a/src/components/HistoricalRecordSelector/index.tsx b/src/components/HistoricalRecordSelector/index.tsx
index 484c8649ee1..42401cd5669 100644
--- a/src/components/HistoricalRecordSelector/index.tsx
+++ b/src/components/HistoricalRecordSelector/index.tsx
@@ -334,18 +334,7 @@ export function HistoricalRecordSelector<T extends BaseRecord>({
   );
 
   return (
-    <Sheet
-      open={isOpen}
-      onOpenChange={(open) => {
-        if (open) {
-          resetState();
-          setActiveType(structuredTypes[0]?.type || "");
-          setIsOpen(true);
-        } else {
-          setIsOpen(false);
-        }
-      }}
-    >
+    <Sheet open={isOpen} onOpenChange={setIsOpen}>
       <SheetTrigger asChild>
         <div className="flex items-center justify-end">
           <Button
diff --git a/src/components/Medicine/MedicationAdministration/MedicineAdminSheet.tsx b/src/components/Medicine/MedicationAdministration/MedicineAdminSheet.tsx
index e652b31965e..43b3d9883d8 100644
--- a/src/components/Medicine/MedicationAdministration/MedicineAdminSheet.tsx
+++ b/src/components/Medicine/MedicationAdministration/MedicineAdminSheet.tsx
@@ -184,6 +184,7 @@ export function MedicineAdminSheet({
     onOpenChange(false);
     setSelectedMedicines(new Set());
     setAdministrationRequests({});
+    setSearch("");
   };
 
   const handleAdministrationChange = useCallback(
diff --git a/src/components/Questionnaire/ManageQuestionnaireTagsSheet.tsx b/src/components/Questionnaire/ManageQuestionnaireTagsSheet.tsx
index 97cab1656a7..82be2a0ca44 100644
--- a/src/components/Questionnaire/ManageQuestionnaireTagsSheet.tsx
+++ b/src/components/Questionnaire/ManageQuestionnaireTagsSheet.tsx
@@ -372,6 +372,9 @@ export default function ManageQuestionnaireTagsSheet({
               variant="outline"
               onClick={() => {
                 setSelectedTags(questionnaire.tags);
+                setNewTagName("");
+                setNewTagSlug("");
+                setIsCreateOpen(false);
                 setOpen(false);
               }}
             >
diff --git a/src/pages/Encounters/AssociateDeviceSheet.tsx b/src/pages/Encounters/AssociateDeviceSheet.tsx
index 50a03b12ee7..124c027d9de 100644
--- a/src/pages/Encounters/AssociateDeviceSheet.tsx
+++ b/src/pages/Encounters/AssociateDeviceSheet.tsx
@@ -57,7 +57,13 @@ export default function AssociateDeviceSheet({
   };
 
   return (
-    <Sheet open={open} onOpenChange={setOpen}>
+    <Sheet
+      open={open}
+      onOpenChange={(open) => {
+        setOpen(open);
+        setSelectedDevice(null);
+      }}
+    >
       <SheetTrigger asChild>{children}</SheetTrigger>
       <SheetContent>
         <SheetHeader>
diff --git a/src/pages/Facility/settings/organizations/components/FacilityOrganizationFormSheet.tsx b/src/pages/Facility/settings/organizations/components/FacilityOrganizationFormSheet.tsx
index 308e0152956..986b8e545ab 100644
--- a/src/pages/Facility/settings/organizations/components/FacilityOrganizationFormSheet.tsx
+++ b/src/pages/Facility/settings/organizations/components/FacilityOrganizationFormSheet.tsx
@@ -247,16 +247,27 @@ export default function FacilityOrganizationFormSheet({
                 </FormItem>
               )}
             />
-
-            <Button type="submit" className="w-full" disabled={isPending}>
-              {isPending
-                ? isEditMode
-                  ? t("updating")
-                  : t("creating")
-                : isEditMode
-                  ? t("update_organization")
-                  : t("create_organization")}
-            </Button>
+            <div className="flex justify-end mt-6 space-x-2">
+              <Button
+                type="button"
+                onClick={() => {
+                  setOpen(false);
+                  form.reset();
+                }}
+                className="bg-white text-gray-800 border border-gray-300 hover:bg-gray-100"
+              >
+                {t("cancel")}
+              </Button>
+              <Button type="submit" disabled={isPending}>
+                {isPending
+                  ? isEditMode
+                    ? t("updating")
+                    : t("creating")
+                  : isEditMode
+                    ? t("update_organization")
+                    : t("create_organization")}
+              </Button>
+            </div>
           </form>
         </Form>
       </SheetContent>
diff --git a/src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx b/src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx
index 5a997470e64..e69939b2d0b 100644
--- a/src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx
+++ b/src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx
@@ -332,6 +332,7 @@ export default function CreateScheduleExceptionSheet({
                       className="mt-2 md:mt-0"
                       type="button"
                       disabled={isPending}
+                      onClick={() => form.reset()}
                     >
                       {t("cancel")}
                     </Button>
diff --git a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
index a7071055acb..1250dfbeac7 100644
--- a/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
+++ b/src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
@@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
+                  >
                     {t("cancel")}
                   </Button>
                 </SheetClose>


Reviews:
user: login: rithviknishad
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-13T06:16:38Z
user: login: rithviknishad
body: Please do this for other such form sheets as well (such as schedule exception) along with this PR wherever applicable!

<img width="725" alt="image" src="https://github.com/user-attachments/assets/6f76db5d-c636-450a-af2a-9a44b8306f90" />

state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-05-13T06:17:51Z
user: login: Jacobjeevan
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T04:20:17Z
user: login: rithviknishad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-14T04:25:23Z
user: login: siva222003
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T04:25:30Z
user: login: siva222003
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T04:37:52Z
user: login: Jacobjeevan
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T13:14:57Z
user: login: rithviknishad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-16T12:46:21Z
user: login: siva222003
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T13:06:47Z
user: login: rithviknishad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-16T13:12:19Z
user: login: siva222003
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T13:17:43Z
user: login: Jacobjeevan
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-23T06:59:26Z
user: login: rithviknishad
body: minor thing
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-23T07:18:34Z

Review comments:
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: Jacobjeevan
body: handle within sheet state instead (onOpenChange), since user can close by clicking elsewhere on screen.
created_at: 2025-05-14T04:20:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: rithviknishad
body: Let's not do this, this was intentionally not done so that sheet's state can be restored.

What if user accidentally closes the sheet? They can restore it.

But if they voluntarily clicked cancel, form state would be discarded.

ref: https://github.com/ohcnetwork/care_fe/issues/12224#issuecomment-2870923191
created_at: 2025-05-14T04:25:23Z
author_association: MEMBER
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: siva222003
body: @Jacobjeevan But here the form should reset only when we click `cancel`, right?
created_at: 2025-05-14T04:25:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: siva222003
body: @rithviknishad There are some sheets that already manage state using `onOpenChange` to reset the form. So, do you want me to keep them as they are, or should they also reset only when `cancel` is clicked?

And also, sheets like `CreateEncounter`, which don’t have a cancel button, are also using this approach.

- My idea is to remove the reset logic from `onOpenChange` for the sheets that have a Cancel button and reset the form only when Cancel is clicked.

- And for the sheets that don’t have a cancel option, I’ll keep the current behavior as is ,resetting on `onOpenChange` (or remove it).

What do you think?
created_at: 2025-05-14T04:37:52Z
author_association: CONTRIBUTOR
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: Jacobjeevan
body: > @rithviknishad There are some sheets that already manage state using `onOpenChange` to reset the form. So, do you want me to keep them as they are, or should they also reset only when `cancel` is clicked?
> 
> And also, sheets like `CreateEncounter`, which don’t have a cancel button, are also using this approach.
> 
>     * My idea is to remove the reset logic from `onOpenChange` for the sheets that have a Cancel button and reset the form only when Cancel is clicked.
> 
>     * And for the sheets that don’t have a cancel option, I’ll keep the current behavior as is ,resetting on `onOpenChange` (or remove it).
> 
> 
> What do you think?

(1) Yep
(2) This seems fine, but check if the reset is expensive for the user. All form sheets should have a cancel button, so let's add it if it's missing. For other things, we can keep the behavior as is 🤔 
created_at: 2025-05-14T13:14:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: rithviknishad
body: @siva222003 could you update the status and give an updated ETA on this?
created_at: 2025-05-16T12:46:20Z
author_association: MEMBER
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: siva222003
body: @rithviknishad Sorry, I was occupied with the GSoC task and couldn't complete this. I'll make the changes by EOD tomorrow.
I've also updated the ETA in the issue.
created_at: 2025-05-16T13:06:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: rithviknishad
body: Cool, no worries! It's okay to take time, just make sure you add a new comment every time you think you'd need more time to get things wrapped...
created_at: 2025-05-16T13:12:19Z
author_association: MEMBER
diff_hunk: @@ -700,7 +700,12 @@ export default function CreateScheduleTemplateSheet({
 
               <SheetFooter className="absolute inset-x-0 bottom-0 border-t border-gray-200 bg-white p-6">
                 <SheetClose asChild>
-                  <Button variant="outline" type="button" disabled={isPending}>
+                  <Button
+                    variant="outline"
+                    type="button"
+                    disabled={isPending}
+                    onClick={() => form.reset()}
path: src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx
user: login: siva222003
body: yeah, I'll keep that in mind 🙂
created_at: 2025-05-16T13:17:43Z
author_association: CONTRIBUTOR
diff_hunk: @@ -57,7 +57,13 @@ export default function AssociateDeviceSheet({
   };
 
   return (
-    <Sheet open={open} onOpenChange={setOpen}>
+    <Sheet
+      open={open}
+      onOpenChange={() => {
+        setOpen((prev) => !prev);
+        setSelectedDevice(null);
+      }}
path: src/pages/Encounters/AssociateDeviceSheet.tsx
user: login: rithviknishad
body: ```suggestion
      onOpenChange={(open) => {
        setOpen(open);
        setSelectedDevice(null);
      }}
```
created_at: 2025-05-23T07:17:42Z
author_association: MEMBER

PR comments:
user: login: netlify[bot]
created_at: 2025-05-12T17:31:49Z
body: ### <span aria-hidden="true">✅</span> Deploy Preview for *care-ohc* ready!


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 3077668068a435b0afaa28a9bee0216dfa2f10de |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/care-ohc/deploys/68302156d1bfe60008355fbf |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-12289.preview.ohc.network](https://deploy-preview-12289.preview.ohc.network) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTEyMjg5LnByZXZpZXcub2hjLm5ldHdvcmsifQ.4yxAdHieSFFfshD_6xVjSvvAkJnfFd0vIZmaGg8tU-4)<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [care-ohc Preview](https://deploy-preview-12289.preview.ohc.network) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/care-ohc/configuration/notifications#deploy-notifications)._
author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-05-12T17:31:51Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

"""
## Walkthrough

The change updates multiple components to move form reset logic from sheet open/close handlers to explicit cancel button clicks. Cancel buttons now reset form states and close sheets, ensuring forms clear only on user cancellation. Additionally, some sheets clear extra state like search inputs or selections on close or cancel.

## Changes

| File(s)                                                                                     | Change Summary                                                                                                                        |
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx, src/pages/Scheduling/components/CreateScheduleExceptionSheet.tsx | Added `onClick` handler to cancel buttons to reset form state when clicked, clearing form fields.                                     |
| src/components/Consent/ConsentFormSheet.tsx, src/components/Encounter/CreateEncounterForm.tsx | Moved form reset from sheet `onOpenChange` to cancel button `onClick`; cancel button closes sheet and resets form explicitly.         |
| src/components/HistoricalRecordSelector/index.tsx                                          | Simplified sheet `onOpenChange` to directly use state setter, removing side effects like resetting active type or state on close.     |
| src/components/Medicine/MedicationAdministration/MedicineAdminSheet.tsx                     | Added clearing of search input state on sheet close alongside existing resets.                                                       |
| src/components/Questionnaire/ManageQuestionnaireTagsSheet.tsx                              | Enhanced cancel button to reset tag selections, clear new tag inputs, and close create tag UI section on cancel.                      |
| src/pages/Encounters/AssociateDeviceSheet.tsx                                              | Changed sheet `onOpenChange` to toggle open state and reset selected device to null on every open/close toggle.                      |
| src/pages/Facility/settings/organizations/components/FacilityOrganizationFormSheet.tsx    | Replaced single submit button with button group including a cancel button that resets form and closes sheet; submit button unchanged.|

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant SheetComponent
    participant Form

    User->>SheetComponent: Clicks "Cancel" button
    SheetComponent->>Form: Calls form.reset() and clears relevant states
    Form-->>SheetComponent: Form and states reset
    SheetComponent-->>User: Sheet closes with cleared form and states
```

## Assessment against linked issues

| Objective                                                                                     | Addressed | Explanation                                     |
|-----------------------------------------------------------------------------------------------|-----------|-------------------------------------------------|
| Clear form values when "Cancel" is clicked in Create Schedule Template sheet (#12224)         | ✅        |                                                 |

## Suggested labels

`Tested ✅`

## Suggested reviewers

- Jacobjeevan

## Poem

> A bunny hops with nimble feet,  
> Now "Cancel" wipes the form so neat!  
> No more old values lurking near—  
> Fresh starts await, the path is clear.  
> With every click, a tidy sheet,  
> This change is truly quite a treat! 🐇✨
"""

<!-- walkthrough_end -->
<!-- This is an auto-generated comment: all tool run failures by coderabbit.ai -->

> [!WARNING]
> There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
> 
> <details>
> <summary>🔧 ESLint</summary>
> 
> > If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
> 
> npm warn config production Use `--omit=dev` instead.
> npm error Exit handler never called!
> npm error This is an error with npm itself. Please report this error at:
> npm error   <https://github.com/npm/cli/issues>
> npm error A complete log of this run can be found in: /.npm/_logs/2025-05-23T07_20_25_025Z-debug-0.log
> 
> 
> 
> </details>

<!-- end of auto-generated comment: all tool run failures by coderabbit.ai -->

<!-- announcements_start -->

> [!NOTE]
> <details>
> <summary>⚡️ AI Code Reviews for VS Code, Cursor, Windsurf</summary>
> 
> CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
> Learn more [here](http://coderabbit.ai/ide).
> 
> </details>

<!-- announcements_end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 97188d50083e38e8ef70d0005e808463cd177a22 and 3077668068a435b0afaa28a9bee0216dfa2f10de.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/pages/Encounters/AssociateDeviceSheet.tsx` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* src/pages/Encounters/AssociateDeviceSheet.tsx

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (5)</summary>

* GitHub Check: parallel-job (3)
* GitHub Check: parallel-job (2)
* GitHub Check: parallel-job (1)
* GitHub Check: parallel-job (4)
* GitHub Check: Test

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4baRJQ2PwKZn4sBkwGEl8BPAJcr3gGAGsULEQGWDpvDxpmbi9qD0QGtOjIAHc0ZAcBZnUaejlIbERKe0k0ACYlgAZlgGZ0ZFtIDEcBWYBGJYAOAE4NGAbGWExSdFpaf0QZ5CQHDzMjpYAWSEm0B7wDBESCxbAYMTwfAYNDlXDyAh+VKhXBXDJZfoNLCojx5CGFP4laEoZAMcpVKJAsJXOoNWhNMIkVrtGigzLMC5wVC8Eh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touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=ohcnetwork/care_fe&utm_content=12289):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: siva222003
created_at: 2025-05-18T16:08:36Z
body: @rithviknishad @Jacobjeevan
I have added the reset on the sheets where I felt it was needed.  
Also, I added a `Cancel` button in two sheets to handle the state reset when clicking `Cancel` instead of relying on `onOpenChange`.

Please review and let me know if any changes are needed.
author_association: CONTRIBUTOR
user: login: nihal467
created_at: 2025-05-23T07:35:24Z
body: LGTM
author_association: MEMBER
user: login: github-actions[bot]
created_at: 2025-05-24T04:54:58Z
body: @siva222003 Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:
author_association: NONE