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

Phone Input Component #170

Closed
JhumanJ opened this issue Aug 18, 2023 · 35 comments
Closed

Phone Input Component #170

JhumanJ opened this issue Aug 18, 2023 · 35 comments

Comments

@JhumanJ
Copy link
Owner

JhumanJ commented Aug 18, 2023

Currently the input component used for the phone type is a basic <text-input>. We want to have a dedicated component for the phone type. Ex:
image

The goal of this issue is to create this PhoneInput.vue component, and to use it for the phone type. Required data for the countries can be placed as a json in resources/data.

Requirements

  • It should work with all countries and contain nice flags
  • It must work will existing form themes (see form-theme.js). Themes can be changed in the customization section of the form editor
  • The component must be lazy-loaded to avoid loading all of its data on every page. Ex here: /resources/js/components/forms/index.js#L41
  • The dropdown must be using our VSelect.vue component
  • It should handle clashes for instance, for French number you don't need +33 and start with a 0, so if user selects +33 for France, and enters 0123456789, the resulting value should not be +330123456789 but +330123456789
  • It should have a dedicated phone validation rule in the back-end in AnswerFormRequest. The number must start with a valid country code and have the right length

Please feel free to reach out if you have any question!

@JhumanJ JhumanJ added help wanted Extra attention is needed feature request labels Aug 18, 2023
@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 18, 2023

/bounty $150

@algora-pbc
Copy link

algora-pbc bot commented Aug 18, 2023

💎 $150 bounty created by JhumanJ
🙋 If you start working on this, comment /attempt #170 to notify everyone
👉 To claim this bounty, submit a pull request that includes the text /claim #170 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to JhumanJ/OpnForm!

Attempt Started (GMT+0) Solution
🔴 @Ashutosh-Bhadauriya Aug 18, 2023, 5:18:36 PM WIP
🔴 @ayusham001 Aug 19, 2023, 4:12:28 AM WIP
🟡 @Ahtritus Aug 30, 2023, 7:21:31 AM #189

@Ashutosh-Bhadauriya
Copy link

Ashutosh-Bhadauriya commented Aug 18, 2023

@JhumanJ I would like to take this 🙂
/attempt #170

Options

@rishi-raj-jain
Copy link
Contributor

I'm next in line!

@sagar-kashyap
Copy link

the resulting value should not be +330123456789 but +330123456789

@JhumanJ can you clarify your 2nd last point in requirement.

@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 18, 2023

Hey guys. So essentially remove the leading 0 if there is one before pre-pending the country code

@ayusham001
Copy link

ayusham001 commented Aug 19, 2023

/attempt #170

Options

@algora-pbc
Copy link

algora-pbc bot commented Aug 19, 2023

Note: The user @Ashutosh-Bhadauriya is already attempting to complete issue #170 and claim the bounty. If you attempt to complete the same issue, there is a chance that @Ashutosh-Bhadauriya will complete the issue first, and be awarded the bounty. We recommend discussing with @Ashutosh-Bhadauriya and potentially collaborating on the same solution versus creating an alternate solution.

@Ashutosh-Bhadauriya
Copy link

Hey @JhumanJ I'm getting this error, when running npm run dev, any idea. I tried googling found some fixes but it didn't help. Also tried adding this to vite.config.js, but no success
server: { https: true, host: 'localhost' },

image

@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 19, 2023

Hey @Ashutosh-Bhadauriya, I've just pushed something to fix this, please pull an try again.

@Ashutosh-Bhadauriya
Copy link

Sure, thanks!

@Ashutosh-Bhadauriya
Copy link

@rishi-raj-jain I've cancelled my attempt on this, you can take it.

@rishi-raj-jain
Copy link
Contributor

@Ashutosh-Bhadauriya I think @ayusham001 is already on it.

@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 22, 2023

Hey @ayusham001 can you please confirm or cancel attemp?

@ayusham001
Copy link

@JhumanJ
I did the few changes
But rn m cancelling the attempt

@algora-pbc
Copy link

algora-pbc bot commented Aug 25, 2023

@Ashutosh-Bhadauriya: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

@algora-pbc
Copy link

algora-pbc bot commented Aug 26, 2023

@ayusham001: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

@Ahtritus
Copy link
Contributor

Hey, is this still open? If yes, I'd like to have a shot at it

@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 30, 2023 via email

@Ahtritus
Copy link
Contributor

Ahtritus commented Aug 30, 2023

Alright then, I'm taking this.
/attempt #170

Options

@abhinandanmishra1
Copy link

abhinandanmishra1 commented Aug 30, 2023

Hii @JhumanJ ,

Can I also work on this issue? I just want to make a try and it's my first open source attempt.

@Ahtritus
Copy link
Contributor

Ahtritus commented Aug 31, 2023

@JhumanJ did you guys have any existing plan on how to render the flags? I had initially thought of using the flag emojis, like 🇦🇫 for Afghanistan, but Chrome isn't properly rendering them, atleast on my side. I could use SVGs for each but it would be a bit more complicated and might bloat the code a little.

@JhumanJ
Copy link
Owner Author

JhumanJ commented Aug 31, 2023 via email

@Ahtritus
Copy link
Contributor

Ahtritus commented Sep 1, 2023

I actually got this beautiful little library called vue-tel-input which does all the heavy lifting, don't even require the country-list json. However, the dropdown needs to be styled a bit more. Shall try to get a PR up by tomorrow.

image

@JhumanJ
Copy link
Owner Author

JhumanJ commented Sep 1, 2023 via email

@Ahtritus
Copy link
Contributor

Ahtritus commented Sep 2, 2023

Its a bit trickier than I initially thought. The styles are more or less working with the 3 themes but the borders are acting up a bit. The backend validation is still left though. Honestly, neither php nor vue are my strong suits, might take some more time.

Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 4, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 4, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 4, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 5, 2023
@algora-pbc
Copy link

algora-pbc bot commented Sep 6, 2023

@Ahtritus: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 6, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 6, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 6, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 8, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 8, 2023
… 0 phone number is ignored, added regex to ignore non digit phone input
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 8, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 10, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 10, 2023
Ahtritus added a commit to Ahtritus/OpnForm that referenced this issue Sep 10, 2023
JhumanJ added a commit that referenced this issue Sep 12, 2023
* #170-ENH: Created custom dropdown phone input

* #170-ENH: Added phone_number rules

* #170-ENH: Added phone_number rules

* #170-ENH: Added separate Rule for phone number input, starting 0 phone number is ignored, added regex to ignore non digit phone input

* #170-ENH: Removed global registration of CountryFlag

* #170-ENH: Using VSelect component for country selection, added prop for dropdown styling

* #170-ENH: Updated phone number rule

* #170-ENH: Added margins to country selector

---------

Co-authored-by: Sutirtha <[email protected]>
Co-authored-by: Julien Nahum <[email protected]>
@JhumanJ
Copy link
Owner Author

JhumanJ commented Sep 12, 2023

Hey @Ahtritus I think you need to do something here to claim the bounty!

@Ahtritus
Copy link
Contributor

Hey @Ahtritus I think you need to do something here to claim the bounty!

lol yeah, i forgot to claim it. Lemme do that in the PR

@algora-pbc
Copy link

algora-pbc bot commented Sep 12, 2023

💡 @Ahtritus submitted a pull request that claims the bounty. You can visit your org dashboard to reward.

@Ahtritus
Copy link
Contributor

Not sure what's the next step, I guess you have to close it so that I receive the bounty.

@JhumanJ
Copy link
Owner Author

JhumanJ commented Sep 12, 2023

Let's try!

@JhumanJ JhumanJ closed this as completed Sep 12, 2023
@algora-pbc
Copy link

algora-pbc bot commented Sep 12, 2023

🎉🎈 @Ahtritus has been awarded $150! 🎈🎊

@JhumanJ
Copy link
Owner Author

JhumanJ commented Sep 12, 2023

Paid aout, thank you @Ahtritus !

@Ahtritus
Copy link
Contributor

Nice working with you man, thanks @JhumanJ !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants