marketplacepos 3.15.1 → 3.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Marketplace/{chunk-TRGFX3AD.js → chunk-2DXLUQ37.js} +1 -1
- package/Marketplace/{chunk-AMUX4WZH.js → chunk-2H6RTUI7.js} +1 -1
- package/Marketplace/{chunk-BV6WKJBP.js → chunk-377T6MRS.js} +1 -1
- package/Marketplace/{chunk-JSPMPN5T.js → chunk-3LFPRLIN.js} +1 -1
- package/Marketplace/{chunk-IG2LDANH.js → chunk-6UIEOJ5F.js} +1 -1
- package/Marketplace/{chunk-2NRYBLX2.js → chunk-AMJOGMUP.js} +1 -1
- package/Marketplace/{chunk-GOR2LPT5.js → chunk-BIJUW2YT.js} +1 -1
- package/Marketplace/{chunk-PUC6ODUE.js → chunk-CMEYJNG2.js} +1 -1
- package/Marketplace/{chunk-W5TR3NDM.js → chunk-E7OT7R3Z.js} +1 -1
- package/Marketplace/{chunk-WDY3SIUY.js → chunk-FACXOOME.js} +1 -1
- package/Marketplace/{chunk-PYCM3S43.js → chunk-G42YVZDB.js} +1 -1
- package/Marketplace/{chunk-4HOIRUEO.js → chunk-GHRADKBY.js} +1 -1
- package/Marketplace/{chunk-3I25MNEJ.js → chunk-GS4AHG4Z.js} +1 -1
- package/Marketplace/{chunk-UJL2GLHS.js → chunk-K2RTDCYM.js} +1 -1
- package/Marketplace/{chunk-OR4XOUSV.js → chunk-LCVHYD7R.js} +1 -1
- package/Marketplace/{chunk-5NDG3SUM.js → chunk-O4KD2NHK.js} +1 -1
- package/Marketplace/{chunk-QITW54IW.js → chunk-OML53I6I.js} +1 -1
- package/Marketplace/{chunk-G7GU37FJ.js → chunk-QWBRNEPW.js} +1 -1
- package/Marketplace/{chunk-B4SCNDB5.js → chunk-QWWHTKOD.js} +1 -1
- package/Marketplace/{chunk-WRS54BQ7.js → chunk-VRWHBZNB.js} +1 -1
- package/Marketplace/{chunk-OCG3HG72.js → chunk-VUAE4ACL.js} +1 -1
- package/Marketplace/{chunk-RER2OLD4.js → chunk-XB2E6KQY.js} +1 -1
- package/Marketplace/{chunk-JQZFTRSI.js → chunk-YDHKWEGR.js} +1 -1
- package/Marketplace/{chunk-TLKDYQBN.js → chunk-ZSVDUB3D.js} +1 -1
- package/Marketplace/{chunk-K4IJAE56.js → chunk-ZYS3QD4F.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-XF2FUSJ6.js → main-5VBEV3KS.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as c}from"./chunk-
|
|
1
|
+
import{g as c}from"./chunk-OML53I6I.js";import{b as a}from"./chunk-AAFEUTPF.js";import{$ as s,ca as o}from"./chunk-HSFUKC7R.js";var d=(()=>{let e=class e{constructor(i,t){this.toastr=i,this.authService=t}canActivate(i,t){let n=JSON.parse(window.localStorage.getItem("user")),l=new Date;if(n!=null){let p=new Date(n.Token.expiredAt);return l<p?!0:(this.onTokenExpired(),!1)}else return this.onTokenExpired(),!1}onTokenExpired(){this.toastr.error("Your session has expired. Please login again.","Session Expired").onShown.subscribe(()=>this.authService.logout())}};e.\u0275fac=function(t){return new(t||e)(o(a),o(c))},e.\u0275prov=s({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R}from"./chunk-6NFPCNPI.js";import{a as Q}from"./chunk-XHAXYWZ7.js";import{a as Ve,b as De,c as $}from"./chunk-VVKIT2K2.js";import"./chunk-BVIRHZTZ.js";import{b as Ee}from"./chunk-RXDUUYMX.js";import{a as Me}from"./chunk-GP6U42SV.js";import{a as Pe,b as Fe}from"./chunk-O5FN3DLG.js";import{a as be}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as Te}from"./chunk-C62XLEFW.js";import"./chunk-6NTRXLMW.js";import{a as ge,b as Ce,d as he,e as xe}from"./chunk-Y27IE54D.js";import{g as ue}from"./chunk-QITW54IW.js";import{b as ce,e as _e}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{d as ve,k as ye,l as Ie,m as we}from"./chunk-UUNZHJ6W.js";import{t as fe,u as Se}from"./chunk-CTKEWRX4.js";import"./chunk-GXHE2CDH.js";import{b as ae,c as le,h as re,l as se,n as pe,y as me}from"./chunk-QOA24ZLA.js";import{c as D,f as de}from"./chunk-2AMEIUWK.js";import{$a as c,$b as S,Ac as ne,B as z,Cc as ie,Dc as oe,Ha as F,Hb as O,Ia as s,Ib as m,Ja as T,Jb as V,Kb as P,Mb as I,Nb as w,Ob as b,Pb as Z,Q as G,Qb as q,Sb as k,X as B,Za as u,_b as C,ac as N,bc as U,da as H,ga as Y,gb as y,hb as L,jb as A,kb as W,lb as a,mb as r,nb as x,oa as _,ob as M,pa as d,pb as E,rb as v,tc as X,ub as f,vc as J,wb as l,wc as ee,zb as K,zc as te}from"./chunk-HSFUKC7R.js";import"./chunk-GNOSNGXM.js";var Re=n=>({"text-decoration-line-through":n}),Be=n=>({"ms-10":n}),Le=n=>({"bg-gradient-warning":n});function Ae(n,p){if(n&1){let e=v();a(0,"button",39),f("click",function(){_(e);let t=l().ngIf,o=l(2);return d(o.updateStock(t))}),x(1,"i",40),m(2," Update "),r()}}function We(n,p){if(n&1){let e=v();a(0,"div"),u(1,Ae,3,0,"button",36),a(2,"button",37),f("click",function(){_(e);let t=l(2);return d(t.openExportDialog())}),x(3,"i",38),a(4,"span"),m(5,"Export"),r()()()}if(n&2){let e=p.ngIf,i=l(2);s(),c("ngIf",i.productService.hasSelectionVariant(e))}}function Oe(n,p){if(n&1&&(a(0,"span",41),x(1,"img",42),r(),m(2)),n&2){let e=p.item;s(),c("src",e==null?null:e.Img,F),s(),P(" ",e.Name," ")}}function Ue(n,p){n&1&&(a(0,"div",43)(1,"span"),m(2," showing only different stock, please press next to populate more data "),r()())}function $e(n,p){if(n&1){let e=v();a(0,"th")(1,"input",44),b("ngModelChange",function(t){_(e);let o=l(2);return w(o.checkboxState,t)||(o.checkboxState=t),d(t)}),f("ngModelChange",function(){let t=_(e).ngIf,o=l(2);return d(o.onCheckboxStateChange(t))}),r()()}if(n&2){let e=l(2);s(),I("ngModel",e.checkboxState)}}function Qe(n,p){n&1&&(a(0,"th",33),m(1," Reserved "),r())}function je(n,p){}function ze(n,p){if(n&1){let e=v();a(0,"input",63),b("ngModelChange",function(t){_(e);let o=l(3).$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),f("ngModelChange",function(){_(e);let t=l(3).$implicit,o=l(2);return d(o.onCheckboxStateProduct(t))}),r()}if(n&2){let e=l(3).$implicit;I("ngModel",e.selected)}}function Ge(n,p){if(n&1){let e=v();a(0,"img",64),f("click",function(t){_(e);let o=l(3).$implicit,h=l(2);return d(h.onZoomImage(t,o==null?null:o.ImageUrl))}),r()}if(n&2){let e=l(3).$implicit;K("src",e==null?null:e.ThumbnailUrl,F)}}function He(n,p){n&1&&x(0,"img",60)}function Ye(n,p){if(n&1&&(x(0,"br"),a(1,"div",65),x(2,"i",66),a(3,"small"),m(4),r()()),n&2){let e=l(3).$implicit;s(4),P("(",e==null?null:e.Category,")")}}function Ke(n,p){if(n&1&&(a(0,"td",56)(1,"div",15),u(2,ze,1,1,"input",57),a(3,"div",58),u(4,Ge,1,1,"img",59)(5,He,1,0,"img",60),r()()(),a(6,"td",61)(7,"span",62),m(8),r(),u(9,Ye,5,1),r()),n&2){let e=l(2).$implicit,i=l(2);c("rowSpan",e==null?null:e.Variants.length),s(2),y(e.Variants.length>1?2:-1),s(),c("ngClass",k(7,Be,e.Variants.length<=1)),s(),y(e!=null&&e.ThumbnailUrl?4:5),s(2),c("rowSpan",e==null?null:e.Variants.length),s(2),V(e==null?null:e.Name),s(),y(e.CategoryID!==null&&e.CategoryID!=i.guidEmpty?9:-1)}}function Ze(n,p){if(n&1){let e=v();a(0,"input",44),b("ngModelChange",function(t){_(e);let o=l(2).$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),r()}if(n&2){let e=l(2).$implicit;I("ngModel",e.selected)}}function qe(n,p){if(n&1&&u(0,Ze,1,1,"input",50),n&2){let e=l().$implicit;y((e==null?null:e.Inventory)<=1e5?0:-1)}}function Xe(n,p){if(n&1){let e=v();a(0,"input",44),b("ngModelChange",function(t){_(e);let o=l().$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),r()}if(n&2){let e=l().$implicit;I("ngModel",e.selected)}}function Je(n,p){n&1&&(a(0,"div",67),m(1," Not Found "),r())}function et(n,p){if(n&1&&(a(0,"div")(1,"span",68),m(2),C(3,"number"),r(),m(4," => "),a(5,"span",69),m(6),C(7,"number"),r()()),n&2){let e=l().$implicit;s(2),P(" ",S(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),V(S(7,4,e==null?null:e.Inventory))}}function tt(n,p){if(n&1&&(m(0),C(1,"number")),n&2){let e=l().$implicit;P(" ",S(1,1,e==null?null:e.Inventory)," ")}}function nt(n,p){if(n&1&&(M(0),a(1,"div",70)(2,"a",71),x(3,"i",72),r()(),E()),n&2){let e=l().$implicit,i=l(3);s(2),c("href",i.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),F)}}function it(n,p){if(n&1){let e=v();a(0,"span",77),f("click",function(){let t=_(e).ngIf,o=l(2).$implicit,h=l().$implicit,g=l(2);return d(g.openTableDialog(h,o,t))}),m(1),C(2,"number"),r()}if(n&2){let e=l(2).$implicit;s(),P(" ",S(2,1,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," ")}}function ot(n,p){if(n&1){let e=v();a(0,"td",73)(1,"div",51)(2,"div"),u(3,it,3,3,"span",74),C(4,"async"),r(),a(5,"div",70)(6,"a",71),x(7,"i",72),r()(),a(8,"div",70)(9,"span",75),f("click",function(){_(e);let t=l().$implicit,o=l(3);return d(o.refreshInventory(t==null||t.Channel[0]==null?null:t.Channel[0].ChannelItemID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelVariationID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelID,t==null?null:t.ID))}),x(10,"i",76),r()()()()}if(n&2){let e=l().$implicit,i=l(3);c("ngClass",k(5,Le,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(3),c("ngIf",S(4,3,i.products$)),s(3),c("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,F)}}function at(n,p){if(n&1&&(M(0),a(1,"span",78),m(2),C(3,"number"),r(),E()),n&2){let e=l(2).$implicit;s(2),P(" (",S(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function lt(n,p){n&1&&m(0," - ")}function rt(n,p){if(n&1&&(M(0),a(1,"td",47),u(2,at,4,3,"ng-container",55)(3,lt,1,0,"ng-template",null,1,U),r(),E()),n&2){let e=O(4),i=l().$implicit;s(2),c("ngIf",i==null||i.Channel[0]==null?null:i.Channel[0].InventoryReserved)("ngIfElse",e)}}function st(n,p){n&1&&(M(0),m(1," - "),E())}function pt(n,p){if(n&1&&(a(0,"span",79),C(1,"date"),m(2),C(3,"date"),r()),n&2){let e=l().$implicit;c("matTooltip",N(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),P(" ",N(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}function mt(n,p){if(n&1&&(a(0,"tr"),u(1,Ke,10,9),a(2,"td",46),m(3),r(),a(4,"td",47)(5,"span",48),m(6),r()(),a(7,"td",49),u(8,qe,1,1)(9,Xe,1,1,"input",50),r(),a(10,"td")(11,"div",51),u(12,Je,2,0,"div",52)(13,et,8,6,"div")(14,tt,2,3)(15,nt,4,1,"ng-container",5),r()(),u(16,ot,11,7,"td",53)(17,rt,5,2,"ng-container",5),a(18,"td",54),u(19,st,2,0,"ng-container",55)(20,pt,4,8,"ng-template",null,0,U),r()()),n&2){let e=p.$implicit,i=p.index,t=O(21),o=l(3);s(),y(i==0?1:-1),s(2),V(e==null?null:e.Model),s(2),c("matTooltip",e.Discontinued?o.discontinuedVariantMsg:"")("ngClass",k(14,Re,e.Discontinued)),s(),V(e==null?null:e.Code),s(2),y((e==null?null:e.Channel[0].TypeID)==1?8:(e==null?null:e.Inventory)>=0?9:-1),s(4),c("ngIf",(e==null?null:e.I)==null),s(),y((e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)?13:-1),s(),y((e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)?14:-1),s(),c("ngIf",(e==null?null:e.I)!=null),s(),c("ngIf",e==null?null:e.Channel),s(),c("ngIf",o.isShowReservedColumn),s(2),c("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==o.minDate)("ngIfElse",t)}}function ct(n,p){if(n&1&&(a(0,"tbody"),A(1,je,0,0,null,null,L),u(3,mt,22,16,"tr",45),r()),n&2){let e=p.$implicit;s(),W(e.Variants),s(2),c("ngForOf",e.Variants)}}function _t(n,p){if(n&1){let e=v();a(0,"mainpanel",3),f("onSubmit",function(t){_(e);let o=l();return d(o.onSearch(t))}),a(1,"actions")(2,"div",4),u(3,We,6,1,"div",5),C(4,"async"),r()(),a(5,"filters")(6,"div")(7,"label",6),m(8,"Channel"),r(),a(9,"ng-select",7),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.ChannelID,t)||(o.searchFilter.ChannelID=t),d(t)}),u(10,Oe,3,2,"ng-template",8),r()(),a(11,"div",9)(12,"label",10),m(13,"PageNumber"),r(),a(14,"input",11),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.PageNumber,t)||(o.searchFilter.PageNumber=t),d(t)}),r()(),a(15,"div",9)(16,"label",12),m(17,"Page Size"),r(),a(18,"input",13),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.RowCount,t)||(o.searchFilter.RowCount=t),d(t)}),r()(),a(19,"div",9)(20,"label",14),m(21,"Quantity From - To"),r(),a(22,"div",15)(23,"input",16),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.QuantityFrom,t)||(o.searchFilter.QuantityFrom=t),d(t)}),r(),m(24," - "),a(25,"input",17),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.QuantityTo,t)||(o.searchFilter.QuantityTo=t),d(t)}),r()()()(),a(26,"content")(27,"div",18)(28,"div",19)(29,"div",20),u(30,Ue,3,0,"div",21),a(31,"table",22)(32,"thead",23)(33,"tr")(34,"th",24),m(35," Product "),x(36,"br"),a(37,"mat-slide-toggle",25),f("toggleChange",function(){_(e);let t=l();return t.showDifferenceStock=!t.showDifferenceStock,d(t.onShowDifferenceStock())}),a(38,"small",14),m(39,"FILTER DIFFERENT INVENTORY"),r()()(),a(40,"th",26),m(41,"Variant"),r(),a(42,"th",27),m(43,"SKU"),r(),u(44,$e,2,1,"th",5),C(45,"async"),a(46,"th",28),m(47,"POS"),r(),a(48,"th",29)(49,"div",30),f("click",function(){_(e);let t=l();return d(t.openModalFilter())}),x(50,"img",31),a(51,"span",32),m(52),C(53,"stringLimit"),r()()(),u(54,Qe,2,0,"th",33),a(55,"th",34),m(56,"Last Sync"),r()()(),A(57,ct,4,1,"tbody",null,L),C(59,"async"),r(),a(60,"infinite-paginator",35),C(61,"async"),f("onNextPage",function(){_(e);let t=l();return d(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){_(e);let t=l();return d(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){_(e);let t=l();return d(t.infinitePagination.getRowCount(t.searchFilter))}),r()()()()()()}if(n&2){let e=l();c("headerTitle","Inventory Comparison")("pageData",e.pageData)("hideSearchBox",!1),s(3),c("ngIf",S(4,23,e.products$)),s(6),c("clearable",!1)("items",e.channelOptions),I("ngModel",e.searchFilter.ChannelID),s(5),I("ngModel",e.searchFilter.PageNumber),s(4),I("ngModel",e.searchFilter.RowCount),s(5),I("ngModel",e.searchFilter.QuantityFrom),s(2),I("ngModel",e.searchFilter.QuantityTo),s(5),c("ngIf",(e.searchFilter==null?null:e.searchFilter.filterModel)==3),s(14),c("ngIf",S(45,25,e.products$)),s(5),c("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>13?e.selectedChannel==null?null:e.selectedChannel.Name:""),s(),c("src",e.selectedChannel==null?null:e.selectedChannel.Img,F),s(2),P(" ",N(53,27,e.selectedChannel==null?null:e.selectedChannel.Name,13)," "),s(2),y(e.isShowReservedColumn?54:-1),s(3),W(S(59,30,e.products$)),s(3),c("totalData",e.infinitePagination.totalData())("hideCount",e.infinitePagination.hideCount())("rowCount",S(61,32,e.infinitePagination.totalRowCount$))("pageNumber",e.infinitePagination.pageNumber())("disableNextButton",e.infinitePagination.disableNextButton())("goToLastPage",e.infinitePagination.isLastPage())}}var Ht=(()=>{let p=class p{constructor(i,t,o,h,g,j,ke,Ne){this.http=i,this.toastr=t,this.dialog=o,this.productService=h,this.authService=g,this.biggerPictureService=j,this.inventoryService=ke,this.mainPanelService=Ne,this.infinitePagination=H($),this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="InventoryLoader/Load",this.fetchApi="Inventory/GetSingleChannelComparison",this.rowCountApi="Inventory/GetInventoryByChannelRowCount",this.minDate=D.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=D.GuidEMpty,this.Options=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.infinitePagination.data$.pipe(B(i=>{this.checkShowReservedColumn(i)}),G())}checkShowReservedColumn(i){let t=0,o;i.forEach(h=>{o=h.Variants.find(g=>D.IsNotEmpty(g?.Channel[0]?.InventoryReserved)),o&&(t+=1)}),this.isShowReservedColumn=t>0}initPageLoader(){this.infinitePagination.fetchDataEndpoint=this.fetchApi,this.infinitePagination.fethRowCountEndpoint=this.rowCountApi,this.loader$=this.http.post(`/api/${this.loaderApi}`,{}).pipe(B(i=>{this.searchFilter={RowCount:i.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:i.Filter.ChannelID},this.initSelectedChannel(),this.infinitePagination.reloadPagination(this.searchFilter),this.showToastrMarketplaceInactive(!i.Filter.IsMarketplaceAppActive)}))}showToastrMarketplaceInactive(i){i&&this.toastr.warning(`Automatic inventory sync disabled.
|
|
1
|
+
import{a as R}from"./chunk-6NFPCNPI.js";import{a as Q}from"./chunk-XHAXYWZ7.js";import{a as Ve,b as De,c as $}from"./chunk-VVKIT2K2.js";import"./chunk-BVIRHZTZ.js";import{b as Ee}from"./chunk-RXDUUYMX.js";import{a as Me}from"./chunk-GP6U42SV.js";import{a as Pe,b as Fe}from"./chunk-O5FN3DLG.js";import{a as be}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as Te}from"./chunk-C62XLEFW.js";import"./chunk-6NTRXLMW.js";import{a as ge,b as Ce,d as he,e as xe}from"./chunk-Y27IE54D.js";import{g as ue}from"./chunk-OML53I6I.js";import{b as ce,e as _e}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{d as ve,k as ye,l as Ie,m as we}from"./chunk-UUNZHJ6W.js";import{t as fe,u as Se}from"./chunk-CTKEWRX4.js";import"./chunk-GXHE2CDH.js";import{b as ae,c as le,h as re,l as se,n as pe,y as me}from"./chunk-QOA24ZLA.js";import{c as D,f as de}from"./chunk-2AMEIUWK.js";import{$a as c,$b as S,Ac as ne,B as z,Cc as ie,Dc as oe,Ha as F,Hb as O,Ia as s,Ib as m,Ja as T,Jb as V,Kb as P,Mb as I,Nb as w,Ob as b,Pb as Z,Q as G,Qb as q,Sb as k,X as B,Za as u,_b as C,ac as N,bc as U,da as H,ga as Y,gb as y,hb as L,jb as A,kb as W,lb as a,mb as r,nb as x,oa as _,ob as M,pa as d,pb as E,rb as v,tc as X,ub as f,vc as J,wb as l,wc as ee,zb as K,zc as te}from"./chunk-HSFUKC7R.js";import"./chunk-GNOSNGXM.js";var Re=n=>({"text-decoration-line-through":n}),Be=n=>({"ms-10":n}),Le=n=>({"bg-gradient-warning":n});function Ae(n,p){if(n&1){let e=v();a(0,"button",39),f("click",function(){_(e);let t=l().ngIf,o=l(2);return d(o.updateStock(t))}),x(1,"i",40),m(2," Update "),r()}}function We(n,p){if(n&1){let e=v();a(0,"div"),u(1,Ae,3,0,"button",36),a(2,"button",37),f("click",function(){_(e);let t=l(2);return d(t.openExportDialog())}),x(3,"i",38),a(4,"span"),m(5,"Export"),r()()()}if(n&2){let e=p.ngIf,i=l(2);s(),c("ngIf",i.productService.hasSelectionVariant(e))}}function Oe(n,p){if(n&1&&(a(0,"span",41),x(1,"img",42),r(),m(2)),n&2){let e=p.item;s(),c("src",e==null?null:e.Img,F),s(),P(" ",e.Name," ")}}function Ue(n,p){n&1&&(a(0,"div",43)(1,"span"),m(2," showing only different stock, please press next to populate more data "),r()())}function $e(n,p){if(n&1){let e=v();a(0,"th")(1,"input",44),b("ngModelChange",function(t){_(e);let o=l(2);return w(o.checkboxState,t)||(o.checkboxState=t),d(t)}),f("ngModelChange",function(){let t=_(e).ngIf,o=l(2);return d(o.onCheckboxStateChange(t))}),r()()}if(n&2){let e=l(2);s(),I("ngModel",e.checkboxState)}}function Qe(n,p){n&1&&(a(0,"th",33),m(1," Reserved "),r())}function je(n,p){}function ze(n,p){if(n&1){let e=v();a(0,"input",63),b("ngModelChange",function(t){_(e);let o=l(3).$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),f("ngModelChange",function(){_(e);let t=l(3).$implicit,o=l(2);return d(o.onCheckboxStateProduct(t))}),r()}if(n&2){let e=l(3).$implicit;I("ngModel",e.selected)}}function Ge(n,p){if(n&1){let e=v();a(0,"img",64),f("click",function(t){_(e);let o=l(3).$implicit,h=l(2);return d(h.onZoomImage(t,o==null?null:o.ImageUrl))}),r()}if(n&2){let e=l(3).$implicit;K("src",e==null?null:e.ThumbnailUrl,F)}}function He(n,p){n&1&&x(0,"img",60)}function Ye(n,p){if(n&1&&(x(0,"br"),a(1,"div",65),x(2,"i",66),a(3,"small"),m(4),r()()),n&2){let e=l(3).$implicit;s(4),P("(",e==null?null:e.Category,")")}}function Ke(n,p){if(n&1&&(a(0,"td",56)(1,"div",15),u(2,ze,1,1,"input",57),a(3,"div",58),u(4,Ge,1,1,"img",59)(5,He,1,0,"img",60),r()()(),a(6,"td",61)(7,"span",62),m(8),r(),u(9,Ye,5,1),r()),n&2){let e=l(2).$implicit,i=l(2);c("rowSpan",e==null?null:e.Variants.length),s(2),y(e.Variants.length>1?2:-1),s(),c("ngClass",k(7,Be,e.Variants.length<=1)),s(),y(e!=null&&e.ThumbnailUrl?4:5),s(2),c("rowSpan",e==null?null:e.Variants.length),s(2),V(e==null?null:e.Name),s(),y(e.CategoryID!==null&&e.CategoryID!=i.guidEmpty?9:-1)}}function Ze(n,p){if(n&1){let e=v();a(0,"input",44),b("ngModelChange",function(t){_(e);let o=l(2).$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),r()}if(n&2){let e=l(2).$implicit;I("ngModel",e.selected)}}function qe(n,p){if(n&1&&u(0,Ze,1,1,"input",50),n&2){let e=l().$implicit;y((e==null?null:e.Inventory)<=1e5?0:-1)}}function Xe(n,p){if(n&1){let e=v();a(0,"input",44),b("ngModelChange",function(t){_(e);let o=l().$implicit;return w(o.selected,t)||(o.selected=t),d(t)}),r()}if(n&2){let e=l().$implicit;I("ngModel",e.selected)}}function Je(n,p){n&1&&(a(0,"div",67),m(1," Not Found "),r())}function et(n,p){if(n&1&&(a(0,"div")(1,"span",68),m(2),C(3,"number"),r(),m(4," => "),a(5,"span",69),m(6),C(7,"number"),r()()),n&2){let e=l().$implicit;s(2),P(" ",S(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),V(S(7,4,e==null?null:e.Inventory))}}function tt(n,p){if(n&1&&(m(0),C(1,"number")),n&2){let e=l().$implicit;P(" ",S(1,1,e==null?null:e.Inventory)," ")}}function nt(n,p){if(n&1&&(M(0),a(1,"div",70)(2,"a",71),x(3,"i",72),r()(),E()),n&2){let e=l().$implicit,i=l(3);s(2),c("href",i.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),F)}}function it(n,p){if(n&1){let e=v();a(0,"span",77),f("click",function(){let t=_(e).ngIf,o=l(2).$implicit,h=l().$implicit,g=l(2);return d(g.openTableDialog(h,o,t))}),m(1),C(2,"number"),r()}if(n&2){let e=l(2).$implicit;s(),P(" ",S(2,1,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," ")}}function ot(n,p){if(n&1){let e=v();a(0,"td",73)(1,"div",51)(2,"div"),u(3,it,3,3,"span",74),C(4,"async"),r(),a(5,"div",70)(6,"a",71),x(7,"i",72),r()(),a(8,"div",70)(9,"span",75),f("click",function(){_(e);let t=l().$implicit,o=l(3);return d(o.refreshInventory(t==null||t.Channel[0]==null?null:t.Channel[0].ChannelItemID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelVariationID,t==null||t.Channel[0]==null?null:t.Channel[0].ChannelID,t==null?null:t.ID))}),x(10,"i",76),r()()()()}if(n&2){let e=l().$implicit,i=l(3);c("ngClass",k(5,Le,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(3),c("ngIf",S(4,3,i.products$)),s(3),c("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,F)}}function at(n,p){if(n&1&&(M(0),a(1,"span",78),m(2),C(3,"number"),r(),E()),n&2){let e=l(2).$implicit;s(2),P(" (",S(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function lt(n,p){n&1&&m(0," - ")}function rt(n,p){if(n&1&&(M(0),a(1,"td",47),u(2,at,4,3,"ng-container",55)(3,lt,1,0,"ng-template",null,1,U),r(),E()),n&2){let e=O(4),i=l().$implicit;s(2),c("ngIf",i==null||i.Channel[0]==null?null:i.Channel[0].InventoryReserved)("ngIfElse",e)}}function st(n,p){n&1&&(M(0),m(1," - "),E())}function pt(n,p){if(n&1&&(a(0,"span",79),C(1,"date"),m(2),C(3,"date"),r()),n&2){let e=l().$implicit;c("matTooltip",N(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),P(" ",N(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}function mt(n,p){if(n&1&&(a(0,"tr"),u(1,Ke,10,9),a(2,"td",46),m(3),r(),a(4,"td",47)(5,"span",48),m(6),r()(),a(7,"td",49),u(8,qe,1,1)(9,Xe,1,1,"input",50),r(),a(10,"td")(11,"div",51),u(12,Je,2,0,"div",52)(13,et,8,6,"div")(14,tt,2,3)(15,nt,4,1,"ng-container",5),r()(),u(16,ot,11,7,"td",53)(17,rt,5,2,"ng-container",5),a(18,"td",54),u(19,st,2,0,"ng-container",55)(20,pt,4,8,"ng-template",null,0,U),r()()),n&2){let e=p.$implicit,i=p.index,t=O(21),o=l(3);s(),y(i==0?1:-1),s(2),V(e==null?null:e.Model),s(2),c("matTooltip",e.Discontinued?o.discontinuedVariantMsg:"")("ngClass",k(14,Re,e.Discontinued)),s(),V(e==null?null:e.Code),s(2),y((e==null?null:e.Channel[0].TypeID)==1?8:(e==null?null:e.Inventory)>=0?9:-1),s(4),c("ngIf",(e==null?null:e.I)==null),s(),y((e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)?13:-1),s(),y((e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)?14:-1),s(),c("ngIf",(e==null?null:e.I)!=null),s(),c("ngIf",e==null?null:e.Channel),s(),c("ngIf",o.isShowReservedColumn),s(2),c("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==o.minDate)("ngIfElse",t)}}function ct(n,p){if(n&1&&(a(0,"tbody"),A(1,je,0,0,null,null,L),u(3,mt,22,16,"tr",45),r()),n&2){let e=p.$implicit;s(),W(e.Variants),s(2),c("ngForOf",e.Variants)}}function _t(n,p){if(n&1){let e=v();a(0,"mainpanel",3),f("onSubmit",function(t){_(e);let o=l();return d(o.onSearch(t))}),a(1,"actions")(2,"div",4),u(3,We,6,1,"div",5),C(4,"async"),r()(),a(5,"filters")(6,"div")(7,"label",6),m(8,"Channel"),r(),a(9,"ng-select",7),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.ChannelID,t)||(o.searchFilter.ChannelID=t),d(t)}),u(10,Oe,3,2,"ng-template",8),r()(),a(11,"div",9)(12,"label",10),m(13,"PageNumber"),r(),a(14,"input",11),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.PageNumber,t)||(o.searchFilter.PageNumber=t),d(t)}),r()(),a(15,"div",9)(16,"label",12),m(17,"Page Size"),r(),a(18,"input",13),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.RowCount,t)||(o.searchFilter.RowCount=t),d(t)}),r()(),a(19,"div",9)(20,"label",14),m(21,"Quantity From - To"),r(),a(22,"div",15)(23,"input",16),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.QuantityFrom,t)||(o.searchFilter.QuantityFrom=t),d(t)}),r(),m(24," - "),a(25,"input",17),b("ngModelChange",function(t){_(e);let o=l();return w(o.searchFilter.QuantityTo,t)||(o.searchFilter.QuantityTo=t),d(t)}),r()()()(),a(26,"content")(27,"div",18)(28,"div",19)(29,"div",20),u(30,Ue,3,0,"div",21),a(31,"table",22)(32,"thead",23)(33,"tr")(34,"th",24),m(35," Product "),x(36,"br"),a(37,"mat-slide-toggle",25),f("toggleChange",function(){_(e);let t=l();return t.showDifferenceStock=!t.showDifferenceStock,d(t.onShowDifferenceStock())}),a(38,"small",14),m(39,"FILTER DIFFERENT INVENTORY"),r()()(),a(40,"th",26),m(41,"Variant"),r(),a(42,"th",27),m(43,"SKU"),r(),u(44,$e,2,1,"th",5),C(45,"async"),a(46,"th",28),m(47,"POS"),r(),a(48,"th",29)(49,"div",30),f("click",function(){_(e);let t=l();return d(t.openModalFilter())}),x(50,"img",31),a(51,"span",32),m(52),C(53,"stringLimit"),r()()(),u(54,Qe,2,0,"th",33),a(55,"th",34),m(56,"Last Sync"),r()()(),A(57,ct,4,1,"tbody",null,L),C(59,"async"),r(),a(60,"infinite-paginator",35),C(61,"async"),f("onNextPage",function(){_(e);let t=l();return d(t.infinitePagination.onNextPage(t.searchFilter))})("onLastPage",function(){_(e);let t=l();return d(t.infinitePagination.onLastPage(t.searchFilter))})("onGetRowCount",function(){_(e);let t=l();return d(t.infinitePagination.getRowCount(t.searchFilter))}),r()()()()()()}if(n&2){let e=l();c("headerTitle","Inventory Comparison")("pageData",e.pageData)("hideSearchBox",!1),s(3),c("ngIf",S(4,23,e.products$)),s(6),c("clearable",!1)("items",e.channelOptions),I("ngModel",e.searchFilter.ChannelID),s(5),I("ngModel",e.searchFilter.PageNumber),s(4),I("ngModel",e.searchFilter.RowCount),s(5),I("ngModel",e.searchFilter.QuantityFrom),s(2),I("ngModel",e.searchFilter.QuantityTo),s(5),c("ngIf",(e.searchFilter==null?null:e.searchFilter.filterModel)==3),s(14),c("ngIf",S(45,25,e.products$)),s(5),c("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>13?e.selectedChannel==null?null:e.selectedChannel.Name:""),s(),c("src",e.selectedChannel==null?null:e.selectedChannel.Img,F),s(2),P(" ",N(53,27,e.selectedChannel==null?null:e.selectedChannel.Name,13)," "),s(2),y(e.isShowReservedColumn?54:-1),s(3),W(S(59,30,e.products$)),s(3),c("totalData",e.infinitePagination.totalData())("hideCount",e.infinitePagination.hideCount())("rowCount",S(61,32,e.infinitePagination.totalRowCount$))("pageNumber",e.infinitePagination.pageNumber())("disableNextButton",e.infinitePagination.disableNextButton())("goToLastPage",e.infinitePagination.isLastPage())}}var Ht=(()=>{let p=class p{constructor(i,t,o,h,g,j,ke,Ne){this.http=i,this.toastr=t,this.dialog=o,this.productService=h,this.authService=g,this.biggerPictureService=j,this.inventoryService=ke,this.mainPanelService=Ne,this.infinitePagination=H($),this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="InventoryLoader/Load",this.fetchApi="Inventory/GetSingleChannelComparison",this.rowCountApi="Inventory/GetInventoryByChannelRowCount",this.minDate=D.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=D.GuidEMpty,this.Options=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.infinitePagination.data$.pipe(B(i=>{this.checkShowReservedColumn(i)}),G())}checkShowReservedColumn(i){let t=0,o;i.forEach(h=>{o=h.Variants.find(g=>D.IsNotEmpty(g?.Channel[0]?.InventoryReserved)),o&&(t+=1)}),this.isShowReservedColumn=t>0}initPageLoader(){this.infinitePagination.fetchDataEndpoint=this.fetchApi,this.infinitePagination.fethRowCountEndpoint=this.rowCountApi,this.loader$=this.http.post(`/api/${this.loaderApi}`,{}).pipe(B(i=>{this.searchFilter={RowCount:i.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:i.Filter.ChannelID},this.initSelectedChannel(),this.infinitePagination.reloadPagination(this.searchFilter),this.showToastrMarketplaceInactive(!i.Filter.IsMarketplaceAppActive)}))}showToastrMarketplaceInactive(i){i&&this.toastr.warning(`Automatic inventory sync disabled.
|
|
2
2
|
Please enable Dealpos X Marketplace Apps integration in POS Configuration`,"Warning")}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(i=>i.ID==this.searchFilter.ChannelID)}onSearch(i){this.searchFilter.text=i,this.infinitePagination.reloadPagination(this.searchFilter),this.initSelectedChannel()}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(i){let t=this.productService.selectedVariantProduct(i);if(t.length>0){let o=t.map(g=>({ID:g.ID,Code:g.Code,Inventory:g.Inventory})),h={ListChannelID:[this.searchFilter.ChannelID],List:o};this.http.post("/api/Inventory/UpdateChannel",h).subscribe(g=>{this.searchFilter.PageNumber=1,this.infinitePagination.reloadPagination(this.searchFilter),this.checkboxState=!1,this.handlingUpdateStock(g)})}}handlingUpdateStock(i){if(i[0]?.StatusProduct){let t=i[0].StatusProduct.Fail_list,o=i[0].StatusProduct.Success_list;this.inventoryService.showToastrUpdateInventory("Stock",o,t)}else this.toastr.error(i[0]?.Exception,"Error")}refreshInventory(i,t,o,h){let g={ChannelItemID:i,ChannelVariationID:t,ChannelID:o,VariantID:h};this.http.post("/api/Inventory/RefreshInventoryChannel",g).subscribe(j=>{this.toastr.success("Successfully updated","Success"),this.infinitePagination.reloadPagination(this.searchFilter)})}onCheckboxStateProduct(i){i.Variants=i.Variants.map(t=>(t.Inventory>=0&&(t.selected=i.selected),t))}onCheckboxStateChange(i){i=i.map(t=>(t.Variants=t.Variants.map(o=>(o.selected=this.checkboxState,o)),t))}openTableDialog(i,t,o){this.dialog.open(Ve,{data:{Name:i.Name,Variant:t,ChannelID:t?.Channel[0].ChannelID,Table:"inventory",ChannelItemID:i.ChannelItemID}}).afterClosed().pipe(z(g=>D.IsNotEmpty(g))).subscribe(g=>{this.updateItemAfterDialog(g,o)})}updateItemAfterDialog(i,t){let o={ID:i.ChannelID,ChannelItemID:i.ChannelItemID,ChannelVariantID:i.ChannelVariationID,NewQuantity:parseFloat(i.Inventory),VariantID:i.ID,SKU:i.Sku};this.http.post("/api/Inventory/UpdateQuantityByItem",o).subscribe(h=>{this.searchFilter.PageNumber=1,this.infinitePagination.reloadPagination(this.searchFilter),this.handlingUpdateStock([h])})}openExportDialog(){this.dialog.open(Ee,{data:{title:"Export Inventory Single Channel Comparison",pageNumber:this.searchFilter.PageNumber,rowCount:this.searchFilter.RowCount,filterExport:this.searchFilter,getRowCountApi:this.rowCountApi,QuantityFrom:this.searchFilter.QuantityFrom,QuantityTo:this.searchFilter.QuantityTo,exportApi:"Inventory/GetExportSingleChannelComparison"}}).afterClosed().subscribe()}onShowDifferenceStock(){this.showDifferenceStock?this.searchFilter.filterModel=Q.DIFFERENCE:this.searchFilter.filterModel=Q.ALL,this.infinitePagination.reloadPagination(this.searchFilter)}onZoomImage(i,t){this.biggerPictureService.openBiggerPicture(i,t)}};p.\u0275fac=function(t){return new(t||p)(T(_e),T(ce),T(ve),T(be),T(ue),T(Te),T(R),T(ye))},p.\u0275cmp=Y({type:p,selectors:[["app-single-channel-comparison"]],standalone:!0,features:[Z([$,R]),q],decls:2,vars:3,consts:[["SYNCDATE",""],["EMPTY_RESERVED",""],["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit",4,"ngIf"],["textButton","Search",3,"onSubmit","headerTitle","pageData","hideSearchBox"],[1,"d-flex"],[4,"ngIf"],["for","ng-select",1,"fw-bold"],["id","ng-select","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text","mt-3",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModelChange","ngModel"],[1,"fw-bold"],[1,"d-flex","align-items-center","justify-content-start"],["type","number","name","QuantityFrom",1,"w-25","me-2","mt-3","form-control",3,"ngModelChange","ngModel"],["type","number","name","QuantityTo",1,"w-25","ms-2","form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["class","alert alert-warning d-flex justify-content-between text-dark","role","alert",4,"ngIf"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","ps-12",2,"width","25%"],[3,"toggleChange"],["scope","col",1,"text-start"],["scope","col",1,"text-end",2,"width","10%"],["scope","col",1,"text-end","w-10",2,"width","8%"],[1,"text-end",2,"width","150px"],["role","button","matTooltipPosition","above",1,"d-inline-block",3,"click","matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],["matTooltip","Reserved Stock","matTooltipPosition","above",1,"text-end",2,"width","80px"],[1,"text-center",2,"width","145px"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],["class","btn btn-success",3,"click",4,"ngIf"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"me-2"],[2,"width","18px",3,"src"],["role","alert",1,"alert","alert-warning","d-flex","justify-content-between","text-dark"],["type","checkbox",3,"ngModelChange","ngModel"],[4,"ngFor","ngForOf"],[1,"text-start"],[1,"text-end"],["matTooltipPosition","above",3,"matTooltip","ngClass"],[1,"align-middle"],["type","checkbox",3,"ngModel"],[1,"d-flex","align-items-center","justify-content-end"],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],["class","text-end",3,"ngClass",4,"ngIf"],[1,"text-center"],[4,"ngIf","ngIfElse"],[1,"text-start",2,"width","0%",3,"rowSpan"],["type","checkbox",1,"me-3",3,"ngModel"],[3,"ngClass"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img",2,"margin-left","20px"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"click","src"],[1,"d-flex","align-items-center"],["title","Category",1,"fa-solid","fa-tags","me-2",2,"opacity","60%"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],["title","Stock Available"],["title","Inventory below minimum inventory"],[1,"ms-3"],["target","_blank",3,"href"],[1,"fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[1,"text-end",3,"ngClass"],["class","cursor",3,"click",4,"ngIf"],["matTooltip","Refresh stock according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","fa-sync","fa-lg","external-link-custom","pt-1"],[1,"cursor",3,"click"],[1,"text-danger"],["matTooltipShowDelay","500",3,"matTooltip"]],template:function(t,o){t&1&&(u(0,_t,62,34,"mainpanel",2),C(1,"async")),t&2&&c("ngIf",S(1,1,o.loader$))},dependencies:[oe,X,J,ee,te,ie,ne,we,Ie,xe,he,ge,Ce,me,le,pe,ae,re,se,Me,De,de,Fe,Pe,Se,fe],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}"]});let n=p;return n})();export{Ht as SingleChannelComparisonComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as rt}from"./chunk-O5FN3DLG.js";import{c as ot}from"./chunk-2L5RCILV.js";import{a as Q,b as X,d as Y,e as Z}from"./chunk-Y27IE54D.js";import{g as J}from"./chunk-
|
|
1
|
+
import{b as rt}from"./chunk-O5FN3DLG.js";import{c as ot}from"./chunk-2L5RCILV.js";import{a as Q,b as X,d as Y,e as Z}from"./chunk-Y27IE54D.js";import{g as J}from"./chunk-OML53I6I.js";import{b as $,e as q}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{l as it,m as nt}from"./chunk-UUNZHJ6W.js";import{t as tt,u as et}from"./chunk-CTKEWRX4.js";import"./chunk-GXHE2CDH.js";import{h as H,l as A,y as z}from"./chunk-QOA24ZLA.js";import{b as v,c as G}from"./chunk-2AMEIUWK.js";import{$a as m,$b as W,Dc as S,Ha as P,Ia as c,Ib as l,Ja as h,Jb as u,Kb as j,Mb as y,Nb as L,Ob as M,Q as T,X as x,Za as g,Zc as C,_b as V,aa as p,ga as E,ha as d,lb as r,mb as a,nb as D,oa as O,ob as U,pa as w,pb as F,q as I,rb as K,ub as _,vc as k,wb as f,wc as R,zc as B}from"./chunk-HSFUKC7R.js";import"./chunk-GNOSNGXM.js";function ct(n,e){if(n&1&&(r(0,"span",13),D(1,"img",14),a(),r(2,"span"),l(3),a()),n&2){let s=e.item;c(),m("src",s.Img,P)("alt",s.Name),c(2),j(" ",s.Name," ")}}function mt(n,e){if(n&1){let s=K();U(0),r(1,"ng-select",16),M("ngModelChange",function(i){O(s);let o=f().$implicit;return L(o.ProductSKU,i)||(o.ProductSKU=i),w(i)}),a(),F()}if(n&2){let s=e.ngIf,t=f().$implicit;c(),y("ngModel",t.ProductSKU),m("items",s)}}function pt(n,e){if(n&1&&(r(0,"tr")(1,"td"),l(2),a(),r(3,"td"),l(4),a(),r(5,"td"),l(6),a(),r(7,"td"),g(8,mt,2,2,"ng-container",15),V(9,"async"),a()()),n&2){let s=e.$implicit,t=f();c(2),u(s.Name),c(2),u(s.Service),c(2),u(s.TypeString),c(2),m("ngIf",W(9,4,t.logisticOptions$))}}var st=(()=>{let e=class e{constructor(t,i,o){this.http=t,this.toastr=i,this.authService=o,this.filter={ChannelID:""},this.logisticServiceOptions=[],this.channelOptions=this.authService.getChannels(),this.initUnsupportedChannel(),this.initLoader()}initUnsupportedChannel(){let t=[v.WooCommerce,v.Lazada,v.Shopify];this.channelOptions=this.channelOptions.map(i=>(t.forEach(o=>{i.TypeID===o&&(i.disabled=!0)}),i))}initLoader(){this.http.post("/api/Logistic/Load",{}).subscribe(t=>{this.filter=t.Filter,this.channelName=this.channelOptions[0].Name,this.initLogisticServiceOptions(),this.getLogisticService()})}initLogisticServiceOptions(){this.logisticOptions$=this.http.get("/api/Logistic/OptionLogisticsService").pipe(T(1),x(t=>{this.logisticServiceOptions=t}))}Validate(){for(let t of this.logisticServices)this.datasource.find(o=>o.ProductSKU==t.ProductSKU&&o.Name==t.Name)===void 0&&(t.IsChange=!0);return Promise.resolve(this.logisticServices)}submitLogistics(){this.Validate().then(t=>{this.http.post("/api/Logistic/Submit",this.logisticServices).subscribe(i=>{this.toastr.success("Success","Update Complete!",{timeOut:5e3,enableHtml:!0}),this.getLogisticService()})})}getLogisticService(){this.datasource=[],this.http.post("/api/Logistic/Get",this.filter).pipe(I(t=>t.map(i=>(i.ProductSKU=G.IsEmpty(i.ProductSKU)?null:i.ProductSKU,i)))).subscribe(t=>{this.iniTitle(),this.logisticServices=t,this.datasource=structuredClone(t)})}iniTitle(){let t=this.channelOptions.find(i=>i.ID==this.filter.ChannelID);this.channelName=t?t.Name:null}};e.\u0275fac=function(i){return new(i||e)(h(q),h($),h(J))},e.\u0275cmp=E({type:e,selectors:[["app-logistic"]],decls:28,vars:6,consts:[["hideSearchBox","true","searchBoxPlaceHolder","Enter Number...",3,"onSubmit","headerTitle","hideSearchDropdown"],[1,"mb-2","fw-bold"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["role","button","data-toggle","tooltip","data-placement","top","matTooltip","enter Logistic for recorded",1,"btn","btn-success","btn-fill","btn-lg","text-white",3,"click"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[4,"ngFor","ngForOf"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[4,"ngIf"],["placeholder","Logistic Service Code","bindLabel","Name","bindValue","Code",1,"w-75",3,"ngModelChange","ngModel","items"]],template:function(i,o){i&1&&(r(0,"mainpanel",0),_("onSubmit",function(){return o.getLogisticService()}),r(1,"filters")(2,"div")(3,"label",1),l(4,"Select a Channel"),a(),r(5,"ng-select",2),M("ngModelChange",function(b){return L(o.filter.ChannelID,b)||(o.filter.ChannelID=b),b}),g(6,ct,4,3,"ng-template",3),a()()(),r(7,"actions")(8,"a",4),_("click",function(){return o.submitLogistics()}),l(9,"Submit"),a()(),r(10,"content")(11,"div",5)(12,"div",6)(13,"div",7)(14,"div",8)(15,"table",9)(16,"thead",10)(17,"tr",11)(18,"th"),l(19,"Logistic"),a(),r(20,"th"),l(21,"Service"),a(),r(22,"th"),l(23,"Type"),a(),r(24,"th"),l(25,"Logistic Service"),a()()(),r(26,"tbody"),g(27,pt,10,6,"tr",12),a()()()()()()()()),i&2&&(m("headerTitle","Logistic Courier - "+o.channelName)("hideSearchDropdown",!1),c(5),m("clearable",!1)("items",o.channelOptions),y("ngModel",o.filter.ChannelID),c(22),m("ngForOf",o.logisticServices))},dependencies:[k,R,H,A,it,Y,Q,X,tt,B]});let n=e;return n})();var dt=[{path:"",component:st}],lt=(()=>{let e=class e{};e.\u0275fac=function(i){return new(i||e)},e.\u0275mod=d({type:e}),e.\u0275inj=p({imports:[S,C.forChild(dt)]});let n=e;return n})();var kt=(()=>{let e=class e{};e.\u0275fac=function(i){return new(i||e)},e.\u0275mod=d({type:e}),e.\u0275inj=p({imports:[S,C,lt,z,nt,Z,rt,ot,et]});let n=e;return n})();export{kt as LogisticModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ue}from"./chunk-VUL363BT.js";import"./chunk-6U6JR5K6.js";import{a as Mi}from"./chunk-BVIRHZTZ.js";import{a as be,b as we,c as Yi}from"./chunk-CHPESC5O.js";import{a as Se}from"./chunk-4URWFKAM.js";import{b as nn}from"./chunk-RXDUUYMX.js";import"./chunk-GP6U42SV.js";import"./chunk-O5FN3DLG.js";import{a as rn,b as on,c as ln,d as sn,e as pn,f as cn,g as dn}from"./chunk-KGSUB5OH.js";import"./chunk-XNGU3O4O.js";import{a as ji,b as Ui}from"./chunk-RKRJ4JOF.js";import{a as Be,b as mn,c as Ct,d as un,e as hn,f as _n,g as Rt,h as vt,i as De,k as b,l as gn,m as rt,n as Qt,o as Jt,p as Ht,q as fn,r as Cn,s as Xt,t as Wt,u as vn}from"./chunk-NEQN5BMS.js";import"./chunk-3TNPJNQS.js";import{a as yn,b as bn}from"./chunk-VHYFEAS2.js";import{a as xe,b as zi}from"./chunk-OXSGKWPW.js";import{f as Qi,g as Ji,h as Xi,i as en,j as tn}from"./chunk-DSDMENCN.js";import{a as Zi}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as me}from"./chunk-AUMUHIAD.js";import{b as an}from"./chunk-ZG6JXFSY.js";import{b as qi}from"./chunk-ZQLDSEY5.js";import{a as Gi,b as Ki,c as $i}from"./chunk-2L5RCILV.js";import{a as Ae}from"./chunk-
|
|
1
|
+
import{a as ue}from"./chunk-VUL363BT.js";import"./chunk-6U6JR5K6.js";import{a as Mi}from"./chunk-BVIRHZTZ.js";import{a as be,b as we,c as Yi}from"./chunk-CHPESC5O.js";import{a as Se}from"./chunk-4URWFKAM.js";import{b as nn}from"./chunk-RXDUUYMX.js";import"./chunk-GP6U42SV.js";import"./chunk-O5FN3DLG.js";import{a as rn,b as on,c as ln,d as sn,e as pn,f as cn,g as dn}from"./chunk-KGSUB5OH.js";import"./chunk-XNGU3O4O.js";import{a as ji,b as Ui}from"./chunk-RKRJ4JOF.js";import{a as Be,b as mn,c as Ct,d as un,e as hn,f as _n,g as Rt,h as vt,i as De,k as b,l as gn,m as rt,n as Qt,o as Jt,p as Ht,q as fn,r as Cn,s as Xt,t as Wt,u as vn}from"./chunk-NEQN5BMS.js";import"./chunk-3TNPJNQS.js";import{a as yn,b as bn}from"./chunk-VHYFEAS2.js";import{a as xe,b as zi}from"./chunk-OXSGKWPW.js";import{f as Qi,g as Ji,h as Xi,i as en,j as tn}from"./chunk-DSDMENCN.js";import{a as Zi}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as me}from"./chunk-AUMUHIAD.js";import{b as an}from"./chunk-ZG6JXFSY.js";import{b as qi}from"./chunk-ZQLDSEY5.js";import{a as Gi,b as Ki,c as $i}from"./chunk-2L5RCILV.js";import{a as Ae}from"./chunk-2DXLUQ37.js";import"./chunk-M4JG6342.js";import"./chunk-6NTRXLMW.js";import{a as ve,b as ye,c as Vi,d as de,e as Oi}from"./chunk-Y27IE54D.js";import{f as Pe,g as ce}from"./chunk-OML53I6I.js";import{b as nt,e as q}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{b as Ai,d as at,e as Bi,f as Ri,g as Hi,l as re,m as Wi}from"./chunk-UUNZHJ6W.js";import{t as Fi,u as Li}from"./chunk-CTKEWRX4.js";import{P as Ni}from"./chunk-GXHE2CDH.js";import{a as Ii,b as At,c as pe,h as ee,l as te,n as Ce,y as Bt}from"./chunk-QOA24ZLA.js";import{b as F,c as A}from"./chunk-2AMEIUWK.js";import{$ as He,$a as m,$b as z,Ab as wi,Ac as G,B as mi,Bb as Mt,Cb as Et,Cc as se,Db as Ke,Dc as Ee,Eb as $e,Ha as j,Hb as Y,Ia as s,Ib as c,Ja as x,Jb as y,Kb as k,Lb as xi,Mb as I,Nb as M,Oa as fi,Ob as E,Pa as Ci,Pb as Pt,Q as Ge,Qb as ge,Rb as le,Sb as ne,T as ui,Tb as J,Ua as vi,Uc as Ft,Vc as ki,Wa as tt,Wb as Si,X as Xe,Xb as Ti,Xc as fe,Ya as ht,Za as f,Zc as Lt,_ as hi,_a as B,_b as N,aa as We,ab as yi,ac as X,ad as Ei,bb as kt,bc as ae,bd as gt,ca as Ie,db as _e,ed as qe,fd as Pi,ga as L,gb as Zt,ha as Ye,hd as ft,ia as _i,jc as Di,kc as O,lb as r,lc as Me,mb as o,na as gi,nb as C,oa as h,ob as S,pa as _,pb as T,q as ie,qa as Fe,qb as Le,ra as qt,rb as D,rc as Vt,sa as et,tc as ze,ub as v,vc as $,w as di,wb as p,wc as U,xb as It,xc as Ot,ya as ut,yb as _t,yc as Nt,za as Q,zb as bi,zc as it}from"./chunk-HSFUKC7R.js";import{a as pi,b as ci}from"./chunk-GNOSNGXM.js";var wn=(()=>{let l=class l{constructor(){this.ObjectOrderTabs=[{Title:"1 - New Order",Url:"/menu/Order/new",Permissions:[]},{Title:"2 - Ready to Ship",Url:"/menu/Order/ready_to_ship",Permissions:[]},{Title:"3 - Shipped",Url:"/menu/Order/Shipped",Permissions:[]},{Title:"4 - Completed",Url:"/menu/Order/Delivered",Permissions:[]},{Title:"All",Url:"/menu/Order/All",Permissions:[]},{Title:"99 - Cancelled",Url:"/menu/Order/Cancelled",Permissions:[]},{Title:"Download",Url:"/menu/Order/Download",Permissions:[Mi.downloadOrder]}]}ngOnInit(){}};l.\u0275fac=function(i){return new(i||l)},l.\u0275cmp=L({type:l,selectors:[["app-orders"]],decls:5,vars:2,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs","usePermissions"]],template:function(i,n){i&1&&(r(0,"nav",0)(1,"div",1)(2,"div"),C(3,"nav-tab",2),o()()(),C(4,"router-outlet")),i&2&&(s(3),m("Tabs",n.ObjectOrderTabs)("usePermissions",!0))},dependencies:[ji,ki]});let a=l;return a})();var xn=(()=>{let l=class l{constructor(){}convertToCSV(t,i){let n;if(typeof t=="string")n=t;else{var d=typeof t=="object"?t:JSON.parse(t);n=this.transformToCSVStringFormat(d)}this.downloadCSV(n,i)}transformToCSVStringFormat(t){if(!t||!t.length)return;let i=",",n=Object.keys(t[0]);return t.map(g=>n.map(u=>{let w=g[u]===null||g[u]===void 0?"":g[u];return w=w instanceof Date?w.toLocaleString():w.toString().replace(/"/g,'""'),w.search(/("|,|\n)/g)>=0&&(w=`"${w}"`),w}).join(i)).join(`
|
|
2
2
|
`)}downloadCSV(t,i){var n=new Blob([t],{type:"text/csv;charset=utf8;"}),d=document.createElement("a");d.setAttribute("href",window.URL.createObjectURL(n)),d.setAttribute("download",i),document.body.appendChild(d),d.click(),document.body.removeChild(d)}};l.\u0275fac=function(i){return new(i||l)},l.\u0275prov=He({token:l,factory:l.\u0275fac,providedIn:"root"});let a=l;return a})();var ot=(()=>{let l=class l{constructor(t,i){this.http=t,this.exportService=i}loadInitialPage(){return this.http.post("/api/ordersLoader/GetOrder",{})}getNewOrders(t){return this.http.post("/api/orders/GetNewOrder",t).pipe(ie(i=>i.Data))}getTotalNewOrders(t,i,n){let d={ListChannelID:t,From:i,To:n};return this.http.post("/api/orders/GetCountNewOrder",d).pipe(ie(g=>g.Count))}exportOrders(t,i){return this.http.post("api/Orders/ExportOrder",t).pipe(Xe(n=>{this.exportService.convertToCSV(n,i)}))}};l.\u0275fac=function(i){return new(i||l)(Ie(q),Ie(xn))},l.\u0275prov=He({token:l,factory:l.\u0275fac});let a=l;return a})();var Yt=(()=>{let l=class l{constructor(t,i){this.http=t,this.toastr=i}acceptTokopediaOrders(t){return this.http.post("/api/Orders/AcceptOrderTokopedia",t).pipe(Xe(i=>{this.tokopediaAcceptOrderHandler(i)}))}tokopediaAcceptOrderHandler(t){let i=t.filter(d=>d.Status==!1),n=t.filter(d=>d.Status==!0);if(i.length==0&&n.length>0){let d=`<ol>${this.generateSuccessMessage(n)}</ol>`;this.toastr.success(d,"Success",{enableHtml:!0})}else if(i.length>0&&n.length>0){let d=`<ol>
|
|
3
3
|
${this.generateSuccessMessage(n)}
|
|
4
4
|
${this.generateErrorMessage(i)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T,b as Pt,c as ae}from"./chunk-IAYFW5AU.js";import"./chunk-E3LCGTRI.js";import{a as re}from"./chunk-5BU6HQXL.js";import{a as Z}from"./chunk-7KG3DC5J.js";import{a as B}from"./chunk-4URWFKAM.js";import{b as oe}from"./chunk-RXDUUYMX.js";import"./chunk-GP6U42SV.js";import"./chunk-O5FN3DLG.js";import{a as zt,b as Ht}from"./chunk-RKRJ4JOF.js";import{f as rt}from"./chunk-2NRYBLX2.js";import{f as Xt,g as te,h as ee,i as ne,j as ie}from"./chunk-DSDMENCN.js";import{a as R}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as q,b as bt}from"./chunk-4BPLZVXV.js";import{a as z}from"./chunk-ONKOEBKR.js";import{b as le}from"./chunk-ZG6JXFSY.js";import"./chunk-ZQLDSEY5.js";import{a as Yt,b as Zt,c as qt}from"./chunk-2L5RCILV.js";import{a as X}from"./chunk-TRGFX3AD.js";import{a as Qt}from"./chunk-C62XLEFW.js";import"./chunk-M4JG6342.js";import"./chunk-6NTRXLMW.js";import{a as ot,b as xt,d as Y,e as Gt}from"./chunk-Y27IE54D.js";import{g as A}from"./chunk-QITW54IW.js";import{b as W,e as K}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{d as J,l as L,m as Jt}from"./chunk-UUNZHJ6W.js";import{t as vt,u as Kt}from"./chunk-CTKEWRX4.js";import{P as Wt}from"./chunk-GXHE2CDH.js";import{b as jt,c as it,h as $,l as G,y as $t}from"./chunk-QOA24ZLA.js";import{b as H,c as x}from"./chunk-2AMEIUWK.js";import{$a as s,$b as k,Ac as At,B as y,Cc as Ct,Dc as Lt,Ha as O,Hb as j,Ia as c,Ib as d,Ja as C,Jb as _t,Kb as w,Mb as D,Nb as E,Ob as N,Rb as Q,Sb as lt,Uc as ft,V as Ot,Vc as Rt,Wc as nt,X as Nt,Xc as St,Za as S,Zc as Bt,_b as F,aa as kt,ac as Ut,bc as et,c as Dt,ga as M,ha as Vt,lb as a,mb as l,nb as _,oa as m,ob as P,pa as u,pb as b,q as Et,rb as v,ub as f,vc as V,wb as p,wc as U,zc as gt}from"./chunk-HSFUKC7R.js";import"./chunk-GNOSNGXM.js";var Se=()=>["/menu/products/download/by-url"],ce=(()=>{let r=class r{constructor(){this.productTabs=[{Title:"Sold in Channel",Url:"/menu/products/status/sold-in-channel",Description:"SKU has been mapped between dealpos and marketplace"},{Title:"Not in POS",Url:"/menu/products/status/not-in-pos",Description:"SKU sold in Marketplace but not exist in DEALPOS"},{Title:"Not in Channel",Url:"/menu/products/status/not-in-channel",Description:"SKU has not been sold on one of channels"},{Title:"In POS",Url:"/menu/products/status/in-pos",Description:"All products which is already available in POS"},{Title:"Multiple Listing",Url:"/menu/products/status/duplicate-sku",Description:"SKU(s) which is listed more than one time (one to many)"},{Title:"Channel Statistic",Url:"/menu/products/status/channel-statistic",Description:"Product statistic from each channel obtained from the last product scan"}]}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-status"]],decls:13,vars:3,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid","d-flex","align-items-center","justify-content-between"],[3,"Tabs"],[1,"dropdown","me-6"],["role","button","data-bs-toggle","dropdown","aria-expanded","false",1,"text-dark"],[1,"fa-solid","fa-bars","fa-lg"],[1,"dropdown-menu","dropdown-menu-end","row"],[1,"d-flex"],[1,"dropdown-item",3,"routerLink"]],template:function(e,i){e&1&&(a(0,"nav",0)(1,"div",1)(2,"div"),_(3,"nav-tab",2),l()(),a(4,"div")(5,"div",3)(6,"a",4),_(7,"i",5),l(),a(8,"div",6)(9,"div",7)(10,"a",8),d(11,"Download Product By Url"),l()()()()()(),_(12,"router-outlet")),e&2&&(c(3),s("Tabs",i.productTabs),c(7),s("routerLink",Q(2,Se)))},dependencies:[zt,Rt,St]});let o=r;return o})();function xe(o,r){if(o&1){let n=v();a(0,"button",13),f("click",function(){m(n);let e=p(2);return u(e.onOpenScanDialog())}),_(1,"i",14),d(2," Scan Channel "),l()}}function ve(o,r){if(o&1&&(P(0),S(1,xe,3,0,"button",12),b()),o&2){let n=p();c(),s("ngIf",!n.productService.hasSelection(n.products))}}function Pe(o,r){if(o&1){let n=v();P(0),a(1,"button",15),f("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),_(2,"i",14),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Scan (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function be(o,r){if(o&1){let n=v();P(0),a(1,"button",16),f("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),_(2,"i",17),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Upload (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Ie(o,r){if(o&1){let n=v();a(0,"div",18)(1,"app-product-card",19),f("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null?null:n.Variants.length)>1?(n==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",(n==null?null:n.Channel.length)<t.channelOptions.length)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)}}function we(o,r){o&1&&(P(0),a(1,"div",20),_(2,"app-empty-state"),l(),b())}function ye(o,r){if(o&1){let n=v();P(0),a(1,"div",21)(2,"div",22)(3,"app-custom-paginator",23),f("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",!0)}}var de=(()=>{let r=class r{constructor(t,e,i,h,g,I,at){this.http=t,this.toastr=e,this.dialog=i,this.productService=h,this.authService=g,this.uploadProductService=I,this.route=at,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.multipeScanChannels=[],this.getLoaderPage(),this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}getLoaderPage(){this.productService.LoadInPOS().subscribe(t=>{this.Categories=t.Options.Categories,this.searchFilter.PageNumber=t.Filter.PageNumber,this.searchFilter.RowCount=t.Filter.RowCount,this.searchFilter.ChannelID=null,this.searchFilter.Category=t.Filter.Category,this.searchFilter.PageSize=100,this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Category:this.searchFilter.Category,From:this.startDate,To:this.endDate};this.http.post("/api/product/GetInPOS",t).subscribe(e=>{this.products=e.Data,this.rowCount=e.Total==null?this.searchFilter.RowCount:e.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){if(this.searchFilter.ChannelID==null){this.toastr.error("Please Select Channel","Error");return}this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{this.getLoaderPage();let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,e,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){this.dialog.open(Pt,{data:{title:this.products[t].Name,variants:this.products[t].Variants},width:"800px"})}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}searchProduct(t){this.searchFilter.text=t,this.getProducts()}onScanMultipleProduct(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty;let e=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok]);this.dialog.open(T,{data:{filter:t,channelOptions:e,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(h=>x.IsNotEmpty(h))).subscribe(h=>{this.searchFilter.ChannelID=h.ChannelID,this.searchFilter.ScanFull=h.ScanFull,this.searchFilter.UpdatedProduct=h.UpdatedProduct;let g=this.productService.selectedProduct(this.products),I=this.productService.getVariantCodesProducts(g);this.scanSingleProduct(I)})}onScanSingleProduct(t){let e=JSON.parse(JSON.stringify(this.searchFilter));e.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(h)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{if(e)this.toastr.success("Successfully Scan ","Success");else{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${i?.Name} `,"Error")}this.searchFilter.ChannelID=x.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=x.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}};r.\u0275fac=function(e){return new(e||r)(C(K),C(W),C(J),C(R),C(A),C(rt),C(nt))},r.\u0275cmp=M({type:r,selectors:[["app-in-pos"]],decls:22,vars:13,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","Name","bindValue","Name","placeholder","Select Category",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],[1,"mt-5"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["type","button","data-cy","scanSoldinChannel","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onScan","onDescEvent","onCheckBoxChange","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){if(e&1){let h=v();a(0,"mainpanel",1),f("onSubmit",function(I){return m(h),u(i.searchProduct(I))}),a(1,"actions"),S(2,ve,2,1,"ng-container",2)(3,Pe,4,1,"ng-container",2)(4,be,4,1,"ng-container",2),l(),a(5,"filters")(6,"div")(7,"label",3),d(8,"Category"),l(),a(9,"ng-select",4),f("ngModelChange",function(I){return m(h),u(i.searchFilter.Category=I)}),l()(),a(10,"div",5)(11,"mat-date-range-input",6)(12,"input",7),N("ngModelChange",function(I){return m(h),E(i.startDate,I)||(i.startDate=I),u(I)}),f("click",function(){m(h);let I=j(15);return u(I.open())}),l(),a(13,"input",8),N("ngModelChange",function(I){return m(h),E(i.endDate,I)||(i.endDate=I),u(I)}),f("click",function(){m(h);let I=j(15);return u(I.open())}),l()(),_(14,"mat-date-range-picker",null,0),l()(),a(16,"content")(17,"div",9)(18,"div",10),S(19,Ie,2,10,"div",11)(20,we,3,0,"ng-container",2),l(),S(21,ye,4,4,"ng-container",2),l()()()}if(e&2){let h=j(15);s("headerTitle","In POS ("+i.rowCount+")"),c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)&&i.multipeScanChannels.length>0),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.Categories)("ngModel",i.searchFilter.Category),c(2),s("rangePicker",h),c(),D("ngModel",i.startDate),c(),D("ngModel",i.endDate),c(6),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products.length>0)}},dependencies:[V,U,it,$,G,L,Y,z,q,B,ee,Xt,te,ne],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.img-logo[_ngcontent-%COMP%]{height:24px;width:24px}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}"]});let o=r;return o})();function Me(o,r){if(o&1){let n=v();P(0),a(1,"button",10),f("click",function(){m(n);let e=p();return u(e.onOpenScanDialog())}),_(2,"i",11),d(3," Scan Channel "),l(),b()}}function Oe(o,r){if(o&1){let n=v();P(0),a(1,"button",12),f("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),_(2,"i",11),d(3),l(),b()}if(o&2){let n=p();c(3),w(" Scan (",n.productService.selectedProduct(n.products).length,") ")}}function Fe(o,r){if(o&1){let n=v();P(0),a(1,"button",13),f("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),_(2,"i",14),d(3),l(),b()}if(o&2){let n=p();c(3),w(" Upload (",n.productService.selectedProduct(n.products).length,") ")}}function Te(o,r){if(o&1&&(a(0,"span",15),_(1,"img",16),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,O)("alt",n.Name),c(),w(" ",n.Name," ")}}function De(o,r){if(o&1){let n=v();a(0,"div",17)(1,"label",18),d(2,"Item ID"),l(),a(3,"input",19),N("ngModelChange",function(e){m(n);let i=p();return E(i.searchFilter.Item_id,e)||(i.searchFilter.Item_id=e),u(e)}),l()()}if(o&2){let n=p();c(3),D("ngModel",n.searchFilter.Item_id)}}function Ee(o,r){if(o&1){let n=v();a(0,"div",20)(1,"app-product-card",21),f("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenVariantDetail(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n==null?null:n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null||n.Variants==null?null:n.Variants.length)>1?(n==null||n.Variants==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",n==null?null:n.hasScan)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)}}function Ne(o,r){o&1&&(P(0),a(1,"div",22),_(2,"app-empty-state"),l(),b())}function ke(o,r){if(o&1){let n=v();a(0,"div",23)(1,"div",24)(2,"app-custom-paginator",25),f("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var me=(()=>{let r=class r{constructor(t,e,i,h,g,I,at,ht){this.http=t,this.dialog=e,this.toastr=i,this.productService=h,this.activateRouter=g,this.authService=I,this.route=at,this.uploadProductService=ht,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=x.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(x.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,e.Filter.ChannelID!=x.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(e.Filter.ChannelID)),this.searchFilter.PageSize=e.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Item_id:this.searchFilter.Item_id};this.productService.findAllSoldInChannel(t).subscribe(e=>{this.products=e.Data,this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions),this.products=this.productService.checkProductHasScanButton(this.products,this.channelOptions)})}searchProduct(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onOpenVariantDetail(t){let e=this.products[t].Variants;this.dialog.open(Pt,{data:{variants:e,title:this.products[t].Name},width:"800px"})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).pipe(y(e=>e)).subscribe(e=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(x.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let e=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(T,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanProducts(h)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=x.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(T,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct;let h=this.productService.selectedProduct(this.products),g=this.productService.getVariantCodesProducts(h);this.scanProducts(g)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);e?this.toastr.success(`Product Successfully scan with ${i?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${i?.Name} `,"Error"),this.searchFilter.ChannelID=x.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=x.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onClearFilterChannel(){this.searchFilter.ChannelID=x.GuidEMpty,this.searchFilter.Item_id=""}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}getRowCount(){let t={ListChannelID:this.searchFilter.ListChannelID,text:this.searchFilter.text};this.http.post("/api/product/GetSoldInChannelRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(W),C(R),C(ft),C(A),C(nt),C(rt))},r.\u0275cmp=M({type:r,selectors:[["app-sold-in-channel"]],decls:18,vars:12,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","clearable","multiple","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["class","mt-5",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"mt-5"],[1,"fw-bold"],["type","text","name","Item_id","id","Item_id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onDescEvent","onScan","onCheckBoxChange","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.searchProduct(g)}),a(1,"actions"),S(2,Me,4,0,"ng-container",1)(3,Oe,4,1,"ng-container",1)(4,Fe,4,1,"ng-container",1),l(),a(5,"filters")(6,"div")(7,"label",2),d(8,"Channel"),l(),a(9,"ng-select",3),f("ngModelChange",function(g){return i.searchFilter.ListChannelID=g})("clear",function(){return i.onClearFilterChannel()}),S(10,Te,3,3,"ng-template",4),l()(),S(11,De,4,1,"div",5),l(),a(12,"content")(13,"div",6)(14,"div",7),S(15,Ee,2,10,"div",8)(16,Ne,3,0,"ng-container",1),l(),S(17,ke,3,4,"div",9),l()()()),e&2&&(s("headerTitle","Sold in Channel"),c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.multipeScanChannels.length>0&&i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("multiple",!0)("items",i.channelOptions)("ngModel",i.searchFilter.ListChannelID),c(2),s("ngIf",i.searchFilter.ListChannelID!=null),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products==null?null:i.products.length))},dependencies:[V,U,it,$,G,L,Y,ot,xt,z,q,B],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=r;return o})();function Ue(o,r){if(o&1){let n=v();a(0,"button",13),f("click",function(){m(n);let e=p(2);return u(e.uploadMultipleProduct())}),_(1,"i",14),d(2),l()}if(o&2){let n=p(2);c(2),w(" upload (",n.selectedProducts==null?null:n.selectedProducts.length,") ")}}function Ae(o,r){if(o&1){let n=v();P(0),a(1,"td",29)(2,"input",30),N("ngModelChange",function(e){m(n);let i=p(2).$implicit;return E(i.selected,e)||(i.selected=e),u(e)}),f("ngModelChange",function(){m(n);let e=p(3).ngIf,i=p(3);return u(i.onSelectProduct(e))}),l()(),b()}if(o&2){let n=p(2).$implicit;c(),s("rowSpan",n==null?null:n.Variants.length),c(),D("ngModel",n.selected)}}function Le(o,r){if(o&1){let n=v();P(0),a(1,"img",35),f("click",function(e){m(n);let i=p(3).$implicit,h=p(4);return u(h.onZoomImage(e,i==null?null:i.ImageUrl))}),l(),b()}if(o&2){let n=p(3).$implicit;c(),s("src",n==null?null:n.ImageUrl,O)}}function Re(o,r){o&1&&_(0,"img",36)}function Be(o,r){if(o&1&&(P(0),a(1,"td",29)(2,"div",31),S(3,Le,2,1,"ng-container",11)(4,Re,1,0,"ng-template",null,1,et),l()(),a(6,"td",32)(7,"h4",33)(8,"span",34),d(9),l()()(),b()),o&2){let n=j(5),t=p(2).$implicit;c(),s("rowSpan",t==null?null:t.Variants.length),c(2),s("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),c(3),s("rowSpan",t==null?null:t.Variants.length),c(2),s("matTooltip",(t==null||t.Name==null?null:t.Name.length)>50?t==null?null:t.Name:""),c(),w(" ",t==null?null:t.Name," ")}}function je(o,r){if(o&1&&(a(0,"div")(1,"a",25),_(2,"img",37),l()()),o&2){let n=r.$implicit;c(),s("href",n.URL,O),c(),s("src",n.Img,O)("matTooltip",n.Name)}}function $e(o,r){if(o&1&&(a(0,"div"),_(1,"img",37),l()),o&2){let n=r.$implicit;c(),s("src",n.Img,O)("matTooltip",n.Name)}}function Ge(o,r){if(o&1&&(a(0,"tr"),S(1,Ae,3,2,"ng-container",12)(2,Be,10,6,"ng-container",12),a(3,"td"),d(4),l(),a(5,"td")(6,"span"),d(7),l(),a(8,"span",24)(9,"a",25),_(10,"i",26),l()()(),a(11,"td",27)(12,"div",28),S(13,je,3,3,"div",23),l()(),a(14,"td",27)(15,"div",28),S(16,$e,2,2,"div",23),l()()()),o&2){let n=r.$implicit,t=r.index,e=p(5);c(),s("ngIf",t==0),c(),s("ngIf",t==0),c(2),w(" ",n.Name," "),c(3),w(" ",n.Code," "),c(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),O),c(4),s("ngForOf",n==null?null:n.Available),c(3),s("ngForOf",n==null?null:n.NotAvailable)}}function We(o,r){if(o&1&&(P(0),S(1,Ge,17,7,"tr",23),b()),o&2){let n=r.$implicit;c(),s("ngForOf",n.Variants)}}function Ke(o,r){if(o&1&&(a(0,"tbody"),S(1,We,2,1,"ng-container",23),l()),o&2){let n=r.ngIf;c(),s("ngForOf",n)}}function Je(o,r){if(o&1&&(P(0),a(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),_(5,"th",18),a(6,"th",19),d(7,"Product"),l(),a(8,"th",20),d(9,"Variant"),l(),a(10,"th",20),d(11,"SKU"),l(),a(12,"th",21),d(13,"Available In"),l(),a(14,"th",22),d(15,"Not Available In"),l()()(),S(16,Ke,2,1,"tbody",12),F(17,"async"),l()(),b()),o&2){let n=p(2);c(16),s("ngIf",k(17,1,n.data$))}}function ze(o,r){o&1&&(a(0,"div",38),_(1,"app-empty-state"),l())}function He(o,r){if(o&1){let n=v();a(0,"span",46),f("click",function(){m(n);let e=p(4);return u(e.getRowCount())}),a(1,"i",47),d(2,"?"),l()()}}function Ye(o,r){if(o&1&&(a(0,"span"),d(1),F(2,"number"),l()),o&2){let n=r.ngIf;c(),_t(k(2,1,n==null?null:n.Count))}}function Ze(o,r){if(o&1){let n=v();a(0,"a",48),f("click",function(){m(n);let e=p(4);return u(e.onNextPage())}),_(1,"i",49),d(2," Next"),l()}}function qe(o,r){if(o&1){let n=v();a(0,"a",50),f("click",function(){m(n);let e=p(4);return u(e.onLastPage())}),_(1,"i",51),d(2," Last"),l()}}function Qe(o,r){if(o&1&&(P(0),a(1,"div",39)(2,"div",40)(3,"div",41),d(4),F(5,"number"),S(6,He,3,0,"span",42)(7,Ye,3,3,"span",12),F(8,"async"),d(9),l()(),a(10,"div",43),S(11,Ze,3,0,"a",44)(12,qe,3,0,"a",45),l()(),b()),o&2){let n=p().ngIf,t=p(2);c(4),w(" Showing 1 - ",k(5,6,n==null?null:n.length)," of "),c(2),s("ngIf",t.paginationService.hideCount),c(),s("ngIf",!t.paginationService.hideCount&&k(8,8,t.rowCount$)),c(2),w(" records ~ ",t.paginationService.footerPageNumber," Page "),c(2),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage),c(),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage)}}function Xe(o,r){if(o&1&&(P(0),S(1,Qe,13,10,"ng-container",12),b()),o&2){let n=r.ngIf;c(),s("ngIf",(n==null?null:n.length)>0)}}function tn(o,r){if(o&1){let n=v();a(0,"mainpanel",3),f("onSubmit",function(e){m(n);let i=p();return u(i.searchProduct(e))}),a(1,"actions"),S(2,Ue,3,1,"button",4),a(3,"button",5),f("click",function(){m(n);let e=p();return u(e.openScanDialog())}),_(4,"i",6),d(5," Scan Channel "),l(),a(6,"button",7),f("click",function(){m(n);let e=p();return u(e.openExportDialog())}),_(7,"i",8),a(8,"span"),d(9,"Export"),l()()(),a(10,"content")(11,"div",9)(12,"div",10),S(13,Je,18,3,"ng-container",11),F(14,"async"),S(15,ze,2,0,"ng-template",null,0,et),l(),S(17,Xe,2,1,"ng-container",12),F(18,"async"),l()()()}if(o&2){let n,t=j(16),e=p();s("hideSearchDropdown",!0),c(2),s("ngIf",e.hasSelectionProduct),c(11),s("ngIf",((n=k(14,5,e.data$))==null?null:n.length)>0)("ngIfElse",t),c(4),s("ngIf",k(18,7,e.data$))}}var ue=(()=>{let r=class r{constructor(t,e,i,h,g,I,at,ht,fe){this.http=t,this.dialog=e,this.toastr=i,this.route=h,this.productService=g,this.paginationService=I,this.biggerPictureService=at,this.authService=ht,this.uploadProductService=fe,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=ht.getChannels(),this.hostName=this.authService.getDomain()}ngOnInit(){this.initPageLoader(),this.iniData()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.notChannelAPI,this.loader$=this.http.post(`api/${this.loaderAPI}`,{}).pipe(Nt(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(Et(t=>(t=t.map(e=>(e.Variants=e.Variants.map(i=>(i.Available=this.productService.sortChannel(i.Available),i.NotAvailable=this.productService.sortChannel(i.NotAvailable),i.Available=this.assignLogoChannel(i.Available),i.NotAvailable=this.assignLogoChannel(i.NotAvailable),i)),e.Channel=e?.Variants[0]?.Available,e)),t)))}assignLogoChannel(t){return t=t.map(e=>(e.Img=x.getChannelLogoByTypeId(e.TypeID),e)),t}searchProduct(t){this.filterSearch.text=t,this.paginationService.reloadPagination(this.filterSearch)}scanAllProduct(){let t=this.productService.findChannelById(this.filterSearch.ChannelID,this.channelOptions);this.productService.scanAll(this.filterSearch.ChannelID,this.filterSearch.ScanFull,this.filterSearch.UpdatedProduct,this.filterSearch.Async).subscribe(e=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(e,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.filterSearch.ChannelID=i.ChannelID,this.filterSearch.ScanFull=i.ScanFull,this.filterSearch.UpdatedProduct=i.UpdatedProduct,this.filterSearch.Async=i.Async,this.scanAllProduct()})}getRowCount(){this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`/api/${this.rowCountAPI}`,this.filterSearch)}onNextPage(){this.paginationService.onNextPage(this.filterSearch)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:t=>{this.filterSearch.PageNumber=1,this.paginationService.getAllData(this.filterSearch,t.Count)}})}onZoomImage(t,e){this.biggerPictureService.openBiggerPicture(t,e)}onSelectProduct(t){this.hasSelectionProduct=this.productService.hasSelection(t),this.selectedProducts=this.productService.selectedProduct(t)}uploadMultipleProduct(){this.uploadProductService.setSelectedProduct(this.selectedProducts),this.route.navigate(["/menu/products/upload"])}ngOnDestroy(){this.paginationService.destroy()}openExportDialog(){this.dialog.open(oe,{data:{title:"Export Not In Channel",pageNumber:this.filterSearch.PageNumber,rowCount:this.filterSearch.RowCount,filterExport:this.filterSearch,getRowCountApi:"product/GetNotInChannelRowCount",exportApi:"product/GetNotInChannelExport"}}).afterClosed().subscribe()}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(W),C(nt),C(R),C(re),C(Qt),C(A),C(rt))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-channel"]],decls:2,vars:3,consts:[["EMPTY",""],["elsePic",""],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"hideSearchDropdown","onSubmit",4,"ngIf"],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"onSubmit","hideSearchDropdown"],["class","btn btn-light shadow rounded ms-2",3,"click",4,"ngIf"],["data-cy","scanNotinChannel","type","button",1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-md-12"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","10px"],["colspan","2",1,"ms-5","text-center",2,"width","450px"],[2,"width","150px"],[2,"width","20%"],[2,"width","16%"],[4,"ngFor","ngForOf"],[1,"ms-1"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"padding-left","0px"],[1,"d-flex","flex-wrap","mb-1"],[1,"text-center",3,"rowSpan"],["type","checkbox",3,"ngModelChange","ngModel"],[2,"padding-right","0px"],[1,"text-start",3,"rowSpan"],[1,"ms-5","fw-normal","text-ellipsis",2,"max-width","26vw !important"],[3,"matTooltip"],[1,"border","rounded","cursor-pointer",2,"max-width","40px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded",2,"max-width","40px"],["alt","",1,"channel-logo","cursor-pointer","ms-4","mt-3",3,"src","matTooltip"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load all products",3,"click",4,"ngIf"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-share"]],template:function(e,i){e&1&&(S(0,tn,19,9,"mainpanel",2),F(1,"async")),e&2&&s("ngIf",k(1,1,i.loader$))},dependencies:[V,U,jt,$,G,L,vt,B,gt,Ct],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}thead[_ngcontent-%COMP%]{position:sticky;top:0}.channel-logo[_ngcontent-%COMP%]{width:20px}.w-img[_ngcontent-%COMP%]{width:100%}"]});let o=r;return o})();var en=o=>[o],nn=()=>[];function on(o,r){if(o&1){let n=v();a(0,"button",15),f("click",function(){m(n);let e=p();return u(e.openScanDialog())}),_(1,"i",16),d(2," Scan Channel "),l()}}function rn(o,r){if(o&1){let n=v();P(0),a(1,"button",17),f("click",function(){m(n);let e=p();return u(e.onDownloadAllProduct("SELECTED"))}),_(2,"i",18),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Download (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function an(o,r){if(o&1&&(a(0,"span",19),_(1,"img",20),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,O)("alt",n.Name),c(),w(" ",n.Name," ")}}function ln(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),f("onCheckBoxChange",function(e){let i=m(n).index,h=p();return u(h.onSelectProduct(e,i))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onShowVariantDetail(e))})("onDownload",function(){let e=m(n).$implicit,i=p();return u(i.onDownloadProduct(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanChannel(e))}),l()()}if(o&2){let n=r.$implicit;c(),s("showRedirectIcon",!1)("title",n==null?null:n.Name)("image",n==null?null:n.Image)("imageForZoom",n==null?null:n.Image)("code",n==null?null:n.SKU)("description",(n==null||n.Variant==null?null:n.Variant.length)>0?(n==null||n.Variant==null?null:n.Variant.length)+" Variants":null)("downloadButton",!0)("channels",n!=null&&n.Channel?lt(10,en,n==null?null:n.Channel):Q(12,nn))("showCheckBox",!0)("scanButton",!0)}}function cn(o,r){o&1&&(P(0),a(1,"div",23),_(2,"app-empty-state"),l(),b())}function sn(o,r){if(o&1){let n=v();a(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),f("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var he=(()=>{let r=class r{constructor(t,e,i,h,g,I){this.http=t,this.dialog=e,this.productService=i,this.toastrService=h,this.activateRouter=g,this.authService=I,this.searchFilter=new Z,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(x.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,this.searchFilter.PageSize=e.Filter.RowCount,this.getProducts()})}getProducts(){this.http.post("/api/product/GetProductChannelNotPOS",this.searchFilter).subscribe(t=>{this.products=t.Data,this.mapChannelToProduct(),this.setSkuProduct()})}mapChannelToProduct(){let t;this.products=this.products.map(e=>(t=this.channelOptions.find(i=>i.ID==e.ChannelID),t?e.Channel=JSON.parse(JSON.stringify(t)):e.Channel=null,e)).map(e=>(e.Channel&&(e.Channel.Url=e.Url),e))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?x.IsNotEmpty(t?.ChannelItemSKU)?t.SKU=t?.ChannelItemSKU:t.SKU="SKU not assigned":t.SKU=t?.Variant[0]?.ChannelVariationSKU?t?.Variant[0]?.ChannelVariationSKU:"SKU not assigned",t))}onSearch(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onClearChannelFilter(){this.searchFilter.ChannelID=x.GuidEMpty}onScanAll(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(e=>{this.searchFilter.Async?this.toastrService.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.initPageLoader(x.GuidEMpty),this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=x.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.Async=i.Async,this.onScanAll()})}onDownloadAllProduct(t){let e;t=="ALL"?e=this.products:e=this.productService.selectedProduct(this.products),e.length>0&&this.productService.downloadMultipleProduct(e).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,e){this.products[e].selected=t}onDownloadProduct(t){confirm(`Are you sure you want to Retrieve product ${t?.Name} from ${t?.Channel.Name} to POS?`)&&this.productService.downloadProduct(t).subscribe({next:()=>{this.getProducts()}})}onScanChannel(t){let e=JSON.parse(JSON.stringify(t));delete e.Channel,this.productService.scanCompareToPos([e]).subscribe(i=>{i.Status?(this.initPageLoader(x.GuidEMpty),this.toastrService.success(`product ${t.Name} have been successfully scanned and synchronized with POS`,"Success")):this.toastrService.error(`Product ${t.Name} is not existed in POS`,"Error")})}onShowVariantDetail(t){let e=this.products[t].Variant;e.length>0&&this.dialog.open(ae,{data:{title:this.products[t].Name,variants:e},width:"30%"})}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,text:this.searchFilter.text,HaveSku:parseInt(this.searchFilter.HaveSku)};this.http.post("/api/product/GetProductChannelNotPOSRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Count})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(R),C(W),C(ft),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-pos"]],decls:30,vars:13,consts:[["headerTitle","Not in POS","textButton","Search","description","SKU sold in Marketplace but not exist in DEALPOS",3,"onSubmit"],["type","button","data-cy","scanNotInPos","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],[4,"ngIf"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp",""],[1,"mt-5"],[1,"fw-bold"],["name","haveSKU",1,"form-control","h-100","pt-3","rounded","mt-2",3,"ngModelChange","ngModel"],[1,"me-5",3,"value"],["type","text","name","Item_id","id","Item_id","placeholder","item id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3",3,"click"],[1,"fa","fa-download"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onCheckBoxChange","onDescEvent","onDownload","onScan","showRedirectIcon","title","image","imageForZoom","code","description","downloadButton","channels","showCheckBox","scanButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.onSearch(g)}),a(1,"actions"),S(2,on,3,0,"button",1)(3,rn,4,1,"ng-container",2),l(),a(4,"filters")(5,"div")(6,"label",3),d(7,"Channel"),l(),a(8,"ng-select",4),N("ngModelChange",function(g){return E(i.searchFilter.ChannelID,g)||(i.searchFilter.ChannelID=g),g}),S(9,an,3,3,"ng-template",5),l()(),a(10,"div",6)(11,"label",7),d(12,"SKU Assigned"),l(),a(13,"mat-radio-group",8),N("ngModelChange",function(g){return E(i.searchFilter.HaveSku,g)||(i.searchFilter.HaveSku=g),g}),a(14,"mat-radio-button",9),d(15," All "),l(),a(16,"mat-radio-button",9),d(17," Yes "),l(),a(18,"mat-radio-button",9),d(19," No "),l()()(),a(20,"div",6)(21,"label",7),d(22,"Item ID"),l(),a(23,"input",10),N("ngModelChange",function(g){return E(i.searchFilter.Item_id,g)||(i.searchFilter.Item_id=g),g}),l()()(),a(24,"content")(25,"div",11)(26,"div",12),S(27,ln,2,13,"div",13)(28,cn,3,0,"ng-container",2),l(),S(29,sn,3,4,"div",14),l()()()),e&2&&(c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.channelOptions),D("ngModel",i.searchFilter.ChannelID),c(5),D("ngModel",i.searchFilter.HaveSku),c(),s("value",0),c(2),s("value",1),c(2),s("value",2),c(5),D("ngModel",i.searchFilter.Item_id),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[V,U,it,$,G,L,Y,ot,Yt,Zt,z,q,B],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.itemTitle[_ngcontent-%COMP%]{cursor:pointer}"]});let o=r;return o})();function pn(o,r){if(o&1&&(a(0,"span",9),_(1,"img",10),l(),d(2)),o&2){let n=r.item,t=p();c(),s("src",t.getChannelLogo(n.TypeID),O),c(),w(" ",n.Name," ")}}function dn(o,r){if(o&1&&(a(0,"div",11),_(1,"app-duplicate-product-card",12),l()),o&2){let n=r.$implicit,t=r.index;c(),s("imageForZoom",n.ImageUrl)("title",n.Name)("code",n.Code)("id",t)("image",n.ThumbnailURL)("channels",n.Channels)}}function mn(o,r){o&1&&(P(0),a(1,"div",13),_(2,"app-empty-state"),l(),b())}function un(o,r){if(o&1){let n=v();P(0),a(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),f("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())})("total",function(){m(n);let e=p();return u(e.getRowCount())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickedRowCount)}}var _e=(()=>{let r=class r{constructor(t,e,i){this.httpService=t,this.productService=e,this.authService=i,this.searchFilter=new Z,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=i.getChannels()}getPageLoader(){this.productService.loader().subscribe(t=>{this.searchFilter=t.Filter,this.searchFilter.PageSize=t.Filter.RowCount,this.getProducts()})}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,RowCount:this.searchFilter.RowCount,PageNumber:this.searchFilter.PageNumber,text:this.searchFilter.text};this.httpService.post("/api/product/GetDuplicateInChannel",t).subscribe(e=>{this.products=e.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=x.GuidEMpty}getChannelLogo(t){return x.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(e=>{this.hasClickedRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(R),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-duplicate-sku"]],decls:14,vars:7,consts:[["headerTitle","Multiple Listing","textButton"," Search","description","SKU(s) which is listed more than one time (one to many)",3,"onSubmit"],["container",""],[1,"mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","multiple","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid"],[1,"row","mt-8","mx-1"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"imageForZoom","title","code","id","image","channels"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","total","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.onSearch(g)}),a(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),d(5,"Channel"),l(),a(6,"ng-select",3),N("ngModelChange",function(g){return E(i.searchFilter.ListChannelID,g)||(i.searchFilter.ListChannelID=g),g}),f("clear",function(){return i.onClearFilter()}),S(7,pn,3,2,"ng-template",4),l()()()(),a(8,"content")(9,"div",5)(10,"div",6),S(11,dn,2,6,"div",7)(12,mn,3,0,"ng-container",8),l(),S(13,un,4,4,"ng-container",8),l()()()),e&2&&(c(6),s("multiple",!0)("clearable",!0)("items",i.channelOptions),D("ngModel",i.searchFilter.ListChannelID),c(5),s("ngForOf",i.products),c(),s("ngIf",(i.products==null?null:i.products.length)==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[V,U,$,G,L,Y,ot,xt,bt,z,B]});let o=r;return o})();var hn=()=>["/menu/products/status/sold-in-channel"],ge=o=>({ID:o}),_n=()=>["/menu/products/status/not-in-pos"];function gn(o,r){if(o&1&&(P(0),d(1),b()),o&2){let n=p().$implicit;c(),w(" ",n.Count," ")}}function Cn(o,r){if(o&1){let n=v();a(0,"span",26),f("click",function(){m(n);let e=p().$implicit,i=p(2);return u(i.getLiveProductCount(e.ID,e))}),_(1,"i",27),l()}}function fn(o,r){if(o&1){let n=v();a(0,"tr")(1,"td"),_(2,"img",17),a(3,"span",18),d(4),l()(),a(5,"td",19),S(6,gn,2,1,"ng-container",6)(7,Cn,2,0,"ng-template",null,1,et),l(),a(9,"td",19)(10,"a",20),d(11),F(12,"number"),l()(),a(13,"td",19)(14,"a",20),d(15),F(16,"number"),l()(),a(17,"td"),d(18),F(19,"date"),l(),a(20,"td")(21,"div",21)(22,"button",22),f("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onScanChannel(e))}),_(23,"i",23),d(24," Scan "),l(),a(25,"button",24),f("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onClearCache(e.ID))}),_(26,"i",25),d(27," Clear "),l()()()()}if(o&2){let n=r.$implicit,t=j(8),e=p(2);c(2),s("src",e.getChannelLogo(n.TypeID),O),c(2),_t(n.Name),c(2),s("ngIf",n.Count!==void 0)("ngIfElse",t),c(4),s("routerLink",Q(18,hn))("queryParams",lt(19,ge,n.ID)),c(),w(" ",k(12,11,n.SoldInChannel)," "),c(3),s("routerLink",Q(21,_n))("queryParams",lt(22,ge,n.ID)),c(),w(" ",k(16,13,n.NotInPOS)," "),c(3),w("",n.LastSync?Ut(19,15,n.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function Sn(o,r){if(o&1&&(P(0),a(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),d(6,"Channel"),l(),a(7,"th",11),d(8,"Live Product"),l(),a(9,"th",12),d(10,"Sold In Channel"),l(),a(11,"th",13),d(12,"Product Not in POS"),l(),a(13,"th",14),d(14,"Last Sync"),l(),_(15,"th",15),l()(),a(16,"tbody"),S(17,fn,28,24,"tr",16),F(18,"async"),l()()(),b()),o&2){let n,t=p();c(17),s("ngForOf",(n=k(18,1,t.channels$))==null?null:n.Data)}}function xn(o,r){o&1&&(a(0,"div",28),_(1,"app-empty-state"),l())}var Ce=(()=>{let r=class r{constructor(t,e,i,h){this.productService=t,this.toastr=e,this.dialog=i,this.authService=h,this.destroy$=new Dt,this.channelOptions=h.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,e){this.productService.getTotalProductLive(t).pipe(Ot(this.destroy$)).subscribe(i=>{e.Count=i.Count})}onScanChannel(t){this.dialog.open(T,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(y(e=>x.IsNotEmpty(e))).subscribe(e=>{this.scanAllProduct(t.ID,e)})}scanAllProduct(t,e){let i=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(e.ChannelID,e.ScanFull,e.UpdatedProduct,e.Async).pipe(y(h=>h)).subscribe(h=>{e.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(h,i,!e.UpdatedProduct),this.setObsProductStatistic())})}onClearCache(t){confirm("Are you sure you want to Clear Cache? This Process will remove your product integration to marketplace")&&this.productService.clearCacheChannel(t).pipe(Ot(this.destroy$)).subscribe(i=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return x.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};r.\u0275fac=function(e){return new(e||r)(C(R),C(W),C(J),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-channel-statistic"]],decls:9,vars:6,consts:[["EMPTY",""],["QUESTION",""],["headerTitle","Products Statistic",3,"hideSearchBox","hideSearchDropdown"],[1,"container-fluid"],[1,"row","mt-4"],[1,"col-md-12"],[4,"ngIf","ngIfElse"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[1,"text-center",2,"width","13rem"],[1,"text-center",2,"width","9rem"],[1,"text-center",2,"width","14rem"],[2,"width","10rem"],[2,"width","12rem"],[4,"ngFor","ngForOf"],[2,"width","24px","height","24px",3,"src"],[1,"ms-3"],[1,"text-center"],[3,"routerLink","queryParams"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-sm","btn-secondary","fs-6",3,"click"],[1,"fa","fa-spinner"],[1,"btn","btn-sm","btn-secondary","fs-6","ms-3",3,"click"],[1,"fa","fa-trash"],["matTooltip","Click to see total live product",1,"cursor-pointer","fs-5","text-primary",3,"click"],[1,"fa-solid","fa-circle-question","cursor"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"]],template:function(e,i){if(e&1&&(a(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),S(5,Sn,19,3,"ng-container",6),F(6,"async"),S(7,xn,2,0,"ng-template",null,0,et),l()()()()()),e&2){let h,g=j(8);s("hideSearchBox",!0)("hideSearchDropdown",!0),c(5),s("ngIf",((h=k(6,4,i.channels$))==null||h.Data==null?null:h.Data.length)>0)("ngIfElse",g)}},dependencies:[V,U,L,vt,St,B,gt,Ct,At]});let o=r;return o})();var vn=[{component:ce,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:de,canActivate:[X],data:{title:"Products in POS"}},{path:"sold-in-channel",component:me,canActivate:[X],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:ue,canActivate:[X],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:he,canActivate:[X],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:_e,canActivate:[X],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:Ce,canActivate:[X],data:{title:"Channel Statistic"}}]}],Di=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=Vt({type:r}),r.\u0275inj=kt({imports:[Lt,$t,Jt,Kt,Gt,le,qt,Ht,bt,z,q,Bt.forChild(vn),ie,Wt]});let o=r;return o})();export{Di as StatusModule};
|
|
1
|
+
import{a as T,b as Pt,c as ae}from"./chunk-IAYFW5AU.js";import"./chunk-E3LCGTRI.js";import{a as re}from"./chunk-5BU6HQXL.js";import{a as Z}from"./chunk-7KG3DC5J.js";import{a as B}from"./chunk-4URWFKAM.js";import{b as oe}from"./chunk-RXDUUYMX.js";import"./chunk-GP6U42SV.js";import"./chunk-O5FN3DLG.js";import{a as zt,b as Ht}from"./chunk-RKRJ4JOF.js";import{f as rt}from"./chunk-AMJOGMUP.js";import{f as Xt,g as te,h as ee,i as ne,j as ie}from"./chunk-DSDMENCN.js";import{a as R}from"./chunk-EEOWKNSQ.js";import"./chunk-IJAO5VS5.js";import{a as q,b as bt}from"./chunk-4BPLZVXV.js";import{a as z}from"./chunk-ONKOEBKR.js";import{b as le}from"./chunk-ZG6JXFSY.js";import"./chunk-ZQLDSEY5.js";import{a as Yt,b as Zt,c as qt}from"./chunk-2L5RCILV.js";import{a as X}from"./chunk-2DXLUQ37.js";import{a as Qt}from"./chunk-C62XLEFW.js";import"./chunk-M4JG6342.js";import"./chunk-6NTRXLMW.js";import{a as ot,b as xt,d as Y,e as Gt}from"./chunk-Y27IE54D.js";import{g as A}from"./chunk-OML53I6I.js";import{b as W,e as K}from"./chunk-AAFEUTPF.js";import"./chunk-KCDL7SWP.js";import{d as J,l as L,m as Jt}from"./chunk-UUNZHJ6W.js";import{t as vt,u as Kt}from"./chunk-CTKEWRX4.js";import{P as Wt}from"./chunk-GXHE2CDH.js";import{b as jt,c as it,h as $,l as G,y as $t}from"./chunk-QOA24ZLA.js";import{b as H,c as x}from"./chunk-2AMEIUWK.js";import{$a as s,$b as k,Ac as At,B as y,Cc as Ct,Dc as Lt,Ha as O,Hb as j,Ia as c,Ib as d,Ja as C,Jb as _t,Kb as w,Mb as D,Nb as E,Ob as N,Rb as Q,Sb as lt,Uc as ft,V as Ot,Vc as Rt,Wc as nt,X as Nt,Xc as St,Za as S,Zc as Bt,_b as F,aa as kt,ac as Ut,bc as et,c as Dt,ga as M,ha as Vt,lb as a,mb as l,nb as _,oa as m,ob as P,pa as u,pb as b,q as Et,rb as v,ub as f,vc as V,wb as p,wc as U,zc as gt}from"./chunk-HSFUKC7R.js";import"./chunk-GNOSNGXM.js";var Se=()=>["/menu/products/download/by-url"],ce=(()=>{let r=class r{constructor(){this.productTabs=[{Title:"Sold in Channel",Url:"/menu/products/status/sold-in-channel",Description:"SKU has been mapped between dealpos and marketplace"},{Title:"Not in POS",Url:"/menu/products/status/not-in-pos",Description:"SKU sold in Marketplace but not exist in DEALPOS"},{Title:"Not in Channel",Url:"/menu/products/status/not-in-channel",Description:"SKU has not been sold on one of channels"},{Title:"In POS",Url:"/menu/products/status/in-pos",Description:"All products which is already available in POS"},{Title:"Multiple Listing",Url:"/menu/products/status/duplicate-sku",Description:"SKU(s) which is listed more than one time (one to many)"},{Title:"Channel Statistic",Url:"/menu/products/status/channel-statistic",Description:"Product statistic from each channel obtained from the last product scan"}]}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=M({type:r,selectors:[["app-status"]],decls:13,vars:3,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid","d-flex","align-items-center","justify-content-between"],[3,"Tabs"],[1,"dropdown","me-6"],["role","button","data-bs-toggle","dropdown","aria-expanded","false",1,"text-dark"],[1,"fa-solid","fa-bars","fa-lg"],[1,"dropdown-menu","dropdown-menu-end","row"],[1,"d-flex"],[1,"dropdown-item",3,"routerLink"]],template:function(e,i){e&1&&(a(0,"nav",0)(1,"div",1)(2,"div"),_(3,"nav-tab",2),l()(),a(4,"div")(5,"div",3)(6,"a",4),_(7,"i",5),l(),a(8,"div",6)(9,"div",7)(10,"a",8),d(11,"Download Product By Url"),l()()()()()(),_(12,"router-outlet")),e&2&&(c(3),s("Tabs",i.productTabs),c(7),s("routerLink",Q(2,Se)))},dependencies:[zt,Rt,St]});let o=r;return o})();function xe(o,r){if(o&1){let n=v();a(0,"button",13),f("click",function(){m(n);let e=p(2);return u(e.onOpenScanDialog())}),_(1,"i",14),d(2," Scan Channel "),l()}}function ve(o,r){if(o&1&&(P(0),S(1,xe,3,0,"button",12),b()),o&2){let n=p();c(),s("ngIf",!n.productService.hasSelection(n.products))}}function Pe(o,r){if(o&1){let n=v();P(0),a(1,"button",15),f("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),_(2,"i",14),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Scan (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function be(o,r){if(o&1){let n=v();P(0),a(1,"button",16),f("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),_(2,"i",17),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Upload (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function Ie(o,r){if(o&1){let n=v();a(0,"div",18)(1,"app-product-card",19),f("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null?null:n.Variants.length)>1?(n==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",(n==null?null:n.Channel.length)<t.channelOptions.length)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)}}function we(o,r){o&1&&(P(0),a(1,"div",20),_(2,"app-empty-state"),l(),b())}function ye(o,r){if(o&1){let n=v();P(0),a(1,"div",21)(2,"div",22)(3,"app-custom-paginator",23),f("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",!0)}}var de=(()=>{let r=class r{constructor(t,e,i,h,g,I,at){this.http=t,this.toastr=e,this.dialog=i,this.productService=h,this.authService=g,this.uploadProductService=I,this.route=at,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.multipeScanChannels=[],this.getLoaderPage(),this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}getLoaderPage(){this.productService.LoadInPOS().subscribe(t=>{this.Categories=t.Options.Categories,this.searchFilter.PageNumber=t.Filter.PageNumber,this.searchFilter.RowCount=t.Filter.RowCount,this.searchFilter.ChannelID=null,this.searchFilter.Category=t.Filter.Category,this.searchFilter.PageSize=100,this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Category:this.searchFilter.Category,From:this.startDate,To:this.endDate};this.http.post("/api/product/GetInPOS",t).subscribe(e=>{this.products=e.Data,this.rowCount=e.Total==null?this.searchFilter.RowCount:e.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){if(this.searchFilter.ChannelID==null){this.toastr.error("Please Select Channel","Error");return}this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{this.getLoaderPage();let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,e,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){this.dialog.open(Pt,{data:{title:this.products[t].Name,variants:this.products[t].Variants},width:"800px"})}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}searchProduct(t){this.searchFilter.text=t,this.getProducts()}onScanMultipleProduct(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty;let e=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok]);this.dialog.open(T,{data:{filter:t,channelOptions:e,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(h=>x.IsNotEmpty(h))).subscribe(h=>{this.searchFilter.ChannelID=h.ChannelID,this.searchFilter.ScanFull=h.ScanFull,this.searchFilter.UpdatedProduct=h.UpdatedProduct;let g=this.productService.selectedProduct(this.products),I=this.productService.getVariantCodesProducts(g);this.scanSingleProduct(I)})}onScanSingleProduct(t){let e=JSON.parse(JSON.stringify(this.searchFilter));e.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(h)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{if(e)this.toastr.success("Successfully Scan ","Success");else{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${i?.Name} `,"Error")}this.searchFilter.ChannelID=x.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=x.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}};r.\u0275fac=function(e){return new(e||r)(C(K),C(W),C(J),C(R),C(A),C(rt),C(nt))},r.\u0275cmp=M({type:r,selectors:[["app-in-pos"]],decls:22,vars:13,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","Name","bindValue","Name","placeholder","Select Category",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],[1,"mt-5"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["type","button","data-cy","scanSoldinChannel","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onScan","onDescEvent","onCheckBoxChange","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){if(e&1){let h=v();a(0,"mainpanel",1),f("onSubmit",function(I){return m(h),u(i.searchProduct(I))}),a(1,"actions"),S(2,ve,2,1,"ng-container",2)(3,Pe,4,1,"ng-container",2)(4,be,4,1,"ng-container",2),l(),a(5,"filters")(6,"div")(7,"label",3),d(8,"Category"),l(),a(9,"ng-select",4),f("ngModelChange",function(I){return m(h),u(i.searchFilter.Category=I)}),l()(),a(10,"div",5)(11,"mat-date-range-input",6)(12,"input",7),N("ngModelChange",function(I){return m(h),E(i.startDate,I)||(i.startDate=I),u(I)}),f("click",function(){m(h);let I=j(15);return u(I.open())}),l(),a(13,"input",8),N("ngModelChange",function(I){return m(h),E(i.endDate,I)||(i.endDate=I),u(I)}),f("click",function(){m(h);let I=j(15);return u(I.open())}),l()(),_(14,"mat-date-range-picker",null,0),l()(),a(16,"content")(17,"div",9)(18,"div",10),S(19,Ie,2,10,"div",11)(20,we,3,0,"ng-container",2),l(),S(21,ye,4,4,"ng-container",2),l()()()}if(e&2){let h=j(15);s("headerTitle","In POS ("+i.rowCount+")"),c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)&&i.multipeScanChannels.length>0),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.Categories)("ngModel",i.searchFilter.Category),c(2),s("rangePicker",h),c(),D("ngModel",i.startDate),c(),D("ngModel",i.endDate),c(6),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products.length>0)}},dependencies:[V,U,it,$,G,L,Y,z,q,B,ee,Xt,te,ne],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.img-logo[_ngcontent-%COMP%]{height:24px;width:24px}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}"]});let o=r;return o})();function Me(o,r){if(o&1){let n=v();P(0),a(1,"button",10),f("click",function(){m(n);let e=p();return u(e.onOpenScanDialog())}),_(2,"i",11),d(3," Scan Channel "),l(),b()}}function Oe(o,r){if(o&1){let n=v();P(0),a(1,"button",12),f("click",function(){m(n);let e=p();return u(e.onScanMultipleProduct())}),_(2,"i",11),d(3),l(),b()}if(o&2){let n=p();c(3),w(" Scan (",n.productService.selectedProduct(n.products).length,") ")}}function Fe(o,r){if(o&1){let n=v();P(0),a(1,"button",13),f("click",function(){m(n);let e=p();return u(e.onUploadMultipleProduct())}),_(2,"i",14),d(3),l(),b()}if(o&2){let n=p();c(3),w(" Upload (",n.productService.selectedProduct(n.products).length,") ")}}function Te(o,r){if(o&1&&(a(0,"span",15),_(1,"img",16),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,O)("alt",n.Name),c(),w(" ",n.Name," ")}}function De(o,r){if(o&1){let n=v();a(0,"div",17)(1,"label",18),d(2,"Item ID"),l(),a(3,"input",19),N("ngModelChange",function(e){m(n);let i=p();return E(i.searchFilter.Item_id,e)||(i.searchFilter.Item_id=e),u(e)}),l()()}if(o&2){let n=p();c(3),D("ngModel",n.searchFilter.Item_id)}}function Ee(o,r){if(o&1){let n=v();a(0,"div",20)(1,"app-product-card",21),f("onUpload",function(){let e=m(n).$implicit,i=p();return u(i.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onOpenVariantDetail(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let i=m(n).$implicit;return u(i.selected=e)}),l()()}if(o&2){let n=r.$implicit,t=p();c(),s("productId",n==null?null:n.ID)("title",n==null?null:n.Name)("image",n==null?null:n.ThumbnailUrl)("description",(n==null||n.Variants==null?null:n.Variants.length)>1?(n==null||n.Variants==null?null:n.Variants.length)+" Variants":null)("channels",t.productService.getChannelProduct(n))("code",t.getVariantCode(n==null?null:n.Variants))("showCheckBox",n==null?null:n.hasScan)("scanButton",!0)("uploadButton",n==null?null:n.hasUpload)("imageForZoom",n==null?null:n.ImageUrl)}}function Ne(o,r){o&1&&(P(0),a(1,"div",22),_(2,"app-empty-state"),l(),b())}function ke(o,r){if(o&1){let n=v();a(0,"div",23)(1,"div",24)(2,"app-custom-paginator",25),f("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var me=(()=>{let r=class r{constructor(t,e,i,h,g,I,at,ht){this.http=t,this.dialog=e,this.toastr=i,this.productService=h,this.activateRouter=g,this.authService=I,this.route=at,this.uploadProductService=ht,this.searchFilter=new Z,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=x.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(x.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,e.Filter.ChannelID!=x.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(e.Filter.ChannelID)),this.searchFilter.PageSize=e.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[H.Tokopedia,H.Tiktok])}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,text:this.searchFilter.text,Item_id:this.searchFilter.Item_id};this.productService.findAllSoldInChannel(t).subscribe(e=>{this.products=e.Data,this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions),this.products=this.productService.checkProductHasScanButton(this.products,this.channelOptions)})}searchProduct(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onOpenVariantDetail(t){let e=this.products[t].Variants;this.dialog.open(Pt,{data:{variants:e,title:this.products[t].Name},width:"800px"})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.Async=i.Async,this.scanAllProduct()})}scanAllProduct(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).pipe(y(e=>e)).subscribe(e=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(x.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let e=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(T,{data:{filter:e,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID;let h=this.productService.getVariantCodesProduct(t);this.scanProducts(h)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=x.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(T,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.UpdatedProduct=i.UpdatedProduct;let h=this.productService.selectedProduct(this.products),g=this.productService.getVariantCodesProducts(h);this.scanProducts(g)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:e=>{let i=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);e?this.toastr.success(`Product Successfully scan with ${i?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${i?.Name} `,"Error"),this.searchFilter.ChannelID=x.GuidEMpty,e&&this.getProducts()},error:e=>{this.searchFilter.ChannelID=x.GuidEMpty}})}getVariantCode(t){let e;return t.length>1&&(e=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(e=t[0].Code),e}onClearFilterChannel(){this.searchFilter.ChannelID=x.GuidEMpty,this.searchFilter.Item_id=""}onUploadMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.uploadProductService.setSelectedProduct(t),this.route.navigate(["/menu/products/upload"])}getRowCount(){let t={ListChannelID:this.searchFilter.ListChannelID,text:this.searchFilter.text};this.http.post("/api/product/GetSoldInChannelRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(W),C(R),C(ft),C(A),C(nt),C(rt))},r.\u0275cmp=M({type:r,selectors:[["app-sold-in-channel"]],decls:18,vars:12,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],[4,"ngIf"],[1,"fw-bold","mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","clearable","multiple","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],["class","mt-5",4,"ngIf"],[1,"container-fluid"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanSoldinChannel",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"mt-5"],[1,"fw-bold"],["type","text","name","Item_id","id","Item_id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onUpload","onDescEvent","onScan","onCheckBoxChange","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.searchProduct(g)}),a(1,"actions"),S(2,Me,4,0,"ng-container",1)(3,Oe,4,1,"ng-container",1)(4,Fe,4,1,"ng-container",1),l(),a(5,"filters")(6,"div")(7,"label",2),d(8,"Channel"),l(),a(9,"ng-select",3),f("ngModelChange",function(g){return i.searchFilter.ListChannelID=g})("clear",function(){return i.onClearFilterChannel()}),S(10,Te,3,3,"ng-template",4),l()(),S(11,De,4,1,"div",5),l(),a(12,"content")(13,"div",6)(14,"div",7),S(15,Ee,2,10,"div",8)(16,Ne,3,0,"ng-container",1),l(),S(17,ke,3,4,"div",9),l()()()),e&2&&(s("headerTitle","Sold in Channel"),c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.multipeScanChannels.length>0&&i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("multiple",!0)("items",i.channelOptions)("ngModel",i.searchFilter.ListChannelID),c(2),s("ngIf",i.searchFilter.ListChannelID!=null),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",i.products==null?null:i.products.length))},dependencies:[V,U,it,$,G,L,Y,ot,xt,z,q,B],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=r;return o})();function Ue(o,r){if(o&1){let n=v();a(0,"button",13),f("click",function(){m(n);let e=p(2);return u(e.uploadMultipleProduct())}),_(1,"i",14),d(2),l()}if(o&2){let n=p(2);c(2),w(" upload (",n.selectedProducts==null?null:n.selectedProducts.length,") ")}}function Ae(o,r){if(o&1){let n=v();P(0),a(1,"td",29)(2,"input",30),N("ngModelChange",function(e){m(n);let i=p(2).$implicit;return E(i.selected,e)||(i.selected=e),u(e)}),f("ngModelChange",function(){m(n);let e=p(3).ngIf,i=p(3);return u(i.onSelectProduct(e))}),l()(),b()}if(o&2){let n=p(2).$implicit;c(),s("rowSpan",n==null?null:n.Variants.length),c(),D("ngModel",n.selected)}}function Le(o,r){if(o&1){let n=v();P(0),a(1,"img",35),f("click",function(e){m(n);let i=p(3).$implicit,h=p(4);return u(h.onZoomImage(e,i==null?null:i.ImageUrl))}),l(),b()}if(o&2){let n=p(3).$implicit;c(),s("src",n==null?null:n.ImageUrl,O)}}function Re(o,r){o&1&&_(0,"img",36)}function Be(o,r){if(o&1&&(P(0),a(1,"td",29)(2,"div",31),S(3,Le,2,1,"ng-container",11)(4,Re,1,0,"ng-template",null,1,et),l()(),a(6,"td",32)(7,"h4",33)(8,"span",34),d(9),l()()(),b()),o&2){let n=j(5),t=p(2).$implicit;c(),s("rowSpan",t==null?null:t.Variants.length),c(2),s("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),c(3),s("rowSpan",t==null?null:t.Variants.length),c(2),s("matTooltip",(t==null||t.Name==null?null:t.Name.length)>50?t==null?null:t.Name:""),c(),w(" ",t==null?null:t.Name," ")}}function je(o,r){if(o&1&&(a(0,"div")(1,"a",25),_(2,"img",37),l()()),o&2){let n=r.$implicit;c(),s("href",n.URL,O),c(),s("src",n.Img,O)("matTooltip",n.Name)}}function $e(o,r){if(o&1&&(a(0,"div"),_(1,"img",37),l()),o&2){let n=r.$implicit;c(),s("src",n.Img,O)("matTooltip",n.Name)}}function Ge(o,r){if(o&1&&(a(0,"tr"),S(1,Ae,3,2,"ng-container",12)(2,Be,10,6,"ng-container",12),a(3,"td"),d(4),l(),a(5,"td")(6,"span"),d(7),l(),a(8,"span",24)(9,"a",25),_(10,"i",26),l()()(),a(11,"td",27)(12,"div",28),S(13,je,3,3,"div",23),l()(),a(14,"td",27)(15,"div",28),S(16,$e,2,2,"div",23),l()()()),o&2){let n=r.$implicit,t=r.index,e=p(5);c(),s("ngIf",t==0),c(),s("ngIf",t==0),c(2),w(" ",n.Name," "),c(3),w(" ",n.Code," "),c(2),s("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),O),c(4),s("ngForOf",n==null?null:n.Available),c(3),s("ngForOf",n==null?null:n.NotAvailable)}}function We(o,r){if(o&1&&(P(0),S(1,Ge,17,7,"tr",23),b()),o&2){let n=r.$implicit;c(),s("ngForOf",n.Variants)}}function Ke(o,r){if(o&1&&(a(0,"tbody"),S(1,We,2,1,"ng-container",23),l()),o&2){let n=r.ngIf;c(),s("ngForOf",n)}}function Je(o,r){if(o&1&&(P(0),a(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),_(5,"th",18),a(6,"th",19),d(7,"Product"),l(),a(8,"th",20),d(9,"Variant"),l(),a(10,"th",20),d(11,"SKU"),l(),a(12,"th",21),d(13,"Available In"),l(),a(14,"th",22),d(15,"Not Available In"),l()()(),S(16,Ke,2,1,"tbody",12),F(17,"async"),l()(),b()),o&2){let n=p(2);c(16),s("ngIf",k(17,1,n.data$))}}function ze(o,r){o&1&&(a(0,"div",38),_(1,"app-empty-state"),l())}function He(o,r){if(o&1){let n=v();a(0,"span",46),f("click",function(){m(n);let e=p(4);return u(e.getRowCount())}),a(1,"i",47),d(2,"?"),l()()}}function Ye(o,r){if(o&1&&(a(0,"span"),d(1),F(2,"number"),l()),o&2){let n=r.ngIf;c(),_t(k(2,1,n==null?null:n.Count))}}function Ze(o,r){if(o&1){let n=v();a(0,"a",48),f("click",function(){m(n);let e=p(4);return u(e.onNextPage())}),_(1,"i",49),d(2," Next"),l()}}function qe(o,r){if(o&1){let n=v();a(0,"a",50),f("click",function(){m(n);let e=p(4);return u(e.onLastPage())}),_(1,"i",51),d(2," Last"),l()}}function Qe(o,r){if(o&1&&(P(0),a(1,"div",39)(2,"div",40)(3,"div",41),d(4),F(5,"number"),S(6,He,3,0,"span",42)(7,Ye,3,3,"span",12),F(8,"async"),d(9),l()(),a(10,"div",43),S(11,Ze,3,0,"a",44)(12,qe,3,0,"a",45),l()(),b()),o&2){let n=p().ngIf,t=p(2);c(4),w(" Showing 1 - ",k(5,6,n==null?null:n.length)," of "),c(2),s("ngIf",t.paginationService.hideCount),c(),s("ngIf",!t.paginationService.hideCount&&k(8,8,t.rowCount$)),c(2),w(" records ~ ",t.paginationService.footerPageNumber," Page "),c(2),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage),c(),s("ngIf",t.paginationService.disableNextButton&&!t.paginationService.goToLastPage)}}function Xe(o,r){if(o&1&&(P(0),S(1,Qe,13,10,"ng-container",12),b()),o&2){let n=r.ngIf;c(),s("ngIf",(n==null?null:n.length)>0)}}function tn(o,r){if(o&1){let n=v();a(0,"mainpanel",3),f("onSubmit",function(e){m(n);let i=p();return u(i.searchProduct(e))}),a(1,"actions"),S(2,Ue,3,1,"button",4),a(3,"button",5),f("click",function(){m(n);let e=p();return u(e.openScanDialog())}),_(4,"i",6),d(5," Scan Channel "),l(),a(6,"button",7),f("click",function(){m(n);let e=p();return u(e.openExportDialog())}),_(7,"i",8),a(8,"span"),d(9,"Export"),l()()(),a(10,"content")(11,"div",9)(12,"div",10),S(13,Je,18,3,"ng-container",11),F(14,"async"),S(15,ze,2,0,"ng-template",null,0,et),l(),S(17,Xe,2,1,"ng-container",12),F(18,"async"),l()()()}if(o&2){let n,t=j(16),e=p();s("hideSearchDropdown",!0),c(2),s("ngIf",e.hasSelectionProduct),c(11),s("ngIf",((n=k(14,5,e.data$))==null?null:n.length)>0)("ngIfElse",t),c(4),s("ngIf",k(18,7,e.data$))}}var ue=(()=>{let r=class r{constructor(t,e,i,h,g,I,at,ht,fe){this.http=t,this.dialog=e,this.toastr=i,this.route=h,this.productService=g,this.paginationService=I,this.biggerPictureService=at,this.authService=ht,this.uploadProductService=fe,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=ht.getChannels(),this.hostName=this.authService.getDomain()}ngOnInit(){this.initPageLoader(),this.iniData()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.notChannelAPI,this.loader$=this.http.post(`api/${this.loaderAPI}`,{}).pipe(Nt(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(Et(t=>(t=t.map(e=>(e.Variants=e.Variants.map(i=>(i.Available=this.productService.sortChannel(i.Available),i.NotAvailable=this.productService.sortChannel(i.NotAvailable),i.Available=this.assignLogoChannel(i.Available),i.NotAvailable=this.assignLogoChannel(i.NotAvailable),i)),e.Channel=e?.Variants[0]?.Available,e)),t)))}assignLogoChannel(t){return t=t.map(e=>(e.Img=x.getChannelLogoByTypeId(e.TypeID),e)),t}searchProduct(t){this.filterSearch.text=t,this.paginationService.reloadPagination(this.filterSearch)}scanAllProduct(){let t=this.productService.findChannelById(this.filterSearch.ChannelID,this.channelOptions);this.productService.scanAll(this.filterSearch.ChannelID,this.filterSearch.ScanFull,this.filterSearch.UpdatedProduct,this.filterSearch.Async).subscribe(e=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(e,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.filterSearch.ChannelID=i.ChannelID,this.filterSearch.ScanFull=i.ScanFull,this.filterSearch.UpdatedProduct=i.UpdatedProduct,this.filterSearch.Async=i.Async,this.scanAllProduct()})}getRowCount(){this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`/api/${this.rowCountAPI}`,this.filterSearch)}onNextPage(){this.paginationService.onNextPage(this.filterSearch)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:t=>{this.filterSearch.PageNumber=1,this.paginationService.getAllData(this.filterSearch,t.Count)}})}onZoomImage(t,e){this.biggerPictureService.openBiggerPicture(t,e)}onSelectProduct(t){this.hasSelectionProduct=this.productService.hasSelection(t),this.selectedProducts=this.productService.selectedProduct(t)}uploadMultipleProduct(){this.uploadProductService.setSelectedProduct(this.selectedProducts),this.route.navigate(["/menu/products/upload"])}ngOnDestroy(){this.paginationService.destroy()}openExportDialog(){this.dialog.open(oe,{data:{title:"Export Not In Channel",pageNumber:this.filterSearch.PageNumber,rowCount:this.filterSearch.RowCount,filterExport:this.filterSearch,getRowCountApi:"product/GetNotInChannelRowCount",exportApi:"product/GetNotInChannelExport"}}).afterClosed().subscribe()}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(W),C(nt),C(R),C(re),C(Qt),C(A),C(rt))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-channel"]],decls:2,vars:3,consts:[["EMPTY",""],["elsePic",""],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"hideSearchDropdown","onSubmit",4,"ngIf"],["headerTitle","Not in Channel","description","SKU has not been sold on one of channels",3,"onSubmit","hideSearchDropdown"],["class","btn btn-light shadow rounded ms-2",3,"click",4,"ngIf"],["data-cy","scanNotinChannel","type","button",1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"container-fluid","mt-3"],[1,"row"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click"],["aria-hidden","true",1,"fa","fa-upload"],[1,"col-md-12"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],[2,"width","10px"],["colspan","2",1,"ms-5","text-center",2,"width","450px"],[2,"width","150px"],[2,"width","20%"],[2,"width","16%"],[4,"ngFor","ngForOf"],[1,"ms-1"],["target","_blank",3,"href"],[1,"fas","fa-solid","fa-arrow-up-right-from-square","external-link-custom"],[2,"padding-left","0px"],[1,"d-flex","flex-wrap","mb-1"],[1,"text-center",3,"rowSpan"],["type","checkbox",3,"ngModelChange","ngModel"],[2,"padding-right","0px"],[1,"text-start",3,"rowSpan"],[1,"ms-5","fw-normal","text-ellipsis",2,"max-width","26vw !important"],[3,"matTooltip"],[1,"border","rounded","cursor-pointer",2,"max-width","40px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded",2,"max-width","40px"],["alt","",1,"channel-logo","cursor-pointer","ms-4","mt-3",3,"src","matTooltip"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load all products",3,"click",4,"ngIf"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-share"]],template:function(e,i){e&1&&(S(0,tn,19,9,"mainpanel",2),F(1,"async")),e&2&&s("ngIf",k(1,1,i.loader$))},dependencies:[V,U,jt,$,G,L,vt,B,gt,Ct],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}thead[_ngcontent-%COMP%]{position:sticky;top:0}.channel-logo[_ngcontent-%COMP%]{width:20px}.w-img[_ngcontent-%COMP%]{width:100%}"]});let o=r;return o})();var en=o=>[o],nn=()=>[];function on(o,r){if(o&1){let n=v();a(0,"button",15),f("click",function(){m(n);let e=p();return u(e.openScanDialog())}),_(1,"i",16),d(2," Scan Channel "),l()}}function rn(o,r){if(o&1){let n=v();P(0),a(1,"button",17),f("click",function(){m(n);let e=p();return u(e.onDownloadAllProduct("SELECTED"))}),_(2,"i",18),d(3),l(),b()}if(o&2){let n,t=p();c(3),w(" Download (",(n=t.productService.selectedProduct(t.products))==null?null:n.length,") ")}}function an(o,r){if(o&1&&(a(0,"span",19),_(1,"img",20),l(),d(2)),o&2){let n=r.item;c(),s("src",n.Img,O)("alt",n.Name),c(),w(" ",n.Name," ")}}function ln(o,r){if(o&1){let n=v();a(0,"div",21)(1,"app-product-card",22),f("onCheckBoxChange",function(e){let i=m(n).index,h=p();return u(h.onSelectProduct(e,i))})("onDescEvent",function(){let e=m(n).index,i=p();return u(i.onShowVariantDetail(e))})("onDownload",function(){let e=m(n).$implicit,i=p();return u(i.onDownloadProduct(e))})("onScan",function(){let e=m(n).$implicit,i=p();return u(i.onScanChannel(e))}),l()()}if(o&2){let n=r.$implicit;c(),s("showRedirectIcon",!1)("title",n==null?null:n.Name)("image",n==null?null:n.Image)("imageForZoom",n==null?null:n.Image)("code",n==null?null:n.SKU)("description",(n==null||n.Variant==null?null:n.Variant.length)>0?(n==null||n.Variant==null?null:n.Variant.length)+" Variants":null)("downloadButton",!0)("channels",n!=null&&n.Channel?lt(10,en,n==null?null:n.Channel):Q(12,nn))("showCheckBox",!0)("scanButton",!0)}}function cn(o,r){o&1&&(P(0),a(1,"div",23),_(2,"app-empty-state"),l(),b())}function sn(o,r){if(o&1){let n=v();a(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),f("total",function(){m(n);let e=p();return u(e.getRowCount())})("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())}),l()()()}if(o&2){let n=p();c(2),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickRowCount)}}var he=(()=>{let r=class r{constructor(t,e,i,h,g,I){this.http=t,this.dialog=e,this.productService=i,this.toastrService=h,this.activateRouter=g,this.authService=I,this.searchFilter=new Z,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(x.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(e=>{this.searchFilter=e.Filter,this.searchFilter.PageSize=e.Filter.RowCount,this.getProducts()})}getProducts(){this.http.post("/api/product/GetProductChannelNotPOS",this.searchFilter).subscribe(t=>{this.products=t.Data,this.mapChannelToProduct(),this.setSkuProduct()})}mapChannelToProduct(){let t;this.products=this.products.map(e=>(t=this.channelOptions.find(i=>i.ID==e.ChannelID),t?e.Channel=JSON.parse(JSON.stringify(t)):e.Channel=null,e)).map(e=>(e.Channel&&(e.Channel.Url=e.Url),e))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?x.IsNotEmpty(t?.ChannelItemSKU)?t.SKU=t?.ChannelItemSKU:t.SKU="SKU not assigned":t.SKU=t?.Variant[0]?.ChannelVariationSKU?t?.Variant[0]?.ChannelVariationSKU:"SKU not assigned",t))}onSearch(t){this.searchFilter.text=t,this.hasClickRowCount=!1,this.getProducts()}onClearChannelFilter(){this.searchFilter.ChannelID=x.GuidEMpty}onScanAll(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(e=>{this.searchFilter.Async?this.toastrService.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.initPageLoader(x.GuidEMpty),this.productService.successToastrScanAllProduct(e,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=x.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=x.GuidEMpty,this.dialog.open(T,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(y(i=>x.IsNotEmpty(i))).subscribe(i=>{this.searchFilter.ChannelID=i.ChannelID,this.searchFilter.UpdatedProduct=i.UpdatedProduct,this.searchFilter.ScanFull=i.ScanFull,this.searchFilter.Async=i.Async,this.onScanAll()})}onDownloadAllProduct(t){let e;t=="ALL"?e=this.products:e=this.productService.selectedProduct(this.products),e.length>0&&this.productService.downloadMultipleProduct(e).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,e){this.products[e].selected=t}onDownloadProduct(t){confirm(`Are you sure you want to Retrieve product ${t?.Name} from ${t?.Channel.Name} to POS?`)&&this.productService.downloadProduct(t).subscribe({next:()=>{this.getProducts()}})}onScanChannel(t){let e=JSON.parse(JSON.stringify(t));delete e.Channel,this.productService.scanCompareToPos([e]).subscribe(i=>{i.Status?(this.initPageLoader(x.GuidEMpty),this.toastrService.success(`product ${t.Name} have been successfully scanned and synchronized with POS`,"Success")):this.toastrService.error(`Product ${t.Name} is not existed in POS`,"Error")})}onShowVariantDetail(t){let e=this.products[t].Variant;e.length>0&&this.dialog.open(ae,{data:{title:this.products[t].Name,variants:e},width:"30%"})}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,text:this.searchFilter.text,HaveSku:parseInt(this.searchFilter.HaveSku)};this.http.post("/api/product/GetProductChannelNotPOSRowCount",t).subscribe(e=>{this.hasClickRowCount=!0,this.rowCount=e.Count})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(J),C(R),C(W),C(ft),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-not-in-pos"]],decls:30,vars:13,consts:[["headerTitle","Not in POS","textButton","Search","description","SKU sold in Marketplace but not exist in DEALPOS",3,"onSubmit"],["type","button","data-cy","scanNotInPos","class","btn btn-outline-secondary shadow rounded",3,"click",4,"ngIf"],[4,"ngIf"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp",""],[1,"mt-5"],[1,"fw-bold"],["name","haveSKU",1,"form-control","h-100","pt-3","rounded","mt-2",3,"ngModelChange","ngModel"],[1,"me-5",3,"value"],["type","text","name","Item_id","id","Item_id","placeholder","item id",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row","mt-8"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],["class","row",4,"ngIf"],["type","button","data-cy","scanNotInPos",1,"btn","btn-outline-secondary","shadow","rounded",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","ms-3",3,"click"],[1,"fa","fa-download"],[1,"me-2"],[2,"width","18px",3,"src","alt"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"onCheckBoxChange","onDescEvent","onDownload","onScan","showRedirectIcon","title","image","imageForZoom","code","description","downloadButton","channels","showCheckBox","scanButton"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row"],[1,"col-12"],[3,"total","next","previous","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.onSearch(g)}),a(1,"actions"),S(2,on,3,0,"button",1)(3,rn,4,1,"ng-container",2),l(),a(4,"filters")(5,"div")(6,"label",3),d(7,"Channel"),l(),a(8,"ng-select",4),N("ngModelChange",function(g){return E(i.searchFilter.ChannelID,g)||(i.searchFilter.ChannelID=g),g}),S(9,an,3,3,"ng-template",5),l()(),a(10,"div",6)(11,"label",7),d(12,"SKU Assigned"),l(),a(13,"mat-radio-group",8),N("ngModelChange",function(g){return E(i.searchFilter.HaveSku,g)||(i.searchFilter.HaveSku=g),g}),a(14,"mat-radio-button",9),d(15," All "),l(),a(16,"mat-radio-button",9),d(17," Yes "),l(),a(18,"mat-radio-button",9),d(19," No "),l()()(),a(20,"div",6)(21,"label",7),d(22,"Item ID"),l(),a(23,"input",10),N("ngModelChange",function(g){return E(i.searchFilter.Item_id,g)||(i.searchFilter.Item_id=g),g}),l()()(),a(24,"content")(25,"div",11)(26,"div",12),S(27,ln,2,13,"div",13)(28,cn,3,0,"ng-container",2),l(),S(29,sn,3,4,"div",14),l()()()),e&2&&(c(2),s("ngIf",!i.productService.hasSelection(i.products)),c(),s("ngIf",i.productService.hasSelection(i.products)),c(5),s("clearable",!0)("items",i.channelOptions),D("ngModel",i.searchFilter.ChannelID),c(5),D("ngModel",i.searchFilter.HaveSku),c(),s("value",0),c(2),s("value",1),c(2),s("value",2),c(5),D("ngModel",i.searchFilter.Item_id),c(4),s("ngForOf",i.products),c(),s("ngIf",i.products.length==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[V,U,it,$,G,L,Y,ot,Yt,Zt,z,q,B],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.itemTitle[_ngcontent-%COMP%]{cursor:pointer}"]});let o=r;return o})();function pn(o,r){if(o&1&&(a(0,"span",9),_(1,"img",10),l(),d(2)),o&2){let n=r.item,t=p();c(),s("src",t.getChannelLogo(n.TypeID),O),c(),w(" ",n.Name," ")}}function dn(o,r){if(o&1&&(a(0,"div",11),_(1,"app-duplicate-product-card",12),l()),o&2){let n=r.$implicit,t=r.index;c(),s("imageForZoom",n.ImageUrl)("title",n.Name)("code",n.Code)("id",t)("image",n.ThumbnailURL)("channels",n.Channels)}}function mn(o,r){o&1&&(P(0),a(1,"div",13),_(2,"app-empty-state"),l(),b())}function un(o,r){if(o&1){let n=v();P(0),a(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),f("next",function(){m(n);let e=p();return u(e.getProducts())})("previous",function(){m(n);let e=p();return u(e.getProducts())})("total",function(){m(n);let e=p();return u(e.getRowCount())}),l()()(),b()}if(o&2){let n=p();c(3),s("filter",n.searchFilter)("totaldata",n.products==null?null:n.products.length)("paginationTotal",n.rowCount)("hasClicked",n.hasClickedRowCount)}}var _e=(()=>{let r=class r{constructor(t,e,i){this.httpService=t,this.productService=e,this.authService=i,this.searchFilter=new Z,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=i.getChannels()}getPageLoader(){this.productService.loader().subscribe(t=>{this.searchFilter=t.Filter,this.searchFilter.PageSize=t.Filter.RowCount,this.getProducts()})}getProducts(){let t={ListChannelID:this.searchFilter.ListChannelID,RowCount:this.searchFilter.RowCount,PageNumber:this.searchFilter.PageNumber,text:this.searchFilter.text};this.httpService.post("/api/product/GetDuplicateInChannel",t).subscribe(e=>{this.products=e.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=x.GuidEMpty}getChannelLogo(t){return x.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(e=>{this.hasClickedRowCount=!0,this.rowCount=e.Total})}};r.\u0275fac=function(e){return new(e||r)(C(K),C(R),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-duplicate-sku"]],decls:14,vars:7,consts:[["headerTitle","Multiple Listing","textButton"," Search","description","SKU(s) which is listed more than one time (one to many)",3,"onSubmit"],["container",""],[1,"mb-2"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text",3,"ngModelChange","clear","multiple","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"container-fluid"],[1,"row","mt-8","mx-1"],["class","col-12 col-md-6 col-xl-4 px-3 my-3",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[3,"imageForZoom","title","code","id","image","channels"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"row","mt-2","justify-content-end"],[1,"col-md-12"],[3,"next","previous","total","filter","totaldata","paginationTotal","hasClicked"]],template:function(e,i){e&1&&(a(0,"mainpanel",0),f("onSubmit",function(g){return i.onSearch(g)}),a(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),d(5,"Channel"),l(),a(6,"ng-select",3),N("ngModelChange",function(g){return E(i.searchFilter.ListChannelID,g)||(i.searchFilter.ListChannelID=g),g}),f("clear",function(){return i.onClearFilter()}),S(7,pn,3,2,"ng-template",4),l()()()(),a(8,"content")(9,"div",5)(10,"div",6),S(11,dn,2,6,"div",7)(12,mn,3,0,"ng-container",8),l(),S(13,un,4,4,"ng-container",8),l()()()),e&2&&(c(6),s("multiple",!0)("clearable",!0)("items",i.channelOptions),D("ngModel",i.searchFilter.ListChannelID),c(5),s("ngForOf",i.products),c(),s("ngIf",(i.products==null?null:i.products.length)==0),c(),s("ngIf",(i.products==null?null:i.products.length)>0))},dependencies:[V,U,$,G,L,Y,ot,xt,bt,z,B]});let o=r;return o})();var hn=()=>["/menu/products/status/sold-in-channel"],ge=o=>({ID:o}),_n=()=>["/menu/products/status/not-in-pos"];function gn(o,r){if(o&1&&(P(0),d(1),b()),o&2){let n=p().$implicit;c(),w(" ",n.Count," ")}}function Cn(o,r){if(o&1){let n=v();a(0,"span",26),f("click",function(){m(n);let e=p().$implicit,i=p(2);return u(i.getLiveProductCount(e.ID,e))}),_(1,"i",27),l()}}function fn(o,r){if(o&1){let n=v();a(0,"tr")(1,"td"),_(2,"img",17),a(3,"span",18),d(4),l()(),a(5,"td",19),S(6,gn,2,1,"ng-container",6)(7,Cn,2,0,"ng-template",null,1,et),l(),a(9,"td",19)(10,"a",20),d(11),F(12,"number"),l()(),a(13,"td",19)(14,"a",20),d(15),F(16,"number"),l()(),a(17,"td"),d(18),F(19,"date"),l(),a(20,"td")(21,"div",21)(22,"button",22),f("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onScanChannel(e))}),_(23,"i",23),d(24," Scan "),l(),a(25,"button",24),f("click",function(){let e=m(n).$implicit,i=p(2);return u(i.onClearCache(e.ID))}),_(26,"i",25),d(27," Clear "),l()()()()}if(o&2){let n=r.$implicit,t=j(8),e=p(2);c(2),s("src",e.getChannelLogo(n.TypeID),O),c(2),_t(n.Name),c(2),s("ngIf",n.Count!==void 0)("ngIfElse",t),c(4),s("routerLink",Q(18,hn))("queryParams",lt(19,ge,n.ID)),c(),w(" ",k(12,11,n.SoldInChannel)," "),c(3),s("routerLink",Q(21,_n))("queryParams",lt(22,ge,n.ID)),c(),w(" ",k(16,13,n.NotInPOS)," "),c(3),w("",n.LastSync?Ut(19,15,n.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function Sn(o,r){if(o&1&&(P(0),a(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),d(6,"Channel"),l(),a(7,"th",11),d(8,"Live Product"),l(),a(9,"th",12),d(10,"Sold In Channel"),l(),a(11,"th",13),d(12,"Product Not in POS"),l(),a(13,"th",14),d(14,"Last Sync"),l(),_(15,"th",15),l()(),a(16,"tbody"),S(17,fn,28,24,"tr",16),F(18,"async"),l()()(),b()),o&2){let n,t=p();c(17),s("ngForOf",(n=k(18,1,t.channels$))==null?null:n.Data)}}function xn(o,r){o&1&&(a(0,"div",28),_(1,"app-empty-state"),l())}var Ce=(()=>{let r=class r{constructor(t,e,i,h){this.productService=t,this.toastr=e,this.dialog=i,this.authService=h,this.destroy$=new Dt,this.channelOptions=h.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,e){this.productService.getTotalProductLive(t).pipe(Ot(this.destroy$)).subscribe(i=>{e.Count=i.Count})}onScanChannel(t){this.dialog.open(T,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(y(e=>x.IsNotEmpty(e))).subscribe(e=>{this.scanAllProduct(t.ID,e)})}scanAllProduct(t,e){let i=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(e.ChannelID,e.ScanFull,e.UpdatedProduct,e.Async).pipe(y(h=>h)).subscribe(h=>{e.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(h,i,!e.UpdatedProduct),this.setObsProductStatistic())})}onClearCache(t){confirm("Are you sure you want to Clear Cache? This Process will remove your product integration to marketplace")&&this.productService.clearCacheChannel(t).pipe(Ot(this.destroy$)).subscribe(i=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return x.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};r.\u0275fac=function(e){return new(e||r)(C(R),C(W),C(J),C(A))},r.\u0275cmp=M({type:r,selectors:[["app-channel-statistic"]],decls:9,vars:6,consts:[["EMPTY",""],["QUESTION",""],["headerTitle","Products Statistic",3,"hideSearchBox","hideSearchDropdown"],[1,"container-fluid"],[1,"row","mt-4"],[1,"col-md-12"],[4,"ngIf","ngIfElse"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[1,"text-center",2,"width","13rem"],[1,"text-center",2,"width","9rem"],[1,"text-center",2,"width","14rem"],[2,"width","10rem"],[2,"width","12rem"],[4,"ngFor","ngForOf"],[2,"width","24px","height","24px",3,"src"],[1,"ms-3"],[1,"text-center"],[3,"routerLink","queryParams"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-sm","btn-secondary","fs-6",3,"click"],[1,"fa","fa-spinner"],[1,"btn","btn-sm","btn-secondary","fs-6","ms-3",3,"click"],[1,"fa","fa-trash"],["matTooltip","Click to see total live product",1,"cursor-pointer","fs-5","text-primary",3,"click"],[1,"fa-solid","fa-circle-question","cursor"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"]],template:function(e,i){if(e&1&&(a(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),S(5,Sn,19,3,"ng-container",6),F(6,"async"),S(7,xn,2,0,"ng-template",null,0,et),l()()()()()),e&2){let h,g=j(8);s("hideSearchBox",!0)("hideSearchDropdown",!0),c(5),s("ngIf",((h=k(6,4,i.channels$))==null||h.Data==null?null:h.Data.length)>0)("ngIfElse",g)}},dependencies:[V,U,L,vt,St,B,gt,Ct,At]});let o=r;return o})();var vn=[{component:ce,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:de,canActivate:[X],data:{title:"Products in POS"}},{path:"sold-in-channel",component:me,canActivate:[X],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:ue,canActivate:[X],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:he,canActivate:[X],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:_e,canActivate:[X],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:Ce,canActivate:[X],data:{title:"Channel Statistic"}}]}],Di=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=Vt({type:r}),r.\u0275inj=kt({imports:[Lt,$t,Jt,Kt,Gt,le,qt,Ht,bt,z,q,Bt.forChild(vn),ie,Wt]});let o=r;return o})();export{Di as StatusModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-EEOWKNSQ.js";import{g as j}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-EEOWKNSQ.js";import{g as j}from"./chunk-OML53I6I.js";import{b as S,e as d}from"./chunk-AAFEUTPF.js";import{b as a,c as g}from"./chunk-2AMEIUWK.js";import{$ as l,B as C,E as u,Ua as U,Wc as w,d as P,da as c,n,q as A,w as I}from"./chunk-HSFUKC7R.js";var R=(()=>{let r=class r{constructor(){this.httpService=c(d)}getAttributes(o,t){return this.httpService.get("api/product/shopee/GetAttributes",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/shopee/AddProduct",o).pipe(u(e=>n(null)))}generateAttribute(o){return o.map(t=>({attribute_id:t.attribute_id,attribute_value_list:t.attribute_value_list.map(e=>({value_id:e.value_id,original_value_name:e.original_value_name}))})),o}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var D=(()=>{let r=class r{constructor(){this.httpService=c(d)}getCategories(o){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/tiktok/AddProduct",o).pipe(u(e=>n(null)))}generateAttribute(o){let t;return o.map(e=>(e.type=="PRODUCT_PROPERTY"?t={id:e.id,name:e.name,type:e.type,values:e.values}:t={id:e.id,name:e.values[0].id,type:e.type},t))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var H=(()=>{let r=class r{constructor(){this.httpService=c(d)}getAttributes(o,t){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/lazada/AddProduct",o).pipe(u(e=>n(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var T=(()=>{let r=class r{constructor(){this.httpService=c(d)}getAttributes(o,t){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:o},{key:"CategoryID",value:t}])}getCategories(o){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/woo/AddProduct",o).pipe(u(e=>n(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var y=class{};var b=class{};var F=(()=>{let r=class r{constructor(){this.httpService=c(d)}getCategories(o){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:o}])}uploadProduct(o){return this.httpService.post("api/product/tokopedia/AddProduct",o).pipe(u(e=>n(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var x=(()=>{let r=class r{constructor(){this.toastrService=c(S)}showToastrUploadMultiple(o){let t=[],e=[],s=this.getResponseList(o);if(o.filter(p=>g.IsNotEmpty(p)).forEach(p=>{typeof p?.Response=="string"?e=[...e,s.length>1?this.setHtmlli(p.Response):this.setHtmlli(p.Response,!1)]:(p?.Response?.Success_list.forEach(f=>{t=[...t,s.length>1?this.setHtmlli(`Product ${f.Name} was <b>successfully</b> uploaded to ${p.Channel}`):this.setHtmlli(`Product ${f.Name} was <b>successfully</b> uploaded to ${p.Channel}`,!1)]}),p?.Response.Fail_list.forEach(f=>{e=[...e,s.length>1?this.setHtmlli(f.Message):this.setHtmlli(f.Message,!1)]}))}),e.length>0&&t.length>0){let p=[...t,...e];this.toastrService.warning(this.concatMessage(p),"Warning!",{enableHtml:!0})}else t.length>0&&e.length==0?this.toastrService.success(this.concatMessage(t),"Success",{enableHtml:!0}):this.toastrService.error(this.concatMessage(e),"Error",{enableHtml:!0})}concatMessage(o=[]){let t="";return o.forEach(e=>{t+=e}),o.length>1?`<ol>${t}</ol>`:t}getResponseList(o){let t=[];return o.filter(e=>g.IsNotEmpty(e)).forEach(e=>{typeof e.Response=="string"?t=[...t,e.Response]:(e?.Response.Success_list.forEach(s=>{t=[...t,s.Name]}),e?.Response.Fail_list.forEach(s=>{t=[...t,s.Message]}))}),t}setHtmlli(o,t=!0){return t?`<li>${o}</li>`:o}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var M=(()=>{let r=class r{constructor(){this.httpService=c(d)}uploadProduct(o){return this.httpService.post("api/product/shopify/AddProduct",o).pipe(u(e=>n(null)))}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();var zt=(()=>{let r=class r{constructor(){this.authService=c(j),this.productService=c(E),this.shoppeUploadService=c(R),this.tiktokUploadService=c(D),this.lazadaUploadService=c(H),this.tokopediaUploadService=c(F),this.wooUploadService=c(T),this.shopifyUploadService=c(M),this.toastrHandlingService=c(x),this.toastr=c(S),this.router=c(w),this._channels=this.authService.getChannels(),this._selectedProduct=new P(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(C(o=>o&&o.length>0))}get channels(){return this._channels}getStoredProducts(){let o=localStorage.getItem("productsUpload");if(o){let t=JSON.parse(o);return t&&t.length>0?t:[]}else return[]}setSelectedProduct(o){localStorage.setItem("productsUpload",JSON.stringify(o)),this._selectedProduct.next(o)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let o=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(o,this.channels)}get channelProductUpload(){let o=this.getUnselectedChannels();return U(o.map(e=>{let s=new y;return s.id=e.ID,s.name=e.Name,s.type=e.TypeID,s.categoryId=null,s.attributes=[],s.selected=!1,s}))}onUploadProduct(o){let t=o.filter(e=>e.selected&&e.attributes.length>0&&e.type==a.Shopee||e.selected&&g.IsNotEmpty(e.categoryId)&&e.type!=a.Shopee);if(t.length>0){let e=this.generateDataForUpload(t);this.uploadProduct(e)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(o){let t=this.generateObservableForUpload(o);I(t).pipe(A(e=>{let s=[];return e.forEach(p=>{s=[...s,...p]}),s})).subscribe({next:(e=[])=>{g.IsNotEmpty(e)&&this.toastrHandlingService.showToastrUploadMultiple(e),this.hasSuccessRes(e)&&this.onSuccessUpload()}})}hasSuccessRes(o){let t=!1;return o.forEach(e=>{e?.Response.Success_list?.length>0&&g.IsNotEmpty(e)&&(t=!0)}),t}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(o){let t=[],e=[],s=[],p=[],f=[],k=[];o.forEach(h=>{switch(h.ChannelType){case a.Shopee:e.push(h);break;case a.Tiktok:t.push(h);break;case a.Lazada:s.push(h);break;case a.Tokopedia:p.push(h);break;case a.WooCommerce:f.push(h);break;case a.Shopify:k.push(h);break}});let m=[];return[{type:a.Shopee,data:e},{type:a.Tiktok,data:t},{type:a.Lazada,data:s},{type:a.Tokopedia,data:p},{type:a.WooCommerce,data:f},{type:a.Shopify,data:k}].filter(h=>h.data.length>0).forEach(h=>{switch(h.type){case a.Shopee:m.push(this.shoppeUploadService.uploadProduct(e));break;case a.Tiktok:m.push(this.tiktokUploadService.uploadProduct(t));break;case a.Lazada:m.push(this.lazadaUploadService.uploadProduct(s));break;case a.Tokopedia:m.push(this.tokopediaUploadService.uploadProduct(p));break;case a.WooCommerce:m.push(this.wooUploadService.uploadProduct(f));break;case a.Shopify:m.push(this.shopifyUploadService.uploadProduct(k));break}}),m}generateDataForUpload(o){let t=[];return o.forEach(e=>{let s=new b;s.ChannelID=e.id,s.ChannelType=e.type,s.Products=this._selectedProduct.getValue(),e.type==a.Shopify?delete s.CategoryID:s.CategoryID=e.categoryId,e.type==a.WooCommerce||e.type==a.Shopify?s.Attribute=e.attributes[0]:s.Attributes=this.formatAttributes(e.type,e.attributes),t.push(s)}),t}formatAttributes(o,t){let e;switch(o){case a.Shopee:e=this.shoppeUploadService.generateAttribute(t);break;case a.Tiktok:e=this.tiktokUploadService.generateAttribute(t);break;case a.WooCommerce:e=this.tiktokUploadService.generateAttribute(t);break;case a.Tokopedia:e=t;break;case a.Shopify:e=t;break;default:e=[];break}return e}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"});let i=r;return i})();export{R as a,D as b,H as c,F as d,T as e,zt as f};
|