rubyforgood / human-essentials

Human Essentials is an inventory management system for diaper, incontinence, and period-supply banks. It supports them in distributing to partners, tracking inventory, and reporting stats and analytics.
https://humanessentials.app
MIT License
466 stars 494 forks source link

[BUG]: Item lookup fails when adding items in a new kit #4780

Open coalest opened 5 days ago

coalest commented 5 days ago

Is there an existing issue for this?

Current Behavior

When adding items in a new kit, the JS for barcode lookup doesn't seem to be working. When I enter a nonexistent barcode and press enter, no modal pops up to add that barcode item. And I see this error in the console: image When I enter an existing barcode and press enter, no empty new item is added at the bottom. And I see this error in the console: image

Expected Behavior

I expect to see a modal to add a new barcode item if it doesn't exist yet. (like how it works for creating a new distribution for example). I expect to have a new empty item added to the bottom if the item does exist.

Basically I expect it to work the same as when adding items elsewhere in the application, such as for purchases or distributions.

Steps To Reproduce

  1. Log in as an org admin.
  2. Go to Inventory => Kits tab.
  3. Click "New kit".
  4. Enter a nonexistent barcode number and hit enter.
  5. Note that no modal pops up to add that item. (issue 1)
  6. Enter an existing barcode number and hit enter.
  7. Note that item name and quanity are filled, but a new empty item is not added. (issue 2)

Environment

No response

Criteria for Completion

No response

Anything else?

Attaching a PR to fix this issue.

Code of Conduct

cielf commented 5 days ago

Thanks for the catch!