CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

[Feature][Ready] Phone field type

Open tabacitu opened this issue 6 years ago • 12 comments

Merges #1348 Fixes #1202 Uses https://github.com/jackocnr/intl-tel-input

Declaration:

[
   'name' => 'phone',
   'type' => 'phone',
   'label' => 'Phone Number (international)',
]

Merged #1348 and added a few features:

  • the number is always stored using the international format (in a hidden input);
  • check phone number integrity using utilsScript, loaded from CDN (the only way I could get it to work);
  • always show the phone number prefix, next to the country flag;
  • pre-populate the country flag based on the user's IP address, if the field is empty (geoIpLookup);
  • copy-paste a phone number with prefix will automatically load the country flag;

Removed:

  • prefix and suffix field options (not needed; plus it would be confusing since the phone number also has its own prefix);
  • html files with intl-tel-input demo

tabacitu avatar May 15 '18 06:05 tabacitu

PS. The field type seems to be working properly for me, but further testing is recommended.

tabacitu avatar May 15 '18 06:05 tabacitu

@AbbyJanke - what do you think? I feel enabling these advanced features makes the field more intuitive and foolproof.

tabacitu avatar May 15 '18 06:05 tabacitu

It's approved, when will this get merged? :)

ziming avatar Nov 11 '18 12:11 ziming

@ziming probably by the end of the week, included in the 3.5 release. It’s gonna be a big update - I think you’ll love it :-) Can’t wait to finally put all pieces together.

tabacitu avatar Nov 15 '18 13:11 tabacitu

@tabacitu Looks like we had plans for this in 3.5 but it didn't get merged? Think we can get this added?

AbbyJanke avatar Dec 30 '18 01:12 AbbyJanke

agreed!

ziming avatar Apr 12 '19 12:04 ziming

Any news about this?

CyberCr33p avatar May 22 '19 14:05 CyberCr33p

Paths are still based on Backpack v3, uses vendor instead of packages. This needs to be changed before merging.

martijnb92 avatar Jun 16 '20 14:06 martijnb92

Hi guys, any news on this?

rodrigoUriarte avatar Jul 11 '20 02:07 rodrigoUriarte

Haven't worked on this in a while, @rUriarteDev , no, sorry. I'd still love to have this, it's just never been a priority. The v4 field shouldn't be too different from the v3 code here - only minor changes I think. Let us know if you end up working on this before we do, and it's something that works well - might merge it into Backpack, or create a Backpack add-on for it.

tabacitu avatar Aug 08 '20 12:08 tabacitu

Any update on this?

AfzalSabbir avatar Jun 25 '22 05:06 AfzalSabbir

No updates yet. But it's on the roadmap, and it'll probably get done in the next 1-2 months.

We should keep in mind that developers could/should also use Propaganistas/Laravel-Phone to validate the phone numbers introduced with any new phone field. So the inputs should also match the format that package expects. This adds another layer of complexity to the field...

tabacitu avatar Aug 20 '22 08:08 tabacitu

New field checklist:

  • [ ] does the value get saved to the database?
  • [ ] does the value need to be casted to something in the Model? is it mandatory? should it support both?
  • [ ] can the dev increase/decrease the size using Bootstrap classes?
  • [ ] does resizing also work with Fluent field syntax? eg. ->size(6)?
  • [ ] does it support ->disabled() and ->readonly()
  • [ ] does it support ->default()?
  • [ ] has all jQuery been removed in favor of vanilla Javascript?
  • [ ] have the CSS and JS dependencies been loaded with @loadOnce?
  • [ ] have the CSS and JS dependencies been pushed to proper stacks (after_scripts and after_styles)
  • [ ] on error, does the field properly show the error?
  • [ ] does the field support prefix and suffix?
  • [ ] does the field support hint?
  • [ ] on validation error, does the field properly get the old value?
  • [ ] can the dev customize the configuration/parameters from PHP?
  • [ ] are you sure there are no visible strings that should be turned into translated strings?
  • [ ] does this field work inside the repeatable field?
  • [ ] does this field work with our CrudField JS Library? do all events there work on this field?
  • [ ] if the input is first on page, does the focus correctly set on the input?
  • [ ] if the input is first in a modal, does the focus correctly set on the input?
  • [ ] does the field have documentation? should it say it needs assets to be published to work?
  • [ ] does the field have a screenshot?

tabacitu avatar Nov 03 '22 16:11 tabacitu

This field is done by PR PRO 103

jcastroa87 avatar Nov 07 '22 14:11 jcastroa87

Closing in favor of #4761 🎉

tabacitu avatar Nov 07 '22 16:11 tabacitu