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 validation to inventory management page #5782

Merged
merged 2 commits into from
Jun 28, 2023
Merged

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Jun 26, 2023

WHAT

🤖 Generated by Copilot at 0c03edc

This pull request improves the user experience and data quality of the AddInventoryForm component by adding form validation and error messages. It modifies the src/Components/Facility/AddInventoryForm.tsx file to implement the validation logic and error display.

Proposed Changes

image

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

HOW

🤖 Generated by Copilot at 0c03edc

  • Add errors property to initialState and initialize it with initError object that maps each field to an empty string (link)
  • Rename action type from set_error to set_errors and update reducer accordingly (link)
  • Add validateForm function that checks the validity of each field and sets the error messages in errors object (link)
  • Modify handleSubmit function to call validateForm and return early if form is invalid (link)
  • Add error prop to SelectField component for id field and display the error message from errors object (link)
  • Add error prop to SelectField component for isIncoming field and display the error message from errors object or stockError message (link)
  • Add error prop to TextInputField component for quantity field and display the error message from errors object (link)
  • Add error prop to SelectField component for unit field and display the error message from errors object (link)

@Ashesh3 Ashesh3 requested a review from a team June 26, 2023 05:58
@Ashesh3 Ashesh3 requested a review from a team as a code owner June 26, 2023 05:58
@Ashesh3 Ashesh3 requested a review from gigincg June 26, 2023 05:58
@vercel
Copy link

vercel bot commented Jun 26, 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 27, 2023 3:34am

@netlify
Copy link

netlify bot commented Jun 26, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 90a4c88
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/649a58803c953200075430d4
😎 Deploy Preview https://deploy-preview-5782--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 configuration.

@github-actions github-actions bot added the cypress failed pull request with cypress test failure label Jun 26, 2023
@github-actions github-actions bot added cypress passed and removed cypress failed pull request with cypress test failure labels Jun 27, 2023
@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit 93c9fbc into develop Jun 28, 2023
28 of 29 checks passed
@khavinshankar khavinshankar deleted the issue-5690 branch June 28, 2023 05:13
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make all four field in Facility Inventory Addition Form Mandatory
3 participants