Closed (fixed)
Project:
Commerce Point of Sale (POS)
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Dec 2017 at 06:14 UTC
Updated:
3 Sep 2018 at 09:49 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
thejacer87 commentedComment #3
sorabh.v6I also faced the same bug. I believe it is because we are using input type number. When I changed the input type to text then I did not saw that bug again. Please refer the attached gif -
Comment #4
mglamanWouldn't the proper fix to use `parseInt` in the JavaScript?
Comment #5
mglamanGive it a try
Comment #7
mglamanOkay, that doesn't work because it doesn't append. So the input needs to be changed to text, as specified in #3
Comment #8
sorabh.v6@mglaman Changing this field to text will remove the validation of type number. Previously this field was a textfield and to apply validation I had to change that to number field. If we make it a textfield then we will have to apply custom validation.
Comment #9
sorabh.v6@mglaman This is the issue where the field was changed from `text` to `number` - https://www.drupal.org/project/commerce_pos/issues/2916647
Comment #10
deepakaryan1988Comment #11
deepakaryan1988Hello,
I have made the patch for attaching .0 at the end. Now, I am uploading it but there is still lots of things to do.
I'll update the patch as I further progress.
Comment #13
deepakaryan1988Thanks to @travis.
Submitting a patch now.
For later on, I'll disable " . " once it used once.
Comment #14
travis-bradbury commentedThis needs a test that fails without the fix.
Comment #15
TimRutherford commentedComment #16
TimRutherford commentedAfter investigation, it does not seem possible to fix this in a clean way. The current solution in patch 13 has its issues and looks a bit confusing having a random 0 show up then get removed on next key press. I'd propose a couple solutions:
Personally I think #1 is the way to go. Its easy and pretty clean. We would need to make sure we fix the issues in https://www.drupal.org/project/commerce_pos/issues/2916647 though.
Comment #17
subhojit777Comment #18
subhojit777Agree with Tim et al that the
textfieldapproach looks much cleaner.Comment #19
subhojit777There is a problem with #18. Entering
1.22000000also throws error.Comment #20
subhojit777Not neat :( but fixes the problem. If we want to make it absolutely neat, then I would recommend providing a message to the end-user that the amount will rounded up to two digits, and use
round().Comment #21
subhojit777Lets decide whether to follow the JS/PHP approach to fix this problem, and then we can write tests.
Comment #22
jnrfred commentedPatch in #20 looks good. The amount does not disappear temporarily when you use the keypad.
Comment #23
travis-bradbury commented$form_state->setError($form['keypad']['amount'], $this->t('The amount should be of two digit precision.'));Instead of "two" this should say the number from
$fraction_digit.Comment #24
jnrfred commentedThis patch addresses #23 fixes.
Comment #25
gmem commentedSeeing as this is still an issue, I went ahead and rerolled the patch, as well as tweaked the styling on the input to limit the width - otherwise it overlaps the add cash amount button.
Comment #26
gmem commentedComment #27
smccabe commentedThe max width setting is overridden to 100% for me in both Chrome and FF, also I think it is better to set this via the field size from the form, not the CSS.
Comment #28
smccabe commentedminor reroll and npm update
Comment #29
gmem commentedRemoved the styling and set the size attribute to 10 with the same effect.
Comment #31
gmem commentedReroll
Comment #32
gmem commentedComment #34
smccabe commentedComment #35
sorabh.v6