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

Incorrect restriction in withdrawls edit form #1709

Merged
merged 7 commits into from
Jan 24, 2024

Conversation

slavcho
Copy link
Contributor

@slavcho slavcho commented Jan 22, 2024

The amount of the withdrawals can be a decimal number.
It should not be limited to integers only.

Before:

image

ani-kalpachka and others added 7 commits January 22, 2024 21:51
…podkrepi-bg#1703)

* Remove unused import and translations

* Remove unused translations, added EN translations for bank transactions

* Remove unused translations from campaigns.json

* Remove unused translations from campaign.json

* Add missing EN trnlations in campaigns.json

* Add missing translations for common.json

* Fix lint error

---------

Co-authored-by: ani-kalpachka <[email protected]>
* Update translations

* Update tranlations

* Update translations

---------

Co-authored-by: ani-kalpachka <[email protected]>
* Add missing EN translations

* Update translations for support.json and reccurong-donation.json

* Update translations for validation.json and transfer.json

* Update translations

---------

Co-authored-by: ani-kalpachka <[email protected]>
* components/commmon: Gallery component improvements
- Improved logic to render the Gallery Component more efficiently
- Expanded the size of the images, when FullScreen is toggled
- Added a button to minimize fullscreen slider

* common/Gallery: Fix component crash when child is a single image
In some situations, only a single image is uploaded, and in that case child.props.children is an object rather, than an array to map it over.

* common/ImageSlider: Hide backdrop on FullScreenImageSlider
Avoid minimizing gallery due to accidental touches
Copy link

❌ Not all tests have run for this PR. Please add the run tests label to trigger them.

@sashko9807
Copy link
Member

If I remember correctly ,we save the amount of a withdrawal record in stotinki as an integer, and conversions to decimals are only done on the front end for data visualization.

@slavcho
Copy link
Contributor Author

slavcho commented Jan 23, 2024

If I remember correctly ,we save the amount of a withdrawal record in stotinki as an integer, and conversions to decimals are only done on the front end for data visualization.

this is handled in:

  function handleSubmit(values: WithdrawalInput) {
    const data: WithdrawalData = {
      amount: toMoney(values.amount),
      

Actually we can save the form, but we cannot edit it later. It should be the same logic.
And this restriction is not in the CreateForm.

@slavcho
Copy link
Contributor Author

slavcho commented Jan 23, 2024

@ani-kalpachka Can you please review this since Diana requested it urgently?

@@ -47,7 +47,7 @@ const validationSchema: yup.SchemaOf<WithdrawalData> = yup
.defined()
.shape({
status: yup.string().trim().min(1).max(10).required(),
amount: yup.number().positive().integer().required(),
amount: yup.number().positive().required(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it is an issue considering the amount field can't be edited in EditForm, but maybe for consistency reason we should at least have the number().positive(), rules for amount validation.

@slavcho slavcho merged commit fc52796 into podkrepi-bg:master Jan 24, 2024
6 of 7 checks passed
@slavcho slavcho deleted the mmaster branch February 28, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants