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

Add autosave to forms #5731

Merged
merged 5 commits into from
Jun 22, 2023
Merged

Add autosave to forms #5731

merged 5 commits into from
Jun 22, 2023

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Jun 20, 2023

WHAT

🤖 Generated by Copilot at 1690c7a

The pull request adds auto-save and draft functionality to various forms in the application, such as consultation, facility, daily rounds, patient register, and user add forms. It uses a custom hook useAutoSaveReducer and a component DraftSection to handle the logic and UI for saving and restoring form state. It also refactors some form components and types to support the new features and fixes some minor bugs.

Proposed Changes

  • Adds auto saving drafts to forms
    image

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

HOW

🤖 Generated by Copilot at 1690c7a

  • Implement auto-save and draft functionality for forms using custom hooks and components (link, link, link, link, link, link, link)
  • Add permanent_address field to PatientModel interface and patient register form (link, link, link)
    • Add sameAddress field to UserForm type and state to store whether current address and permanent address are the same (link, link)
    • Add checkbox to toggle sameAddress field and conditionally render permanent_address field (link, link)
    • Modify fetchData, validateForm, and handleSubmit functions to use state.form.sameAddress and state.form.permanent_address fields (link, link, link)
  • Add phone_number_is_whatsapp field to UserForm type and user add form (link, link, link)
    • Add checkbox to toggle phone_number_is_whatsapp field and conditionally render alt_phone_number field (link, link)
    • Modify useAbortableEffect and handleSubmit functions to use state.form.phone_number_is_whatsapp and state.form.alt_phone_number fields (link, link)
  • Add InvestigationAdvice and procedures fields to FormDetails type and consultation form (link, link, link, link)
    • Modify fetchData, validateForm, and handleSubmit functions to use state.form.InvestigationAdvice and state.form.procedures fields (link, link, link, link)
    • Modify InvestigationBuilder and ProcedureBuilder components to use handleFormFieldChange function to update the fields (link, link)
  • Fix bug where dropdown menu was not visible in CollapseV2 component by removing overflow-hidden class (link)
  • Fix bug where DateFormField component expected a Date object as the value prop by handling the case where the field.value was a string (link)
  • Remove unused useReducer imports from various files (link, link, link, link, link, link)
  • Add excludeFromDraft parameter to FormContextValue type to allow form fields to opt out of the draft functionality (link)

@Ashesh3 Ashesh3 requested a review from a team June 20, 2023 13:57
@Ashesh3 Ashesh3 requested a review from a team as a code owner June 20, 2023 13:57
@Ashesh3 Ashesh3 requested a review from bodhish June 20, 2023 13:57
@vercel
Copy link

vercel bot commented Jun 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2023 1:28pm

@netlify
Copy link

netlify bot commented Jun 20, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit ffa4939
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/6492facbb3e1730008833f79
😎 Deploy Preview https://deploy-preview-5731--care-egov-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added cypress failed pull request with cypress test failure merge conflict pull requests with merge conflict labels Jun 20, 2023
@github-actions
Copy link

👋 Hi, @Ashesh3,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@github-actions github-actions bot removed the merge conflict pull requests with merge conflict label Jun 21, 2023
@nihal467 nihal467 added the P1 breaking issue or vital feature label Jun 21, 2023
@Ashesh3
Copy link
Member Author

Ashesh3 commented Jun 21, 2023

@nihal467 Made the fixes

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit f22ee92 into develop Jun 22, 2023
@khavinshankar khavinshankar deleted the form-draft branch June 22, 2023 00:12
@github-actions
Copy link

@Ashesh3 We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cypress failed pull request with cypress test failure P1 breaking issue or vital feature tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants