marketplacepos 5.38.3 → 5.38.5
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-7POQ3C3K.js → chunk-2TKPU2N4.js} +1 -1
- package/Marketplace/{chunk-S6WP72HC.js → chunk-2WJSVVRH.js} +1 -1
- package/Marketplace/{chunk-3PJZW7HF.js → chunk-3DTDXKFQ.js} +1 -1
- package/Marketplace/{chunk-XYZPGDD2.js → chunk-5UFM4R4N.js} +1 -1
- package/Marketplace/{chunk-KVKFKGDQ.js → chunk-5V2G4JZI.js} +1 -1
- package/Marketplace/{chunk-AHACTT37.js → chunk-7C76K4Q5.js} +1 -1
- package/Marketplace/{chunk-AVI5X2TT.js → chunk-A7JDRCKV.js} +1 -1
- package/Marketplace/{chunk-CZUJNA5G.js → chunk-AFZJSPWS.js} +1 -1
- package/Marketplace/{chunk-NEXCPJGQ.js → chunk-BMAYZLH7.js} +1 -1
- package/Marketplace/{chunk-G6T2QL55.js → chunk-CNWJBMIQ.js} +1 -1
- package/Marketplace/{chunk-CBHXQUMA.js → chunk-ESWJCZZP.js} +1 -1
- package/Marketplace/{chunk-VOXQUD5E.js → chunk-GH55WYGY.js} +1 -1
- package/Marketplace/{chunk-7CDZNNWL.js → chunk-HO5MJE26.js} +1 -1
- package/Marketplace/{chunk-LRHLOGXM.js → chunk-J7TJEZXH.js} +1 -1
- package/Marketplace/{chunk-F7NU25EB.js → chunk-K2UZHZCJ.js} +1 -1
- package/Marketplace/{chunk-4AOCYXXV.js → chunk-KOM5ZICH.js} +1 -1
- package/Marketplace/{chunk-B5LX5TOF.js → chunk-LW76SQFU.js} +1 -1
- package/Marketplace/{chunk-ZYWCWZDR.js → chunk-N7YYFKGG.js} +1 -1
- package/Marketplace/{chunk-HAUNYMEG.js → chunk-OKLT6GH5.js} +1 -1
- package/Marketplace/{chunk-WFEOCQ7B.js → chunk-ONI2IMCW.js} +1 -1
- package/Marketplace/{chunk-Z3KIQHIK.js → chunk-OTYDLADB.js} +1 -1
- package/Marketplace/{chunk-JIBVE3DE.js → chunk-OWSO46ZD.js} +1 -1
- package/Marketplace/{chunk-K5ZBGZ47.js → chunk-RGTAWKII.js} +1 -1
- package/Marketplace/{chunk-W3X2KRUQ.js → chunk-RY2ZOZ3A.js} +1 -1
- package/Marketplace/{chunk-HLBD2ZRF.js → chunk-T5BCWPOW.js} +1 -1
- package/Marketplace/{chunk-PG3IYBPX.js → chunk-UNM4PZPP.js} +1 -1
- package/Marketplace/{chunk-ZS3HQV2S.js → chunk-UWAJCC5U.js} +1 -1
- package/Marketplace/{chunk-OOJNZDBG.js → chunk-VMAJA64B.js} +1 -1
- package/Marketplace/{chunk-4FI4YSVV.js → chunk-VSXHWRNT.js} +2 -2
- package/Marketplace/{chunk-5RI4KPF6.js → chunk-WBKPCUZ2.js} +1 -1
- package/Marketplace/{chunk-VSJIQ3SX.js → chunk-WK577OZB.js} +1 -1
- package/Marketplace/{chunk-ZHN24KZM.js → chunk-XIUYKYPU.js} +1 -1
- package/Marketplace/{chunk-OJVDCT5U.js → chunk-XJLNBLYY.js} +2 -2
- package/Marketplace/{chunk-UPZ35RUO.js → chunk-YT4PFZ7J.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-TARO2A2O.js → main-KYXOLZYL.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A,b as Re}from"./chunk-ZHN24KZM.js";import"./chunk-CBHXQUMA.js";import"./chunk-MS4AQ6UA.js";import{a as H}from"./chunk-ZD5LURJS.js";import{a as Le}from"./chunk-PPDHTO44.js";import{a as tt}from"./chunk-7KG3DC5J.js";import{b as Ue}from"./chunk-3LQNSF7T.js";import"./chunk-YXFTLQ5M.js";import{a as be,b as ve}from"./chunk-OE2JYQHN.js";import{e as ut}from"./chunk-ZS3HQV2S.js";import{a as je}from"./chunk-LLZSSV5A.js";import{i as Ee,j as Fe,k as Ve,l as Ne,m as Ae}from"./chunk-CRC6ZWYT.js";import"./chunk-CLKCSTGQ.js";import"./chunk-7TWBIV3T.js";import{a as W}from"./chunk-EGTYAIU5.js";import"./chunk-LOJPRXKZ.js";import"./chunk-6ALHX2I4.js";import"./chunk-3RK6DDJD.js";import{a as Rt}from"./chunk-J3P46Z53.js";import{a as J}from"./chunk-4ASUM4N5.js";import{b as Be}from"./chunk-CVQMAWML.js";import{a as Te,b as De}from"./chunk-LEHTNMIE.js";import{a as ye,b as Pe,c as Ie}from"./chunk-GHQH62TZ.js";import"./chunk-CH2MLZU7.js";import{a as ot}from"./chunk-F7NU25EB.js";import{a as et}from"./chunk-62PFQNHJ.js";import{c as Oe}from"./chunk-Q72ZXPDP.js";import"./chunk-MNFHFW3E.js";import"./chunk-ZZVNB72Q.js";import{a as ke}from"./chunk-VGXQU74M.js";import"./chunk-SDUUFQUI.js";import"./chunk-G6EG5QJS.js";import{a as Me}from"./chunk-RIHLYYZU.js";import{f as we}from"./chunk-Q2OEJFVT.js";import{a as dt,b as Vt,d as X,e as he}from"./chunk-6IAGGRZN.js";import"./chunk-T6QOFDEE.js";import"./chunk-KXZCGKQW.js";import"./chunk-QCZIDOKW.js";import{h as ue,j as $}from"./chunk-3PJZW7HF.js";import{b as B,e as j}from"./chunk-BUFEIJAI.js";import"./chunk-K5XRGNWG.js";import"./chunk-V5WYSCVT.js";import"./chunk-KHWTOD6H.js";import{b as Nt,c as At,d as K,e as _e,f as ge,g as Ce,h as fe,i as Ut,j as Lt,k as Se,m as G,n as xe}from"./chunk-ITTRZMEX.js";import{r as pt,s as mt}from"./chunk-TMFFA26Y.js";import"./chunk-WAW37FIG.js";import{b as me,c as st,h as L,m as R,y as Ft}from"./chunk-DPLEMBB4.js";import{b as V,c as f}from"./chunk-PXB4YEY3.js";import{E as kt,F as de,G as ct,H as Et,J as pe,d as Tt,f as N,g as D,j as Dt,k as se,m as lt,n as Q}from"./chunk-GPEVUTDI.js";import{$c as ce,Dc as U,Eb as w,Ec as p,Fb as oe,Fc as z,G as M,Gc as b,Ic as k,Jc as E,Ka as Ct,Kb as C,Kc as F,Pc as it,Qa as ft,Qc as Z,Rc as Jt,Tc as le,Vb as Wt,Wb as c,Xb as ae,Zc as O,_c as T,aa as wt,ad as q,bc as Mt,ca as Gt,cc as Ht,ea as ee,ec as zt,f as Xt,fc as Kt,gc as o,hc as a,ic as _,jc as v,ka as ne,kc as y,mc as x,nb as ie,ob as I,pa as rt,qb as r,rc as g,sc as s,tc as re,uc as Ot,v as te,wb as S,ya as m,za as u}from"./chunk-T5ONJF63.js";import"./chunk-K2H6WANG.js";var en=()=>["/menu/products/download/by-url"],$e=(()=>{class i{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"}]}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["app-status"]],standalone:!1,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(n,e){n&1&&(o(0,"nav",0)(1,"div",1)(2,"div"),_(3,"nav-tab",2),a()(),o(4,"div")(5,"div",3)(6,"a",4),_(7,"i",5),a(),o(8,"div",6)(9,"div",7)(10,"a",8),p(11,"Download Product By Url"),a()()()()()(),_(12,"router-outlet")),n&2&&(r(3),c("Tabs",e.productTabs),r(7),c("routerLink",it(2,en)))},dependencies:[be,de,Et],encapsulation:2})}}return i})();var at=function(i){return i.Tokopedia="https://seller.tokopedia.com",i.Shoope="https://seller.shopee.co.id",i.Tiktok="https://seller-id.tiktok.com",i.WooCommerce="https://woocommerce.dealpos.app",i.Lazada="https://sellercenter.lazada.co.id",i}(at||{});var Yt={Success:"Success",Info:"Info",Warning:"Warning",Error:"Error"};var nn=[[["header"]],[["content"]],[["footer"]]],on=["header","content","footer"],an=(i,d)=>({bodyScrollable:i,hideScrollbar:d}),rn=(i,d,t,n)=>({"bg-success":i,"bg-warning":d,"bg-info":t,"bg-danger":n}),ln=i=>({"mx-auto":i}),cn=(i,d)=>({"show-footer":i,"p-0":d});function sn(i,d){if(i&1){let t=x();o(0,"div",8),g("click",function(){m(t);let e=s();return u(e.onBack.emit())}),o(1,"a",9),_(2,"i",10),a()()}}function dn(i,d){if(i&1){let t=x();o(0,"div")(1,"a",11),g("click",function(){m(t);let e=s();return u(e.onClose.emit())}),_(2,"i",12),a()()}}function pn(i,d){if(i&1){let t=x();o(0,"a",16),g("click",function(){m(t);let e=s(2);return u(e.onCancel.emit())}),p(1),a()}if(i&2){let t=s(2);r(),b(" ",t.config!=null&&t.config.cancelText?t.config==null?null:t.config.cancelText:"Cancel","")}}function mn(i,d){if(i&1){let t=x();o(0,"button",17),g("click",function(){m(t);let e=s(2);return u(e.onOk.emit())})("keyup.F2",function(){m(t);let e=s(2);return u(e.onOk.emit())}),a()}if(i&2){let t=s(2);c("disabled",!(t.config!=null&&t.config.validated)||!t.dynamicValidated)("innerHTML",t.config!=null&&t.config.okText?t.config==null?null:t.config.okText:"Ok (F2)",ie)}}function un(i,d){if(i&1&&(o(0,"mat-dialog-actions",13),Ot(1,2),C(2,pn,2,1,"a",14)(3,mn,1,2,"button",15),a()),i&2){let t=s();r(2),c("ngIf",!(t.config!=null&&t.config.hideCancel)),r(),c("ngIf",!(t.config!=null&&t.config.hideOk))}}var Zt=class{constructor(){this.title="New Modal",this.okText="Ok (F2)",this.cancelText="Cancel",this.hideFooter=!1,this.hideCancel=!1,this.hideOk=!1,this.hideClose=!1,this.eMoney=!1,this.headerType=Yt.Success,this.validated=!0,this.customWidth="initial",this.bodyScrollable=!1,this.hideScrollbar=!1,this.disableKeyup=!1,this.noPadding=!1}},Ge=(()=>{class i{constructor(){this.dynamicValidated=!0,this.onOk=new Ct,this.onCancel=new Ct,this.onClose=new Ct,this.onBack=new Ct,this.headerType=Yt}ngOnInit(){this.config==null&&(this.config=new Zt)}onKeyup(t){this.config?.disableKeyup||(t.code=="F2"&&this.onOk.emit("F2"),(t.code=="Enter"||t.code=="NumpadEnter")&&this.onOk.emit("Enter"))}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["modal-material"]],inputs:{config:"config",dynamicValidated:"dynamicValidated"},outputs:{onOk:"onOk",onCancel:"onCancel",onClose:"onClose",onBack:"onBack"},ngContentSelectors:on,decls:11,vars:23,consts:[["id","modal_material",1,"modal-material","d-flex","align-items-start","flex-column","position-relative","maxHeight",3,"keyup","ngClass"],["mat-dialog-title","",1,"d-flex","w-100","justify-content-between","modal-header","position-relative",3,"ngClass"],["class","back-button position-absolute pointer d-print-none",3,"click",4,"ngIf"],[1,"d-flex","flex-row","d-print-none","align-items-center",3,"ngClass"],[1,"fw-normal"],[4,"ngIf"],[1,"modal-body","w-100",3,"ngClass"],["class","w-100 py-7 border-top d-flex justify-content-end d-print-none",4,"ngIf"],[1,"back-button","position-absolute","pointer","d-print-none",3,"click"],[1,"btn","back-button"],[1,"fa-solid","fa-arrow-left"],[1,"btn-light-blue","btn-sm","pointer","close",3,"click"],[1,"fa-solid","fa-xmark","fa-lg","text-primary"],[1,"w-100","py-7","border-top","d-flex","justify-content-end","d-print-none"],["class","btn btn-light-blue text-primary btn-lg fw-bold mx-3",3,"click",4,"ngIf"],["class","btn btn-light-blue me-6 text-primary btn-lg fw-bold mx-3","data-cy","btn-ok",3,"disabled","innerHTML","click","keyup.F2",4,"ngIf"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3",3,"click"],["data-cy","btn-ok",1,"btn","btn-light-blue","me-6","text-primary","btn-lg","fw-bold","mx-3",3,"click","keyup.F2","disabled","innerHTML"]],template:function(n,e){n&1&&(re(nn),o(0,"div",0),g("keyup",function(h){return e.onKeyup(h)}),o(1,"div",1),C(2,sn,3,0,"div",2),o(3,"div",3)(4,"h4",4),p(5),a(),Ot(6),a(),C(7,dn,3,0,"div",5),a(),o(8,"mat-dialog-content",6),Ot(9,1),a(),C(10,un,4,2,"mat-dialog-actions",7),a()),n&2&&(ae("width",e.config==null?null:e.config.customWidth),c("ngClass",Jt(10,an,e.config==null?null:e.config.bodyScrollable,e.config==null?null:e.config.hideScrollbar)),r(),c("ngClass",le(13,rn,e.headerType.Success==(e.config==null?null:e.config.headerType),e.headerType.Warning==(e.config==null?null:e.config.headerType),e.headerType.Info==(e.config==null?null:e.config.headerType),e.headerType.Error==(e.config==null?null:e.config.headerType))),r(),c("ngIf",e.config==null?null:e.config.eMoney),r(),c("ngClass",Z(18,ln,e.config==null?null:e.config.eMoney)),r(2),z(e.config==null?null:e.config.title),r(2),c("ngIf",!(e.config!=null&&e.config.hideClose)),r(),c("ngClass",Jt(20,cn,!(e.config!=null&&e.config.hideFooter),e.config==null?null:e.config.noPadding)),r(2),c("ngIf",!(e.config!=null&&e.config.hideFooter)))},dependencies:[Q,Tt,D,fe,_e,Ce,ge],styles:[".mat-mdc-dialog-container{padding:0!important;border-radius:4px!important;overflow:visible!important} .mat-mdc-dialog-container [mat-dialog-title]{color:#fff;padding:15px;border:none}@media print{ .mat-mdc-dialog-container{box-shadow:unset;width:100vw}}@media print{ .cdk-overlay-pane{position:absolute!important;top:-30px;max-width:100vw!important}.modal-body[_ngcontent-%COMP%]{width:100vw!important}}body.modal-body[_ngcontent-%COMP%]{height:100%;overflow-y:hidden}mat-dialog-actions[_ngcontent-%COMP%]{bottom:15px}mat-dialog-actions[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{padding:15px!important;margin-right:12px}mat-dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:15px!important}mat-dialog-actions[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin-right:auto;margin-top:-1rem;padding-top:.4rem!important;margin-left:1rem}.back-button[_ngcontent-%COMP%]{top:5px;left:0}.close[_ngcontent-%COMP%]{padding:.4rem .5rem}.no-padding[_ngcontent-%COMP%]{padding:0}.modal-material[_ngcontent-%COMP%]{width:40vw}@media (max-width: 992px){.modal-material[_ngcontent-%COMP%]{width:50vw!important}}@media (max-width: 576px){ .dialog-filter .modal-material{width:100%!important} .dialog-filter mat-dialog-actions{position:sticky;bottom:0;background:#fff} .dialog-filter .modal-material.d-flex.align-items-start.flex-column.position-relative.maxHeight.bodyScrollable.maxHeight.bodyScrollable .modal-body{max-height:100%!important;overflow-y:auto}}.maxHeight.bodyScrollable[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow-y:auto}.modal-header[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{padding:15px}.modal-dialog[_ngcontent-%COMP%]{max-width:none}.modal-content[_ngcontent-%COMP%]{width:auto;margin:auto;max-width:850px}.maxHeight[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow:auto}.modal-body[_ngcontent-%COMP%]{padding:1rem}.modal-body[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{display:block}.modal-body[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin:0;position:absolute;bottom:-20px}.modal-body[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] input[type=password][_ngcontent-%COMP%]{border:1px solid #c8d3df;padding:5px 7px}.modal-body[_ngcontent-%COMP%] table[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{width:330px;height:90px}"]})}}return i})();var hn=i=>({"is-disabled":i});function _n(i,d){if(i&1&&(v(0),o(1,"tr")(2,"td",10),p(3),a(),o(4,"td",10),p(5),a(),o(6,"td",11)(7,"p",12),p(8,"Product Not in Channel!"),a()()(),y()),i&2){let t=s().$implicit;r(3),b(" ",t==null?null:t.Model," "),r(2),b(" ",t==null?null:t.Code," ")}}function gn(i,d){if(i&1&&(o(0,"td",10),p(1),a()),i&2){let t=s(3).$implicit;Wt("rowspan",t.Channel.length),r(),b(" ",t==null?null:t.Model," ")}}function Cn(i,d){if(i&1&&(o(0,"td",10),p(1),a()),i&2){let t=s(3).$implicit;Wt("rowspan",t.Channel.length),r(),b(" ",t==null?null:t.Code," ")}}function fn(i,d){if(i&1){let t=x();o(0,"tr"),C(1,gn,2,2,"td",13)(2,Cn,2,2,"td",13),o(3,"td",10)(4,"div",14)(5,"a",15),_(6,"img",16),a(),o(7,"div",17),p(8),a()()(),o(9,"td",10),p(10),O(11,"number"),a(),o(12,"td",18),p(13),O(14,"number"),a(),o(15,"td",19)(16,"div",20)(17,"button",21),g("click",function(){let e=m(t).$implicit,l=s(2).$implicit,h=s();return u(h.onDetach(e,l))}),_(18,"i",22),o(19,"span",23),p(20,"Detach"),a()(),o(21,"a",24),_(22,"i",25),o(23,"span",23),p(24,"Edit"),a()()()()()}if(i&2){let t=d.$implicit,n=d.$index,e=s(3);r(),c("ngIf",n==0),r(),c("ngIf",n==0),r(3),c("href",t.Url,I)("title",t.Title),r(),c("src",e.getChannelLogo(t.TypeID),I),r(),c("matTooltip",(t==null||t.Name==null?null:t.Name.length)>40?t==null?null:t.Name:""),r(),b(" ",t.Name," "),r(2),z(T(11,12,t.Price)),r(3),z(T(14,14,t.Inventory)),r(8),c("href",e.getHyperlinkSellerCenter(t),I)("ngClass",Z(16,hn,t.TypeID==e.channelType.KalCare))("matTooltip",t.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function Sn(i,d){if(i&1&&zt(0,fn,25,18,"tr",null,Ht),i&2){let t=s().$implicit;Kt(t==null?null:t.Channel)}}function xn(i,d){if(i&1&&C(0,_n,9,2,"ng-container",9)(1,Sn,2,0,"ng-template",null,0,q),i&2){let t=d.$implicit,n=U(2);c("ngIf",!t.Channel||t.Channel.length<1)("ngIfElse",n)}}var Bt=(()=>{class i{constructor(t,n){this.data=t,this.dialogRef=n,this.httpService=rt(j),this.toastr=rt(B),this.variants=ft([]),this.channelType=V,this.variants.set(this.data.variants),this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new Lt,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="850px"}onDetach(t,n){let e={ChannelID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariationID:t.ChannelVariationID};this.httpService.post(ue.DetachVariant,[e]).subscribe(l=>{this.toastr.success(l.Message,"Success"),this.updateVariantAfterDetach(n,t.ChannelVariationID)})}updateVariantAfterDetach(t,n){this.variants.update(e=>{let l=e.findIndex(h=>h.ID===t.ID);return l!==-1&&(e[l].Channel=e[l].Channel.filter(h=>h.ChannelVariationID!==n)),[...e]})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let n="javascript:void(0)";switch(t.TypeID){case V.Shopee:n=`${at.Shoope}/portal/product/${t.ChannelItemID}`;break;case V.Tiktok:n=`${at.Tiktok}/product/edit/${t.ChannelItemID}`;break;case V.Tokopedia:n=`${at.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case V.WooCommerce:n=`${at.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case V.Lazada:n=`${at.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return n}static{this.\u0275fac=function(n){return new(n||i)(S(At),S(Nt))}}static{this.\u0275cmp=w({type:i,selectors:[["app-modal-variant"]],decls:27,vars:1,consts:[["printChannelModal",""],[3,"onClose","onCancel","config"],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],[1,"d-flex","align-items-center"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngIf","ngIfElse"],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],[1,"text-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"btn","btn-small","btn-light","px-4","py-2","me-3",3,"click"],[1,"fa-sharp","fa-link-slash","me-2",2,"font-size","10px"],[1,"fs-6"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-edit","me-2",2,"font-size","10px"]],template:function(n,e){n&1&&(o(0,"modal-material",1),g("onClose",function(){return e.dialogRef.close()})("onCancel",function(){return e.dialogRef.close()}),o(1,"content")(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4)(6,"div",5)(7,"span"),p(8,"VARIANT"),a(),o(9,"sup"),_(10,"i",6),a()()(),o(11,"th",4),p(12,"SKU"),a(),o(13,"th",4)(14,"div",5)(15,"span"),p(16,"PRODUCT"),a(),o(17,"sup"),_(18,"i",7),a()()(),o(19,"th",4),p(20,"PRICE"),a(),o(21,"th",8),p(22,"INVENTORY"),a(),_(23,"th",4),a()(),o(24,"tbody"),zt(25,xn,3,2,null,null,Ht),a()()()()),n&2&&(c("config",e.modalConfig),r(25),Kt(e.variants()))},dependencies:[Q,Tt,D,lt,mt,pt,Ge],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]})}}return i})();function bn(i,d){if(i&1&&(o(0,"mat-option",6)(1,"div"),_(2,"img",7),o(3,"span"),p(4),a()()()),i&2){let t=d.$implicit;c("value",t.ChannelID),r(2),c("src",t.logo,I),r(2),z(t.Title)}}var _t=(()=>{class i{constructor(){this.dialogRef=rt(Nt),this.channels=rt(At),this.channelIds=ft([]),this.channelOptions=ft([])}ngOnInit(){this.initModalConfig();let t=this.channels.filter((n,e,l)=>l.findIndex(h=>h.ChannelID===n.ChannelID)===e);this.channelOptions.set(t)}initModalConfig(){this.modalConfig=new Lt,this.modalConfig.title="Detach Product",this.modalConfig.okText="Save"}onClose(){this.dialogRef.close()}onSave(){let t=this.channels.filter(n=>this.channelIds().includes(n.ChannelID)).map(n=>({ChannelID:n.ChannelID,ChannelItemID:n.ChannelItemID}));this.dialogRef.close(t)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["app-modal-detach-product"]],decls:8,vars:5,consts:[[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","ngModel","multiple"],["class","channel-option",3,"value",4,"ngFor","ngForOf"],[1,"channel-option",3,"value"],[2,"width","18px","margin-right","10px",3,"src"]],template:function(n,e){n&1&&(o(0,"modal-material",0),g("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()})("onOk",function(){return e.onSave()}),o(1,"div",1)(2,"div")(3,"label",2),p(4,"Select a Channel"),a(),o(5,"mat-form-field",3)(6,"mat-select",4),F("ngModelChange",function(h){return E(e.channelIds,h)||(e.channelIds=h),h}),C(7,bn,5,3,"mat-option",5),a()()()()()),n&2&&(c("dynamicValidated",e.channelIds().length>0)("config",e.modalConfig),r(6),k("ngModel",e.channelIds),c("multiple",!0),r(),c("ngForOf",e.channelOptions()))},dependencies:[Q,N,Se,Me,we,De,Te,Oe,Ft,L,R,mt],encapsulation:2})}}return i})();function vn(i,d){if(i&1){let t=x();o(0,"button",13),g("click",function(){m(t);let e=s();return u(e.onDetachMultipleProduct())}),_(1,"i",14),p(2),a()}if(i&2){let t,n=s();r(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function yn(i,d){if(i&1){let t=x();o(0,"button",16),g("click",function(){m(t);let e=s(2);return u(e.onOpenScanDialog())}),_(1,"i",17),p(2," Scan Channel "),a()}}function Pn(i,d){if(i&1&&(v(0),C(1,yn,3,0,"button",15),y()),i&2){let t=s();r(),c("ngIf",!t.productService.hasSelection(t.products))}}function In(i,d){if(i&1){let t=x();v(0),o(1,"button",18),g("click",function(){m(t);let e=s();return u(e.onScanMultipleProduct())}),_(2,"i",17),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Scan (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function wn(i,d){if(i&1){let t=x();v(0),o(1,"button",19),g("click",function(){m(t);let e=s();return u(e.onUploadMultipleProduct())}),_(2,"i",20),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Upload (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function Mn(i,d){if(i&1){let t=x();o(0,"div",21)(1,"app-product-card",22),g("onUpload",function(){let e=m(t).$implicit,l=s();return u(l.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let l=m(t).$implicit;return u(l.selected=e)})("onDetach",function(){let e=m(t).$implicit,l=s();return u(l.onDetachProduct([e]))}),a()()}if(i&2){let t=d.$implicit,n=s();r(),c("productId",t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",(t==null?null:t.Channel.length)<n.channelOptions.length)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function On(i,d){i&1&&(v(0),o(1,"div",23),_(2,"app-empty-state"),a(),y())}function Tn(i,d){if(i&1){let t=x();v(0),o(1,"div",24)(2,"div",25)(3,"app-custom-paginator",26),g("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()(),y()}if(i&2){let t=s();r(3),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",!0)("nextButtonAlwaysVisible",!0)}}var Ke=(()=>{class i{constructor(t,n,e,l,h,P,gt){this.http=t,this.toastr=n,this.dialog=e,this.productService=l,this.authService=h,this.uploadProductService=P,this.route=gt,this.searchFilter=new tt,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,[V.Tokopedia,V.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(n=>{this.products=n.Data,this.rowCount=n.Total==null?this.searchFilter.RowCount:n.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.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 n=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,n,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){let n=this.products[t]?.Variants||[];this.dialog.open(Bt,{data:{title:this.products[t].Name,variants:n}})}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=f.GuidEMpty;let n=this.productService.filterChannelByTypeId(this.channelOptions,[V.Tokopedia,V.Tiktok]);this.dialog.open(A,{data:{filter:t,channelOptions:n,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(l=>f.IsNotEmpty(l))).subscribe(l=>{this.searchFilter.ChannelID=l.ChannelID,this.searchFilter.ScanFull=l.ScanFull,this.searchFilter.UpdatedProduct=l.UpdatedProduct;let h=this.productService.selectedProduct(this.products),P=this.productService.getVariantCodesProducts(h);this.scanSingleProduct(P)})}onScanSingleProduct(t){let n=JSON.parse(JSON.stringify(this.searchFilter));n.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let l=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(l)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{if(n)this.toastr.success("Successfully Scan ","Success");else{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${e?.Name} `,"Error")}this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t=[]){let n;return t?.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t?.length==1&&(n=t[0].Code),n}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(_t,{width:"600px",data:[...n]}).afterClosed().pipe(M(e=>f.IsNotEmpty(e)),wt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,Ut.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(B),S(K),S(W),S($),S(ut),S(ct))}}static{this.\u0275cmp=w({type:i,selectors:[["app-in-pos"]],standalone:!1,decls:23,vars:14,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[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",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["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","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[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","nextButtonAlwaysVisible"]],template:function(n,e){if(n&1){let l=x();o(0,"mainpanel",1),g("onSubmit",function(P){return m(l),u(e.searchProduct(P))}),o(1,"actions"),C(2,vn,3,1,"button",2)(3,Pn,2,1,"ng-container",3)(4,In,4,1,"ng-container",3)(5,wn,4,1,"ng-container",3),a(),o(6,"filters")(7,"div")(8,"label",4),p(9,"Category"),a(),o(10,"ng-select",5),g("ngModelChange",function(P){return m(l),u(e.searchFilter.Category=P)}),a()(),o(11,"div",6)(12,"mat-date-range-input",7)(13,"input",8),F("ngModelChange",function(P){return m(l),E(e.startDate,P)||(e.startDate=P),u(P)}),g("click",function(){m(l);let P=U(16);return u(P.open())}),a(),o(14,"input",9),F("ngModelChange",function(P){return m(l),E(e.endDate,P)||(e.endDate=P),u(P)}),g("click",function(){m(l);let P=U(16);return u(P.open())}),a()(),_(15,"mat-date-range-picker",null,0),a()(),o(17,"content")(18,"div",10)(19,"div",11),C(20,Mn,2,11,"div",12)(21,On,3,0,"ng-container",3),a(),C(22,Tn,4,5,"ng-container",3),a()()()}if(n&2){let l=U(16);c("headerTitle","In POS ("+e.rowCount+")"),r(2),Mt(e.productService.hasSelection(e.products)?2:-1),r(),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)&&e.multipeScanChannels.length>0),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("items",e.Categories)("ngModel",e.searchFilter.Category),r(2),c("rangePicker",l),r(),k("ngModel",e.startDate),r(),k("ngModel",e.endDate),r(6),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",e.products.length>0)}},dependencies:[N,D,st,L,R,G,X,J,et,H,Ee,Fe,Ve,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}"]})}}return i})();function Dn(i,d){if(i&1){let t=x();o(0,"button",11),g("click",function(){m(t);let e=s();return u(e.onDetachMultipleProduct())}),_(1,"i",12),p(2),a()}if(i&2){let t,n=s();r(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function kn(i,d){if(i&1){let t=x();v(0),o(1,"button",13),g("click",function(){m(t);let e=s();return u(e.onOpenScanDialog())}),_(2,"i",14),p(3," Scan Channel "),a(),y()}}function En(i,d){if(i&1){let t=x();v(0),o(1,"button",15),g("click",function(){m(t);let e=s();return u(e.onScanMultipleProduct())}),_(2,"i",14),p(3),a(),y()}if(i&2){let t=s();r(3),b(" Scan (",t.productService.selectedProduct(t.products).length,") ")}}function Fn(i,d){if(i&1){let t=x();v(0),o(1,"button",16),g("click",function(){m(t);let e=s();return u(e.onUploadMultipleProduct())}),_(2,"i",17),p(3),a(),y()}if(i&2){let t=s();r(3),b(" Upload (",t.productService.selectedProduct(t.products).length,") ")}}function Vn(i,d){if(i&1&&(o(0,"span",18),_(1,"img",19),a(),p(2)),i&2){let t=d.item;r(),c("src",t.Img,I)("alt",t.Name),r(),b(" ",t.Name," ")}}function Nn(i,d){if(i&1){let t=x();o(0,"div",20)(1,"label",21),p(2,"Item ID"),a(),o(3,"input",22),F("ngModelChange",function(e){m(t);let l=s();return E(l.searchFilter.Item_id,e)||(l.searchFilter.Item_id=e),u(e)}),a()()}if(i&2){let t=s();r(3),k("ngModel",t.searchFilter.Item_id)}}function An(i,d){if(i&1){let t=x();o(0,"div",23)(1,"app-product-card",24),g("onUpload",function(){let e=m(t).$implicit,l=s();return u(l.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onOpenVariantDetail(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let l=m(t).$implicit;return u(l.selected=e)})("onDetach",function(){let e=m(t).$implicit,l=s();return u(l.onDetachProduct([e]))}),a()()}if(i&2){let t=d.$implicit,n=s();r(),c("productId",t==null?null:t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",t==null?null:t.hasScan)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function Un(i,d){i&1&&(v(0),o(1,"div",25),_(2,"app-empty-state"),a(),y())}function Ln(i,d){if(i&1){let t=x();o(0,"div",26)(1,"div",27)(2,"app-custom-paginator",28),g("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()()}if(i&2){let t=s();r(2),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var Je=(()=>{class i{constructor(t,n,e,l,h,P,gt,It){this.http=t,this.dialog=n,this.toastr=e,this.productService=l,this.activateRouter=h,this.authService=P,this.route=gt,this.uploadProductService=It,this.searchFilter=new tt,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=f.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,n.Filter.ChannelID!=f.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(n.Filter.ChannelID)),this.searchFilter.PageSize=n.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[V.Tokopedia,V.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(n=>{this.products=n.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 n=this.products[t].Variants;this.dialog.open(Bt,{data:{variants:n,title:this.products[t].Name}})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.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(M(n=>n)).subscribe(n=>{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(n,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(f.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let n=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(A,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let l=this.productService.getVariantCodesProduct(t);this.scanProducts(l)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=f.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(A,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct;let l=this.productService.selectedProduct(this.products),h=this.productService.getVariantCodesProducts(l);this.scanProducts(h)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);n?this.toastr.success(`Product Successfully scan with ${e?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${e?.Name} `,"Error"),this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let n;return t.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(n=t[0].Code),n}onClearFilterChannel(){this.searchFilter.ChannelID=f.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(n=>{this.hasClickRowCount=!0,this.rowCount=n.Total})}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(_t,{width:"600px",data:[...n]}).afterClosed().pipe(M(e=>f.IsNotEmpty(e)),wt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,Ut.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(B),S(W),S(kt),S($),S(ct),S(ut))}}static{this.\u0275cmp=w({type:i,selectors:[["app-sold-in-channel"]],standalone:!1,decls:19,vars:13,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[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",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["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","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.searchProduct(h)}),o(1,"actions"),C(2,Dn,3,1,"button",1)(3,kn,4,0,"ng-container",2)(4,En,4,1,"ng-container",2)(5,Fn,4,1,"ng-container",2),a(),o(6,"filters")(7,"div")(8,"label",3),p(9,"Channel"),a(),o(10,"ng-select",4),g("ngModelChange",function(h){return e.searchFilter.ListChannelID=h})("clear",function(){return e.onClearFilterChannel()}),C(11,Vn,3,3,"ng-template",5),a()(),C(12,Nn,4,1,"div",6),a(),o(13,"content")(14,"div",7)(15,"div",8),C(16,An,2,11,"div",9)(17,Un,3,0,"ng-container",2),a(),C(18,Ln,3,4,"div",10),a()()()),n&2&&(c("headerTitle","Sold in Channel"),r(2),Mt(e.productService.hasSelection(e.products)?2:-1),r(),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.multipeScanChannels.length>0&&e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("multiple",!0)("items",e.channelOptions)("ngModel",e.searchFilter.ListChannelID),r(2),c("ngIf",e.searchFilter.ListChannelID!=null),r(4),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",e.products==null?null:e.products.length))},dependencies:[N,D,st,L,R,G,X,dt,Vt,J,et,H],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}"]})}}return i})();function Rn(i,d){if(i&1){let t=x();o(0,"button",13),g("click",function(){m(t);let e=s(2);return u(e.uploadMultipleProduct())}),_(1,"i",14),p(2),a()}if(i&2){let t=s(2);r(2),b(" upload (",t.selectedProducts==null?null:t.selectedProducts.length,") ")}}function Bn(i,d){if(i&1){let t=x();v(0),o(1,"td",29)(2,"input",30),F("ngModelChange",function(e){m(t);let l=s(2).$implicit;return E(l.selected,e)||(l.selected=e),u(e)}),g("ngModelChange",function(){m(t);let e=s(3).ngIf,l=s(3);return u(l.onSelectProduct(e))}),a()(),y()}if(i&2){let t=s(2).$implicit;r(),c("rowSpan",t==null?null:t.Variants.length),r(),k("ngModel",t.selected)}}function jn(i,d){if(i&1){let t=x();v(0),o(1,"img",35),g("click",function(e){m(t);let l=s(3).$implicit,h=s(4);return u(h.onZoomImage(e,l==null?null:l.ImageUrl))}),a(),y()}if(i&2){let t=s(3).$implicit;r(),c("src",t==null?null:t.ImageUrl,I)}}function $n(i,d){i&1&&_(0,"img",36)}function Gn(i,d){if(i&1&&(v(0),o(1,"td",29)(2,"div",31),C(3,jn,2,1,"ng-container",11)(4,$n,1,0,"ng-template",null,1,q),a()(),o(6,"td",32)(7,"h4",33)(8,"span",34),p(9),a()()(),y()),i&2){let t=U(5),n=s(2).$implicit;r(),c("rowSpan",n==null?null:n.Variants.length),r(2),c("ngIf",n==null?null:n.ImageUrl)("ngIfElse",t),r(3),c("rowSpan",n==null?null:n.Variants.length),r(2),c("matTooltip",(n==null||n.Name==null?null:n.Name.length)>50?n==null?null:n.Name:""),r(),b(" ",n==null?null:n.Name," ")}}function Wn(i,d){if(i&1&&(o(0,"div")(1,"a",25),_(2,"img",37),a()()),i&2){let t=d.$implicit;r(),c("href",t.URL,I),r(),c("src",t.Img,I)("matTooltip",t.Name)}}function Hn(i,d){if(i&1&&(o(0,"div"),_(1,"img",37),a()),i&2){let t=d.$implicit;r(),c("src",t.Img,I)("matTooltip",t.Name)}}function zn(i,d){if(i&1&&(o(0,"tr"),C(1,Bn,3,2,"ng-container",12)(2,Gn,10,6,"ng-container",12),o(3,"td"),p(4),a(),o(5,"td")(6,"span"),p(7),a(),o(8,"span",24)(9,"a",25),_(10,"i",26),a()()(),o(11,"td",27)(12,"div",28),C(13,Wn,3,3,"div",23),a()(),o(14,"td",27)(15,"div",28),C(16,Hn,2,2,"div",23),a()()()),i&2){let t=d.$implicit,n=d.index,e=s(5);r(),c("ngIf",n==0),r(),c("ngIf",n==0),r(2),b(" ",t.Name," "),r(3),b(" ",t.Code," "),r(2),c("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(t==null?null:t.ID),I),r(4),c("ngForOf",t==null?null:t.Available),r(3),c("ngForOf",t==null?null:t.NotAvailable)}}function Kn(i,d){if(i&1&&(v(0),C(1,zn,17,7,"tr",23),y()),i&2){let t=d.$implicit;r(),c("ngForOf",t.Variants)}}function Jn(i,d){if(i&1&&(o(0,"tbody"),C(1,Kn,2,1,"ng-container",23),a()),i&2){let t=d.ngIf;r(),c("ngForOf",t)}}function Yn(i,d){if(i&1&&(v(0),o(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),_(5,"th",18),o(6,"th",19),p(7,"Product"),a(),o(8,"th",20),p(9,"Variant"),a(),o(10,"th",20),p(11,"SKU"),a(),o(12,"th",21),p(13,"Available In"),a(),o(14,"th",22),p(15,"Not Available In"),a()()(),C(16,Jn,2,1,"tbody",12),O(17,"async"),a()(),y()),i&2){let t=s(2);r(16),c("ngIf",T(17,1,t.data$))}}function Zn(i,d){i&1&&(o(0,"div",38),_(1,"app-empty-state"),a())}function qn(i,d){if(i&1){let t=x();o(0,"span",46),g("click",function(){m(t);let e=s(4);return u(e.getRowCount())}),o(1,"i",47),p(2,"?"),a()()}}function Qn(i,d){if(i&1&&(o(0,"span"),p(1),O(2,"number"),a()),i&2){let t=d.ngIf;r(),z(T(2,1,t==null?null:t.Count))}}function Xn(i,d){if(i&1){let t=x();o(0,"a",48),g("click",function(){m(t);let e=s(4);return u(e.onNextPage())}),_(1,"i",49),p(2," Next"),a()}}function ti(i,d){if(i&1){let t=x();o(0,"a",50),g("click",function(){m(t);let e=s(4);return u(e.onLastPage())}),_(1,"i",51),p(2," Last"),a()}}function ei(i,d){if(i&1&&(v(0),o(1,"div",39)(2,"div",40)(3,"div",41),p(4),O(5,"number"),C(6,qn,3,0,"span",42)(7,Qn,3,3,"span",12),O(8,"async"),p(9),a()(),o(10,"div",43),C(11,Xn,3,0,"a",44)(12,ti,3,0,"a",45),a()(),y()),i&2){let t=s().ngIf,n=s(2);r(4),b(" Showing 1 - ",T(5,6,t==null?null:t.length)," of "),r(2),c("ngIf",n.paginationService.hideCount),r(),c("ngIf",!n.paginationService.hideCount&&T(8,8,n.rowCount$)),r(2),b(" records ~ ",n.paginationService.footerPageNumber," Page "),r(2),c("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),r(),c("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function ni(i,d){if(i&1&&(v(0),C(1,ei,13,10,"ng-container",12),y()),i&2){let t=d.ngIf;r(),c("ngIf",(t==null?null:t.length)>0)}}function ii(i,d){if(i&1){let t=x();o(0,"mainpanel",3),g("onSubmit",function(e){m(t);let l=s();return u(l.searchProduct(e))}),o(1,"actions"),C(2,Rn,3,1,"button",4),o(3,"button",5),g("click",function(){m(t);let e=s();return u(e.openScanDialog())}),_(4,"i",6),p(5," Scan Channel "),a(),o(6,"button",7),g("click",function(){m(t);let e=s();return u(e.openExportDialog())}),_(7,"i",8),o(8,"span"),p(9,"Export"),a()()(),o(10,"content")(11,"div",9)(12,"div",10),C(13,Yn,18,3,"ng-container",11),O(14,"async"),C(15,Zn,2,0,"ng-template",null,0,q),a(),C(17,ni,2,1,"ng-container",12),O(18,"async"),a()()()}if(i&2){let t,n=U(16),e=s();c("hideSearchDropdown",!0),r(2),c("ngIf",e.hasSelectionProduct),r(11),c("ngIf",((t=T(14,5,e.data$))==null?null:t.length)>0)("ngIfElse",n),r(4),c("ngIf",T(18,7,e.data$))}}var Ye=(()=>{class i{constructor(t,n,e,l,h,P,gt,It,tn){this.http=t,this.dialog=n,this.toastr=e,this.route=l,this.productService=h,this.paginationService=P,this.biggerPictureService=gt,this.authService=It,this.uploadProductService=tn,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=It.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(ee(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(te(t=>(t=t.map(n=>(n.Variants=n.Variants.map(e=>(e.Available=this.productService.sortChannel(e.Available),e.NotAvailable=this.productService.sortChannel(e.NotAvailable),e.Available=this.assignLogoChannel(e.Available),e.NotAvailable=this.assignLogoChannel(e.NotAvailable),e)),n.Channel=n?.Variants[0]?.Available,n)),t)))}assignLogoChannel(t){return t=t.map(n=>(n.Img=f.getChannelLogoByTypeId(n.TypeID),n)),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(n=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(n,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.filterSearch.ChannelID=e.ChannelID,this.filterSearch.ScanFull=e.ScanFull,this.filterSearch.UpdatedProduct=e.UpdatedProduct,this.filterSearch.Async=e.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,n){this.biggerPictureService.openBiggerPicture(t,n)}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(Ue,{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()}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(B),S(ct),S(W),S(Le),S(ke),S($),S(ut))}}static{this.\u0275cmp=w({type:i,selectors:[["app-not-in-channel"]],standalone:!1,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(n,e){n&1&&(C(0,ii,19,9,"mainpanel",2),O(1,"async")),n&2&&c("ngIf",T(1,1,e.loader$))},dependencies:[N,D,me,L,R,G,pt,H,Dt,lt],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%}"]})}}return i})();var oi=i=>[i],ai=()=>[];function ri(i,d){if(i&1){let t=x();o(0,"button",15),g("click",function(){m(t);let e=s();return u(e.openScanDialog())}),_(1,"i",16),p(2," Scan Channel "),a()}}function li(i,d){if(i&1){let t=x();v(0),o(1,"button",17),g("click",function(){m(t);let e=s();return u(e.onDownloadAllProduct("SELECTED"))}),_(2,"i",18),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Download (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function ci(i,d){if(i&1&&(o(0,"span",19),_(1,"img",20),a(),p(2)),i&2){let t=d.item;r(),c("src",t.Img,I)("alt",t.Name),r(),b(" ",t.Name," ")}}function si(i,d){if(i&1){let t=x();o(0,"div",21)(1,"app-product-card",22),g("onCheckBoxChange",function(e){let l=m(t).index,h=s();return u(h.onSelectProduct(e,l))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onShowVariantDetail(e))})("onDownload",function(){let e=m(t).$implicit,l=s();return u(l.onDownloadProduct(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanChannel(e))}),a()()}if(i&2){let t=d.$implicit;r(),c("showRedirectIcon",!1)("title",t==null?null:t.Name)("image",t==null?null:t.Image)("imageForZoom",t==null?null:t.Image)("code",t==null?null:t.SKU)("description",(t==null||t.Variant==null?null:t.Variant.length)>0?(t==null||t.Variant==null?null:t.Variant.length)+" Variants":null)("downloadButton",!0)("channels",t!=null&&t.Channel?Z(10,oi,t==null?null:t.Channel):it(12,ai))("showCheckBox",!0)("scanButton",!0)}}function di(i,d){i&1&&(v(0),o(1,"div",23),_(2,"app-empty-state"),a(),y())}function pi(i,d){if(i&1){let t=x();o(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),g("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()()}if(i&2){let t=s();r(2),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var Ze=(()=>{class i{constructor(t,n,e,l,h,P){this.http=t,this.dialog=n,this.productService=e,this.toastrService=l,this.activateRouter=h,this.authService=P,this.searchFilter=new tt,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,this.searchFilter.PageSize=n.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(n=>(t=this.channelOptions.find(e=>e.ID==n.ChannelID),t?n.Channel=JSON.parse(JSON.stringify(t)):n.Channel=null,n)).map(n=>(n.Channel&&(n.Channel.Url=n.Url),n))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?f.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=f.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(n=>{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(f.GuidEMpty),this.productService.successToastrScanAllProduct(n,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=f.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.Async=e.Async,this.onScanAll()})}onDownloadAllProduct(t){let n;t=="ALL"?n=this.products:n=this.productService.selectedProduct(this.products),n.length>0&&this.productService.downloadMultipleProduct(n).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,n){this.products[n].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 n=JSON.parse(JSON.stringify(t));delete n.Channel,this.productService.scanCompareToPos([n]).subscribe(e=>{e.Status?(this.initPageLoader(f.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 n=this.products[t].Variant;n.length>0&&this.dialog.open(Re,{data:{title:this.products[t].Name,variants:n},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(n=>{this.hasClickRowCount=!0,this.rowCount=n.Count})}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(W),S(B),S(kt),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-not-in-pos"]],standalone:!1,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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.onSearch(h)}),o(1,"actions"),C(2,ri,3,0,"button",1)(3,li,4,1,"ng-container",2),a(),o(4,"filters")(5,"div")(6,"label",3),p(7,"Channel"),a(),o(8,"ng-select",4),F("ngModelChange",function(h){return E(e.searchFilter.ChannelID,h)||(e.searchFilter.ChannelID=h),h}),C(9,ci,3,3,"ng-template",5),a()(),o(10,"div",6)(11,"label",7),p(12,"SKU Assigned"),a(),o(13,"mat-radio-group",8),F("ngModelChange",function(h){return E(e.searchFilter.HaveSku,h)||(e.searchFilter.HaveSku=h),h}),o(14,"mat-radio-button",9),p(15," All "),a(),o(16,"mat-radio-button",9),p(17," Yes "),a(),o(18,"mat-radio-button",9),p(19," No "),a()()(),o(20,"div",6)(21,"label",7),p(22,"Item ID"),a(),o(23,"input",10),F("ngModelChange",function(h){return E(e.searchFilter.Item_id,h)||(e.searchFilter.Item_id=h),h}),a()()(),o(24,"content")(25,"div",11)(26,"div",12),C(27,si,2,13,"div",13)(28,di,3,0,"ng-container",2),a(),C(29,pi,3,4,"div",14),a()()()),n&2&&(r(2),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("items",e.channelOptions),k("ngModel",e.searchFilter.ChannelID),r(5),k("ngModel",e.searchFilter.HaveSku),r(),c("value",0),r(2),c("value",1),r(2),c("value",2),r(5),k("ngModel",e.searchFilter.Item_id),r(4),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[N,D,st,L,R,G,X,dt,ye,Pe,J,et,H],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}"]})}}return i})();function mi(i,d){if(i&1&&(o(0,"span",9),_(1,"img",10),a(),p(2)),i&2){let t=d.item,n=s();r(),c("src",n.getChannelLogo(t.TypeID),I),r(),b(" ",t.Name," ")}}function ui(i,d){if(i&1&&(o(0,"div",11),_(1,"app-duplicate-product-card",12),a()),i&2){let t=d.$implicit,n=d.index;r(),c("imageForZoom",t.ImageUrl)("title",t.Name)("code",t.Code)("id",n)("image",t.ThumbnailURL)("channels",t.Channels)}}function hi(i,d){i&1&&(v(0),o(1,"div",13),_(2,"app-empty-state"),a(),y())}function _i(i,d){if(i&1){let t=x();v(0),o(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),g("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())})("total",function(){m(t);let e=s();return u(e.getRowCount())}),a()()(),y()}if(i&2){let t=s();r(3),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickedRowCount)}}var qe=(()=>{class i{constructor(t,n,e){this.httpService=t,this.productService=n,this.authService=e,this.searchFilter=new tt,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=e.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(n=>{this.products=n.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=f.GuidEMpty}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(n=>{this.hasClickedRowCount=!0,this.rowCount=n.Total})}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(W),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-duplicate-sku"]],standalone:!1,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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.onSearch(h)}),o(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),p(5,"Channel"),a(),o(6,"ng-select",3),F("ngModelChange",function(h){return E(e.searchFilter.ListChannelID,h)||(e.searchFilter.ListChannelID=h),h}),g("clear",function(){return e.onClearFilter()}),C(7,mi,3,2,"ng-template",4),a()()()(),o(8,"content")(9,"div",5)(10,"div",6),C(11,ui,2,6,"div",7)(12,hi,3,0,"ng-container",8),a(),C(13,_i,4,4,"ng-container",8),a()()()),n&2&&(r(6),c("multiple",!0)("clearable",!0)("items",e.channelOptions),k("ngModel",e.searchFilter.ListChannelID),r(5),c("ngForOf",e.products),r(),c("ngIf",(e.products==null?null:e.products.length)==0),r(),c("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[N,D,L,R,G,X,dt,Vt,Rt,J,H],encapsulation:2})}}return i})();var gi=()=>["/menu/products/status/sold-in-channel"],Qe=i=>({ID:i}),Ci=()=>["/menu/products/status/not-in-pos"];function fi(i,d){if(i&1&&(v(0),p(1),y()),i&2){let t=s().$implicit;r(),b(" ",t.Count," ")}}function Si(i,d){if(i&1){let t=x();o(0,"span",26),g("click",function(){m(t);let e=s().$implicit,l=s(2);return u(l.getLiveProductCount(e.ID,e))}),_(1,"i",27),a()}}function xi(i,d){if(i&1){let t=x();o(0,"tr")(1,"td"),_(2,"img",17),o(3,"span",18),p(4),a()(),o(5,"td",19),C(6,fi,2,1,"ng-container",6)(7,Si,2,0,"ng-template",null,1,q),a(),o(9,"td",19)(10,"a",20),p(11),O(12,"number"),a()(),o(13,"td",19)(14,"a",20),p(15),O(16,"number"),a()(),o(17,"td"),p(18),O(19,"date"),a(),o(20,"td")(21,"div",21)(22,"button",22),g("click",function(){let e=m(t).$implicit,l=s(2);return u(l.onScanChannel(e))}),_(23,"i",23),p(24," Scan "),a(),o(25,"button",24),g("click",function(){let e=m(t).$implicit,l=s(2);return u(l.onClearCache(e.ID))}),_(26,"i",25),p(27," Clear "),a()()()()}if(i&2){let t=d.$implicit,n=U(8),e=s(2);r(2),c("src",e.getChannelLogo(t.TypeID),I),r(2),z(t.Name),r(2),c("ngIf",t.Count!==void 0)("ngIfElse",n),r(4),c("routerLink",it(18,gi))("queryParams",Z(19,Qe,t.ID)),r(),b(" ",T(12,11,t.SoldInChannel)," "),r(3),c("routerLink",it(21,Ci))("queryParams",Z(22,Qe,t.ID)),r(),b(" ",T(16,13,t.NotInPOS)," "),r(3),b("",t.LastSync?ce(19,15,t.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function bi(i,d){if(i&1&&(v(0),o(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),p(6,"Channel"),a(),o(7,"th",11),p(8,"Live Product"),a(),o(9,"th",12),p(10,"Sold In Channel"),a(),o(11,"th",13),p(12,"Product Not in POS"),a(),o(13,"th",14),p(14,"Last Sync"),a(),_(15,"th",15),a()(),o(16,"tbody"),C(17,xi,28,24,"tr",16),O(18,"async"),a()()(),y()),i&2){let t,n=s();r(17),c("ngForOf",(t=T(18,1,n.channels$))==null?null:t.Data)}}function vi(i,d){i&1&&(o(0,"div",28),_(1,"app-empty-state"),a())}var Xe=(()=>{class i{constructor(t,n,e,l){this.productService=t,this.toastr=n,this.dialog=e,this.authService=l,this.destroy$=new Xt,this.channelOptions=l.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,n){this.productService.getTotalProductLive(t).pipe(Gt(this.destroy$)).subscribe(e=>{n.Count=e.Count})}onScanChannel(t){this.dialog.open(A,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(M(n=>f.IsNotEmpty(n))).subscribe(n=>{this.scanAllProduct(t.ID,n)})}scanAllProduct(t,n){let e=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(n.ChannelID,n.ScanFull,n.UpdatedProduct,n.Async).pipe(M(l=>l)).subscribe(l=>{n.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(l,e,!n.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(Gt(this.destroy$)).subscribe(e=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static{this.\u0275fac=function(n){return new(n||i)(S(W),S(B),S(K),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-channel-statistic"]],standalone:!1,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(n,e){if(n&1&&(o(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),C(5,bi,19,3,"ng-container",6),O(6,"async"),C(7,vi,2,0,"ng-template",null,0,q),a()()()()()),n&2){let l,h=U(8);c("hideSearchBox",!0)("hideSearchDropdown",!0),r(5),c("ngIf",((l=T(6,4,e.channels$))==null||l.Data==null?null:l.Data.length)>0)("ngIfElse",h)}},dependencies:[N,D,G,pt,Et,H,Dt,lt,se],encapsulation:2})}}return i})();var yi=[{component:$e,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:Ke,canActivate:[ot],data:{title:"Products in POS"}},{path:"sold-in-channel",component:Je,canActivate:[ot],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:Ye,canActivate:[ot],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:Ze,canActivate:[ot],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:qe,canActivate:[ot],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:Xe,canActivate:[ot],data:{title:"Channel Statistic"}}]}],ya=(()=>{class i{static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275mod=oe({type:i})}static{this.\u0275inj=ne({imports:[Q,Ft,xe,mt,he,Be,Ie,ve,Rt,J,et,pe.forChild(yi),Ae,je,_t]})}}return i})();export{ya as StatusModule};
|
|
1
|
+
import{a as A,b as Re}from"./chunk-XIUYKYPU.js";import"./chunk-ESWJCZZP.js";import"./chunk-MS4AQ6UA.js";import{a as H}from"./chunk-ZD5LURJS.js";import{a as Le}from"./chunk-PPDHTO44.js";import{a as tt}from"./chunk-7KG3DC5J.js";import{b as Ue}from"./chunk-3LQNSF7T.js";import"./chunk-YXFTLQ5M.js";import{a as be,b as ve}from"./chunk-OE2JYQHN.js";import{e as ut}from"./chunk-UWAJCC5U.js";import{a as je}from"./chunk-LLZSSV5A.js";import{i as Ee,j as Fe,k as Ve,l as Ne,m as Ae}from"./chunk-CRC6ZWYT.js";import"./chunk-CLKCSTGQ.js";import"./chunk-7TWBIV3T.js";import{a as W}from"./chunk-EGTYAIU5.js";import"./chunk-LOJPRXKZ.js";import"./chunk-6ALHX2I4.js";import"./chunk-3RK6DDJD.js";import{a as Rt}from"./chunk-J3P46Z53.js";import{a as J}from"./chunk-4ASUM4N5.js";import{b as Be}from"./chunk-CVQMAWML.js";import{a as Te,b as De}from"./chunk-LEHTNMIE.js";import{a as ye,b as Pe,c as Ie}from"./chunk-GHQH62TZ.js";import"./chunk-CH2MLZU7.js";import{a as ot}from"./chunk-K2UZHZCJ.js";import{a as et}from"./chunk-62PFQNHJ.js";import{c as Oe}from"./chunk-Q72ZXPDP.js";import"./chunk-MNFHFW3E.js";import"./chunk-ZZVNB72Q.js";import{a as ke}from"./chunk-VGXQU74M.js";import"./chunk-SDUUFQUI.js";import"./chunk-G6EG5QJS.js";import{a as Me}from"./chunk-RIHLYYZU.js";import{f as we}from"./chunk-Q2OEJFVT.js";import{a as dt,b as Vt,d as X,e as he}from"./chunk-6IAGGRZN.js";import"./chunk-T6QOFDEE.js";import"./chunk-KXZCGKQW.js";import"./chunk-QCZIDOKW.js";import{h as ue,j as $}from"./chunk-3DTDXKFQ.js";import{b as B,e as j}from"./chunk-BUFEIJAI.js";import"./chunk-K5XRGNWG.js";import"./chunk-V5WYSCVT.js";import"./chunk-KHWTOD6H.js";import{b as Nt,c as At,d as K,e as _e,f as ge,g as Ce,h as fe,i as Ut,j as Lt,k as Se,m as G,n as xe}from"./chunk-ITTRZMEX.js";import{r as pt,s as mt}from"./chunk-TMFFA26Y.js";import"./chunk-WAW37FIG.js";import{b as me,c as st,h as L,m as R,y as Ft}from"./chunk-DPLEMBB4.js";import{b as V,c as f}from"./chunk-PXB4YEY3.js";import{E as kt,F as de,G as ct,H as Et,J as pe,d as Tt,f as N,g as D,j as Dt,k as se,m as lt,n as Q}from"./chunk-GPEVUTDI.js";import{$c as ce,Dc as U,Eb as w,Ec as p,Fb as oe,Fc as z,G as M,Gc as b,Ic as k,Jc as E,Ka as Ct,Kb as C,Kc as F,Pc as it,Qa as ft,Qc as Z,Rc as Jt,Tc as le,Vb as Wt,Wb as c,Xb as ae,Zc as O,_c as T,aa as wt,ad as q,bc as Mt,ca as Gt,cc as Ht,ea as ee,ec as zt,f as Xt,fc as Kt,gc as o,hc as a,ic as _,jc as v,ka as ne,kc as y,mc as x,nb as ie,ob as I,pa as rt,qb as r,rc as g,sc as s,tc as re,uc as Ot,v as te,wb as S,ya as m,za as u}from"./chunk-T5ONJF63.js";import"./chunk-K2H6WANG.js";var en=()=>["/menu/products/download/by-url"],$e=(()=>{class i{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"}]}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["app-status"]],standalone:!1,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(n,e){n&1&&(o(0,"nav",0)(1,"div",1)(2,"div"),_(3,"nav-tab",2),a()(),o(4,"div")(5,"div",3)(6,"a",4),_(7,"i",5),a(),o(8,"div",6)(9,"div",7)(10,"a",8),p(11,"Download Product By Url"),a()()()()()(),_(12,"router-outlet")),n&2&&(r(3),c("Tabs",e.productTabs),r(7),c("routerLink",it(2,en)))},dependencies:[be,de,Et],encapsulation:2})}}return i})();var at=function(i){return i.Tokopedia="https://seller.tokopedia.com",i.Shoope="https://seller.shopee.co.id",i.Tiktok="https://seller-id.tiktok.com",i.WooCommerce="https://woocommerce.dealpos.app",i.Lazada="https://sellercenter.lazada.co.id",i}(at||{});var Yt={Success:"Success",Info:"Info",Warning:"Warning",Error:"Error"};var nn=[[["header"]],[["content"]],[["footer"]]],on=["header","content","footer"],an=(i,d)=>({bodyScrollable:i,hideScrollbar:d}),rn=(i,d,t,n)=>({"bg-success":i,"bg-warning":d,"bg-info":t,"bg-danger":n}),ln=i=>({"mx-auto":i}),cn=(i,d)=>({"show-footer":i,"p-0":d});function sn(i,d){if(i&1){let t=x();o(0,"div",8),g("click",function(){m(t);let e=s();return u(e.onBack.emit())}),o(1,"a",9),_(2,"i",10),a()()}}function dn(i,d){if(i&1){let t=x();o(0,"div")(1,"a",11),g("click",function(){m(t);let e=s();return u(e.onClose.emit())}),_(2,"i",12),a()()}}function pn(i,d){if(i&1){let t=x();o(0,"a",16),g("click",function(){m(t);let e=s(2);return u(e.onCancel.emit())}),p(1),a()}if(i&2){let t=s(2);r(),b(" ",t.config!=null&&t.config.cancelText?t.config==null?null:t.config.cancelText:"Cancel","")}}function mn(i,d){if(i&1){let t=x();o(0,"button",17),g("click",function(){m(t);let e=s(2);return u(e.onOk.emit())})("keyup.F2",function(){m(t);let e=s(2);return u(e.onOk.emit())}),a()}if(i&2){let t=s(2);c("disabled",!(t.config!=null&&t.config.validated)||!t.dynamicValidated)("innerHTML",t.config!=null&&t.config.okText?t.config==null?null:t.config.okText:"Ok (F2)",ie)}}function un(i,d){if(i&1&&(o(0,"mat-dialog-actions",13),Ot(1,2),C(2,pn,2,1,"a",14)(3,mn,1,2,"button",15),a()),i&2){let t=s();r(2),c("ngIf",!(t.config!=null&&t.config.hideCancel)),r(),c("ngIf",!(t.config!=null&&t.config.hideOk))}}var Zt=class{constructor(){this.title="New Modal",this.okText="Ok (F2)",this.cancelText="Cancel",this.hideFooter=!1,this.hideCancel=!1,this.hideOk=!1,this.hideClose=!1,this.eMoney=!1,this.headerType=Yt.Success,this.validated=!0,this.customWidth="initial",this.bodyScrollable=!1,this.hideScrollbar=!1,this.disableKeyup=!1,this.noPadding=!1}},Ge=(()=>{class i{constructor(){this.dynamicValidated=!0,this.onOk=new Ct,this.onCancel=new Ct,this.onClose=new Ct,this.onBack=new Ct,this.headerType=Yt}ngOnInit(){this.config==null&&(this.config=new Zt)}onKeyup(t){this.config?.disableKeyup||(t.code=="F2"&&this.onOk.emit("F2"),(t.code=="Enter"||t.code=="NumpadEnter")&&this.onOk.emit("Enter"))}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["modal-material"]],inputs:{config:"config",dynamicValidated:"dynamicValidated"},outputs:{onOk:"onOk",onCancel:"onCancel",onClose:"onClose",onBack:"onBack"},ngContentSelectors:on,decls:11,vars:23,consts:[["id","modal_material",1,"modal-material","d-flex","align-items-start","flex-column","position-relative","maxHeight",3,"keyup","ngClass"],["mat-dialog-title","",1,"d-flex","w-100","justify-content-between","modal-header","position-relative",3,"ngClass"],["class","back-button position-absolute pointer d-print-none",3,"click",4,"ngIf"],[1,"d-flex","flex-row","d-print-none","align-items-center",3,"ngClass"],[1,"fw-normal"],[4,"ngIf"],[1,"modal-body","w-100",3,"ngClass"],["class","w-100 py-7 border-top d-flex justify-content-end d-print-none",4,"ngIf"],[1,"back-button","position-absolute","pointer","d-print-none",3,"click"],[1,"btn","back-button"],[1,"fa-solid","fa-arrow-left"],[1,"btn-light-blue","btn-sm","pointer","close",3,"click"],[1,"fa-solid","fa-xmark","fa-lg","text-primary"],[1,"w-100","py-7","border-top","d-flex","justify-content-end","d-print-none"],["class","btn btn-light-blue text-primary btn-lg fw-bold mx-3",3,"click",4,"ngIf"],["class","btn btn-light-blue me-6 text-primary btn-lg fw-bold mx-3","data-cy","btn-ok",3,"disabled","innerHTML","click","keyup.F2",4,"ngIf"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3",3,"click"],["data-cy","btn-ok",1,"btn","btn-light-blue","me-6","text-primary","btn-lg","fw-bold","mx-3",3,"click","keyup.F2","disabled","innerHTML"]],template:function(n,e){n&1&&(re(nn),o(0,"div",0),g("keyup",function(h){return e.onKeyup(h)}),o(1,"div",1),C(2,sn,3,0,"div",2),o(3,"div",3)(4,"h4",4),p(5),a(),Ot(6),a(),C(7,dn,3,0,"div",5),a(),o(8,"mat-dialog-content",6),Ot(9,1),a(),C(10,un,4,2,"mat-dialog-actions",7),a()),n&2&&(ae("width",e.config==null?null:e.config.customWidth),c("ngClass",Jt(10,an,e.config==null?null:e.config.bodyScrollable,e.config==null?null:e.config.hideScrollbar)),r(),c("ngClass",le(13,rn,e.headerType.Success==(e.config==null?null:e.config.headerType),e.headerType.Warning==(e.config==null?null:e.config.headerType),e.headerType.Info==(e.config==null?null:e.config.headerType),e.headerType.Error==(e.config==null?null:e.config.headerType))),r(),c("ngIf",e.config==null?null:e.config.eMoney),r(),c("ngClass",Z(18,ln,e.config==null?null:e.config.eMoney)),r(2),z(e.config==null?null:e.config.title),r(2),c("ngIf",!(e.config!=null&&e.config.hideClose)),r(),c("ngClass",Jt(20,cn,!(e.config!=null&&e.config.hideFooter),e.config==null?null:e.config.noPadding)),r(2),c("ngIf",!(e.config!=null&&e.config.hideFooter)))},dependencies:[Q,Tt,D,fe,_e,Ce,ge],styles:[".mat-mdc-dialog-container{padding:0!important;border-radius:4px!important;overflow:visible!important} .mat-mdc-dialog-container [mat-dialog-title]{color:#fff;padding:15px;border:none}@media print{ .mat-mdc-dialog-container{box-shadow:unset;width:100vw}}@media print{ .cdk-overlay-pane{position:absolute!important;top:-30px;max-width:100vw!important}.modal-body[_ngcontent-%COMP%]{width:100vw!important}}body.modal-body[_ngcontent-%COMP%]{height:100%;overflow-y:hidden}mat-dialog-actions[_ngcontent-%COMP%]{bottom:15px}mat-dialog-actions[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{padding:15px!important;margin-right:12px}mat-dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:15px!important}mat-dialog-actions[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin-right:auto;margin-top:-1rem;padding-top:.4rem!important;margin-left:1rem}.back-button[_ngcontent-%COMP%]{top:5px;left:0}.close[_ngcontent-%COMP%]{padding:.4rem .5rem}.no-padding[_ngcontent-%COMP%]{padding:0}.modal-material[_ngcontent-%COMP%]{width:40vw}@media (max-width: 992px){.modal-material[_ngcontent-%COMP%]{width:50vw!important}}@media (max-width: 576px){ .dialog-filter .modal-material{width:100%!important} .dialog-filter mat-dialog-actions{position:sticky;bottom:0;background:#fff} .dialog-filter .modal-material.d-flex.align-items-start.flex-column.position-relative.maxHeight.bodyScrollable.maxHeight.bodyScrollable .modal-body{max-height:100%!important;overflow-y:auto}}.maxHeight.bodyScrollable[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow-y:auto}.modal-header[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%], .modal-footer[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{padding:15px}.modal-dialog[_ngcontent-%COMP%]{max-width:none}.modal-content[_ngcontent-%COMP%]{width:auto;margin:auto;max-width:850px}.maxHeight[_ngcontent-%COMP%] .modal-body[_ngcontent-%COMP%]{max-height:450px;overflow:auto}.modal-body[_ngcontent-%COMP%]{padding:1rem}.modal-body[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{display:block}.modal-body[_ngcontent-%COMP%] .more[_ngcontent-%COMP%]{margin:0;position:absolute;bottom:-20px}.modal-body[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%], .modal-body[_ngcontent-%COMP%] input[type=password][_ngcontent-%COMP%]{border:1px solid #c8d3df;padding:5px 7px}.modal-body[_ngcontent-%COMP%] table[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{width:330px;height:90px}"]})}}return i})();var hn=i=>({"is-disabled":i});function _n(i,d){if(i&1&&(v(0),o(1,"tr")(2,"td",10),p(3),a(),o(4,"td",10),p(5),a(),o(6,"td",11)(7,"p",12),p(8,"Product Not in Channel!"),a()()(),y()),i&2){let t=s().$implicit;r(3),b(" ",t==null?null:t.Model," "),r(2),b(" ",t==null?null:t.Code," ")}}function gn(i,d){if(i&1&&(o(0,"td",10),p(1),a()),i&2){let t=s(3).$implicit;Wt("rowspan",t.Channel.length),r(),b(" ",t==null?null:t.Model," ")}}function Cn(i,d){if(i&1&&(o(0,"td",10),p(1),a()),i&2){let t=s(3).$implicit;Wt("rowspan",t.Channel.length),r(),b(" ",t==null?null:t.Code," ")}}function fn(i,d){if(i&1){let t=x();o(0,"tr"),C(1,gn,2,2,"td",13)(2,Cn,2,2,"td",13),o(3,"td",10)(4,"div",14)(5,"a",15),_(6,"img",16),a(),o(7,"div",17),p(8),a()()(),o(9,"td",10),p(10),O(11,"number"),a(),o(12,"td",18),p(13),O(14,"number"),a(),o(15,"td",19)(16,"div",20)(17,"button",21),g("click",function(){let e=m(t).$implicit,l=s(2).$implicit,h=s();return u(h.onDetach(e,l))}),_(18,"i",22),o(19,"span",23),p(20,"Detach"),a()(),o(21,"a",24),_(22,"i",25),o(23,"span",23),p(24,"Edit"),a()()()()()}if(i&2){let t=d.$implicit,n=d.$index,e=s(3);r(),c("ngIf",n==0),r(),c("ngIf",n==0),r(3),c("href",t.Url,I)("title",t.Title),r(),c("src",e.getChannelLogo(t.TypeID),I),r(),c("matTooltip",(t==null||t.Name==null?null:t.Name.length)>40?t==null?null:t.Name:""),r(),b(" ",t.Name," "),r(2),z(T(11,12,t.Price)),r(3),z(T(14,14,t.Inventory)),r(8),c("href",e.getHyperlinkSellerCenter(t),I)("ngClass",Z(16,hn,t.TypeID==e.channelType.KalCare))("matTooltip",t.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function Sn(i,d){if(i&1&&zt(0,fn,25,18,"tr",null,Ht),i&2){let t=s().$implicit;Kt(t==null?null:t.Channel)}}function xn(i,d){if(i&1&&C(0,_n,9,2,"ng-container",9)(1,Sn,2,0,"ng-template",null,0,q),i&2){let t=d.$implicit,n=U(2);c("ngIf",!t.Channel||t.Channel.length<1)("ngIfElse",n)}}var Bt=(()=>{class i{constructor(t,n){this.data=t,this.dialogRef=n,this.httpService=rt(j),this.toastr=rt(B),this.variants=ft([]),this.channelType=V,this.variants.set(this.data.variants),this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new Lt,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="850px"}onDetach(t,n){let e={ChannelID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariationID:t.ChannelVariationID};this.httpService.post(ue.DetachVariant,[e]).subscribe(l=>{this.toastr.success(l.Message,"Success"),this.updateVariantAfterDetach(n,t.ChannelVariationID)})}updateVariantAfterDetach(t,n){this.variants.update(e=>{let l=e.findIndex(h=>h.ID===t.ID);return l!==-1&&(e[l].Channel=e[l].Channel.filter(h=>h.ChannelVariationID!==n)),[...e]})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let n="javascript:void(0)";switch(t.TypeID){case V.Shopee:n=`${at.Shoope}/portal/product/${t.ChannelItemID}`;break;case V.Tiktok:n=`${at.Tiktok}/product/edit/${t.ChannelItemID}`;break;case V.Tokopedia:n=`${at.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case V.WooCommerce:n=`${at.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case V.Lazada:n=`${at.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return n}static{this.\u0275fac=function(n){return new(n||i)(S(At),S(Nt))}}static{this.\u0275cmp=w({type:i,selectors:[["app-modal-variant"]],decls:27,vars:1,consts:[["printChannelModal",""],[3,"onClose","onCancel","config"],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],[1,"d-flex","align-items-center"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngIf","ngIfElse"],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],[1,"text-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"btn","btn-small","btn-light","px-4","py-2","me-3",3,"click"],[1,"fa-sharp","fa-link-slash","me-2",2,"font-size","10px"],[1,"fs-6"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-edit","me-2",2,"font-size","10px"]],template:function(n,e){n&1&&(o(0,"modal-material",1),g("onClose",function(){return e.dialogRef.close()})("onCancel",function(){return e.dialogRef.close()}),o(1,"content")(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4)(6,"div",5)(7,"span"),p(8,"VARIANT"),a(),o(9,"sup"),_(10,"i",6),a()()(),o(11,"th",4),p(12,"SKU"),a(),o(13,"th",4)(14,"div",5)(15,"span"),p(16,"PRODUCT"),a(),o(17,"sup"),_(18,"i",7),a()()(),o(19,"th",4),p(20,"PRICE"),a(),o(21,"th",8),p(22,"INVENTORY"),a(),_(23,"th",4),a()(),o(24,"tbody"),zt(25,xn,3,2,null,null,Ht),a()()()()),n&2&&(c("config",e.modalConfig),r(25),Kt(e.variants()))},dependencies:[Q,Tt,D,lt,mt,pt,Ge],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]})}}return i})();function bn(i,d){if(i&1&&(o(0,"mat-option",6)(1,"div"),_(2,"img",7),o(3,"span"),p(4),a()()()),i&2){let t=d.$implicit;c("value",t.ChannelID),r(2),c("src",t.logo,I),r(2),z(t.Title)}}var _t=(()=>{class i{constructor(){this.dialogRef=rt(Nt),this.channels=rt(At),this.channelIds=ft([]),this.channelOptions=ft([])}ngOnInit(){this.initModalConfig();let t=this.channels.filter((n,e,l)=>l.findIndex(h=>h.ChannelID===n.ChannelID)===e);this.channelOptions.set(t)}initModalConfig(){this.modalConfig=new Lt,this.modalConfig.title="Detach Product",this.modalConfig.okText="Save"}onClose(){this.dialogRef.close()}onSave(){let t=this.channels.filter(n=>this.channelIds().includes(n.ChannelID)).map(n=>({ChannelID:n.ChannelID,ChannelItemID:n.ChannelItemID}));this.dialogRef.close(t)}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=w({type:i,selectors:[["app-modal-detach-product"]],decls:8,vars:5,consts:[[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","ngModel","multiple"],["class","channel-option",3,"value",4,"ngFor","ngForOf"],[1,"channel-option",3,"value"],[2,"width","18px","margin-right","10px",3,"src"]],template:function(n,e){n&1&&(o(0,"modal-material",0),g("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()})("onOk",function(){return e.onSave()}),o(1,"div",1)(2,"div")(3,"label",2),p(4,"Select a Channel"),a(),o(5,"mat-form-field",3)(6,"mat-select",4),F("ngModelChange",function(h){return E(e.channelIds,h)||(e.channelIds=h),h}),C(7,bn,5,3,"mat-option",5),a()()()()()),n&2&&(c("dynamicValidated",e.channelIds().length>0)("config",e.modalConfig),r(6),k("ngModel",e.channelIds),c("multiple",!0),r(),c("ngForOf",e.channelOptions()))},dependencies:[Q,N,Se,Me,we,De,Te,Oe,Ft,L,R,mt],encapsulation:2})}}return i})();function vn(i,d){if(i&1){let t=x();o(0,"button",13),g("click",function(){m(t);let e=s();return u(e.onDetachMultipleProduct())}),_(1,"i",14),p(2),a()}if(i&2){let t,n=s();r(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function yn(i,d){if(i&1){let t=x();o(0,"button",16),g("click",function(){m(t);let e=s(2);return u(e.onOpenScanDialog())}),_(1,"i",17),p(2," Scan Channel "),a()}}function Pn(i,d){if(i&1&&(v(0),C(1,yn,3,0,"button",15),y()),i&2){let t=s();r(),c("ngIf",!t.productService.hasSelection(t.products))}}function In(i,d){if(i&1){let t=x();v(0),o(1,"button",18),g("click",function(){m(t);let e=s();return u(e.onScanMultipleProduct())}),_(2,"i",17),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Scan (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function wn(i,d){if(i&1){let t=x();v(0),o(1,"button",19),g("click",function(){m(t);let e=s();return u(e.onUploadMultipleProduct())}),_(2,"i",20),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Upload (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function Mn(i,d){if(i&1){let t=x();o(0,"div",21)(1,"app-product-card",22),g("onUpload",function(){let e=m(t).$implicit,l=s();return u(l.onUploadToMultipleChannel(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanSingleProduct(e))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onOpenDialogVariant(e))})("onCheckBoxChange",function(e){let l=m(t).$implicit;return u(l.selected=e)})("onDetach",function(){let e=m(t).$implicit,l=s();return u(l.onDetachProduct([e]))}),a()()}if(i&2){let t=d.$implicit,n=s();r(),c("productId",t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",(t==null?null:t.Channel.length)<n.channelOptions.length)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function On(i,d){i&1&&(v(0),o(1,"div",23),_(2,"app-empty-state"),a(),y())}function Tn(i,d){if(i&1){let t=x();v(0),o(1,"div",24)(2,"div",25)(3,"app-custom-paginator",26),g("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()(),y()}if(i&2){let t=s();r(3),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",!0)("nextButtonAlwaysVisible",!0)}}var Ke=(()=>{class i{constructor(t,n,e,l,h,P,gt){this.http=t,this.toastr=n,this.dialog=e,this.productService=l,this.authService=h,this.uploadProductService=P,this.route=gt,this.searchFilter=new tt,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,[V.Tokopedia,V.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(n=>{this.products=n.Data,this.rowCount=n.Total==null?this.searchFilter.RowCount:n.Total.toString(),this.products=this.productService.checkProductHasUploadBtn(this.products,this.channelOptions)})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.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 n=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,n,!this.searchFilter.UpdatedProduct)}})}onOpenDialogVariant(t){let n=this.products[t]?.Variants||[];this.dialog.open(Bt,{data:{title:this.products[t].Name,variants:n}})}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=f.GuidEMpty;let n=this.productService.filterChannelByTypeId(this.channelOptions,[V.Tokopedia,V.Tiktok]);this.dialog.open(A,{data:{filter:t,channelOptions:n,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(l=>f.IsNotEmpty(l))).subscribe(l=>{this.searchFilter.ChannelID=l.ChannelID,this.searchFilter.ScanFull=l.ScanFull,this.searchFilter.UpdatedProduct=l.UpdatedProduct;let h=this.productService.selectedProduct(this.products),P=this.productService.getVariantCodesProducts(h);this.scanSingleProduct(P)})}onScanSingleProduct(t){let n=JSON.parse(JSON.stringify(this.searchFilter));n.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let l=this.productService.getVariantCodesProduct(t);this.scanSingleProduct(l)})}scanSingleProduct(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{if(n)this.toastr.success("Successfully Scan ","Success");else{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.toastr.error(`This product is not existed in ${e?.Name} `,"Error")}this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t=[]){let n;return t?.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t?.length==1&&(n=t[0].Code),n}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(_t,{width:"600px",data:[...n]}).afterClosed().pipe(M(e=>f.IsNotEmpty(e)),wt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,Ut.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(B),S(K),S(W),S($),S(ut),S(ct))}}static{this.\u0275cmp=w({type:i,selectors:[["app-in-pos"]],standalone:!1,decls:23,vars:14,consts:[["picker",""],["description","All products which is already available in POS",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[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",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["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","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[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","nextButtonAlwaysVisible"]],template:function(n,e){if(n&1){let l=x();o(0,"mainpanel",1),g("onSubmit",function(P){return m(l),u(e.searchProduct(P))}),o(1,"actions"),C(2,vn,3,1,"button",2)(3,Pn,2,1,"ng-container",3)(4,In,4,1,"ng-container",3)(5,wn,4,1,"ng-container",3),a(),o(6,"filters")(7,"div")(8,"label",4),p(9,"Category"),a(),o(10,"ng-select",5),g("ngModelChange",function(P){return m(l),u(e.searchFilter.Category=P)}),a()(),o(11,"div",6)(12,"mat-date-range-input",7)(13,"input",8),F("ngModelChange",function(P){return m(l),E(e.startDate,P)||(e.startDate=P),u(P)}),g("click",function(){m(l);let P=U(16);return u(P.open())}),a(),o(14,"input",9),F("ngModelChange",function(P){return m(l),E(e.endDate,P)||(e.endDate=P),u(P)}),g("click",function(){m(l);let P=U(16);return u(P.open())}),a()(),_(15,"mat-date-range-picker",null,0),a()(),o(17,"content")(18,"div",10)(19,"div",11),C(20,Mn,2,11,"div",12)(21,On,3,0,"ng-container",3),a(),C(22,Tn,4,5,"ng-container",3),a()()()}if(n&2){let l=U(16);c("headerTitle","In POS ("+e.rowCount+")"),r(2),Mt(e.productService.hasSelection(e.products)?2:-1),r(),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)&&e.multipeScanChannels.length>0),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("items",e.Categories)("ngModel",e.searchFilter.Category),r(2),c("rangePicker",l),r(),k("ngModel",e.startDate),r(),k("ngModel",e.endDate),r(6),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",e.products.length>0)}},dependencies:[N,D,st,L,R,G,X,J,et,H,Ee,Fe,Ve,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}"]})}}return i})();function Dn(i,d){if(i&1){let t=x();o(0,"button",11),g("click",function(){m(t);let e=s();return u(e.onDetachMultipleProduct())}),_(1,"i",12),p(2),a()}if(i&2){let t,n=s();r(2),b("Detach (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function kn(i,d){if(i&1){let t=x();v(0),o(1,"button",13),g("click",function(){m(t);let e=s();return u(e.onOpenScanDialog())}),_(2,"i",14),p(3," Scan Channel "),a(),y()}}function En(i,d){if(i&1){let t=x();v(0),o(1,"button",15),g("click",function(){m(t);let e=s();return u(e.onScanMultipleProduct())}),_(2,"i",14),p(3),a(),y()}if(i&2){let t=s();r(3),b(" Scan (",t.productService.selectedProduct(t.products).length,") ")}}function Fn(i,d){if(i&1){let t=x();v(0),o(1,"button",16),g("click",function(){m(t);let e=s();return u(e.onUploadMultipleProduct())}),_(2,"i",17),p(3),a(),y()}if(i&2){let t=s();r(3),b(" Upload (",t.productService.selectedProduct(t.products).length,") ")}}function Vn(i,d){if(i&1&&(o(0,"span",18),_(1,"img",19),a(),p(2)),i&2){let t=d.item;r(),c("src",t.Img,I)("alt",t.Name),r(),b(" ",t.Name," ")}}function Nn(i,d){if(i&1){let t=x();o(0,"div",20)(1,"label",21),p(2,"Item ID"),a(),o(3,"input",22),F("ngModelChange",function(e){m(t);let l=s();return E(l.searchFilter.Item_id,e)||(l.searchFilter.Item_id=e),u(e)}),a()()}if(i&2){let t=s();r(3),k("ngModel",t.searchFilter.Item_id)}}function An(i,d){if(i&1){let t=x();o(0,"div",23)(1,"app-product-card",24),g("onUpload",function(){let e=m(t).$implicit,l=s();return u(l.onUploadToMultipleChannel(e))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onOpenVariantDetail(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanSingleProduct(e))})("onCheckBoxChange",function(e){let l=m(t).$implicit;return u(l.selected=e)})("onDetach",function(){let e=m(t).$implicit,l=s();return u(l.onDetachProduct([e]))}),a()()}if(i&2){let t=d.$implicit,n=s();r(),c("productId",t==null?null:t.ID)("title",t==null?null:t.Name)("image",t==null?null:t.ThumbnailUrl)("description",(t==null||t.Variants==null?null:t.Variants.length)>1?(t==null||t.Variants==null?null:t.Variants.length)+" Variants":null)("channels",n.productService.getChannelProduct(t))("code",n.getVariantCode(t==null?null:t.Variants))("showCheckBox",t==null?null:t.hasScan)("scanButton",!0)("uploadButton",t==null?null:t.hasUpload)("imageForZoom",t==null?null:t.ImageUrl)("detachButton",(t==null||t.Channel==null?null:t.Channel.length)>0)}}function Un(i,d){i&1&&(v(0),o(1,"div",25),_(2,"app-empty-state"),a(),y())}function Ln(i,d){if(i&1){let t=x();o(0,"div",26)(1,"div",27)(2,"app-custom-paginator",28),g("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()()}if(i&2){let t=s();r(2),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var Je=(()=>{class i{constructor(t,n,e,l,h,P,gt,It){this.http=t,this.dialog=n,this.toastr=e,this.productService=l,this.activateRouter=h,this.authService=P,this.route=gt,this.uploadProductService=It,this.searchFilter=new tt,this.products=[],this.rowCount=0,this.hasClickRowCount=!1,this.guidEmpty=f.GuidEMpty,this.multipeScanChannels=[],this.channelOptions=this.authService.getChannels(),this.initMultiScanChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,n.Filter.ChannelID!=f.GuidEMpty&&(this.searchFilter.ListChannelID=[],this.searchFilter.ListChannelID.push(n.Filter.ChannelID)),this.searchFilter.PageSize=n.Filter.RowCount,this.searchFilter.Item_id="",this.getProducts()})}initMultiScanChannels(){this.multipeScanChannels=this.productService.filterChannelByTypeId(this.channelOptions,[V.Tokopedia,V.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(n=>{this.products=n.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 n=this.products[t].Variants;this.dialog.open(Bt,{data:{variants:n,title:this.products[t].Name}})}onOpenScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.Async=e.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(M(n=>n)).subscribe(n=>{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(n,t,!this.searchFilter.UpdatedProduct),this.initPageLoader(f.GuidEMpty))})}onScanSingleProduct(t){t.Channel=this.productService.getChannelProduct(t);let n=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(A,{data:{filter:n,channelOptions:this.channelOptions,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID;let l=this.productService.getVariantCodesProduct(t);this.scanProducts(l)})}onUploadToMultipleChannel(t){this.uploadProductService.setSelectedProduct([t]),this.route.navigate(["/menu/products/upload"])}onScanMultipleProduct(){this.searchFilter.ChannelID=f.GuidEMpty;let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(A,{data:{filter:t,channelOptions:this.multipeScanChannels,isSingleChannel:!0},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.UpdatedProduct=e.UpdatedProduct;let l=this.productService.selectedProduct(this.products),h=this.productService.getVariantCodesProducts(l);this.scanProducts(h)})}scanProducts(t){this.productService.scanSingle(this.searchFilter.ChannelID,t).subscribe({next:n=>{let e=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);n?this.toastr.success(`Product Successfully scan with ${e?.Name}`,"Success"):this.toastr.error(`This product is not existed in ${e?.Name} `,"Error"),this.searchFilter.ChannelID=f.GuidEMpty,n&&this.getProducts()},error:n=>{this.searchFilter.ChannelID=f.GuidEMpty}})}getVariantCode(t){let n;return t.length>1&&(n=(t[0].model?t[0].model:"")+t[0].Code),t.length==1&&(n=t[0].Code),n}onClearFilterChannel(){this.searchFilter.ChannelID=f.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(n=>{this.hasClickRowCount=!0,this.rowCount=n.Total})}onDetachProduct(t){let n=[];t.forEach(e=>{e.Channel=f.assignChannelLogo(e.Channel),n.push(...e.Channel)}),this.dialog.open(_t,{width:"600px",data:[...n]}).afterClosed().pipe(M(e=>f.IsNotEmpty(e)),wt(e=>this.productService.detachProduct(e))).subscribe(e=>{this.toastr.success(e.Message,Ut.Success),this.getProducts()})}onDetachMultipleProduct(){let t=this.productService.selectedProduct(this.products);this.onDetachProduct(t)}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(B),S(W),S(kt),S($),S(ct),S(ut))}}static{this.\u0275cmp=w({type:i,selectors:[["app-sold-in-channel"]],standalone:!1,decls:19,vars:13,consts:[["description","SKU has been mapped between dealpos and marketplace",3,"onSubmit","headerTitle"],["type","button",1,"btn","btn-outline-secondary","shadow","rounded","me-2"],[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",1,"btn","btn-outline-secondary","shadow","rounded","me-2",3,"click"],[1,"fa-sharp","fa-link-slash","me-2"],["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","onDetach","productId","title","image","description","channels","code","showCheckBox","scanButton","uploadButton","imageForZoom","detachButton"],[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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.searchProduct(h)}),o(1,"actions"),C(2,Dn,3,1,"button",1)(3,kn,4,0,"ng-container",2)(4,En,4,1,"ng-container",2)(5,Fn,4,1,"ng-container",2),a(),o(6,"filters")(7,"div")(8,"label",3),p(9,"Channel"),a(),o(10,"ng-select",4),g("ngModelChange",function(h){return e.searchFilter.ListChannelID=h})("clear",function(){return e.onClearFilterChannel()}),C(11,Vn,3,3,"ng-template",5),a()(),C(12,Nn,4,1,"div",6),a(),o(13,"content")(14,"div",7)(15,"div",8),C(16,An,2,11,"div",9)(17,Un,3,0,"ng-container",2),a(),C(18,Ln,3,4,"div",10),a()()()),n&2&&(c("headerTitle","Sold in Channel"),r(2),Mt(e.productService.hasSelection(e.products)?2:-1),r(),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.multipeScanChannels.length>0&&e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("multiple",!0)("items",e.channelOptions)("ngModel",e.searchFilter.ListChannelID),r(2),c("ngIf",e.searchFilter.ListChannelID!=null),r(4),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",e.products==null?null:e.products.length))},dependencies:[N,D,st,L,R,G,X,dt,Vt,J,et,H],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}"]})}}return i})();function Rn(i,d){if(i&1){let t=x();o(0,"button",13),g("click",function(){m(t);let e=s(2);return u(e.uploadMultipleProduct())}),_(1,"i",14),p(2),a()}if(i&2){let t=s(2);r(2),b(" upload (",t.selectedProducts==null?null:t.selectedProducts.length,") ")}}function Bn(i,d){if(i&1){let t=x();v(0),o(1,"td",29)(2,"input",30),F("ngModelChange",function(e){m(t);let l=s(2).$implicit;return E(l.selected,e)||(l.selected=e),u(e)}),g("ngModelChange",function(){m(t);let e=s(3).ngIf,l=s(3);return u(l.onSelectProduct(e))}),a()(),y()}if(i&2){let t=s(2).$implicit;r(),c("rowSpan",t==null?null:t.Variants.length),r(),k("ngModel",t.selected)}}function jn(i,d){if(i&1){let t=x();v(0),o(1,"img",35),g("click",function(e){m(t);let l=s(3).$implicit,h=s(4);return u(h.onZoomImage(e,l==null?null:l.ImageUrl))}),a(),y()}if(i&2){let t=s(3).$implicit;r(),c("src",t==null?null:t.ImageUrl,I)}}function $n(i,d){i&1&&_(0,"img",36)}function Gn(i,d){if(i&1&&(v(0),o(1,"td",29)(2,"div",31),C(3,jn,2,1,"ng-container",11)(4,$n,1,0,"ng-template",null,1,q),a()(),o(6,"td",32)(7,"h4",33)(8,"span",34),p(9),a()()(),y()),i&2){let t=U(5),n=s(2).$implicit;r(),c("rowSpan",n==null?null:n.Variants.length),r(2),c("ngIf",n==null?null:n.ImageUrl)("ngIfElse",t),r(3),c("rowSpan",n==null?null:n.Variants.length),r(2),c("matTooltip",(n==null||n.Name==null?null:n.Name.length)>50?n==null?null:n.Name:""),r(),b(" ",n==null?null:n.Name," ")}}function Wn(i,d){if(i&1&&(o(0,"div")(1,"a",25),_(2,"img",37),a()()),i&2){let t=d.$implicit;r(),c("href",t.URL,I),r(),c("src",t.Img,I)("matTooltip",t.Name)}}function Hn(i,d){if(i&1&&(o(0,"div"),_(1,"img",37),a()),i&2){let t=d.$implicit;r(),c("src",t.Img,I)("matTooltip",t.Name)}}function zn(i,d){if(i&1&&(o(0,"tr"),C(1,Bn,3,2,"ng-container",12)(2,Gn,10,6,"ng-container",12),o(3,"td"),p(4),a(),o(5,"td")(6,"span"),p(7),a(),o(8,"span",24)(9,"a",25),_(10,"i",26),a()()(),o(11,"td",27)(12,"div",28),C(13,Wn,3,3,"div",23),a()(),o(14,"td",27)(15,"div",28),C(16,Hn,2,2,"div",23),a()()()),i&2){let t=d.$implicit,n=d.index,e=s(5);r(),c("ngIf",n==0),r(),c("ngIf",n==0),r(2),b(" ",t.Name," "),r(3),b(" ",t.Code," "),r(2),c("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(t==null?null:t.ID),I),r(4),c("ngForOf",t==null?null:t.Available),r(3),c("ngForOf",t==null?null:t.NotAvailable)}}function Kn(i,d){if(i&1&&(v(0),C(1,zn,17,7,"tr",23),y()),i&2){let t=d.$implicit;r(),c("ngForOf",t.Variants)}}function Jn(i,d){if(i&1&&(o(0,"tbody"),C(1,Kn,2,1,"ng-container",23),a()),i&2){let t=d.ngIf;r(),c("ngForOf",t)}}function Yn(i,d){if(i&1&&(v(0),o(1,"div",15)(2,"table",16)(3,"thead",17)(4,"tr"),_(5,"th",18),o(6,"th",19),p(7,"Product"),a(),o(8,"th",20),p(9,"Variant"),a(),o(10,"th",20),p(11,"SKU"),a(),o(12,"th",21),p(13,"Available In"),a(),o(14,"th",22),p(15,"Not Available In"),a()()(),C(16,Jn,2,1,"tbody",12),O(17,"async"),a()(),y()),i&2){let t=s(2);r(16),c("ngIf",T(17,1,t.data$))}}function Zn(i,d){i&1&&(o(0,"div",38),_(1,"app-empty-state"),a())}function qn(i,d){if(i&1){let t=x();o(0,"span",46),g("click",function(){m(t);let e=s(4);return u(e.getRowCount())}),o(1,"i",47),p(2,"?"),a()()}}function Qn(i,d){if(i&1&&(o(0,"span"),p(1),O(2,"number"),a()),i&2){let t=d.ngIf;r(),z(T(2,1,t==null?null:t.Count))}}function Xn(i,d){if(i&1){let t=x();o(0,"a",48),g("click",function(){m(t);let e=s(4);return u(e.onNextPage())}),_(1,"i",49),p(2," Next"),a()}}function ti(i,d){if(i&1){let t=x();o(0,"a",50),g("click",function(){m(t);let e=s(4);return u(e.onLastPage())}),_(1,"i",51),p(2," Last"),a()}}function ei(i,d){if(i&1&&(v(0),o(1,"div",39)(2,"div",40)(3,"div",41),p(4),O(5,"number"),C(6,qn,3,0,"span",42)(7,Qn,3,3,"span",12),O(8,"async"),p(9),a()(),o(10,"div",43),C(11,Xn,3,0,"a",44)(12,ti,3,0,"a",45),a()(),y()),i&2){let t=s().ngIf,n=s(2);r(4),b(" Showing 1 - ",T(5,6,t==null?null:t.length)," of "),r(2),c("ngIf",n.paginationService.hideCount),r(),c("ngIf",!n.paginationService.hideCount&&T(8,8,n.rowCount$)),r(2),b(" records ~ ",n.paginationService.footerPageNumber," Page "),r(2),c("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),r(),c("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function ni(i,d){if(i&1&&(v(0),C(1,ei,13,10,"ng-container",12),y()),i&2){let t=d.ngIf;r(),c("ngIf",(t==null?null:t.length)>0)}}function ii(i,d){if(i&1){let t=x();o(0,"mainpanel",3),g("onSubmit",function(e){m(t);let l=s();return u(l.searchProduct(e))}),o(1,"actions"),C(2,Rn,3,1,"button",4),o(3,"button",5),g("click",function(){m(t);let e=s();return u(e.openScanDialog())}),_(4,"i",6),p(5," Scan Channel "),a(),o(6,"button",7),g("click",function(){m(t);let e=s();return u(e.openExportDialog())}),_(7,"i",8),o(8,"span"),p(9,"Export"),a()()(),o(10,"content")(11,"div",9)(12,"div",10),C(13,Yn,18,3,"ng-container",11),O(14,"async"),C(15,Zn,2,0,"ng-template",null,0,q),a(),C(17,ni,2,1,"ng-container",12),O(18,"async"),a()()()}if(i&2){let t,n=U(16),e=s();c("hideSearchDropdown",!0),r(2),c("ngIf",e.hasSelectionProduct),r(11),c("ngIf",((t=T(14,5,e.data$))==null?null:t.length)>0)("ngIfElse",n),r(4),c("ngIf",T(18,7,e.data$))}}var Ye=(()=>{class i{constructor(t,n,e,l,h,P,gt,It,tn){this.http=t,this.dialog=n,this.toastr=e,this.route=l,this.productService=h,this.paginationService=P,this.biggerPictureService=gt,this.authService=It,this.uploadProductService=tn,this.loaderAPI="product/Load",this.rowCountAPI="product/GetNotInChannelRowCount",this.notChannelAPI="product/GetNotInChannelV2",this.hasSelectionProduct=!1,this.selectedProducts=[],this.channelOptions=It.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(ee(t=>{this.filterSearch=t.Filter,this.paginationService.reloadPagination(t.Filter)}))}iniData(){this.data$=this.paginationService.data$.pipe(te(t=>(t=t.map(n=>(n.Variants=n.Variants.map(e=>(e.Available=this.productService.sortChannel(e.Available),e.NotAvailable=this.productService.sortChannel(e.NotAvailable),e.Available=this.assignLogoChannel(e.Available),e.NotAvailable=this.assignLogoChannel(e.NotAvailable),e)),n.Channel=n?.Variants[0]?.Available,n)),t)))}assignLogoChannel(t){return t=t.map(n=>(n.Img=f.getChannelLogoByTypeId(n.TypeID),n)),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(n=>{this.filterSearch.Async?this.toastr.success("You will be notified when the scan is completed.","Scan Asynchronous"):(this.productService.successToastrScanAllProduct(n,t,!this.filterSearch.UpdatedProduct),this.initPageLoader())})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.filterSearch));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.filterSearch.ChannelID=e.ChannelID,this.filterSearch.ScanFull=e.ScanFull,this.filterSearch.UpdatedProduct=e.UpdatedProduct,this.filterSearch.Async=e.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,n){this.biggerPictureService.openBiggerPicture(t,n)}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(Ue,{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()}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(B),S(ct),S(W),S(Le),S(ke),S($),S(ut))}}static{this.\u0275cmp=w({type:i,selectors:[["app-not-in-channel"]],standalone:!1,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(n,e){n&1&&(C(0,ii,19,9,"mainpanel",2),O(1,"async")),n&2&&c("ngIf",T(1,1,e.loader$))},dependencies:[N,D,me,L,R,G,pt,H,Dt,lt],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%}"]})}}return i})();var oi=i=>[i],ai=()=>[];function ri(i,d){if(i&1){let t=x();o(0,"button",15),g("click",function(){m(t);let e=s();return u(e.openScanDialog())}),_(1,"i",16),p(2," Scan Channel "),a()}}function li(i,d){if(i&1){let t=x();v(0),o(1,"button",17),g("click",function(){m(t);let e=s();return u(e.onDownloadAllProduct("SELECTED"))}),_(2,"i",18),p(3),a(),y()}if(i&2){let t,n=s();r(3),b(" Download (",(t=n.productService.selectedProduct(n.products))==null?null:t.length,") ")}}function ci(i,d){if(i&1&&(o(0,"span",19),_(1,"img",20),a(),p(2)),i&2){let t=d.item;r(),c("src",t.Img,I)("alt",t.Name),r(),b(" ",t.Name," ")}}function si(i,d){if(i&1){let t=x();o(0,"div",21)(1,"app-product-card",22),g("onCheckBoxChange",function(e){let l=m(t).index,h=s();return u(h.onSelectProduct(e,l))})("onDescEvent",function(){let e=m(t).index,l=s();return u(l.onShowVariantDetail(e))})("onDownload",function(){let e=m(t).$implicit,l=s();return u(l.onDownloadProduct(e))})("onScan",function(){let e=m(t).$implicit,l=s();return u(l.onScanChannel(e))}),a()()}if(i&2){let t=d.$implicit;r(),c("showRedirectIcon",!1)("title",t==null?null:t.Name)("image",t==null?null:t.Image)("imageForZoom",t==null?null:t.Image)("code",t==null?null:t.SKU)("description",(t==null||t.Variant==null?null:t.Variant.length)>0?(t==null||t.Variant==null?null:t.Variant.length)+" Variants":null)("downloadButton",!0)("channels",t!=null&&t.Channel?Z(10,oi,t==null?null:t.Channel):it(12,ai))("showCheckBox",!0)("scanButton",!0)}}function di(i,d){i&1&&(v(0),o(1,"div",23),_(2,"app-empty-state"),a(),y())}function pi(i,d){if(i&1){let t=x();o(0,"div",24)(1,"div",25)(2,"app-custom-paginator",26),g("total",function(){m(t);let e=s();return u(e.getRowCount())})("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())}),a()()()}if(i&2){let t=s();r(2),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickRowCount)}}var Ze=(()=>{class i{constructor(t,n,e,l,h,P){this.http=t,this.dialog=n,this.productService=e,this.toastrService=l,this.activateRouter=h,this.authService=P,this.searchFilter=new tt,this.products=[],this.hasClickRowCount=!1,this.channelOptions=this.authService.getChannels()}ngOnInit(){this.activateRouter.queryParams.subscribe(t=>{t.ID?this.initPageLoader(t.ID):this.initPageLoader(f.GuidEMpty)})}initPageLoader(t){this.productService.loader(t).subscribe(n=>{this.searchFilter=n.Filter,this.searchFilter.PageSize=n.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(n=>(t=this.channelOptions.find(e=>e.ID==n.ChannelID),t?n.Channel=JSON.parse(JSON.stringify(t)):n.Channel=null,n)).map(n=>(n.Channel&&(n.Channel.Url=n.Url),n))}setSkuProduct(){this.products=this.products.map(t=>(t?.Variant?.length==0?f.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=f.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(n=>{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(f.GuidEMpty),this.productService.successToastrScanAllProduct(n,t,!this.searchFilter.UpdatedProduct)),this.searchFilter.ChannelID=f.GuidEMpty})}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=f.GuidEMpty,this.dialog.open(A,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(M(e=>f.IsNotEmpty(e))).subscribe(e=>{this.searchFilter.ChannelID=e.ChannelID,this.searchFilter.UpdatedProduct=e.UpdatedProduct,this.searchFilter.ScanFull=e.ScanFull,this.searchFilter.Async=e.Async,this.onScanAll()})}onDownloadAllProduct(t){let n;t=="ALL"?n=this.products:n=this.productService.selectedProduct(this.products),n.length>0&&this.productService.downloadMultipleProduct(n).subscribe({next:()=>{this.getProducts()}})}onSelectProduct(t,n){this.products[n].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 n=JSON.parse(JSON.stringify(t));delete n.Channel,this.productService.scanCompareToPos([n]).subscribe(e=>{e.Status?(this.initPageLoader(f.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 n=this.products[t].Variant;n.length>0&&this.dialog.open(Re,{data:{title:this.products[t].Name,variants:n},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(n=>{this.hasClickRowCount=!0,this.rowCount=n.Count})}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(K),S(W),S(B),S(kt),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-not-in-pos"]],standalone:!1,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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.onSearch(h)}),o(1,"actions"),C(2,ri,3,0,"button",1)(3,li,4,1,"ng-container",2),a(),o(4,"filters")(5,"div")(6,"label",3),p(7,"Channel"),a(),o(8,"ng-select",4),F("ngModelChange",function(h){return E(e.searchFilter.ChannelID,h)||(e.searchFilter.ChannelID=h),h}),C(9,ci,3,3,"ng-template",5),a()(),o(10,"div",6)(11,"label",7),p(12,"SKU Assigned"),a(),o(13,"mat-radio-group",8),F("ngModelChange",function(h){return E(e.searchFilter.HaveSku,h)||(e.searchFilter.HaveSku=h),h}),o(14,"mat-radio-button",9),p(15," All "),a(),o(16,"mat-radio-button",9),p(17," Yes "),a(),o(18,"mat-radio-button",9),p(19," No "),a()()(),o(20,"div",6)(21,"label",7),p(22,"Item ID"),a(),o(23,"input",10),F("ngModelChange",function(h){return E(e.searchFilter.Item_id,h)||(e.searchFilter.Item_id=h),h}),a()()(),o(24,"content")(25,"div",11)(26,"div",12),C(27,si,2,13,"div",13)(28,di,3,0,"ng-container",2),a(),C(29,pi,3,4,"div",14),a()()()),n&2&&(r(2),c("ngIf",!e.productService.hasSelection(e.products)),r(),c("ngIf",e.productService.hasSelection(e.products)),r(5),c("clearable",!0)("items",e.channelOptions),k("ngModel",e.searchFilter.ChannelID),r(5),k("ngModel",e.searchFilter.HaveSku),r(),c("value",0),r(2),c("value",1),r(2),c("value",2),r(5),k("ngModel",e.searchFilter.Item_id),r(4),c("ngForOf",e.products),r(),c("ngIf",e.products.length==0),r(),c("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[N,D,st,L,R,G,X,dt,ye,Pe,J,et,H],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}"]})}}return i})();function mi(i,d){if(i&1&&(o(0,"span",9),_(1,"img",10),a(),p(2)),i&2){let t=d.item,n=s();r(),c("src",n.getChannelLogo(t.TypeID),I),r(),b(" ",t.Name," ")}}function ui(i,d){if(i&1&&(o(0,"div",11),_(1,"app-duplicate-product-card",12),a()),i&2){let t=d.$implicit,n=d.index;r(),c("imageForZoom",t.ImageUrl)("title",t.Name)("code",t.Code)("id",n)("image",t.ThumbnailURL)("channels",t.Channels)}}function hi(i,d){i&1&&(v(0),o(1,"div",13),_(2,"app-empty-state"),a(),y())}function _i(i,d){if(i&1){let t=x();v(0),o(1,"div",14)(2,"div",15)(3,"app-custom-paginator",16),g("next",function(){m(t);let e=s();return u(e.getProducts())})("previous",function(){m(t);let e=s();return u(e.getProducts())})("total",function(){m(t);let e=s();return u(e.getRowCount())}),a()()(),y()}if(i&2){let t=s();r(3),c("filter",t.searchFilter)("totaldata",t.products==null?null:t.products.length)("paginationTotal",t.rowCount)("hasClicked",t.hasClickedRowCount)}}var qe=(()=>{class i{constructor(t,n,e){this.httpService=t,this.productService=n,this.authService=e,this.searchFilter=new tt,this.products=[],this.hasClickedRowCount=!1,this.getPageLoader(),this.channelOptions=e.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(n=>{this.products=n.Data})}onSearch(t){this.searchFilter.text=t,this.hasClickedRowCount=!1,this.getProducts()}onClearFilter(){this.searchFilter.ChannelID=f.GuidEMpty}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}getRowCount(){let t={text:this.searchFilter.text,ChannelID:this.searchFilter.ChannelID};this.httpService.post("/api/product/GetDuplicateInChannelRowCount",t).subscribe(n=>{this.hasClickedRowCount=!0,this.rowCount=n.Total})}static{this.\u0275fac=function(n){return new(n||i)(S(j),S(W),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-duplicate-sku"]],standalone:!1,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(n,e){n&1&&(o(0,"mainpanel",0),g("onSubmit",function(h){return e.onSearch(h)}),o(1,"filters")(2,"div",1)(3,"div")(4,"h6",2),p(5,"Channel"),a(),o(6,"ng-select",3),F("ngModelChange",function(h){return E(e.searchFilter.ListChannelID,h)||(e.searchFilter.ListChannelID=h),h}),g("clear",function(){return e.onClearFilter()}),C(7,mi,3,2,"ng-template",4),a()()()(),o(8,"content")(9,"div",5)(10,"div",6),C(11,ui,2,6,"div",7)(12,hi,3,0,"ng-container",8),a(),C(13,_i,4,4,"ng-container",8),a()()()),n&2&&(r(6),c("multiple",!0)("clearable",!0)("items",e.channelOptions),k("ngModel",e.searchFilter.ListChannelID),r(5),c("ngForOf",e.products),r(),c("ngIf",(e.products==null?null:e.products.length)==0),r(),c("ngIf",(e.products==null?null:e.products.length)>0))},dependencies:[N,D,L,R,G,X,dt,Vt,Rt,J,H],encapsulation:2})}}return i})();var gi=()=>["/menu/products/status/sold-in-channel"],Qe=i=>({ID:i}),Ci=()=>["/menu/products/status/not-in-pos"];function fi(i,d){if(i&1&&(v(0),p(1),y()),i&2){let t=s().$implicit;r(),b(" ",t.Count," ")}}function Si(i,d){if(i&1){let t=x();o(0,"span",26),g("click",function(){m(t);let e=s().$implicit,l=s(2);return u(l.getLiveProductCount(e.ID,e))}),_(1,"i",27),a()}}function xi(i,d){if(i&1){let t=x();o(0,"tr")(1,"td"),_(2,"img",17),o(3,"span",18),p(4),a()(),o(5,"td",19),C(6,fi,2,1,"ng-container",6)(7,Si,2,0,"ng-template",null,1,q),a(),o(9,"td",19)(10,"a",20),p(11),O(12,"number"),a()(),o(13,"td",19)(14,"a",20),p(15),O(16,"number"),a()(),o(17,"td"),p(18),O(19,"date"),a(),o(20,"td")(21,"div",21)(22,"button",22),g("click",function(){let e=m(t).$implicit,l=s(2);return u(l.onScanChannel(e))}),_(23,"i",23),p(24," Scan "),a(),o(25,"button",24),g("click",function(){let e=m(t).$implicit,l=s(2);return u(l.onClearCache(e.ID))}),_(26,"i",25),p(27," Clear "),a()()()()}if(i&2){let t=d.$implicit,n=U(8),e=s(2);r(2),c("src",e.getChannelLogo(t.TypeID),I),r(2),z(t.Name),r(2),c("ngIf",t.Count!==void 0)("ngIfElse",n),r(4),c("routerLink",it(18,gi))("queryParams",Z(19,Qe,t.ID)),r(),b(" ",T(12,11,t.SoldInChannel)," "),r(3),c("routerLink",it(21,Ci))("queryParams",Z(22,Qe,t.ID)),r(),b(" ",T(16,13,t.NotInPOS)," "),r(3),b("",t.LastSync?ce(19,15,t.LastSync,"dd MMM yyyy HH:mm"):"Never"," ")}}function bi(i,d){if(i&1&&(v(0),o(1,"div",7)(2,"table",8)(3,"thead",9)(4,"tr",10)(5,"th"),p(6,"Channel"),a(),o(7,"th",11),p(8,"Live Product"),a(),o(9,"th",12),p(10,"Sold In Channel"),a(),o(11,"th",13),p(12,"Product Not in POS"),a(),o(13,"th",14),p(14,"Last Sync"),a(),_(15,"th",15),a()(),o(16,"tbody"),C(17,xi,28,24,"tr",16),O(18,"async"),a()()(),y()),i&2){let t,n=s();r(17),c("ngForOf",(t=T(18,1,n.channels$))==null?null:t.Data)}}function vi(i,d){i&1&&(o(0,"div",28),_(1,"app-empty-state"),a())}var Xe=(()=>{class i{constructor(t,n,e,l){this.productService=t,this.toastr=n,this.dialog=e,this.authService=l,this.destroy$=new Xt,this.channelOptions=l.getChannels()}ngOnInit(){this.setObsProductStatistic()}setObsProductStatistic(){this.channels$=this.productService.getProductStatistic()}getLiveProductCount(t,n){this.productService.getTotalProductLive(t).pipe(Gt(this.destroy$)).subscribe(e=>{n.Count=e.Count})}onScanChannel(t){this.dialog.open(A,{width:"700px",data:{channelOptions:this.channelOptions,filter:{ChannelID:t.ID},disabledChannelOption:!0}}).afterClosed().pipe(M(n=>f.IsNotEmpty(n))).subscribe(n=>{this.scanAllProduct(t.ID,n)})}scanAllProduct(t,n){let e=this.productService.findChannelById(t,this.channelOptions);this.productService.scanAll(n.ChannelID,n.ScanFull,n.UpdatedProduct,n.Async).pipe(M(l=>l)).subscribe(l=>{n.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.productService.successToastrScanAllProduct(l,e,!n.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(Gt(this.destroy$)).subscribe(e=>{this.toastr.success("Successfully cleared cache","Success"),this.setObsProductStatistic()})}getChannelLogo(t){return f.getChannelLogoByTypeId(t)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static{this.\u0275fac=function(n){return new(n||i)(S(W),S(B),S(K),S($))}}static{this.\u0275cmp=w({type:i,selectors:[["app-channel-statistic"]],standalone:!1,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(n,e){if(n&1&&(o(0,"mainpanel",2)(1,"content")(2,"div",3)(3,"div",4)(4,"div",5),C(5,bi,19,3,"ng-container",6),O(6,"async"),C(7,vi,2,0,"ng-template",null,0,q),a()()()()()),n&2){let l,h=U(8);c("hideSearchBox",!0)("hideSearchDropdown",!0),r(5),c("ngIf",((l=T(6,4,e.channels$))==null||l.Data==null?null:l.Data.length)>0)("ngIfElse",h)}},dependencies:[N,D,G,pt,Et,H,Dt,lt,se],encapsulation:2})}}return i})();var yi=[{component:$e,path:"",children:[{path:"",redirectTo:"sold-in-channel",pathMatch:"full"},{path:"in-pos",component:Ke,canActivate:[ot],data:{title:"Products in POS"}},{path:"sold-in-channel",component:Je,canActivate:[ot],data:{title:"Products Sold in Channel"}},{path:"not-in-channel",component:Ye,canActivate:[ot],data:{title:"Products not in Channel"}},{path:"not-in-pos",component:Ze,canActivate:[ot],data:{title:"Products not in POS"}},{path:"duplicate-sku",component:qe,canActivate:[ot],data:{title:"Duplicate Sku in Channel"}},{path:"channel-statistic",component:Xe,canActivate:[ot],data:{title:"Channel Statistic"}}]}],ya=(()=>{class i{static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275mod=oe({type:i})}static{this.\u0275inj=ne({imports:[Q,Ft,xe,mt,he,Be,Ie,ve,Rt,J,et,pe.forChild(yi),Ae,je,_t]})}}return i})();export{ya as StatusModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as it}from"./chunk-CBHXQUMA.js";import{a as st}from"./chunk-LEHTNMIE.js";import{a as at,b as ot}from"./chunk-GHQH62TZ.js";import{c as rt}from"./chunk-Q72ZXPDP.js";import{f as lt}from"./chunk-Q2OEJFVT.js";import{b as w,c as x,j as E,k as U}from"./chunk-ITTRZMEX.js";import{r as P}from"./chunk-TMFFA26Y.js";import{h as et,m as nt}from"./chunk-DPLEMBB4.js";import{b as m,c}from"./chunk-PXB4YEY3.js";import{G as tt,d as X,f as Y,g as Z,j as $}from"./chunk-GPEVUTDI.js";import{Eb as D,Ec as s,Fc as u,Gc as q,Ic as v,Jc as M,Kb as S,Kc as T,Qa as K,Qc as Q,Wb as r,Z as R,Zc as k,_c as A,bc as N,cc as G,ec as z,fc as H,gc as a,hc as l,ic as J,mc as O,ob as j,pa as B,qb as o,rc as y,sc as f,v as W,wb as C,ya as b,za as I}from"./chunk-T5ONJF63.js";function Ct(i,h){if(i&1&&(a(0,"mat-option",10)(1,"div",11),J(2,"img",12),a(3,"span"),s(4),l()()()),i&2){let t=h.$implicit;r("value",t.ID)("disabled",t.disabled),o(),r("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),o(),r("src",t.Img,j),o(2),u(t.Name)}}function gt(i,h){if(i&1){let t=O();a(0,"div",13)(1,"label",14),s(2,"Scan Type"),l(),a(3,"mat-radio-group",15),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.ScanFull,e)||(p.filter.ScanFull=e),I(e)}),a(4,"mat-radio-button",16),s(5," Full (Include Inactive Products) "),l(),a(6,"mat-radio-button",17),s(7," Active "),l()()()}if(i&2){let t=f();o(3),v("ngModel",t.filter.ScanFull),o(),r("value",!0),o(2),r("value",!1)}}function ut(i,h){i&1&&(a(0,"span"),s(1,"Never"),l())}function _t(i,h){if(i&1&&(a(0,"span"),s(1),k(2,"async"),l()),i&2){let t=f(2);o(),u(A(2,1,t.lastSync$))}}function St(i,h){if(i&1){let t=O();a(0,"div",8)(1,"label",3)(2,"span",18),s(3,"Last Scan:"),l(),S(4,ut,2,0,"span"),k(5,"async"),S(6,_t,3,3,"span"),l(),a(7,"mat-radio-group",19),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.UpdatedProduct,e)||(p.filter.UpdatedProduct=e),I(e)}),a(8,"mat-radio-button",20),s(9," Scan All Products "),l(),a(10,"mat-radio-button",21),s(11),l()()()}if(i&2){let t=f();o(4),N(A(5,6,t.lastSync$)==null?4:6),o(3),v("ngModel",t.filter.UpdatedProduct),o(),r("value",!1),o(2),r("value",!0)("matTooltip",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),o(),q(" ",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function yt(i,h){if(i&1){let t=O();a(0,"div",8)(1,"label",3),s(2," Scan Option "),l(),a(3,"mat-radio-group",22),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.Async,e)||(p.filter.Async=e),I(e)}),a(4,"mat-radio-button",23),s(5," Asynchronous (Get Notified when Complete) "),l(),a(6,"mat-radio-button",24),s(7," Synchronous (Wait until Complete) "),l()()()}if(i&2){let t=f();o(3),v("ngModel",t.filter.Async),o(),r("value",!0),o(2),r("value",!1)}}var Lt=(()=>{class i{constructor(t,n,e){this.dialogRef=t,this.data=n,this.router=e,this.channelService=B(it),this.channelType=m,this.disabledChannelOption=!1,this.filter={ChannelID:c.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=c.IsNotEmpty(n.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=c.IsEmpty(n.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==m.Tiktok||t.TypeID==m.Tokopedia||t.TypeID==m.Lazada||t.TypeID==m.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let n=this.filterChannelById(t);this.selectedChannel=n,this.filter.Async=!0,this.iniHasScanUpdate(),this.getLastSync(t)}getLastSync(t){this.lastSync$=this.channelService.getLastSync(t).pipe(W(n=>(this.selectedChannel.LastSync=n.LastSync,this.setDefaultConfigUpdate(),c.IsNotEmpty(n.LastSync)?c.convertToReadableDate(n.LastSync):null)),R(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&c.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==m.Shopee||this.selectedChannel.TypeID==m.Tiktok||this.selectedChannel.TypeID==m.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=m.WooCommerce&&this.selectedChannel?.TypeID!=m.KalCare&&this.selectedChannel?.TypeID!=m.None&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let n;return this.channelOptions&&(n=this.channelOptions.find(e=>e.ID==t)),n}submit(){this.selectedChannel.TypeID==m.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):this.dialogRef.close(this.filter)}isNotEmpty(t){return c.IsNotEmpty(t)}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)(C(w),C(x),C(tt))}}static{this.\u0275cmp=D({type:i,selectors:[["app-scan-dialog"]],standalone:!1,decls:11,vars:8,consts:[[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","disabled","ngModel"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],[1,"mt-8"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"me-2"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(n,e){n&1&&(a(0,"modal-material",0),y("onOk",function(){return e.submit()})("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()}),a(1,"div",1)(2,"div",2)(3,"label",3),s(4,"Select a Channel"),l(),a(5,"mat-form-field",4)(6,"mat-select",5),T("ngModelChange",function(d){return M(e.filter.ChannelID,d)||(e.filter.ChannelID=d),d}),y("ngModelChange",function(d){return e.onSelectChannel(d)}),S(7,Ct,5,5,"mat-option",6),l()(),S(8,gt,8,3,"div",7)(9,St,12,8,"div",8)(10,yt,8,3,"div",9),l()()()),n&2&&(r("dynamicValidated",e.isNotEmpty(e.filter.ChannelID))("config",e.modalConfig),o(6),r("disabled",e.disabledChannelOption),v("ngModel",e.filter.ChannelID),o(),r("ngForOf",e.channelOptions),o(),r("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)),o(),N(e.hasScanUpdate&&e.selectedChannel?9:-1),o(),r("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)))},dependencies:[Y,Z,et,nt,at,ot,lt,st,rt,P,U,$],encapsulation:2})}}return i})();var vt=i=>({"bg-gradient-warning":i});function Mt(i,h){if(i&1&&(a(0,"tr",5)(1,"td"),s(2),l(),a(3,"td",6),s(4),l()()),i&2){let t=h.$implicit;r("matTooltip",t.duplicateMessage),o(2),u(t==null?null:t.Name),o(),r("ngClass",Q(4,vt,t.isDuplicate)),o(),u(t!=null&&t.ChannelVariationSKU?t==null?null:t.ChannelVariationSKU:"Not Assigned")}}var Ht=(()=>{class i{constructor(t,n){this.data=t,this.dialogRef=n,this.variants=K([])}ngOnInit(){this.initModalConfig(),this.initVariants()}initVariants(){let t=this.data?.variants,n={},e=[],p=t.filter(d=>c.IsEmpty(d.ChannelVariationSKU));t.filter(d=>c.IsNotEmpty(d.ChannelVariationSKU)).forEach((d,g,F)=>{n[d.ChannelVariationSKU]=F.filter(_=>_.ChannelVariationSKU===d.ChannelVariationSKU)}),Object.keys(n).forEach(d=>{n[d].length>1&&(n[d]=n[d].map((g,F,_)=>{let L=`SKU ${g.ChannelVariationSKU} is duplicated with variant`;return _.forEach((V,dt)=>{V.Name!==g.Name&&(L+=` ${_.length>2?V.Name+(dt!==_.length-1?",":""):V.Name}`)}),g.duplicateMessage=L,g.isDuplicate=!0,g})),e.push(...n[d])}),e.push(...p),this.variants.set(e)}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.modalConfig.bodyScrollable=!0}static{this.\u0275fac=function(n){return new(n||i)(C(x),C(w))}}static{this.\u0275cmp=D({type:i,selectors:[["app-modal-variants"]],standalone:!1,decls:12,vars:1,consts:[[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"sticky-top"],["matTooltipPosition","above",3,"matTooltip"],[3,"ngClass"]],template:function(n,e){n&1&&(a(0,"modal-material",0),y("onCancel",function(){return e.dialogRef.close()}),a(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),s(6,"Variant"),l(),a(7,"th",4),s(8,"SKU"),l()()(),a(9,"tbody"),z(10,Mt,5,6,"tr",5,G),l()()()()),n&2&&(r("config",e.modalConfig),o(10),H(e.variants()))},dependencies:[X,P,U],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#f6f6f6!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}"]})}}return i})();export{Lt as a,Ht as b};
|
|
1
|
+
import{a as it}from"./chunk-ESWJCZZP.js";import{a as st}from"./chunk-LEHTNMIE.js";import{a as at,b as ot}from"./chunk-GHQH62TZ.js";import{c as rt}from"./chunk-Q72ZXPDP.js";import{f as lt}from"./chunk-Q2OEJFVT.js";import{b as w,c as x,j as E,k as U}from"./chunk-ITTRZMEX.js";import{r as P}from"./chunk-TMFFA26Y.js";import{h as et,m as nt}from"./chunk-DPLEMBB4.js";import{b as m,c}from"./chunk-PXB4YEY3.js";import{G as tt,d as X,f as Y,g as Z,j as $}from"./chunk-GPEVUTDI.js";import{Eb as D,Ec as s,Fc as u,Gc as q,Ic as v,Jc as M,Kb as S,Kc as T,Qa as K,Qc as Q,Wb as r,Z as R,Zc as k,_c as A,bc as N,cc as G,ec as z,fc as H,gc as a,hc as l,ic as J,mc as O,ob as j,pa as B,qb as o,rc as y,sc as f,v as W,wb as C,ya as b,za as I}from"./chunk-T5ONJF63.js";function Ct(i,h){if(i&1&&(a(0,"mat-option",10)(1,"div",11),J(2,"img",12),a(3,"span"),s(4),l()()()),i&2){let t=h.$implicit;r("value",t.ID)("disabled",t.disabled),o(),r("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),o(),r("src",t.Img,j),o(2),u(t.Name)}}function gt(i,h){if(i&1){let t=O();a(0,"div",13)(1,"label",14),s(2,"Scan Type"),l(),a(3,"mat-radio-group",15),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.ScanFull,e)||(p.filter.ScanFull=e),I(e)}),a(4,"mat-radio-button",16),s(5," Full (Include Inactive Products) "),l(),a(6,"mat-radio-button",17),s(7," Active "),l()()()}if(i&2){let t=f();o(3),v("ngModel",t.filter.ScanFull),o(),r("value",!0),o(2),r("value",!1)}}function ut(i,h){i&1&&(a(0,"span"),s(1,"Never"),l())}function _t(i,h){if(i&1&&(a(0,"span"),s(1),k(2,"async"),l()),i&2){let t=f(2);o(),u(A(2,1,t.lastSync$))}}function St(i,h){if(i&1){let t=O();a(0,"div",8)(1,"label",3)(2,"span",18),s(3,"Last Scan:"),l(),S(4,ut,2,0,"span"),k(5,"async"),S(6,_t,3,3,"span"),l(),a(7,"mat-radio-group",19),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.UpdatedProduct,e)||(p.filter.UpdatedProduct=e),I(e)}),a(8,"mat-radio-button",20),s(9," Scan All Products "),l(),a(10,"mat-radio-button",21),s(11),l()()()}if(i&2){let t=f();o(4),N(A(5,6,t.lastSync$)==null?4:6),o(3),v("ngModel",t.filter.UpdatedProduct),o(),r("value",!1),o(2),r("value",!0)("matTooltip",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),o(),q(" ",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function yt(i,h){if(i&1){let t=O();a(0,"div",8)(1,"label",3),s(2," Scan Option "),l(),a(3,"mat-radio-group",22),T("ngModelChange",function(e){b(t);let p=f();return M(p.filter.Async,e)||(p.filter.Async=e),I(e)}),a(4,"mat-radio-button",23),s(5," Asynchronous (Get Notified when Complete) "),l(),a(6,"mat-radio-button",24),s(7," Synchronous (Wait until Complete) "),l()()()}if(i&2){let t=f();o(3),v("ngModel",t.filter.Async),o(),r("value",!0),o(2),r("value",!1)}}var Lt=(()=>{class i{constructor(t,n,e){this.dialogRef=t,this.data=n,this.router=e,this.channelService=B(it),this.channelType=m,this.disabledChannelOption=!1,this.filter={ChannelID:c.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=c.IsNotEmpty(n.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=c.IsEmpty(n.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==m.Tiktok||t.TypeID==m.Tokopedia||t.TypeID==m.Lazada||t.TypeID==m.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let n=this.filterChannelById(t);this.selectedChannel=n,this.filter.Async=!0,this.iniHasScanUpdate(),this.getLastSync(t)}getLastSync(t){this.lastSync$=this.channelService.getLastSync(t).pipe(W(n=>(this.selectedChannel.LastSync=n.LastSync,this.setDefaultConfigUpdate(),c.IsNotEmpty(n.LastSync)?c.convertToReadableDate(n.LastSync):null)),R(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&c.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==m.Shopee||this.selectedChannel.TypeID==m.Tiktok||this.selectedChannel.TypeID==m.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=m.WooCommerce&&this.selectedChannel?.TypeID!=m.KalCare&&this.selectedChannel?.TypeID!=m.None&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let n;return this.channelOptions&&(n=this.channelOptions.find(e=>e.ID==t)),n}submit(){this.selectedChannel.TypeID==m.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):this.dialogRef.close(this.filter)}isNotEmpty(t){return c.IsNotEmpty(t)}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)(C(w),C(x),C(tt))}}static{this.\u0275cmp=D({type:i,selectors:[["app-scan-dialog"]],standalone:!1,decls:11,vars:8,consts:[[3,"onOk","onClose","onCancel","dynamicValidated","config"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"ngModelChange","disabled","ngModel"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],[1,"mt-8"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"me-2"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModelChange","ngModel"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(n,e){n&1&&(a(0,"modal-material",0),y("onOk",function(){return e.submit()})("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()}),a(1,"div",1)(2,"div",2)(3,"label",3),s(4,"Select a Channel"),l(),a(5,"mat-form-field",4)(6,"mat-select",5),T("ngModelChange",function(d){return M(e.filter.ChannelID,d)||(e.filter.ChannelID=d),d}),y("ngModelChange",function(d){return e.onSelectChannel(d)}),S(7,Ct,5,5,"mat-option",6),l()(),S(8,gt,8,3,"div",7)(9,St,12,8,"div",8)(10,yt,8,3,"div",9),l()()()),n&2&&(r("dynamicValidated",e.isNotEmpty(e.filter.ChannelID))("config",e.modalConfig),o(6),r("disabled",e.disabledChannelOption),v("ngModel",e.filter.ChannelID),o(),r("ngForOf",e.channelOptions),o(),r("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)),o(),N(e.hasScanUpdate&&e.selectedChannel?9:-1),o(),r("ngIf",!e.isSingleChannel&&e.isNotEmpty(e.filter.ChannelID)))},dependencies:[Y,Z,et,nt,at,ot,lt,st,rt,P,U,$],encapsulation:2})}}return i})();var vt=i=>({"bg-gradient-warning":i});function Mt(i,h){if(i&1&&(a(0,"tr",5)(1,"td"),s(2),l(),a(3,"td",6),s(4),l()()),i&2){let t=h.$implicit;r("matTooltip",t.duplicateMessage),o(2),u(t==null?null:t.Name),o(),r("ngClass",Q(4,vt,t.isDuplicate)),o(),u(t!=null&&t.ChannelVariationSKU?t==null?null:t.ChannelVariationSKU:"Not Assigned")}}var Ht=(()=>{class i{constructor(t,n){this.data=t,this.dialogRef=n,this.variants=K([])}ngOnInit(){this.initModalConfig(),this.initVariants()}initVariants(){let t=this.data?.variants,n={},e=[],p=t.filter(d=>c.IsEmpty(d.ChannelVariationSKU));t.filter(d=>c.IsNotEmpty(d.ChannelVariationSKU)).forEach((d,g,F)=>{n[d.ChannelVariationSKU]=F.filter(_=>_.ChannelVariationSKU===d.ChannelVariationSKU)}),Object.keys(n).forEach(d=>{n[d].length>1&&(n[d]=n[d].map((g,F,_)=>{let L=`SKU ${g.ChannelVariationSKU} is duplicated with variant`;return _.forEach((V,dt)=>{V.Name!==g.Name&&(L+=` ${_.length>2?V.Name+(dt!==_.length-1?",":""):V.Name}`)}),g.duplicateMessage=L,g.isDuplicate=!0,g})),e.push(...n[d])}),e.push(...p),this.variants.set(e)}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.modalConfig.bodyScrollable=!0}static{this.\u0275fac=function(n){return new(n||i)(C(x),C(w))}}static{this.\u0275cmp=D({type:i,selectors:[["app-modal-variants"]],standalone:!1,decls:12,vars:1,consts:[[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"sticky-top"],["matTooltipPosition","above",3,"matTooltip"],[3,"ngClass"]],template:function(n,e){n&1&&(a(0,"modal-material",0),y("onCancel",function(){return e.dialogRef.close()}),a(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),s(6,"Variant"),l(),a(7,"th",4),s(8,"SKU"),l()()(),a(9,"tbody"),z(10,Mt,5,6,"tr",5,G),l()()()()),n&2&&(r("config",e.modalConfig),o(10),H(e.variants()))},dependencies:[X,P,U],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#f6f6f6!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}"]})}}return i})();export{Lt as a,Ht as b};
|