Adugna Worku

I would prefer the original way

I would prefer the original way

Nikodem Graczewski There is something tricky here. Array.prototype.flatMap() works on chrome version >=69 Unfortunately my virtual machine Chrome version is 66. And flatMap is not supported. That...

Nikodem Graczewski There is something tricky here.

Array.prototype.flatMap() works on chrome version >=69

Unfortunately my virtual machine Chrome version is 66. And flatMap is not supported. That was the reason i was saying its not working.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap

So changing to flatMap won't that create a problem?

// Real lineItem JSON objectvar lineItems =[{"$errors":{"quantityInvalid":false,"occurredDateInvalid":false},"$previewSOH":99,"stockCard":{"id":"e4cd8e1a-8f3c-48d4-891c-fa5160832005","href":"https:...
// Real lineItem JSON object
var lineItems =[{"$errors":{"quantityInvalid":false,"occurredDateInvalid":false},"$previewSOH":99,"stockCard":{"id":"e4cd8e1a-8f3c-48d4-891c-fa5160832005","href":"https://uat.openlmis.org/api/stockCards/e4cd8e1a-8f3c-48d4-891c-fa5160832005"},"orderable":{"productCode":"C118","dispensable":{"dispensingUnit":"10 tab strip","displayUnit":"10 tab strip"},"fullProductName":"Stomachica","description":"Product description goes here.","netContent":1,"packRoundingThreshold":0,"roundToZero":false,"programs":[{"programId":"dce17f2e-af3e-40ad-8e00-3496adef44c3","orderableDisplayCategoryId":"15b8ef1f-a5d6-42dd-95bf-bb68a4504e82","orderableCategoryDisplayName":"Oral contraceptive","orderableCategoryDisplayOrder":6,"active":true,"fullSupply":true,"displayOrder":3,"dosesPerPatient":1,"pricePerPack":5.1}],"children":[{"orderable":{"id":"25665e10-cca7-44c0-b508-e95600d8fb99"},"quantity":10},{"orderable":{"id":"d4dbd20e-8ce2-480e-a019-4a90d115719c"},"quantity":20}],"identifiers":{},"extraData":{},"meta":{"lastUpdated":"2019-04-15T00:55:18.564Z[GMT]","versionId":"2"},"id":"0dc9c1ad-2266-4fb3-ad74-993c38b8c28a"},"lot":null,"stockOnHand":99,"processedDate":"2019-04-15T00:57:46.158Z","occurredDate":"2019-04-15","displayLotMessage":"Product has no lots","reason":{"name":"Unpack Kit","description":null,"reasonType":"DEBIT","reasonCategory":"AGGREGATION","isFreeTextAllowed":false,"tags":["consumed"],"id":"9b4b653a-f319-4a1b-bb80-8d6b4dd6cc12","creditReasonType":false,"debitReasonType":true,"adjustmentReasonCategory":false},"reasonFreeText":null,"quantity":2}];

lineItems.flatMap(function(lineItem) {
    return lineItem.orderable.children.map(function(constituent) {
        return _.extend({}, constituent, {
            reason: creditReason,
            occurredDate: lineItem.occurredDate,
            quantity: lineItem.quantity * constituent.quantity
        });
    })
});
OLMIS-6113 : Create UI for kit unpacking in stock management
OLMIS-6113 : Create UI for kit unpacking in stock management
This doesn't return object in a desired format. I will stick with the existing implementation

This doesn't return object in a desired format. I will stick with the existing implementation

What do i update in reference-ui to be precise?

What do i update in reference-ui to be precise?

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

The message is correct but the key can't be changed this time, since Issue, Receive and Upack share similar keys for the message since they use the same html template

ditto

ditto

Issue, receive and unpack pages uses a single html view but separate message files. The prefix of the message key is up-to the page that will be rendered but the suffix is already hard coded in the...

Issue, receive and unpack pages uses a single html view but separate message files. The prefix of the message key is up-to the page that will be rendered but the suffix is already hard coded in the html file.

So in this case the message value is appropriate but the key is not. changing the key required all the message to be changed in the other modules also. So this implementation shall be refactored for the future but till then the html file is our guide.

Take a look at stock-adjustment/stock-adjustment.html

Sure

Sure

This piece of code will return a random reason No. when the unpack reason view loaded, take a look at unpack-kit-creation.routes.js line 78. Method returns ONLY two reasons of type AGGREGATION. T...

This piece of code will return a random reason


No. when the unpack reason view loaded, take a look at unpack-kit-creation.routes.js line 78. Method returns ONLY two reasons of type AGGREGATION. They are -
1. Kit Unpack (DEBIT)
2. Unpacked From Kit (CREDIT).

So we will use Unpacked From Kit (CREDIT) reason for the constituent line item

Testing a nested child state with the $location.url(url) is not working and doesn't return the proper state object. Example:- lets say openlmis.stockmanagement.kitunpack is a parent state and open...

Testing a nested child state with the $location.url(url) is not working and doesn't return the proper state object.

Example:-
lets say openlmis.stockmanagement.kitunpack is a parent state and openlmis.stockmanagement.kitunpack.creation is a child state. Using $location.url(url) to change the view with the route URL for the parent state works well. $state object will be returned filled with proper values.

But following the same way for the child state, it yields an empty $state. I have researched before and also used $state.go(''state name') which doesn't work
and $state.current object will be empty. I could't find a reference spec in our repos. I will try to figure out how to test child state but please advice if there is any reference in our repos.

I didn't understood well what you mean by "Facility Return" but we need the CREDIT type reason here. During unpacking, the Kit will be DEBITED from SOH and Kit constituents SOH amount will be CREDI...

I didn't understood well what you mean by "Facility Return" but we need the CREDIT type reason here. During unpacking, the Kit will be DEBITED from SOH and Kit constituents SOH amount will be CREDITED. Kit line item comes from the UI and constituent line item will be generated here with reason type CREDIT.

I am not sure how we can use it here. But her we want to generate new Array objects by accessing a second level depth array of other object with our reducing anything. You can advise me on this.

I am not sure how we can use it here.

But her we want to generate new Array objects by accessing a second level depth array of other object with our reducing anything.

You can advise me on this.

adjustment-creation.controller is shared by - Issue, Receive and Unpack pages. the current method will be executed when the operation is kit unpacking. N.B During unpacking, the user just add the ...

adjustment-creation.controller is shared by - Issue, Receive and Unpack pages. the current method will be executed when the operation is kit unpacking.

N.B During unpacking, the user just add the kit as a line item on the view (table) and since we know the corresponding constituents we generate them behind the scene among with a proper unpacked quantity for each constituent when we finally submit the data.

vm.addedLineItem is an object Which is bound with the table in the view. If the data transformation, generating kit constituents, is done on this object unnecessary and confusing change will be dis...

vm.addedLineItem is an object Which is bound with the table in the view. If the data transformation, generating kit constituents, is done on this object unnecessary and confusing change will be displayed in the view.

Do we have an example implementation in our repo? Pls point me if so not sure how to implement this.

Do we have an example implementation in our repo? Pls point me if so not sure how to implement this.

The reason is as i have illustrated below. Push adds the second argument (array) in to the first one as a single element. But when push.apply is used each element of the array we want to append wil...

The reason is as i have illustrated below. Push adds the second argument (array) in to the first one as a single element. But when push.apply is used each element of the array we want to append will be added individually. Performance wise its better that `Array.prototype.concat`
a = [a, b];
b = [c,d];

a.push(a, b); // [a, b, [c,d] ];
a.push.apply(a,b) // [a,b,c,d];

OLMIS-6052: Create a UI for managing kit unpack list in product page
OLMIS-6052: Create a UI for managing kit unpack list in product page
OLMIS-5886 : Add `Additional quantity required` column in Requisition print
OLMIS-5886 : Add `Additional quantity required` column in Requisition print