-
Notifications
You must be signed in to change notification settings - Fork 444
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
Improve validation check for phone number in patient list page #8189 #8394
Improve validation check for phone number in patient list page #8189 #8394
Conversation
@Nithin9585 is attempting to deploy a commit to the Open Healthcare Network Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for care-egov-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const isValidPhoneNumber = (phoneNumber: string) => { | ||
const phoneNumberRegex = /^\+91[0-9]{10}$/; | ||
return phoneNumberRegex.test(phoneNumber); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a reusable validator for Phone Number form field. Avoid re-defining the validations for common ones.
https://github.com/coronasafe/care_fe/blob/develop/src/Components/Form/FieldValidators.tsx#L100
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove the phoneNumberError states if not being used right? We are not setting the state with a value anywhere. We are only clearing it. So no reason to keep the state right?
@@ -141,8 +139,6 @@ export const PatientManager = () => { | |||
updateQuery({ emergency_phone_number: null }); | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To continue with the error, i.e., 8-digit and 9-digit phone numbers are considered valid. This is because it is validating telephone numbers and other numbers that are more than 10 digits 13 digits. Can I get some suggestions to correct this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to clear the error if we are not setting the error state with a value in the first place right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but what about this issue 8 digit and 9 digit numbers are considered as valid because it is validating telephone number also !.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can trigger the search as soon as the number is considered valid. Use the PhoneNumberValidator utility to achieve that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs Cypress Tests
@nihal467 Can you look into this
@Nithin9585 are you still working on this issue |
👋 Hi, @Nithin9585, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
@nihal467 check this out ☝️ |
@Nithin9585 @rithviknishad can you fix the cypress failure |
@rithviknishad why data is filtered, when we type 8 digits, in India, we don't have a valid 8-digit phone or landline number, right ? |
@nihal467 Updated the indian landline number regex validation to ensure it's a 10 digit number as per TRAI docs. References: https://trai.gov.in/sites/default/files/Recommendations_29052020.pdf |
LGTM |
👋 Hi, @Nithin9585, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
@Nithin9585 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
Proposed Changes
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
Merge Checklist
phno-issue.mp4