var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},itemList=[],customPricesList=[],pageIndex=0,page=0,Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends n.Platform.Core.BaseComponent{constructor(){super();this.containerid=""}AssignPriceValue(t,i,r,u){Number($(r).parents("tr").find(".priceValueId").val());$("#hfMrpId").val(t);$("#hfItemvalueid").val(i);n.Apps.Transact.Controls.CreatePriceList.Instance().navigationHelper.popup(i+"|"+t+"|"+r+"|"+u,"",n.Apps.Transact.Controls.CreatePriceValue.Instance(),null,n.Platform.Helpers.Size.Auto)}init(t){var o=`

Price List Items

There is no Data
`,i;$("#"+t).append(o);$("#AddLists").click(function(){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/createpricelistitem.js",function(){n.Apps.Transact.Controls.CreatePriceList.Instance().navigationHelper.popup(0,"",n.Apps.Transact.Controls.CreatePriceList.Instance(),null,n.Platform.Helpers.Size.ExtraLarge)})});$("#txtSearchPriceListItem").on("keyup",function(){window.clearTimeout(i);i=window.setTimeout(function(){var t=$("#txtSearchPriceListItem").val(),i,o;pageIndex=0;i=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value;o=n.Themes.Providers.Detail_Settings.Instance().InputParameters.find(t=>t.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid").Value;n.Apps.Transact.Controls.CreatePriceList.Instance().data(t,r,f,e,u,0)})});var s=encodeURIComponent(encodeURIComponent("")).replace(/\%/g,"!"),r=450,u='Item Name (SKU) <\/th>MRP<\/th>Excise<\/th>Excise %<\/th>List Price<\/th>',f="",e="";n.Apps.Transact.Controls.CreatePriceList.Instance().data(s,r,f,e,u,0)}data(t,i,r,u,f,e){t=t==""?null:t;n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/managers/pricelistmanager.js",function(){Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().getpricecodes(n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value).then(function(o){var s=JSON.parse(o.result);Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().EditPriceListItems(Number(n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value),0,e,t).then(function(o){var h,v,l,a,g,y,it,nt,tt;if(o.result=JSON.parse(o.result),o.result._rows.length==0)$("#conta").addClass("hidden"),$("#gridPager1").hide(),$("#records1").hide(),t==""||t==undefined?$(".searching,#export").hide():($("#tblPriceValuesData").addClass("hidden"),$(".searching").show());else{for($("#conta").removeClass("hidden"),o.result._totalRecords>10?($("#gridPager1").show(),$(".searching").show(),$("#records1").show()):($("#gridPager1").hide(),t==""||t==undefined?$(".searching").hide():$(".searching").show()),$(".divNoData").addClass("hidden"),$("#tblPriceValuesData").removeClass("hidden"),$("#export").show(),h=0;h'+s[h].PriceCodeName+"<\/th>",i+=100);for(h=0;h'+c.Cells[1]+" ("+c.Cells[7]+') <\/strong> <\/small> <\/span><\/div><\/td>'+c.Cells[4]+'<\/span><\/td>'+c.Cells[5]+'<\/span><\/td>'+c.Cells[8]+'<\/span><\/td>'+c.Cells[3]+"<\/span><\/td>",c.Cells[6]!=undefined)for(v=c.Cells[6].split(","),l=0;l'+Number(a)+"<\/span><\/td>");u=u+d+"<\/tr>"}if($("#tblPriceValuesData").html(f+r+"<\/tr><\/thead>"+u+"<\/tbody >"),o.result._totalRecords>10){it=0;$("#div_EstimateItems_pagination").removeClass("hidden");var p=o.result._totalRecords,w=0,b=0,k=(e-0)*10;p>0&&(w=1,b=p);p>k&&(b=k);e-1>0&&(w+=k-10);nt=w+" - "+b+" of "+o.result._totalRecords;$("#lblTotals1").text(nt);tt=$("#gridPager1");tt.pagination(o.result._totalRecords,10,{callback:function(r){n.Apps.Transact.Controls.CreatePriceList.Instance().data(t,i,"","",f,r+1);n.Apps.Transact.Controls.CreatePriceList.Instance().getPriceCodesByLob(n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value,n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value,r,"")},current_page:e-1})}else $("#lblTotals1").text(o.result._totalRecords);$("#records1").removeAttr("style")}$("#divPriceValuesContainer").removeClass("hidden")})})})}jsFiles(){return["platform/membership/managers/accountmanager.js","platform/analytics/providers/iviewersettings.js","apps/transact/controls/pricelist/createpricevalue.js","apps/transact/controls/pricelist/managers/pricelistmanager.js","libs/jquery/pagination/jquery.pagination.js"]}cssFiles(){return["platform/analytics/components/reportbuilder/style.reportbuilder.css"]}export_excel(){return __awaiter(this,void 0,void 0,function*(){yield n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/createpricelistitem.js",function(){return __awaiter(this,void 0,void 0,function*(){function u(){var n,r,u;t='';t=t+"";t=t+"Error Messages<\/x:Name>";t=t+"<\/x:Panes><\/x:WorksheetOptions><\/x:ExcelWorksheet>";t=t+"<\/x:ExcelWorksheets><\/x:ExcelWorkbook><\/xml><\/head>";t=t+"";t=t+$("#myModifiedTable").html();t=t+"<\/table><\/body><\/html>";i="data:application/vnd.ms-excel";n=window.navigator.userAgent;r=n.indexOf("MSIE ");r>0||!!navigator.userAgent.match(/Trident.*rv\:11\./)?window.navigator.msSaveBlob&&(u=new Blob([t],{type:"application/csv;charset=utf-8;"}),navigator.msSaveBlob(u,"Test file.xls")):(console.log(i),console.log(t),$("#testAnchor")[0].click());$("#MessageHolder").html("")}var r,t,i;$($("#testAnchor")[0]).click(function(){console.log(i);console.log(t);$("#testAnchor").attr("href",i+", "+encodeURIComponent(t));$("#testAnchor").attr("download",""+n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistname"})[0].Value+".xls")});r=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value;yield Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().getpricecodes(r).then(function(n){function t(n){for(var t='
"+c+"<\/tbody >"),$(".tree").removeAttr("disabled"),r._totalRecords>10){rt=0;$("#div_EstimateItems_pagination").removeClass("hidden");var y=r._totalRecords,p=0,w=0,b=(f+1)*10;y>0&&(p=1,w=y);y>b&&(w=b);f>0&&(p+=b-10);nt=p+" - "+w+" of "+r._totalRecords;$("#lblTotals").text("Total : "+nt);tt=$("#gridPager2");tt.pagination(r._totalRecords,10,{callback:function(t){n.Apps.Transact.Controls.CreatePriceList.Instance().getPriceCodesByLob(n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value,n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value,t,"")},current_page:f})}else $("#lblTotals").text("Total : "+r._totalRecords)}$("#divPriceValuesContainer").removeClass("hidden");$(".decimal_numerics1").keypress(function(n){if(n.charCode<46||n.charCode>58)return!1})}static Instance(){return this._instance===undefined&&(this._instance=new n.Apps.Transact.Controls.CreatePriceList),this._instance}}t.CreatePriceList=i})(i=t.Controls||(t.Controls={}))})(i=t.Transact||(t.Transact={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
ItemSku<\/b><\/td>ItemName (SKU)<\/b><\/td>ListPrice<\/b><\/td>Mrp<\/b><\/td>PriceListDate<\/b><\/td>PriceListName<\/b><\/td> ',i=0;i"+n[i].PriceCodeName+"<\/b><\/td>";t+="<\/tr><\/thead><\/table>";$("#MessageHolder").append(t)}t(JSON.parse(n.result))});u();i="data:application/vnd.ms-excel"})})})}html(){return`
`}load(t,i){var u=this,r;u.containerid=i;$("#btnCloseCreate").click(function(){var t;if($("#"+i).modal("hide"),$("#"+i).remove(),t=n.Themes.Providers.DetailHelper.installedAppId,t!=0){var e=n.Themes.Compact.Components.Details.Instance().unibase_core_activeportletid,f=n.Platform.Helpers.NavigationHelper.ModalContainerIds,o=f[f.length-1];n.Themes.Compact.Components.Details.Instance().loadWidgets(t,e,"#"+o);var r=n.Themes.Compact.Components.Details.Instance(),s="#"+r._containerId,u=n.Themes.Compact.Components.Details.Instance();u._recordId=Number(n.Themes.Providers.Detail_Settings.Instance().InputParameters.find(t=>t.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_recordid").Value);u._installedAppId=n.Themes.Providers.DetailHelper.installedAppId;r.loadAppDefaultWidget(u,s,r._containerId,function(){})}});$("#export").click(function(){n.Apps.Transact.Controls.CreatePriceList.Instance().exportList(n.Themes.Providers.Detail_Settings.Instance().InputParameters.find(t=>t.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid").Value)});n.Apps.Transact.Controls.CreatePriceList.Instance().editPriceList(0,2,"");$("#txtSearchPriceListItem1").on("keyup",function(){clearTimeout(r);r=setTimeout(function(){var r=$("#txtSearchPriceListItem1").val(),t,i;pageIndex=0;t=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value;i=n.Themes.Providers.Detail_Settings.Instance().InputParameters.find(t=>t.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid").Value;n.Apps.Transact.Controls.CreatePriceList.Instance().getPriceCodesByLob(i,t,0,r)},300)})}getPriceCodesByLob(t,i,r,u){u=u==""?null:u;t=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value;i=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value;Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().getpricecodes(t).then(function(t){Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().EditPriceListItems(i,0,r,u).then(function(f){n.Apps.Transact.Controls.CreatePriceList.Instance().refreshPriceValues(i,u,JSON.parse(f.result),JSON.parse(t.result),r)})})}getPriceValues(t){if(t.find(".priceValueId").val()!=undefined){var e=Number(t.find(".hflistPrice").val()),i=Number(t.find(".hfMrp").val()),o=Number(t.find(".hfExcise").val()),s=Number(t.find(".hfExcisePercent").val()),r=Number(t.find(".listPrice").val()),h=Number(t.find(".Mrp").val()),u=Number(t.find(".excise").val()),f=Number(t.find(".excisePercent").val());(e!=r||i!=h||o!=u||s!=f)&&itemList.push({PriceValueId:Number(t.find(".priceValueId").val()),ItemId:Number(t.find(".ItemId").val()),MrpId:Number(t.find(".MrpId").val()),ListPrice:r,Mrp:i,Excise:u,ExcisePercent:f})}itemList.length!=0&&n.Apps.Transact.Controls.CreatePriceList.Instance().savechanges()}savechanges(){var t=this,i,r;t.navigationHelper.showLoading();$(".tree").attr("disabled");i=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_averageprice"})[0].Value.toString()=="[object Object]"?0:n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_averageprice"})[0].Value;r={PriceListId:n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value,PriceListName:n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistname"})[0].Value,AveragePrice:i,LobId:n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value,PriceValues:itemList,CustomPrices:customPricesList};Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().postdatafilter(r).then(function(){t.navigationHelper.hideLoading();itemList=[];customPricesList=[];var i=$("#txtSearchPriceListItem1").val();n.Apps.Transact.Controls.CreatePriceList.Instance().getPriceCodesByLob(n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value,n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_lobid"})[0].Value,Number($("#gridPager2").find(".pagination").find(".active").text())-1,i)})}getCustomPriceValues(t){var e=n.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function(t){return t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid"})[0].Value,i,f,u;if(t.find(".priceValueId").val()!=undefined){var o=Number(t.find(".ItemId").val()),s=t.find(".MrpId").val(),r=t.find($(".PriceCodePrices")),h=t.find($(".hfPriceCodePrices"));for(i=0;it.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_pricelistid").Value;var i=this;n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/createpricelistitem.js",function(){Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().exportList(t).then(function(n){window.location.href=_appsettings.asset_url()+n.result.FullName})})}refreshPriceValues(t,i,r,u,f){var h,e,l,s,o,a,v,g,rt,nt,tt;h=u;i=encodeURIComponent(encodeURIComponent(i)).replace(/\%/g,"!");var it=450,k="",c="";if($("#divPriceValuesContainer").addClass("hidden"),r._rows.length==0)$(".divNoData1").removeClass("hidden"),$(".table-cont").addClass("hidden"),$("#gridPager2").hide(),$("#records").hide(),i==""||i==undefined?$(".searching1").hide():($("#tblPriceValues").addClass("hidden"),$(".searching1").show());else{for(r._totalRecords>10?($("#gridPager2").show(),$(".searching1").show(),$("#records").show()):($("#gridPager2").hide(),i==""||i==undefined?$(".searching1").hide():$(".searching1").show()),$(".divNoData1").addClass("hidden"),$("#tblPriceValues").removeClass("hidden"),e=0;e'+u[e].PriceCodeName+"<\/a> <\/th>",it+=50;for(e=0;e
'+u.Cells[1]+" ("+u.Cells[7]+') <\/strong> <\/small> <\/label><\/div><\/td>'+u.Cells[4]+'<\/a><\/span><\/td><\/td>',u.Cells[6]!=undefined)for(l=u.Cells[6].split(","),s=0;s<\/td>';c=c+d+"<\/tr>"}if(g=$(".tblItems"),g.find(".pricecodeName-link_new").click(function(){}),$("#club_plan_table").html('