OLMIS-8244: Add packs-to-order preview hint#85
Open
michaldev0 wants to merge 1 commit into
Open
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


OLMIS-8244 — "Will be ordered as X pack(s)" preview hint
https://openlmis.atlassian.net/browse/OLMIS-8244
Companion to the backend fix OpenLMIS/openlmis-fulfillment#55,
which converts requisition-less order quantities from doses to packs at send. Because the entered
doses are rounded to whole packs on send, the user should see the result beforehand.
Change
openlmis-quantity-unit-inputnow renders a hint under the quantity input — e.g."Will be ordered as 2 pack(s) (168 doses)" — in both Doses and Packs input modes.
quantity-unit.service.js— addspacksToOrder(quantity, netContent, packRoundingThreshold, roundToZero), a JS port behaviourally identical to the backendOrderableDto.packsToOrder/canonical referencedata
Orderable#packsToOrder, so the preview matches what the backend stores.openlmis-quantity-unit-input.jsx—showPacksToOrderHintprop + memoised hint; hidden whennetContent === 1(nothing to round) or quantity is empty/zero.openlmisInputDosesPacks.willBeOrderedAsPacksand a small style for the hint.Tests
quantity-unit.service.spec.js(new) — 7 cases mirroring the backendOrderableDtoTestone-for-one (exact, round-up, round-down within threshold, sub-pack min-1, roundToZero, zero net
content, non-positive quantity).
E2E verified (live)
Hint correct across exact (252→3), round-up (130→2), round-down (100→1, 200→2, 90→1), sub-pack
min-1 (20→1); Packs mode (2 packs + 50 doses → 3); hidden for netContent=1 (Male Condom) and for
quantity 0/empty.