Create number field
This PR addresses one of the major bugs we are currently experiencing. We have been relying on the browser to parse our number input, which has proven to be unreliable. This fix ensures that the number field does not contain letters and parses as a valid number.
Also now allows pasting formatted numbers or strings containing letters.
Looking ahead, we may need to rethink our strategy regarding "used" material. It's possible that we could abandon our current approach of only allowing numbers in the quantity field. Instead, we could allow the inclusion of text, and even consider combining quantity and unit. We would then use AI to separate these elements.
Inspired by #3912 Fixes #3998 Fixes #4729 Fixes sentry issues ECAMP3-API-2J, ECAMP3-FRONTEND-16P
Feature branch deployment currently inactive.
If the PR is still open, you can add the deploy! label to this PR to trigger a feature branch deployment.
- Should we also allow comma as decimal separator?
Currently it is only on paste, but I would not
- Should we disallow negative numbers?
Maybe on the validation layer
- In mobile view (dialog) there is an error if I remove quantity (see recording below).
Looks like a problem with e-number-field. Will look at it
@usu I realized that my method was flawed. I've now extracted basic functionality from picker (without yet replacing in pickers) to use in number field. Also the .number modifier was flawed as it didn't return a number or null at all time, but also strings. This way we can ensure that the number field always returns null or a number.
Now on wide screens it is broken on chromium: Screencast from 27.04.2024 13:56:33.webm
I cannot submit a material item on a wide screen. The input fields are cleared, but no request is sent
EDIT: This seems to be a temporary hickup...but still not good
@BacLuc fixed the MaterialItemCreate. It was missing a focus method for number and parse field.