<\/div>';$("#"+n).html(i);t.ItemsQrScan()});$("#chk_AllItems").unbind().click(function(){$("#chk_AllItems").is(":checked")?$(".variant-list").find(".chk_PurPlanItem").each(function(){let n=$(this).closest(".variant-item");n.find("#txt_Cartons").val()!=0&&n.find("#txt_Cartons").val()!=""&&(t.updateItemsArray(n,"PurPlan_AllItems",!1),$(n).find(".chk_PurPlanItem").prop("checked",!0))}):($(".variant-list").find(".chk_PurPlanItem").prop("checked",!1),t.g_CartItems_New=[],$("#ulOrder_Cart").find(".cartitem").remove(),$("#OverallOrderQuantity").text("0"),$("#totalOrderItems").text("0"))});$("#ItemLoadType").unbind().click(function(){$(".div_SearchItem").removeClass("floating-label-form-group-with-value")});$("#txt_SearchItem").focusout(function(){$("#txt_SearchItem").val()==""&&$("#txt_SearchItem").attr("placeholder","Search Items")})}loadControlSettings(){return null}loadPropertySettings(){return null}bindEditFormDetails(){return null}ItemsQrScan(){$("#crpnrd_btn_OpenScanner").addClass("hidden");isMobileApp()?($("#crpnrd_btn_OpenScanner").removeClass("hidden"),$("#crpnrd_btn_OpenScanner").click(function(){Unibase.Platform.Helpers.MobileHelper.Instance().openQrScanner("Bizgaze.Apps.Transact.Controls.OrderItems.Instance().readScanner","txt_SearchItem")})):$("#crpnrd_btn_OpenScanner").addClass("hidden")}loadItems(t,i,r,u,f,e=false){let o=this;t=="Offers"||t=="All Items"||t=="Filter"||t=="Eligible Items"||(t=encodeURIComponent(encodeURIComponent(t).replace("*","%2A").replace(".","%2E")).replace(/\%/g,"!"));(t==undefined||t=="")&&(t=" ");t=="Offers"?(o._estimate.g_LoadOffersOnly=!0,t="",o.g_IsFilterApplied&&(o.g_IsFilterApplied=!1,o.g_FilteredTags="",o.g_TagArray=[],n.Apps.Transact.Components.EstimateFilter.Instance().g_Tags="")):t=="All Items"?(o._estimate.g_LoadOffersOnly=!1,o.g_FilteredTags="",o.g_TagArray=[],n.Apps.Transact.Components.EstimateFilter.Instance().g_Tags="",t=""):t=="Filter"&&(o._estimate.g_LoadOffersOnly=!1);let c=o._estimate.g_PriceCodeId,s=i;s!=undefined||s!=""||(s=" ");o._estimate.g_EstimateTypeId==n.Apps.Transact.Enums.OrderType.SalesEstimate||o._estimate.g_EstimateTypeId==n.Apps.Transact.Enums.OrderType.SalesContract?o.g_WarehouseId=$(".txtAutoComplete_shipfromaddressid").val():(o._estimate.g_EstimateTypeId==n.Apps.Transact.Enums.OrderType.PurchaseEstimate||o._estimate.g_EstimateTypeId==n.Apps.Transact.Enums.OrderType.PurchaseContract)&&(o.g_WarehouseId=$(".txtAutoComplete_shippingaddressid").val());let h;t.replace(" ","")==""&&(t=null);Number(r)==0?($(".InventorySettings").empty(),$("#ulOrder_Cart").html('
<\/li> Your Shopping Cart is empty.<\/strong><\/li>')):o.fileCacheHelper.loadJsFile("apps/transact/managers/inventory/itemmanager.js",function(){o._estimate.g_IsLead&&(u=f);let l="0",a=10;o._estimate.g_IsFromPurchaseIndent&&(l="",o.g_CartItems_New.forEach(n=>{l+=n.ItemId+","}),l=l.replace(/,\s*$/,""),a=0,$(".section_Items").addClass("hidden"));let y={PriceCodeId:Number(c),ContactId:s,ShippingAddressId:Number(u),BranchId:Number(f),WareHouseId:Number(o.g_WarehouseId),LobId:Number(r),OrderType:o._estimate.g_EstimateTypeId,OfferOnly:o._estimate.g_LoadOffersOnly,IsExcise:o.g_IsExcise,SearchTerm:t,Page:o.g_PageIndex,IsCompositePrice:o.g_IsEnableCompositePrice,IsPiecePrice:o.g_IsEnablePiecePrice,IsCompositePiecePrice:o.g_IsEnableCompositePiecePrice,Rows:a,ItemId:l,CountryId:o._estimate.g_CountryId,ItemGroupId:0,Tags:n.Apps.Transact.Components.EstimateFilter.Instance().g_Tags},v=o._estimate.g_OrganizationId;v==0&&(v=o._estimate.g_OrgContactId);($("#ItemLoadType option:selected").text()!="Filter"||n.Apps.Transact.Components.EstimateFilter.Instance().g_Tags.length==0&&$("#ItemLoadType option:selected").text()=="Filter")&&n.Apps.Transact.Components.EstimateFilter.Instance().g_Tags.length==0&&$("#ItemLoadType option:selected").text()=="Filter"&&(o._estimate.g_LoadOffersOnly=!1);h=n.Apps.Transact.Managers.ItemManager.Instance().getVariantsForOrder(y);o.navigationHelper.showLoading();h.then(function(n){if(o.navigationHelper.hideLoading(),e?o.updateItemsAvailability(n.result):n.result.length>0?(o.itemPagination(n,i,r,u,f),o._estimate.g_IsFromPurchaseIndent?$("#btnDynamicSave").removeClass("hidden"):$("#btn_Checkout").removeClass("hidden"),o.g_CartItems_New.length==0&&$("#ulOrder_Cart").html('<\/li> Your Shopping Cart is empty.<\/strong><\/li>'),o.navigationHelper.hideLoading()):($(".div_titledetails").addClass("hidden"),o._estimate.g_LoadOffersOnly?$("#div_ItemList").html('Offer Items not found.<\/div><\/li><\/ul>'):$("#div_ItemList").html('
Items not found.<\/div><\/li><\/ul>')),o.g_CartItems_New.length==0&&o._estimate.g_IsFromPurchaseIndent){let n="Your Shopping Cart is empty.";o._estimate.g_IsFromPurchaseIndent&&(n="No Pending Purchase Indent Items.");$("#ulOrder_Cart").html('
- <\/li>
- '+n+"<\/strong><\/li>")}})})}itemPagination(n,t,i,r,u){let f=this;if(n.result.forEach(n=>{let t=f.g_LoadedItems.findIndex(t=>t.ItemId==n.ItemId);t==-1?f.g_LoadedItems.push(n):f.g_LoadedItems[t].TaxPercentList=n.TaxPercentList}),f.bindItemList(n.result),n.result.length<=10&&n.result.length!=0){$("#div_OrderItems_pagination").removeClass("hidden");$("#ItemsListPagination").removeClass("hidden");let e=n.result[0].TotalRecords,o=0,s=0,h=(f.g_PageIndex+1)*10;e>0&&(o=1,s=e);e>h&&(s=h);f.g_PageIndex>0&&(o+=h-10);let c=o+" - "+s+" of "+e;$("#lblItemTotalRecords").text(c);let l=$("#ItemsListPagination");l.pagination(n.result[0].TotalRecords,10,{items_per_page:10,callback:function(n){f.g_PageIndex=n;f.loadItems($("#txt_SearchItem").val(),t,i,r,u)},current_page:f.g_PageIndex})}else $("#lblItemTotalRecords").text(n.result.length),$("#ItemsListPagination").addClass("hidden")}bindItemList(t){let i=this,o=Number($(".txtAutoComplete_lobid").val()),s=Number($(".txtAutoComplete_billingaddressid").val()),h=Number($(".txtAutoComplete_branchid").val());if($("#div_ItemList").html('
- <\/li>'),t.length==0)return i._estimate.g_LoadOffersOnly?$(".variant-list").html('
Offer Items not found.<\/div><\/li><\/ul>'):$(".variant-list").html('
Items not found.<\/div><\/li><\/ul>'),$(".div_titledetails").addClass("hidden"),!1;$(".div_titledetails").removeClass("hidden");let u="ml-95",f="pl-75";i.g_BodyWidth>320&&i.g_BodyWidth<400&&(u="ml-45",f="pl-10");i.g_BodyWidth>400&&i.g_BodyWidth<470&&(u="ml-55",f="pl-25");i.g_BodyWidth>1300&&i.g_BodyWidth<=1600&&(u="ml-65",f="pl-55");for(let n=0;n
n.ItemId==o);if(f!=null){let n=$(".variant-item:last");i.updateItemsDesign(n,"BindItemList");f.Packs==0&&$(n).find(".txtOrder_ItemCount").val("");f.Pieces==0&&$(n).find(".txtOrder_ItemPieceCount").val("")}else $(u).find(".txtOrder_ItemCount").val(""),$(u).find(".txtOrder_ItemPieceCount").val("")}let e="";e=' Total : 0<\/span><\/span><\/div>