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
436 stars 449 forks source link

[PACKS] #8 New / Edit Distribution for the banks shows custom request units, if applicable #4403

Open cielf opened 3 weeks ago

cielf commented 3 weeks ago

Summary

Add custom request units to new distribution.

Why

This is step #8 of adding the ability to specify "packs" versus "individual" for requests

Details

BLOCKED by #4351

If the distribution is from a request, add a"Requested" column beside the current item fields

The # of requested items and the requested units will be shown beside the corresponding item in the distribution entry.

If the request is using a custom request unit (not the default units), the quantity for the distribution of the item will not be initially filled in. The purpose of this is to reduce the likelihood of errors of the "leaving the number that was there because we fulfilled what they wanted" type. If the item doesn't have custom request units, or the item request uses the default units, the quantity for the distribution will be filled in.

Visual Aid

Image

Identified rules

In all cases:

May put 0 as a quantity Saving with blank quantities will give an error May remove any item May add more items. This functionality will work as it does currently, except for the 0/blank behavior as noted above

On new or edit, not-from-request:

Do not show the requested column

On new, from request

Show the requested column, including units if any Quantities for items requested with custom units are initially blanks Quantities from items requested without a custom unit are initialized to the amount requested Items that were NOT from the request show "n/a" in the requested column

On edit, from request

Quantities for items requested, that are not included in the current distribution, are initialized to 0.
Show the requested column, including units if any. (even for the items that are not included in the current distribution) Item selection for requested items is frozen (i.e. only display the item name) Item selection for not-requested items is not frozen (should be like the current distribution, barcodes and all) may remove

N.B.

All of the changes for PACKS must be implemented behind a flipper flag "enable_packs"

Criteria for completion

Background

The following sections have been identified as required for the PACKS implementation. These should be implemented in numerical order.

Image