Merged PR 929: #2316 WK Gruppierung Fix

#2316 WK Gruppierung Fix
This commit is contained in:
Nino Righi
2021-10-21 16:02:03 +00:00
committed by Lorenz Hilpert
parent 8d26d94b9f
commit c0dec7729c

View File

@@ -50,13 +50,16 @@ export class CheckoutReviewComponent implements OnInit {
map((items) =>
items.reduce((grouped, item) => {
// let index = grouped.findIndex((g) => g?.orderType === item?.features?.orderType && g.destination?.id === item?.destination?.id);
let index = grouped.findIndex((g) => g?.orderType === item?.features?.orderType);
let index = grouped.findIndex((g) => g?.orderType === 'Dummy' || g?.orderType === item?.features?.orderType);
let group = index !== -1 ? grouped[index] : undefined;
group = {
orderType: item?.availability?.supplyChannel === 'MANUALLY' ? 'Dummy' : item.features.orderType,
destination: item.destination?.data,
items: [],
};
if (!group) {
group = {
orderType: item?.availability?.supplyChannel === 'MANUALLY' ? 'Dummy' : item.features.orderType,
destination: item.destination?.data,
items: [],
};
}
group.items = [...group.items, item]?.sort((a, b) => a.destination?.data?.targetBranch?.id - b.destination?.data?.targetBranch?.id);