Advertisement
vitareinforce

Extract isi bundle

Aug 25th, 2020 (edited)
1,202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for(var i = 0; i < data.length; i++) {
  2.             result.push(data[i])
  3.             if(data[i].Approval == 1) {
  4.                 if(data[i].inventory_branch.inventory.IsBundle == 1) {
  5.                     // cek bundle id
  6.                     let itemBranchId = data[i].inventory_branch.Id
  7.                     // get bundle id dr item branch id                    
  8.                     Bundles.searchByItemId(itemBranchId).then(function (bundleData) {
  9.                         // extract item details
  10.                         ItemDetails.findbymodule("Bundle", bundleData.data.Id).then(function (itemdetailsrequest) {
  11.                             let itemdetails = itemdetailsrequest.data
  12.                             // kasih tag IsBundle = 1 di setiap item hasil extractnya
  13.                             for(var j = 0; j < itemdetails.length; j++) {
  14.                                 let itemextrackan = itemdetails[j]
  15.                                 itemextrackan.Code = "EXT/" + itemextrackan.Code
  16.                                 itemextrackan.IsBundle = 1
  17.                                 // push isi item details
  18.                                 console.log(itemextrackan)
  19.                                 result.push(itemextrackan)
  20.                             }
  21.                         })
  22.                     })
  23.                 }
  24.             }
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement