marketplacepos 3.22.1 → 3.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/Marketplace/{chunk-HK66WK22.js → chunk-2DQJZ4SM.js} +1 -1
  2. package/Marketplace/{chunk-5W6WPVQG.js → chunk-2OOIDPNY.js} +1 -1
  3. package/Marketplace/{chunk-SQDFIZMW.js → chunk-3Y4WD5EY.js} +1 -1
  4. package/Marketplace/{chunk-EBYNFVMV.js → chunk-4YWF6TMR.js} +1 -1
  5. package/Marketplace/{chunk-SDII7XXL.js → chunk-6DNNP4QT.js} +1 -1
  6. package/Marketplace/{chunk-4H2AACHZ.js → chunk-75I4TWVV.js} +1 -1
  7. package/Marketplace/{chunk-6MEL53S4.js → chunk-7AFVU7XM.js} +1 -1
  8. package/Marketplace/{chunk-MXMA4SED.js → chunk-CSSLFHG7.js} +1 -1
  9. package/Marketplace/{chunk-OHADF44Q.js → chunk-FKYJVN2C.js} +1 -1
  10. package/Marketplace/{chunk-A35Y7HOJ.js → chunk-FY3BLGYI.js} +1 -1
  11. package/Marketplace/{chunk-IH22G3XP.js → chunk-GJIFVUBA.js} +1 -1
  12. package/Marketplace/{chunk-TKQTS6W7.js → chunk-GOXRLSEL.js} +1 -1
  13. package/Marketplace/{chunk-5EC2PEVE.js → chunk-HHYOM3XB.js} +1 -1
  14. package/Marketplace/{chunk-HHK72C4S.js → chunk-HT7RB66L.js} +1 -1
  15. package/Marketplace/{chunk-YTF4RN6U.js → chunk-HVVW4B4W.js} +1 -1
  16. package/Marketplace/{chunk-YOCYRT76.js → chunk-I5BQWXUB.js} +1 -1
  17. package/Marketplace/{chunk-Z7GKHFMV.js → chunk-JHV7PQGJ.js} +1 -1
  18. package/Marketplace/{chunk-5BHAOLXD.js → chunk-JKLGOAB3.js} +1 -1
  19. package/Marketplace/{chunk-FYZFHN47.js → chunk-KNWBPJ23.js} +1 -1
  20. package/Marketplace/{chunk-RO4DEKKD.js → chunk-LI6EUEGJ.js} +1 -1
  21. package/Marketplace/{chunk-RVV4RI3V.js → chunk-LZXKPCX7.js} +1 -1
  22. package/Marketplace/{chunk-SE55BPZD.js → chunk-MFAJDQPX.js} +1 -1
  23. package/Marketplace/{chunk-JQ2K6T44.js → chunk-MJ6RQDI4.js} +1 -1
  24. package/Marketplace/{chunk-HX2SDZHX.js → chunk-NJKWLKN6.js} +1 -1
  25. package/Marketplace/{chunk-33CGFKGR.js → chunk-OCYDG646.js} +1 -1
  26. package/Marketplace/{chunk-5TYZYJGF.js → chunk-OTFJUSZU.js} +2 -2
  27. package/Marketplace/{chunk-NONK6EKG.js → chunk-P674TVHC.js} +1 -1
  28. package/Marketplace/{chunk-OOK5GT4H.js → chunk-POGKTX46.js} +1 -1
  29. package/Marketplace/{chunk-O7DZGYE7.js → chunk-QN5QWB3Z.js} +1 -1
  30. package/Marketplace/{chunk-YGCOL7HH.js → chunk-QW4P7RSU.js} +1 -1
  31. package/Marketplace/{chunk-QRYPBXV2.js → chunk-RGGT2KKB.js} +1 -1
  32. package/Marketplace/{chunk-4W3VEO3E.js → chunk-TVRKGWQB.js} +1 -1
  33. package/Marketplace/index.html +2 -2
  34. package/Marketplace/{main-VBS2IBYS.js → main-MTZIDUMD.js} +1 -1
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{e as Y}from"./chunk-4SAJUEHO.js";import{a as He,b as de,c as We,d as $e,e as he,f as ze,g as pe,h as Ke,i as V,j as fe,k as T}from"./chunk-KCDL7SWP.js";import{b as ue,c as $,d as Ge}from"./chunk-6SF7AUOH.js";import{o as Le}from"./chunk-OVEJFFL6.js";import{Cd as Be,Ed as Ne,F as De,Fd as Fe,G as xe,Kc as Oe,Lc as Me,O as se,U as Re,Ua as H,Yc as le,Z as ae,aa as x,ba as ce,c as g,ea as G,f as X,j as Te,ja as A,k as Ee,ka as F,ma as C,n as B,o as N,oa as h,p as R,pa as _e,q as K,qa as je,sb as W,ua as L,v as y,w as Pe}from"./chunk-PQDPS2ID.js";import{a as ie,i as I}from"./chunk-GNOSNGXM.js";var Ve={production:!0,version:"3.22.1",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var mt="firebase",wt="10.12.1";V(mt,wt,"app");var U=new Oe("ANGULARFIRE2_VERSION");var vt=(r,o)=>{let t=o?[o]:Ke(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},q=class{constructor(){return vt(St)}},St="app-check";function ge(){}var Q=class{zone;delegate;constructor(o,t=Ee){this.zone=o,this.delegate=t}now(){return this.delegate.now()}schedule(o,t,e){let n=this.zone,i=function(s){n.runGuarded(()=>{o.apply(this,[s])})};return this.delegate.schedule(i,t,e)}},me=class{zone;task=null;constructor(o){this.zone=o}call(o,t){let e=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",ge,{},ge,ge)),t.pipe(G({next:e,complete:e,error:e})).subscribe(o).add(e)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},qe=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Q(Zone.current)),this.insideAngular=t.run(()=>new Q(Zone.current,Te)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(e){return new(e||r)(h(W))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function kt(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
1
+ import{e as Y}from"./chunk-4SAJUEHO.js";import{a as He,b as de,c as We,d as $e,e as he,f as ze,g as pe,h as Ke,i as V,j as fe,k as T}from"./chunk-KCDL7SWP.js";import{b as ue,c as $,d as Ge}from"./chunk-6SF7AUOH.js";import{o as Le}from"./chunk-OVEJFFL6.js";import{Cd as Be,Ed as Ne,F as De,Fd as Fe,G as xe,Kc as Oe,Lc as Me,O as se,U as Re,Ua as H,Yc as le,Z as ae,aa as x,ba as ce,c as g,ea as G,f as X,j as Te,ja as A,k as Ee,ka as F,ma as C,n as B,o as N,oa as h,p as R,pa as _e,q as K,qa as je,sb as W,ua as L,v as y,w as Pe}from"./chunk-PQDPS2ID.js";import{a as ie,i as I}from"./chunk-GNOSNGXM.js";var Ve={production:!0,version:"3.22.2",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var mt="firebase",wt="10.12.1";V(mt,wt,"app");var U=new Oe("ANGULARFIRE2_VERSION");var vt=(r,o)=>{let t=o?[o]:Ke(),e=[];return t.forEach(n=>{n.container.getProvider(r).instances.forEach(s=>{e.includes(s)||e.push(s)})}),e},q=class{constructor(){return vt(St)}},St="app-check";function ge(){}var Q=class{zone;delegate;constructor(o,t=Ee){this.zone=o,this.delegate=t}now(){return this.delegate.now()}schedule(o,t,e){let n=this.zone,i=function(s){n.runGuarded(()=>{o.apply(this,[s])})};return this.delegate.schedule(i,t,e)}},me=class{zone;task=null;constructor(o){this.zone=o}call(o,t){let e=this.unscheduleTask.bind(this);return this.task=this.zone.run(()=>Zone.current.scheduleMacroTask("firebaseZoneBlock",ge,{},ge,ge)),t.pipe(G({next:e,complete:e,error:e})).subscribe(o).add(e)}unscheduleTask(){setTimeout(()=>{this.task!=null&&this.task.state==="scheduled"&&(this.task.invoke(),this.task=null)},10)}},qe=(()=>{class r{ngZone;outsideAngular;insideAngular;constructor(t){this.ngZone=t,this.outsideAngular=t.runOutsideAngular(()=>new Q(Zone.current)),this.insideAngular=t.run(()=>new Q(Zone.current,Te)),globalThis.\u0275AngularFireScheduler||=this}static \u0275fac=function(e){return new(e||r)(h(W))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function kt(){let r=globalThis.\u0275AngularFireScheduler;if(!r)throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
2
2
  provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);return r}function Ue(r){return At(kt())(r)}function At(r){return function(t){return t=t.lift(new me(r.ngZone)),t.pipe(N(r.outsideAngular),B(r.insideAngular))}}var Je=(()=>{let o=class o{constructor(){}getParseToken(){let e=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(e.Token.access_token)}GetRoles(){let n=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return n||[]}ParseToken(e){try{let i=e.split(".")[0].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(i)),c=e.split(".")[1].replace("-","+").replace("_","/"),l=JSON.parse(window.atob(c));return l.header=s,l}catch{return!1}}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var yt=new Map,Ct={activated:!1,tokenObservers:[]},Tt={initialized:!1,enabled:!1};function E(r){return yt.get(r)||Object.assign({},Ct)}function et(){return Tt}var Et="https://content-firebaseappcheck.googleapis.com/v1";var Pt="exchangeDebugToken",Ze={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},Ao=24*60*60*1e3;var ve=class{constructor(o,t,e,n,i){if(this.operation=o,this.retryPolicy=t,this.getWaitDuration=e,this.lowerBound=n,this.upperBound=i,this.pending=null,this.nextErrorWaitInterval=n,n>i)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(o){return I(this,null,function*(){this.stop();try{this.pending=new de,this.pending.promise.catch(t=>{}),yield Dt(this.getNextRun(o)),this.pending.resolve(),yield this.pending.promise,this.pending=new de,this.pending.promise.catch(t=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(t){this.retryPolicy(t)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(o){if(o)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}};function Dt(r){return new Promise(o=>{setTimeout(o,r)})}var xt={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"},j=new $e("appCheck","AppCheck",xt);function tt(r){if(!E(r).activated)throw j.create("use-before-activation",{appName:r.name})}function nt(e,n){return I(this,arguments,function*({url:r,body:o},t){let i={"Content-Type":"application/json"},s=t.getImmediate({optional:!0});if(s){let f=yield s.getHeartbeatsHeader();f&&(i["X-Firebase-Client"]=f)}let a={method:"POST",body:JSON.stringify(o),headers:i},c;try{c=yield fetch(r,a)}catch(f){throw j.create("fetch-network-error",{originalErrorMessage:f?.message})}if(c.status!==200)throw j.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(f){throw j.create("fetch-parse-error",{originalErrorMessage:f?.message})}let d=l.ttl.match(/^([\d.]+)(s)$/);if(!d||!d[2]||isNaN(Number(d[1])))throw j.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${l.ttl}`});let u=Number(d[1])*1e3,p=Date.now();return{token:l.token,expireTimeMillis:p+u,issuedAtTimeMillis:p}})}function rt(r,o){let{projectId:t,appId:e,apiKey:n}=r.options;return{url:`${Et}/projects/${t}/apps/${e}:${Pt}?key=${n}`,body:{debug_token:o}}}var Rt="firebase-app-check-database",_t=1,Se="firebase-app-check-store";var ee=null;function jt(){return ee||(ee=new Promise((r,o)=>{try{let t=indexedDB.open(Rt,_t);t.onsuccess=e=>{r(e.target.result)},t.onerror=e=>{var n;o(j.create("storage-open",{originalErrorMessage:(n=e.target.error)===null||n===void 0?void 0:n.message}))},t.onupgradeneeded=e=>{let n=e.target.result;switch(e.oldVersion){case 0:n.createObjectStore(Se,{keyPath:"compositeKey"})}}}catch(t){o(j.create("storage-open",{originalErrorMessage:t?.message}))}}),ee)}function Ot(r,o){return Mt(Bt(r),o)}function Mt(r,o){return I(this,null,function*(){let e=(yield jt()).transaction(Se,"readwrite"),i=e.objectStore(Se).put({compositeKey:r,value:o});return new Promise((s,a)=>{i.onsuccess=c=>{s()},e.onerror=c=>{var l;a(j.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function Bt(r){return`${r.options.appId}-${r.name}`}var ke=new ze("@firebase/app-check");function we(r,o){return We()?Ot(r,o).catch(t=>{ke.warn(`Failed to write token to IndexedDB. Error: ${t}`)}):Promise.resolve()}function ot(){return et().enabled}function it(){return I(this,null,function*(){let r=et();if(r.enabled&&r.token)return r.token.promise;throw Error(`
3
3
  Can't get debug token in production mode.
4
4
  `)})}var Nt={error:"UNKNOWN_ERROR"};function Ft(r){return He.encodeString(JSON.stringify(r),!1)}function Ae(r,o=!1){return I(this,null,function*(){let t=r.app;tt(t);let e=E(t),n=e.token,i;if(n&&!J(n)&&(e.token=void 0,n=void 0),!n){let c=yield e.cachedTokenPromise;c&&(J(c)?n=c:yield we(t,void 0))}if(!o&&n&&J(n))return{token:n.token};let s=!1;if(ot()){e.exchangeTokenPromise||(e.exchangeTokenPromise=nt(rt(t,yield it()),r.heartbeatServiceProvider).finally(()=>{e.exchangeTokenPromise=void 0}),s=!0);let c=yield e.exchangeTokenPromise;return yield we(t,c),e.token=c,{token:c.token}}try{e.exchangeTokenPromise||(e.exchangeTokenPromise=e.provider.getToken().finally(()=>{e.exchangeTokenPromise=void 0}),s=!0),n=yield E(t).exchangeTokenPromise}catch(c){c.code==="appCheck/throttled"?ke.warn(c.message):ke.error(c),i=c}let a;return n?i?J(n)?a={token:n.token,internalError:i}:a=Ye(i):(a={token:n.token},e.token=n,yield we(t,n)):a=Ye(i),s&&$t(t,a),a})}function Lt(r){return I(this,null,function*(){let o=r.app;tt(o);let{provider:t}=E(o);if(ot()){let e=yield it(),{token:n}=yield nt(rt(o,e),r.heartbeatServiceProvider);return{token:n}}else{let{token:e}=yield t.getToken();return{token:e}}})}function Ht(r,o,t,e){let{app:n}=r,i=E(n),s={next:t,error:e,type:o};if(i.tokenObservers=[...i.tokenObservers,s],i.token&&J(i.token)){let a=i.token;Promise.resolve().then(()=>{t({token:a.token}),Xe(r)}).catch(()=>{})}i.cachedTokenPromise.then(()=>Xe(r))}function st(r,o){let t=E(r),e=t.tokenObservers.filter(n=>n.next!==o);e.length===0&&t.tokenRefresher&&t.tokenRefresher.isRunning()&&t.tokenRefresher.stop(),t.tokenObservers=e}function Xe(r){let{app:o}=r,t=E(o),e=t.tokenRefresher;e||(e=Wt(r),t.tokenRefresher=e),!e.isRunning()&&t.isTokenAutoRefreshEnabled&&e.start()}function Wt(r){let{app:o}=r;return new ve(()=>I(this,null,function*(){let t=E(o),e;if(t.token?e=yield Ae(r,!0):e=yield Ae(r),e.error)throw e.error;if(e.internalError)throw e.internalError}),()=>!0,()=>{let t=E(o);if(t.token){let e=t.token.issuedAtTimeMillis+(t.token.expireTimeMillis-t.token.issuedAtTimeMillis)*.5+3e5,n=t.token.expireTimeMillis-5*60*1e3;return e=Math.min(e,n),Math.max(0,e-Date.now())}else return 0},Ze.RETRIAL_MIN_WAIT,Ze.RETRIAL_MAX_WAIT)}function $t(r,o){let t=E(r).tokenObservers;for(let e of t)try{e.type==="EXTERNAL"&&o.error!=null?e.error(o.error):e.next(o)}catch{}}function J(r){return r.expireTimeMillis-Date.now()>0}function Ye(r){return{token:Ft(Nt),error:r}}var be=class{constructor(o,t){this.app=o,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:o}=E(this.app);for(let t of o)st(this.app,t.next);return Promise.resolve()}};function zt(r,o){return new be(r,o)}function Kt(r){return{getToken:o=>Ae(r,o),getLimitedUseToken:()=>Lt(r),addTokenListener:o=>Ht(r,"INTERNAL",o),removeTokenListener:o=>st(r.app,o)}}var Gt="@firebase/app-check",Vt="0.8.4";var qt="app-check",Qe="app-check-internal";function Ut(){pe(new he(qt,r=>{let o=r.getProvider("app").getImmediate(),t=r.getProvider("heartbeat");return zt(o,t)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((r,o,t)=>{r.getProvider(Qe).initialize()})),pe(new he(Qe,r=>{let o=r.getProvider("app-check").getImmediate();return Kt(o)},"PUBLIC").setInstantiationMode("EXPLICIT")),V(Gt,Vt)}Ut();var Jt=["localhost","0.0.0.0","127.0.0.1"],jo=typeof window<"u"&&Jt.includes(window.location.hostname);var Xt="firebase",Yt="10.12.1";T.registerVersion(Xt,Yt,"app-compat");var Qt=["ngOnDestroy"],ct=(r,o,t,e={})=>new Proxy(r,{get:(n,i)=>t.runOutsideAngular(()=>{if(r[i])return e?.spy?.get&&e.spy.get(i,r[i]),r[i];if(Qt.indexOf(i)>-1)return()=>{};let s=o.toPromise().then(a=>{let c=a?.[i];return typeof c=="function"?c.bind(a):c?.then?c.then(l=>t.run(()=>l)):t.run(()=>c)});return new Proxy(()=>{},{get:(a,c)=>s[c],apply:(a,c,l)=>s.then(d=>{let u=d?.(...l);return e?.spy?.apply&&e.spy.apply(i,l,u),u})})})});var te=class{constructor(o){return o}},ne=new C("angularfire2.app.options"),re=new C("angularfire2.app.name");function Ie(r,o,t){let e=typeof t=="string"&&t||"[DEFAULT]",n=typeof t=="object"&&t||{};n.name=n.name||e;let s=T.apps.filter(a=>a&&a.name===n.name)[0]||o.runOutsideAngular(()=>T.initializeApp(r,n));try{if(JSON.stringify(r)!==JSON.stringify(s.options)){let a=!!module.hot;en("error",`${s.name} Firebase App already initialized with different options${a?", you may need to reload as Firebase is not HMR aware.":"."}`)}}catch{}return new te(s)}var en=(r,...o)=>{le()&&typeof console<"u"&&console[r](...o)},tn={provide:te,useFactory:Ie,deps:[ne,W,[new je,re]]},Ko=(()=>{class r{static initializeApp(t,e){return{ngModule:r,providers:[{provide:ne,useValue:t},{provide:re,useValue:e}]}}constructor(t){T.registerVersion("angularfire",U.full,"core"),T.registerVersion("angularfire",U.full,"app-compat"),T.registerVersion("angular",Me.full,t.toString())}static \u0275fac=function(e){return new(e||r)(h(H))};static \u0275mod=L({type:r});static \u0275inj=F({providers:[tn]})}return r})();function lt(r,o,t,e,n){let[,i,s]=globalThis.\u0275AngularfireInstanceCache.find(a=>a[0]===r)||[];if(i)return nn(n,s)||(at("error",`${o} was already initialized on the ${t} Firebase App with different settings.${rn?" You may need to reload as Firebase is not HMR aware.":""}`),at("warn",{is:n,was:s})),i;{let a=e();return globalThis.\u0275AngularfireInstanceCache.push([r,a,n]),a}}function nn(r,o){try{return r.toString()===o.toString()}catch{return r===o}}var rn=typeof module<"u"&&!!module.hot,at=(r,...o)=>{le()&&typeof console<"u"&&console[r](...o)};globalThis.\u0275AngularfireInstanceCache||=[];var on=new C("angularfire2.auth.use-emulator"),sn=new C("angularfire2.auth.settings"),an=new C("angularfire2.auth.tenant-id"),cn=new C("angularfire2.auth.langugage-code"),ln=new C("angularfire2.auth.use-device-language"),un=new C("angularfire.auth.persistence"),dn=(r,o,t,e,n,i,s,a)=>lt(`${r.name}.auth`,"AngularFireAuth",r.name,()=>{let c=o.runOutsideAngular(()=>r.auth());if(t&&c.useEmulator(...t),e&&(c.tenantId=e),c.languageCode=n,i&&c.useDeviceLanguage(),s)for(let[l,d]of Object.entries(s))c.settings[l]=d;return a&&c.setPersistence(a),c},[t,e,n,i,s,a]),ye=(()=>{class r{authState;idToken;user;idTokenResult;credential;constructor(t,e,n,i,s,a,c,l,d,u,p,f){let z=new X,O=K(void 0).pipe(B(s.outsideAngular),x(()=>i.runOutsideAngular(()=>import("./chunk-F4WIW6HA.js"))),y(()=>Ie(t,i,e)),y(P=>dn(P,i,a,l,d,u,c,p)),ae({bufferSize:1,refCount:!1}));if(Fe(n))this.authState=this.user=this.idToken=this.idTokenResult=this.credential=K(null);else{O.pipe(Re()).subscribe();let P=O.pipe(x(w=>w.getRedirectResult().then(D=>D,()=>null)),Ue,ae({bufferSize:1,refCount:!1})),Z=O.pipe(x(w=>new g(D=>({unsubscribe:i.runOutsideAngular(()=>w.onAuthStateChanged(M=>D.next(M),M=>D.error(M),()=>D.complete()))})))),oe=O.pipe(x(w=>new g(D=>({unsubscribe:i.runOutsideAngular(()=>w.onIdTokenChanged(M=>D.next(M),M=>D.error(M),()=>D.complete()))}))));this.authState=P.pipe(ce(Z),N(s.outsideAngular),B(s.insideAngular)),this.user=P.pipe(ce(oe),N(s.outsideAngular),B(s.insideAngular)),this.idToken=this.user.pipe(x(w=>w?R(w.getIdToken()):K(null))),this.idTokenResult=this.user.pipe(x(w=>w?R(w.getIdTokenResult()):K(null))),this.credential=De(P,z,this.authState.pipe(xe(w=>!w))).pipe(y(w=>w?.user?w:null),N(s.outsideAngular),B(s.insideAngular))}return ct(this,O,i,{spy:{apply:(P,Z,oe)=>{(P.startsWith("signIn")||P.startsWith("createUser"))&&oe.then(w=>z.next(w))}}})}static \u0275fac=function(e){return new(e||r)(h(ne),h(re,8),h(H),h(W),h(qe),h(on,8),h(sn,8),h(an,8),h(cn,8),h(ln,8),h(un,8),h(q,8))};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"any"})}return r})(),ii=(()=>{class r{constructor(){T.registerVersion("angularfire",U.full,"auth-compat")}static \u0275fac=function(e){return new(e||r)};static \u0275mod=L({type:r});static \u0275inj=F({providers:[ye]})}return r})();function m(r,o,t,e){return new Promise((n,i)=>{r||i("IndexedDB not available");let s=r.open(o,t),a;s.onsuccess=c=>{a=s.result,n(a)},s.onerror=c=>{i(`IndexedDB error: ${s.error}`)},typeof e=="function"&&(s.onupgradeneeded=c=>{e(c,a)})})}function ut(r,o,t,e,n){if(!r)return;let i=r.open(o,t);i.onupgradeneeded=s=>{let a=s.target.result;e.forEach(l=>{if(!a.objectStoreNames.contains(l.store)){let d=a.createObjectStore(l.store,l.storeConfig);l.storeSchema.forEach(u=>{d.createIndex(u.name,u.keypath,u.options)})}});let c=n&&n();c&&Object.keys(c).map(l=>parseInt(l,10)).filter(l=>l>s.oldVersion).sort((l,d)=>l-d).forEach(l=>{c[l](a,i.transaction)}),a.close()},i.onsuccess=s=>{s.target.result.close()}}function pn(r,o,t){if(!r||!o||!t)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new g(e=>{try{let n=o+1,i=indexedDB.open(r,n);i.onupgradeneeded=s=>{let a=s.target.result;a.deleteObjectStore(t),a.close(),console.log("onupgradeneeded"),e.next(!0),e.complete()},i.onerror=s=>e.error(s)}catch(n){e.error(n)}})}function fn(r,o){return r.objectStoreNames.contains(o)}function b(r,o,t){r||t("You need to use the openDatabase function to create a database before you query it!"),fn(r,o)||t(`objectStore does not exists: ${o}`)}function S(r,o){let t=r.transaction(o.storeName,o.dbMode);return t.onerror=o.error,t.onabort=o.abort,t}function k(r,o,t,e){return{storeName:o,dbMode:r,error:n=>{t(n)},abort:n=>{t(n)}}}var v=function(r){return r.readonly="readonly",r.readwrite="readwrite",r}(v||{}),dt=new C(null),Ce=(()=>{class r{constructor(t,e){if(this.dbConfig=t,this.platformId=e,!t.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if(!t.version)throw new Error("NgxIndexedDB: Please, provide the db version in the configuration");this.isBrowser=Ne(this.platformId),this.isBrowser&&(this.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,ut(this.indexedDB,t.name,t.version,t.objectStoresMeta,t.migrationFactory),m(this.indexedDB,t.name).then(n=>{n.version!==t.version&&(this.dbConfig.version=n.version)}))}createObjectStore(t,e){let n=[t];ut(this.indexedDB,this.dbConfig.name,++this.dbConfig.version,n,e)}add(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{let c=S(s,k(v.readwrite,t,d=>i.error(d))).objectStore(t),l=n?c.add(e,n):c.add(e);l.onsuccess=d=>I(this,null,function*(){let u=d.target.result,p=c.get(u);p.onsuccess=f=>{i.next(f.target.result),i.complete()}})}).catch(s=>i.error(s))})}bulkAdd(t,e){let n=new Promise((i,s)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{let l=S(a,k(v.readwrite,t,i,s)).objectStore(t),d=e.map(u=>new Promise((p,f)=>{let z=u.key;delete u.key;let O=z?l.add(u,z):l.add(u);O.onsuccess=P=>{let Z=P.target.result;p(Z)}}));i(Promise.all(d))}).catch(a=>s(a))});return R(n)}bulkDelete(t,e){let n=e.map(i=>new Promise((s,a)=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(c=>{let l=S(c,k(v.readwrite,t,a,s));l.objectStore(t).delete(i),l.oncomplete=()=>{this.getAll(t).pipe(se(1)).subscribe(u=>{s(u)})}}).catch(c=>a(c))}));return R(Promise.all(n))}getByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{let c=S(i,k(v.readonly,t,n.error)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result),n.complete()},c.onerror=l=>{n.error(l)}}).catch(i=>n.error(i))})}bulkGet(t,e){let n=e.map(i=>this.getByKey(t,i));return new g(i=>{Pe(n).subscribe(s=>{i.next(s),i.complete()})})}getByID(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let c=S(i,k(v.readonly,t,n.error,n.next)).objectStore(t).get(e);c.onsuccess=l=>{n.next(l.target.result)}}).catch(i=>n.error(i))})}getByIndex(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{b(s,t,u=>i.error(u));let d=S(s,k(v.readonly,t,i.error)).objectStore(t).index(e).get(n);d.onsuccess=u=>{i.next(u.target.result),i.complete()}}).catch(s=>i.error(s))})}getAll(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{b(n,t,c=>e.error(c));let a=S(n,k(v.readonly,t,e.error,e.next)).objectStore(t).getAll();a.onerror=c=>{e.error(c)},a.onsuccess=({target:{result:c}})=>{e.next(c),e.complete()}}).catch(n=>e.error(n))})}update(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let a=S(i,k(v.readwrite,t,l=>n.error(l))).objectStore(t),c=a.put(e);c.onsuccess=l=>I(this,null,function*(){let d=l.target.result,u=a.get(d);u.onsuccess=p=>{n.next(p.target.result),n.complete()}})}).catch(i=>n.error(i))})}delete(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,c=>n.error(c));let s=S(i,k(v.readwrite,t,c=>n.error(c)));s.objectStore(t).delete(e),s.oncomplete=()=>{this.getAll(t).pipe(se(1)).subscribe(c=>{n.next(c),n.complete()})}}).catch(i=>n.error(i))})}deleteByKey(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,c=>n.error(c));let s=S(i,k(v.readwrite,t,c=>n.error(c))),a=s.objectStore(t);s.oncomplete=()=>{n.next(!0),n.complete()},a.delete(e)}).catch(i=>n.error(i))})}clear(t){return new g(e=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(n=>{b(n,t,a=>e.error(a));let i=S(n,k(v.readwrite,t,a=>e.error(a)));i.objectStore(t).clear(),i.oncomplete=()=>{e.next(!0),e.complete()}}).catch(n=>e.error(n))})}deleteDatabase(){return new g(t=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(e=>I(this,null,function*(){yield e.close();let n=this.indexedDB.deleteDatabase(this.dbConfig.name);n.onsuccess=()=>{t.next(!0),t.complete()},n.onerror=i=>t.error(i),n.onblocked=()=>{throw new Error("Unable to delete database because it's blocked")}})).catch(e=>t.error(e))})}openCursor(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let a=S(i,k(v.readonly,t,n.error)).objectStore(t),c=e===void 0?a.openCursor():a.openCursor(e);c.onsuccess=l=>{n.next(l),n.complete()}}).catch(i=>n.error(i))})}openCursorByIndex(t,e,n,i=v.readonly){let s=new X;return m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>{s.error(p)});let u=S(a,k(i,t,p=>{s.error(p)},()=>{s.next()})).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{s.next(p)}}).catch(a=>s.error(a)),s}getAllByIndex(t,e,n){let i=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>s.error(p));let u=S(a,k(v.readonly,t,s.error)).objectStore(t).index(e).openCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(i.push(f.value),f.continue()):(s.next(i),s.complete())}}).catch(a=>s.error(a))})}getAllKeysByIndex(t,e,n){let i=[];return new g(s=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(a=>{b(a,t,p=>s.error(p));let u=S(a,k(v.readonly,t,s.error)).objectStore(t).index(e).openKeyCursor(n);u.onsuccess=p=>{let f=p.target.result;f?(i.push({primaryKey:f.primaryKey,key:f.key}),f.continue()):(s.next(i),s.complete())}}).catch(a=>s.error(a))})}count(t,e){return new g(n=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(i=>{b(i,t,l=>n.error(l));let c=S(i,k(v.readonly,t,n.error)).objectStore(t).count(e);c.onerror=l=>n.error(l),c.onsuccess=l=>{n.next(l.target.result),n.complete()}}).catch(i=>n.error(i))})}countByIndex(t,e,n){return new g(i=>{m(this.indexedDB,this.dbConfig.name,this.dbConfig.version).then(s=>{b(s,t,u=>i.error(u));let d=S(s,k(v.readonly,t,i.error)).objectStore(t).index(e).count(n);d.onerror=u=>i.error(u),d.onsuccess=u=>{i.next(u.target.result),i.complete()}}).catch(s=>i.error(s))})}deleteObjectStore(t){return pn(this.dbConfig.name,++this.dbConfig.version,t)}}return r.\u0275fac=function(t){return new(t||r)(h(dt),h(H))},r.\u0275prov=A({token:r,factory:r.\u0275fac}),r})(),pi=(()=>{class r{static forRoot(t){return{ngModule:r,providers:[Ce,{provide:dt,useValue:t}]}}}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=L({type:r}),r.\u0275inj=F({imports:[[Be]]}),r})();var ht=(()=>{let o=class o{constructor(e){this.db=e,this.DATABASE="Categories"}saveCategoriesByChannelType(e,n){let i=this.getKey(n);return this.db.add(this.DATABASE,e,i).pipe(y(s=>e))}getCategoriesByChannelType(e){let n=this.getKey(e);return this.db.getByKey(this.DATABASE,n)}getKey(e){let n="";switch(e){case ue.Lazada:n="Lazada";break;case ue.Tokopedia:n="Tokopedia";break}return n}clearDatabase(){this.db.clear(this.DATABASE)}getHostName(){let e=localStorage.getItem("Authorization");return this.hostName=JSON.parse(e)?.Host,this.hostName}};o.\u0275fac=function(n){return new(n||o)(h(Ce))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var pt=(()=>{let o=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:"xv1oomgl",name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){let n={Enabled:!0};e&&(n=ie(ie({},n),e)),localStorage.setItem("Intercom",JSON.stringify(n))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!0}),e.hide_default_launcher=!0,this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(window.Intercom("update",{app_id:"xv1oomgl",hide_default_launcher:!1}),e.hide_default_launcher=!1,this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return $.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var ft=(()=>{let o=class o{};o.SubmitConfig="/api/Channel/SubmitConfig",o.PosAccountTest="/api/POSAccount/Test",o.PosAccountRemove="/api/POSAccount/Remove",o.PosAccountGetConfig="/api/ChannelLoader/GetConfig",o.ChannelGetLastSyncByID="/api/Channel/GetLastSyncByID",o.GetChannel="/api/Channel/GetChannel",o.GetChannelLoader="/api/ChannelLoader/GetChannelLoader",o.TestShopID="/api/Channel/TestShopID",o.UpdateChannelIndex="/api/Channel/UpdateChannelIndex",o.DeleteChannel="/api/Channel/DeleteChannel",o.GetRegisterByOutletName="/api/Channel/GetRegistersByOutletOrder",o.GetChannelRowCount="/api/Channel/GetCountChannel",o.GetChannelWarehouse="/api/Channel/GetChannelWarehouseLocation",o.UnSynchronizedWarehouse="/api/Channel/UnSynchronizedWarehouse",o.GetChannelDetail="/api/ChannelLoader/GetChannelView",o.GetOrderPreview="/api/Orders/Preview",o.GetOrderPreviewV2="/api/Orders/PreviewV2",o.GetDownloadOrder="/api/Orders/Download",o.GetDownloadOrderV2="/api/Orders/DownloadV2";let r=o;return r})();var gt=(()=>{let o=class o{constructor(){this.httpService=_e(Y)}update(e){if(e)this.updateLocalStorage(e);else{let n={RowCount:500,PageNumber:1};this.httpService.post(ft.GetChannel,n).pipe(y(i=>i?.Data)).subscribe(i=>{this.updateLocalStorage(i)})}}getChannels(){let e=localStorage.getItem("channels");return e?JSON.parse(e):[]}updateLocalStorage(e){let n=this.mappingChannelLocalStorage(e);localStorage.setItem("channels",JSON.stringify(n))}mappingChannelLocalStorage(e){return e.map(i=>({ID:i.ID,Name:i.Name,TypeID:i.TypeID,Img:$.getChannelLogoByTypeId(i.TypeID)}))}clearLocalStorage(){localStorage.removeItem("channels")}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var ji=(()=>{let o=class o{constructor(e,n,i,s,a,c,l,d){this.httpService=e,this.tokenDecodeService=n,this.afAuth=i,this.ngxPermission=s,this.localDataService=a,this.router=c,this.intercomService=l,this.updateChannelStorageService=d}login(e){return this.httpService.post("/api/token/Login",e).pipe(G(n=>{this.setLocalStorage(n,e.Host,e.Username),this.loadPermissions()}))}getNews(){return this.httpService.get(Ve.news).pipe(y(e=>e?.items?.map(n=>n?.properties)))}loginWithGoogle(e,n){e.preventDefault();let i=new fe;return i.setCustomParameters({prompt:"select_account"}),R(this.afAuth.signInWithPopup(i)).pipe(y(s=>s.credential),y(s=>s.idToken),x(s=>this.httpService.post("/api/token/LoginWithSocialProvider",JSON.stringify({IDToken:s,Host:n}))),G(s=>{this.setLocalStorage(s,n,null),this.loadPermissions()}))}setLocalStorage(e,n,i){localStorage.setItem("user",JSON.stringify(e)),localStorage.setItem("Authorization",JSON.stringify({Host:n,username:i})),this.updateChannelStorageService.update(e.Channels),this.intercomService.updateLocalStorage(e.IntercomWidget),this.intercomService.inititalizeIntercom()}loadPermissions(){this.ngxPermission.loadPermissions([]);let e=localStorage.getItem("user");if($.IsNotEmpty(e)){let n=this.tokenDecodeService.GetRoles();this.ngxPermission.loadPermissions(n)}}getChannels(){return this.updateChannelStorageService.getChannels()}logout(){this.clearLocalStorage(),this.ngxPermission.flushPermissions()}isActiveToken(){let e=JSON.parse(window.localStorage.getItem("user")),n=new Date;if(e!=null){let i=new Date(e.Token.expiredAt);return n<i?!0:(this.clearLocalStorage(),!1)}else return!1}getDomain(){if(!this.domain){let e=localStorage.getItem("Authorization");this.domain="https://"+JSON.parse(e).Host}return this.domain}clearLocalStorage(){this.domain=null,localStorage.removeItem("user"),this.updateChannelStorageService.clearLocalStorage(),this.intercomService.shutdown(),this.localDataService.clearDatabase(),this.router.navigate([""])}};o.\u0275fac=function(n){return new(n||o)(h(Y),h(Je),h(ye),h(Ge),h(ht),h(Le),h(pt),h(gt))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();export{Ve as a,Je as b,Ko as c,ii as d,pi as e,ht as f,ft as g,gt as h,ji as i};
@@ -1 +1 @@
1
- import{a as he}from"./chunk-OSSJKXND.js";import"./chunk-LRU7GIXZ.js";import{a as ce}from"./chunk-5EC2PEVE.js";import{a as se}from"./chunk-44YUSAMN.js";import{a as F}from"./chunk-XHAXYWZ7.js";import{b as pe,c as V}from"./chunk-RDHVV7FZ.js";import"./chunk-BVIRHZTZ.js";import"./chunk-N6IHFFFZ.js";import"./chunk-PD4CUVAW.js";import"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import"./chunk-JXTGH22T.js";import"./chunk-OULUJ2IO.js";import"./chunk-GCKSYCMI.js";import{a as le}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{i as M}from"./chunk-HK66WK22.js";import{b as te,e as ne}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{d as ie,l as ae,m as oe,n as re}from"./chunk-BO4PPSB5.js";import"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as q,h as X,m as Y,o as Z,y as ee}from"./chunk-BSN7ZAXG.js";import{c as D}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as C,Cd as K,Da as b,Ea as P,Eb as I,G as B,Gb as d,Gc as v,Hc as y,Sb as c,Tb as p,Ub as U,Vb as G,Wb as W,Xb as H,Yb as N,bc as g,ea as k,ja as j,jb as h,kb as m,nc as _,pa as S,rc as L,sc as T,ta as A,tc as E,uc as z,vc as $,vd as Q,xb as w,yd as J}from"./chunk-PQDPS2ID.js";import{a as R,b as x}from"./chunk-GNOSNGXM.js";var O=(()=>{let r=class r{constructor(){this.authService=S(M),this.channelOptions=this.authService.getChannels()}filterSelectedChannels(t,i){let e=Object.assign([],this.channelOptions),n=[],a;return t.forEach(o=>{a=e.find(s=>s.ID==o?.parent?.id),a&&(a=x(R({},a),{Name:`${o?.parent?.label} - ${o?.label}`,LocationID:o?.id}),n.push(a))}),i.forEach(o=>{a=e.find(s=>s.ID==o.id),a&&n.push(a)}),n}generateFilterLocation(t,i){let e=[],n=[],a=[];return t.length>0?(e=t.map(o=>o.id),n=t.map(o=>o.parent.id).filter((o,s,f)=>f.indexOf(o)===s)):(e=[],n=[]),a=i.map(o=>o.id),a=a.concat(n).filter((o,s,f)=>f.indexOf(o)===s),{locationIds:e,channelIds:a}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275prov=j({token:r,factory:r.\u0275fac});let l=r;return l})();function ue(l,r){if(l&1){let u=N();c(0,"button",15),C("click",function(){b(u);let i=g().ngIf,e=g();return P(e.onUpdateItems(i))}),U(1,"i",16),_(2," Update "),p()}}function me(l,r){if(l&1&&(c(0,"actions")(1,"div",13),I(2,ue,3,0,"button",14),p()()),l&2){let u=r.ngIf,t=g();h(2),d("ngIf",t.productService.hasSelectionVariant(u))}}function ge(l,r){l&1&&H(0)}function Ce(l,r){if(l&1){let u=N();G(0),c(1,"app-table",17),C("onToggle",function(i){b(u);let e=g();return P(e.onShowDifferenceStock(i))})("onSubmit",function(i){b(u);let e=g();return P(e.updateStockByVariant(i))}),p(),W()}if(l&2){let u=r.ngIf,t=g();h(),d("data",u)("channel",t.channels())("showProductToggle",!0)("hiddenIPOSInventory",t.searchFilter.HiddenIPOSInventory)}}var $e=(()=>{let r=class r{constructor(t,i,e,n,a,o){this.http=t,this.toastr=i,this.dialog=e,this.productService=n,this.authService=a,this.mainPanelService=o,this.paginationService=S(V),this.multiChannelService=S(O),this.searchFilter={PageNumber:1,RowCount:100},this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.selectedLocations=w([]),this.selectedChannels=w([]),this.channels=w([]),this.pageData={Title:"Inventory",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory/pos",Active:!0},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.paginationService.fethRowCountEndpoint=this.allDataCountEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(k(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:F.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.mainPanelService.openModalFilter()}))}onChannelChange(t=[]){let i=t.filter(n=>D.isValidGUID(n.id)==!1),e=t.filter(n=>D.isValidGUID(n.id));this.selectedLocations.set(i),this.selectedChannels.set(e)}onSearch(t){let i=this.multiChannelService.filterSelectedChannels(this.selectedLocations(),this.selectedChannels());this.channels.set(i);let e=this.multiChannelService.generateFilterLocation(this.selectedLocations(),this.selectedChannels());this.searchFilter.ListChannelID=e.channelIds,this.searchFilter.ListLocationID=e.locationIds,this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,i){let e=this.productService.selectedVariantProduct(t);if(e.length>0){let n=[];e.forEach(s=>{s.Channel?.forEach(f=>{n.push({ID:s.ID,Code:s.Code,Inventory:s.Inventory,LocationID:f.LocationID})})});let o={ListChannelID:i.filter(s=>s.selected).map(s=>s.ID),List:n};this.http.post("/api/Inventory/UpdateChannel",o).subscribe(s=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+o.List.length+" variants in "+o.ListChannelID.length+" channels","Success")})}}updateStockByVariant(t){let i={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku,LocationID:t.LocationID};this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(e=>{this.paginationService.reloadPagination(this.searchFilter);let n=this.productService.findChannelById(i.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+n.Name+" to "+i.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=F.DIFFERENCE:this.searchFilter.filterModel=F.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let i=this.productService.selectedVariantProduct(t),e=this.channelOptions.filter(n=>this.channels()?.find(a=>a.ID===n.ID));this.dialog.open(se,{data:{selectedItems:i,channels:JSON.parse(JSON.stringify(e))},width:"600px"}).afterClosed().pipe(B(n=>D.IsNotEmpty(n))).subscribe(n=>{this.updateStock(t,n)})}};r.\u0275fac=function(i){return new(i||r)(m(ne),m(te),m(ie),m(le),m(M),m(ae))},r.\u0275cmp=A({type:r,selectors:[["app-multi-channel-comparison"]],standalone:!0,features:[z([V,O]),$],decls:26,vars:22,consts:[["headerTitle","Inventory Comparison","textButton","Search",3,"onSubmit","pageData","hideSearchBox"],[4,"ngIf"],["for","selectChannel",1,"fw-bold","mb-3"],["id","selectChannel",3,"onChannelChange","multiple"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[1,"d-flex"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"onToggle","onSubmit","data","channel","showProductToggle","hiddenIPOSInventory"]],template:function(i,e){i&1&&(c(0,"mainpanel",0),C("onSubmit",function(a){return e.onSearch(a)}),I(1,me,3,1,"actions",1),v(2,"async"),c(3,"filters"),I(4,ge,1,0,"ng-container",1),v(5,"async"),c(6,"div")(7,"label",2),_(8,"Channel"),p(),c(9,"multiwarehouse-tree-select",3),C("onChannelChange",function(a){return e.onChannelChange(a)}),p()(),c(10,"div",4)(11,"label",5),_(12,"PageNumber"),p(),c(13,"input",6),E("ngModelChange",function(a){return T(e.searchFilter.PageNumber,a)||(e.searchFilter.PageNumber=a),a}),p()(),c(14,"div",4)(15,"label",7),_(16,"Page Size"),p(),c(17,"input",8),E("ngModelChange",function(a){return T(e.searchFilter.RowCount,a)||(e.searchFilter.RowCount=a),a}),p()()(),c(18,"content")(19,"div",9)(20,"div",10)(21,"div",11),I(22,Ce,2,4,"ng-container",1),v(23,"async"),c(24,"infinite-paginator",12),v(25,"async"),C("onNextPage",function(){return e.paginationService.onNextPage(e.searchFilter)})("onLastPage",function(){return e.paginationService.onLastPage(e.searchFilter)})("onGetRowCount",function(){return e.paginationService.getRowCount(e.searchFilter)}),p()()()()()()),i&2&&(d("pageData",e.pageData)("hideSearchBox",!1),h(),d("ngIf",y(2,14,e.paginationService.data$)),h(3),d("ngIf",y(5,16,e.loader$)),h(5),d("multiple",!0),h(4),L("ngModel",e.searchFilter.PageNumber),h(4),L("ngModel",e.searchFilter.RowCount),h(5),d("ngIf",y(23,18,e.paginationService.data$)),h(2),d("totalData",e.paginationService.totalData())("hideCount",e.paginationService.hideCount())("rowCount",y(25,20,e.paginationService.totalRowCount$))("pageNumber",e.paginationService.pageNumber())("disableNextButton",e.paginationService.disableNextButton())("goToLastPage",e.paginationService.isLastPage()))},dependencies:[K,Q,J,re,oe,ce,ee,q,Z,X,Y,pe,he],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let l=r;return l})();export{$e as MultiChannelComparison};
1
+ import{a as he}from"./chunk-OSSJKXND.js";import"./chunk-LRU7GIXZ.js";import{a as ce}from"./chunk-HHYOM3XB.js";import{a as se}from"./chunk-44YUSAMN.js";import{a as F}from"./chunk-XHAXYWZ7.js";import{b as pe,c as V}from"./chunk-RDHVV7FZ.js";import"./chunk-BVIRHZTZ.js";import"./chunk-N6IHFFFZ.js";import"./chunk-PD4CUVAW.js";import"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import"./chunk-JXTGH22T.js";import"./chunk-OULUJ2IO.js";import"./chunk-GCKSYCMI.js";import{a as le}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{i as M}from"./chunk-2DQJZ4SM.js";import{b as te,e as ne}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{d as ie,l as ae,m as oe,n as re}from"./chunk-BO4PPSB5.js";import"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as q,h as X,m as Y,o as Z,y as ee}from"./chunk-BSN7ZAXG.js";import{c as D}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as C,Cd as K,Da as b,Ea as P,Eb as I,G as B,Gb as d,Gc as v,Hc as y,Sb as c,Tb as p,Ub as U,Vb as G,Wb as W,Xb as H,Yb as N,bc as g,ea as k,ja as j,jb as h,kb as m,nc as _,pa as S,rc as L,sc as T,ta as A,tc as E,uc as z,vc as $,vd as Q,xb as w,yd as J}from"./chunk-PQDPS2ID.js";import{a as R,b as x}from"./chunk-GNOSNGXM.js";var O=(()=>{let r=class r{constructor(){this.authService=S(M),this.channelOptions=this.authService.getChannels()}filterSelectedChannels(t,i){let e=Object.assign([],this.channelOptions),n=[],a;return t.forEach(o=>{a=e.find(s=>s.ID==o?.parent?.id),a&&(a=x(R({},a),{Name:`${o?.parent?.label} - ${o?.label}`,LocationID:o?.id}),n.push(a))}),i.forEach(o=>{a=e.find(s=>s.ID==o.id),a&&n.push(a)}),n}generateFilterLocation(t,i){let e=[],n=[],a=[];return t.length>0?(e=t.map(o=>o.id),n=t.map(o=>o.parent.id).filter((o,s,f)=>f.indexOf(o)===s)):(e=[],n=[]),a=i.map(o=>o.id),a=a.concat(n).filter((o,s,f)=>f.indexOf(o)===s),{locationIds:e,channelIds:a}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275prov=j({token:r,factory:r.\u0275fac});let l=r;return l})();function ue(l,r){if(l&1){let u=N();c(0,"button",15),C("click",function(){b(u);let i=g().ngIf,e=g();return P(e.onUpdateItems(i))}),U(1,"i",16),_(2," Update "),p()}}function me(l,r){if(l&1&&(c(0,"actions")(1,"div",13),I(2,ue,3,0,"button",14),p()()),l&2){let u=r.ngIf,t=g();h(2),d("ngIf",t.productService.hasSelectionVariant(u))}}function ge(l,r){l&1&&H(0)}function Ce(l,r){if(l&1){let u=N();G(0),c(1,"app-table",17),C("onToggle",function(i){b(u);let e=g();return P(e.onShowDifferenceStock(i))})("onSubmit",function(i){b(u);let e=g();return P(e.updateStockByVariant(i))}),p(),W()}if(l&2){let u=r.ngIf,t=g();h(),d("data",u)("channel",t.channels())("showProductToggle",!0)("hiddenIPOSInventory",t.searchFilter.HiddenIPOSInventory)}}var $e=(()=>{let r=class r{constructor(t,i,e,n,a,o){this.http=t,this.toastr=i,this.dialog=e,this.productService=n,this.authService=a,this.mainPanelService=o,this.paginationService=S(V),this.multiChannelService=S(O),this.searchFilter={PageNumber:1,RowCount:100},this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.selectedLocations=w([]),this.selectedChannels=w([]),this.channels=w([]),this.pageData={Title:"Inventory",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory/pos",Active:!0},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.paginationService.fethRowCountEndpoint=this.allDataCountEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(k(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:F.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.mainPanelService.openModalFilter()}))}onChannelChange(t=[]){let i=t.filter(n=>D.isValidGUID(n.id)==!1),e=t.filter(n=>D.isValidGUID(n.id));this.selectedLocations.set(i),this.selectedChannels.set(e)}onSearch(t){let i=this.multiChannelService.filterSelectedChannels(this.selectedLocations(),this.selectedChannels());this.channels.set(i);let e=this.multiChannelService.generateFilterLocation(this.selectedLocations(),this.selectedChannels());this.searchFilter.ListChannelID=e.channelIds,this.searchFilter.ListLocationID=e.locationIds,this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,i){let e=this.productService.selectedVariantProduct(t);if(e.length>0){let n=[];e.forEach(s=>{s.Channel?.forEach(f=>{n.push({ID:s.ID,Code:s.Code,Inventory:s.Inventory,LocationID:f.LocationID})})});let o={ListChannelID:i.filter(s=>s.selected).map(s=>s.ID),List:n};this.http.post("/api/Inventory/UpdateChannel",o).subscribe(s=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+o.List.length+" variants in "+o.ListChannelID.length+" channels","Success")})}}updateStockByVariant(t){let i={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku,LocationID:t.LocationID};this.http.post("/api/Inventory/UpdateQuantityByItem",i).subscribe(e=>{this.paginationService.reloadPagination(this.searchFilter);let n=this.productService.findChannelById(i.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+n.Name+" to "+i.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=F.DIFFERENCE:this.searchFilter.filterModel=F.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let i=this.productService.selectedVariantProduct(t),e=this.channelOptions.filter(n=>this.channels()?.find(a=>a.ID===n.ID));this.dialog.open(se,{data:{selectedItems:i,channels:JSON.parse(JSON.stringify(e))},width:"600px"}).afterClosed().pipe(B(n=>D.IsNotEmpty(n))).subscribe(n=>{this.updateStock(t,n)})}};r.\u0275fac=function(i){return new(i||r)(m(ne),m(te),m(ie),m(le),m(M),m(ae))},r.\u0275cmp=A({type:r,selectors:[["app-multi-channel-comparison"]],standalone:!0,features:[z([V,O]),$],decls:26,vars:22,consts:[["headerTitle","Inventory Comparison","textButton","Search",3,"onSubmit","pageData","hideSearchBox"],[4,"ngIf"],["for","selectChannel",1,"fw-bold","mb-3"],["id","selectChannel",3,"onChannelChange","multiple"],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[3,"onNextPage","onLastPage","onGetRowCount","totalData","hideCount","rowCount","pageNumber","disableNextButton","goToLastPage"],[1,"d-flex"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"onToggle","onSubmit","data","channel","showProductToggle","hiddenIPOSInventory"]],template:function(i,e){i&1&&(c(0,"mainpanel",0),C("onSubmit",function(a){return e.onSearch(a)}),I(1,me,3,1,"actions",1),v(2,"async"),c(3,"filters"),I(4,ge,1,0,"ng-container",1),v(5,"async"),c(6,"div")(7,"label",2),_(8,"Channel"),p(),c(9,"multiwarehouse-tree-select",3),C("onChannelChange",function(a){return e.onChannelChange(a)}),p()(),c(10,"div",4)(11,"label",5),_(12,"PageNumber"),p(),c(13,"input",6),E("ngModelChange",function(a){return T(e.searchFilter.PageNumber,a)||(e.searchFilter.PageNumber=a),a}),p()(),c(14,"div",4)(15,"label",7),_(16,"Page Size"),p(),c(17,"input",8),E("ngModelChange",function(a){return T(e.searchFilter.RowCount,a)||(e.searchFilter.RowCount=a),a}),p()()(),c(18,"content")(19,"div",9)(20,"div",10)(21,"div",11),I(22,Ce,2,4,"ng-container",1),v(23,"async"),c(24,"infinite-paginator",12),v(25,"async"),C("onNextPage",function(){return e.paginationService.onNextPage(e.searchFilter)})("onLastPage",function(){return e.paginationService.onLastPage(e.searchFilter)})("onGetRowCount",function(){return e.paginationService.getRowCount(e.searchFilter)}),p()()()()()()),i&2&&(d("pageData",e.pageData)("hideSearchBox",!1),h(),d("ngIf",y(2,14,e.paginationService.data$)),h(3),d("ngIf",y(5,16,e.loader$)),h(5),d("multiple",!0),h(4),L("ngModel",e.searchFilter.PageNumber),h(4),L("ngModel",e.searchFilter.RowCount),h(5),d("ngIf",y(23,18,e.paginationService.data$)),h(2),d("totalData",e.paginationService.totalData())("hideCount",e.paginationService.hideCount())("rowCount",y(25,20,e.paginationService.totalRowCount$))("pageNumber",e.paginationService.pageNumber())("disableNextButton",e.paginationService.disableNextButton())("goToLastPage",e.paginationService.isLastPage()))},dependencies:[K,Q,J,re,oe,ce,ee,q,Z,X,Y,pe,he],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let l=r;return l})();export{$e as MultiChannelComparison};
@@ -1 +1 @@
1
- import{b as qt}from"./chunk-RI7RZYID.js";import{a as zt,b as Qt}from"./chunk-XB345KSK.js";import"./chunk-MY4B7K3R.js";import{b as Ht}from"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import{a as Xt,b as Jt}from"./chunk-JXTGH22T.js";import"./chunk-OULUJ2IO.js";import{a as Bt,b as Rt}from"./chunk-NYDPS33K.js";import{a as mt,b as Gt,c as jt,d as st,e as pt}from"./chunk-NONK6EKG.js";import"./chunk-FGPSBTFS.js";import"./chunk-JP44SOP7.js";import{a as Yt}from"./chunk-GCKSYCMI.js";import"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as Wt}from"./chunk-ZRPSM5PK.js";import"./chunk-FMV4LYKN.js";import"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{d as R,e as G}from"./chunk-CCXKODFV.js";import"./chunk-HK66WK22.js";import{e as nt}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as $t,n as Lt}from"./chunk-BO4PPSB5.js";import{t as Vt,u as Dt}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as et,e as ct,h as L,i as X,l as gt,m as Nt,n as J,p as z,q as Ot,r as Q,s as kt,t as wt,u as Mt,x as q,y as it,z as B}from"./chunk-BSN7ZAXG.js";import{b as Ut,c as g}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as A,Ca as O,Cd as F,Da as W,Ea as Y,Eb as h,Gb as p,Gc as v,Hc as y,K as Tt,M as Ft,Ma as ht,Nb as b,Ob as w,Pa as k,Qb as M,Rb as U,Sb as m,Tb as c,Ub as _,Vb as V,Wb as D,Yb as H,Z as tt,bc as l,ea as P,ja as N,jb as s,nc as f,oc as at,pa as u,pc as Z,rc as At,sc as Et,ta as x,tc as Pt,uc as S,v as E,vc as I,vd as $,wc as lt,yd as T}from"./chunk-PQDPS2ID.js";import"./chunk-GNOSNGXM.js";var K=function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t}(K||{});var ot=function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t}(ot||{});var Ct=(()=>{let o=class o{constructor(){this.shopeeUploadService=u(mt),this.formBuilder=u(q)}getAttributes(n){return this.shopeeUploadService.getAttributes(n.channelId,n.categoryId).pipe(E(i=>this.setLabelToIndonesian(i)))}setLabelToIndonesian(n=[]){let i,a;return n=n.map(r=>(i=r?.multi_lang?.find(d=>d.language=="id"),r.attribute_value_list=r?.attribute_value_list?.map(d=>(a=d?.multi_lang?.find(C=>C.language=="id"),d.name=a?.value,d)),r.name=i?.value?i?.value:r.name,r)),n}createFormGroup(n){let i=this.formBuilder.group({}),a=[];return n.forEach(r=>{if(a=[],r.mandatory&&a.push(ct.required),r?.attribute_info?.format_type==ot.FORMAT_QUANTITATIVE_WITH_UNIT&&r?.attribute_info?.input_type==K.FREE_TEXT_FILED){let d=this.formBuilder.group({unit:new gt(null),value:new gt(null,a)});i.addControl(JSON.stringify(r.attribute_id),d)}else i.addControl(JSON.stringify(r.attribute_id),this.formBuilder.control(null,a))}),i}getFilteredAttributes(n,i){let a=JSON.parse(JSON.stringify(n)),r=Object.keys(i),d=a.filter(C=>r.findIndex(ft=>parseInt(ft)==C.attribute_id||C.mandatory)!=-1);return d=this.filterSelectedAttributes(d,i),d}filterSelectedAttributes(n,i){return n.map(r=>{switch(r.attribute_info.input_type){case K.MULTI_COMBO_BOX:g.IsNotEmpty(i[r.attribute_id])?r.attribute_value_list=r.attribute_value_list.filter(d=>i[r.attribute_id]?.findIndex(C=>C==d.value_id)!=-1):r.attribute_value_list=[];break;case K.FREE_TEXT_FILED:r.attribute_info.format_type==ot.FORMAT_QUANTITATIVE_WITH_UNIT?r.attribute_value_list=this.setSelectedQuantitativeAttr(i[r.attribute_id]?.value,i[r.attribute_id]?.unit):g.IsNotEmpty(i[r.attribute_id])&&(r.attribute_value_list=[{value_id:0,name:i[r.attribute_id]}]);break;default:r.attribute_value_list=r.attribute_value_list.filter(d=>d.value_id==i[r.attribute_id])}return r}).filter(r=>r?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(n,i){let a=[];return g.IsNotEmpty(n)&&(a=[{value_id:0,original_value_name:JSON.stringify(n),value_unit:i}]),a}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();var bt=function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t}(bt||{});var vt=()=>[];function ne(t,o){t&1&&(m(0,"span",5),f(1,"*"),c())}function oe(t,o){if(t&1&&_(0,"ng-select",6),t&2){let e=l().$implicit;p("multiple",!0)("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(4,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function re(t,o){if(t&1&&_(0,"input",8),t&2){let e=l(2).$implicit;p("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function ae(t,o){if(t&1&&(m(0,"option",15),f(1),c()),t&2){let e=o.$implicit;p("value",e),s(),at(e)}}function le(t,o){if(t&1&&(m(0,"div",10),_(1,"input",12),m(2,"select",13)(3,"option",14),f(4,"Unit"),c(),M(5,ae,2,2,"option",15,w),c()()),t&2){let e=l(3).$implicit;p("formGroupName",e.attribute_id),s(),p("placeholder","Isi "+(e==null?null:e.name)),s(2),p("value",null),s(2),U(e==null||e.attribute_info==null?null:e.attribute_info.attribute_unit_list)}}function ce(t,o){if(t&1&&_(0,"input",11),t&2){let e=l(3).$implicit;p("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function me(t,o){if(t&1&&h(0,le,7,3,"div",10)(1,ce,1,2,"input",11),t&2){let e=l(2).$implicit,n=l(2);b((e==null||e.attribute_info==null?null:e.attribute_info.format_type)==n.formatType.FORMAT_QUANTITATIVE_WITH_UNIT?0:1)}}function se(t,o){if(t&1&&_(0,"datepicker",9),t&2){let e=l(2).$implicit;p("formControlName",e.attribute_id)}}function pe(t,o){if(t&1&&h(0,re,1,2,"input",8)(1,me,2,1)(2,se,1,1,"datepicker",9),t&2){let e,n=l().$implicit,i=l(2);b((e=n==null||n.attribute_info==null?null:n.attribute_info.input_validation_type)===i.validationType.VALIDATOR_STRING_TYPE?0:e===i.validationType.VALIDATOR_FLOAT_TYPE?1:e===i.validationType.VALIDATOR_DATE_TYPE?2:-1)}}function de(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(3,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function ue(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(3,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function _e(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),h(2,ne,2,0,"span",5),m(3,"span"),f(4),c()(),h(5,oe,1,5,"ng-select",6)(6,pe,3,1)(7,de,1,4,"ng-select",7)(8,ue,1,4,"ng-select",7),c()),t&2){let e,n=o.$implicit,i=l(2);s(2),b(n.mandatory?2:-1),s(2),Z(" ",n==null?null:n.name," "),s(),b((e=n==null||n.attribute_info==null?null:n.attribute_info.input_type)===i.inputType.MULTI_COMBO_BOX?5:e===i.inputType.FREE_TEXT_FILED?6:e===i.inputType.SINGLE_COMBO_BOX?7:8)}}function fe(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,_e,9,3,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var Zt=(()=>{let o=class o{constructor(){this.formCategoryService=u(Ct),this.attributesChanges=new k,this.inputType=K,this.formatType=ot,this.validationType=bt}ngOnChanges(){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.formCategoryService.getAttributes({categoryId:this.categoryId,channelId:this.channelId,channelType:this.channelType}).pipe(P(n=>{this.form=this.formCategoryService.createFormGroup(n),this.listenToFormChange(n)}),tt(1)))}listenToFormChange(n){let i=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{i=this.formCategoryService.getFilteredAttributes(n,a),this.attributesChanges.emit(i)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["shopee-attribute-form"]],inputs:{channelType:"channelType",categoryId:"categoryId",channelId:"channelId",channelProductUpload:"channelProductUpload"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([Ct]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","value_id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","value_id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"],[1,"attribute-datepicker",3,"formControlName"],[1,"d-flex","align-items-center",3,"formGroupName"],["type","text","autoNum","",1,"form-control",3,"formControlName","placeholder"],["formControlName","value","type","text","autoNum","",1,"form-control","me-1",2,"width","200px",3,"placeholder"],["name","unit","id","unit","formControlName","unit",1,"form-control"],["disabled","","selected","",3,"value"],[3,"value"]],template:function(i,a){i&1&&(h(0,fe,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,wt,Mt,et,kt,L,X,z,Q,Ot,Yt,Qt,zt],styles:["input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{height:36px;border-radius:4px} datepicker.attribute-datepicker>mat-form-field.mat-mdc-form-field>.mat-mdc-text-field-wrapper{height:36px} datepicker.attribute-datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:11px!important;padding-bottom:11px!important;height:36px;min-height:36px!important} datepicker.attribute-datepicker mat-datepicker-toggle>button.mat-mdc-icon-button.mat-mdc-button-base{--mdc-icon-button-state-layer-size: 36px}"]});let t=o;return t})();var yt=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q),this.uploadProductService=u(pt)}getAttributes(n,i){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:i}]).pipe(Tt(r=>this.uploadProductService.selectedProduct$.pipe(E(d=>(r=this.mappingAttributeSalesProperty(r,d),r)))))}mappingAttributeSalesProperty(n,i){let a=0;return n.filter(r=>(r.type=="SALES_PROPERTY"&&(a+=1),a>1?(a=0,!1):!0)).map(r=>(r.type=="SALES_PROPERTY"&&(r.name="Jenis Variant",r.is_multiple_selection=!1,r.is_required=this.isProductHasMoreVariant(i),r.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),r))}isProductHasMoreVariant(n){let i=!1,a=[];return n.forEach(r=>{r.Variants&&a.push(r.Variants.length)}),i=a.some(r=>r>1),i}createFormGroup(n){let i=this.formBuilder.group({}),a=[];return n.forEach(r=>{a=[],r.is_required&&a.push(ct.required),i.addControl(r.id,this.formBuilder.control(null,a))}),i}getFilteredAttributes(n,i){let a=JSON.parse(JSON.stringify(n)),r=Object.keys(i),d=a.filter(C=>r.findIndex(ft=>parseInt(ft)==C.id)!=-1);return d=this.filterSelectedAttributes(d,i),d}filterSelectedAttributes(n,i){return n.map(r=>(g.IsNotEmpty(r.values)?r.is_multiple_selection?r.values=r.values.filter(d=>i[r.id]?.includes(d.id)):r.values=r.values.filter(d=>d.id==i[r.id]):i[r.id]&&(r.values=[{id:null,name:i[r.id]}]),r)).filter(r=>r?.values?.length>0)}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function he(t,o){t&1&&(m(0,"span",5),f(1,"*"),c())}function ge(t,o){if(t&1&&_(0,"ng-select",6),t&2){let e=l().$implicit;p("multiple",!0)("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function Ce(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function be(t,o){if(t&1&&_(0,"input",8),t&2){let e=l().$implicit;p("formControlName",e.id)("placeholder",e==null?null:e.name)}}function ve(t,o){if(t&1&&(m(0,"small",5),f(1),c()),t&2){let e=l().$implicit;s(),Z(" ",e==null?null:e.name," is mandatory ")}}function ye(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),h(2,he,2,0,"span",5),m(3,"span"),f(4),c()(),h(5,ge,1,4,"ng-select",6)(6,Ce,1,3,"ng-select",7)(7,be,1,2,"input",8)(8,ve,2,1,"small",5),c()),t&2){let e=o.$implicit;s(2),b(e.is_required?2:-1),s(2),Z(" ",e==null?null:e.name," "),s(),b(e.is_multiple_selection?5:e.values!==null&&e.values.length>0?6:7),s(3),b(e.is_required?8:-1)}}function xe(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,ye,9,4,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var Kt=(()=>{let o=class o{constructor(){this.tiktokAttributeFormService=u(yt),this.attributesChanges=new k}ngOnChanges(){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(this.channelId,this.categoryId).pipe(E(n=>n.filter(i=>!(i.type=="PRODUCT_PROPERTY"&&(g.IsEmpty(i.values)||i.values?.length==0)&&i.is_customizable==!1))),P(n=>{this.form=this.tiktokAttributeFormService.createFormGroup(n),this.listenToFormChange(n)}),tt(1)))}listenToFormChange(n){let i=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{i=this.tiktokAttributeFormService.getFilteredAttributes(n,a),this.attributesChanges.emit(i)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["tiktok-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([yt]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(i,a){i&1&&(h(0,xe,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,et,L,X,z,Q,it]});let t=o;return t})();var xt=(()=>{let o=class o{constructor(){this.woocommerceUploadService=u(st)}getAttributes(n,i){return this.woocommerceUploadService.getAttributes(n,i).pipe(E(a=>a.map(r=>({key:r.name,label:r.name}))))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();var te=(()=>{let o=class o{constructor(){this.wooAttributeFormService=u(xt),this.channelId=ht(),this.categoryId=ht(),this.attributesChanges=new k}ngOnChanges(){g.IsNotEmpty(this.categoryId())&&g.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(n){this.attributesChanges.emit([n.key])}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([xt]),O,I],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(i,a){i&1&&(m(0,"div",0)(1,"div",1)(2,"div",2),f(3,"Atribut"),c(),m(4,"ng-select",3),v(5,"async"),A("change",function(d){return a.onSelectAttribute(d)}),c()()()),i&2&&(s(4),p("items",y(5,1,a.attributes$)))},dependencies:[F,T,it,G,R,B]});let t=o;return t})();var St=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q)}getAttributes(n,i){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:i}]).pipe(E(r=>r))}createFormGroup(n){let i=this.formBuilder.group({});return n.forEach(a=>{i.addControl(a.variant,this.formBuilder.control(null))}),i}convertAttributes(n={}){return Object.values(n).filter(a=>a!==null).map(a=>JSON.stringify(a))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function Se(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),f(2),c(),_(3,"ng-select",5),c()),t&2){let e=o.$implicit;s(2),Z(" ",e==null?null:e.variant," "),s(),p("formControlName",e.variant)("items",e.values)("placeholder","Pilih "+(e==null?null:e.variant))}}function Ie(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,Se,4,4,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var ee=(()=>{let o=class o{constructor(){this.tokpedAttrFormService=u(St),this.attributesChanges=new k}ngOnInit(){}ngOnChanges(n){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(this.channelId,this.categoryId).pipe(P(i=>{this.form=this.tokpedAttrFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){let n=[];this.formSubscription=this.form.valueChanges.subscribe(i=>{n=this.tokpedAttrFormService.convertAttributes(i),this.attributesChanges.emit(n)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([St]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(i,a){i&1&&(h(0,Ie,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,L,X,z,Q]});let t=o;return t})();var It=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q)}getAttributes(n){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:n}]).pipe(P(a=>(a.Options.StatusOptions=a.Options.Status.map(r=>({id:r,name:r})),a)))}createFormGroup(n){let i=this.formBuilder.group({});return Object.keys(n.Attribute).forEach(r=>{i.addControl(r,this.formBuilder.control(null))}),i}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function Te(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2)(3,"div",3)(4,"div",4),f(5," Brand "),c(),_(6,"input",5),c(),m(7,"div",6)(8,"div",4),f(9," Product Type "),c(),_(10,"input",7),c(),m(11,"div",6)(12,"div",4),f(13," Status "),c(),_(14,"ng-select",8),c()()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(13),p("items",e.Options.StatusOptions)}}var ie=(()=>{let o=class o{constructor(){this.attributesChanges=new k,this.shopifyFormService=u(It)}ngOnChanges(n){n.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId).pipe(P(i=>{this.form=this.shopifyFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(Ft(500)).subscribe(n=>{this.attributesChanges.emit([n])})}ngOnDestroy(){this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["shopify-attribute-form"]],inputs:{channelId:"channelId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([It]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(i,a){i&1&&(h(0,Te,15,2,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,B,J,et,L,X,z,Q,G,R]});let t=o;return t})();function Fe(t,o){if(t&1&&(m(0,"div",6),_(1,"app-product-card",9),c()),t&2){let e=o.$implicit;s(),p("productId",e==null?null:e.ID)("title",e==null?null:e.Name)("image",e==null?null:e.ThumbnailUrl)("description",(e==null||e.Variants==null?null:e.Variants.length)>1?(e==null||e.Variants==null?null:e.Variants.length)+" Variants":null)("imageForZoom",e==null?null:e.ImageUrl)("code",e==null||e.Variants[0]==null?null:e.Variants[0].Code)("showFooter",!1)}}function Ae(t,o){if(t&1){let e=H();V(0),m(1,"mat-checkbox",21),Pt("ngModelChange",function(i){W(e);let a=l().$implicit;return Et(a.selected,i)||(a.selected=i),Y(i)}),A("ngModelChange",function(){let i=W(e).ngIf,a=l(),r=a.$implicit,d=a.$index,C=l();return Y(C.onSelectChannel(r,d,i))}),c(),D()}if(t&2){let e=l().$implicit;s(),At("ngModel",e.selected)}}function Ee(t,o){t&1&&(m(0,"div",18),_(1,"input",22),c())}function Pe(t,o){if(t&1){let e=H();m(0,"app-channel-category-select",23),A("selectedCategory",function(i){W(e);let a=l().$index,r=l();return Y(r.onCategoryChange(a,i))}),c()}if(t&2){let e=l().$implicit,n=l();p("disabled",!e.selected||e.selected&&e.type==n.channelType.Lazada)("channelId",e.id)("channelType",e.type)("categoryId",e.categoryId)}}function Ne(t,o){if(t&1){let e=H();m(0,"shopee-attribute-form",27),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)("channelType",e.type)}}function Oe(t,o){if(t&1){let e=H();m(0,"tiktok-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function ke(t,o){if(t&1){let e=H();m(0,"wooocommerce-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function we(t,o){if(t&1){let e=H();m(0,"tokopedia-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function Me(t,o){if(t&1&&(m(0,"div",20)(1,"div",24),h(2,Ne,1,3,"shopee-attribute-form",25)(3,Oe,1,2,"tiktok-attribute-form",26)(4,ke,1,2,"wooocommerce-attribute-form",26)(5,we,1,2,"tokopedia-attribute-form",26),c()()),t&2){let e,n=l().$implicit,i=l();s(2),b((e=n.type)===i.channelType.Shopee?2:e===i.channelType.Tiktok?3:e===i.channelType.WooCommerce?4:e===i.channelType.Tokopedia?5:-1)}}function Ue(t,o){if(t&1){let e=H();m(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",29),A("attributesChanges",function(i){W(e);let a=l().$index,r=l();return Y(r.onAttributesChange(a,i))}),c()()()}if(t&2){let e=l().$implicit;s(2),p("channelId",e.id)}}function Ve(t,o){if(t&1&&(m(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),h(6,Ae,2,1,"ng-container",14),v(7,"async"),c(),m(8,"div"),_(9,"app-channel-logo",15),c(),m(10,"div",16)(11,"span"),f(12),c()()()(),m(13,"div",12)(14,"div",17),h(15,Ee,2,0,"div",18)(16,Pe,1,4,"app-channel-category-select",19),c()()(),h(17,Me,6,1,"div",20)(18,Ue,3,1,"div",20),c()()),t&2){let e=o.$implicit,n=l();s(6),p("ngIf",y(7,8,n.defaultCategories$)),s(3),p("typeId",e.type)("showChannelName",!1),s(),p("matTooltip",e.name)("matTooltipShowDelay",2500),s(2),at(e.name),s(3),b(e.type==n.channelType.Shopify?15:16),s(2),b(e.categoryId&&n.channelType.Lazada!=e.type&&e.selected?17:n.channelType.Shopify==e.type&&e.selected?18:-1)}}var oo=(()=>{let o=class o{constructor(){this.uploadProductService=u(pt),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=Ut,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(tt(1))}onCategoryChange(n,i){this.channelProductUploads.update(a=>a.map((r,d)=>(d==n&&(r.categoryId=i,r.attributes=[]),r)))}onAttributesChange(n,i){this.channelProductUploads.update(a=>a.map((r,d)=>(d==n&&(r.attributes=i),r)))}onSelectChannel(n,i,a){this.channelProductUploads.update(r=>r.map((d,C)=>{if(C==i&&n.selected){let _t=this.findCategoryByChannelId(n.id,a);d.categoryId=_t?.DefaultCategoryID}return C==i&&!n.selected&&(d.categoryId=null),d}))}findCategoryByChannelId(n,i){return i.find(a=>a.ID===n)}onUploadProduct(){this.uploadProductService.onUploadProduct(this.channelProductUploads())}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["app-product-upload"]],standalone:!0,features:[S([mt,Gt,jt,st]),I],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],[4,"ngIf"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltip","Cannot change category, please change category in admin.shopify.com","matTooltipPosition","above"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(i,a){if(i&1&&(m(0,"mainpanel",0)(1,"actions")(2,"button",1),A("click",function(){return a.onUploadProduct()}),_(3,"i",2),f(4," Upload "),c()(),m(5,"content")(6,"div",3)(7,"h3",4),f(8,"Product To Upload"),c(),m(9,"div",5),M(10,Fe,2,7,"div",6,w),v(12,"async"),c(),m(13,"h3",7),f(14,"Channel To Upload"),c(),M(15,Ve,19,10,"div",8,w),c()()()),i&2){let r;p("hideSearchBox",!0)("hideSearchDropdown",!0),s(2),p("disabled",((r=a.channelProductUploads())==null?null:r.length)==0),s(8),U(y(12,3,a.selectedProducts$)),s(5),U(a.channelProductUploads())}},dependencies:[F,$,T,Ht,Lt,$t,Jt,Xt,Rt,Bt,it,L,Nt,Dt,Vt,Zt,Kt,te,ee,ie,Wt,qt],encapsulation:2});let t=o;return t})();export{oo as ProductUploadComponent};
1
+ import{b as qt}from"./chunk-RI7RZYID.js";import{a as zt,b as Qt}from"./chunk-XB345KSK.js";import"./chunk-MY4B7K3R.js";import{b as Ht}from"./chunk-IJYSJN63.js";import"./chunk-X5Q6FPWS.js";import"./chunk-46AOM3SM.js";import{a as Xt,b as Jt}from"./chunk-JXTGH22T.js";import"./chunk-OULUJ2IO.js";import{a as Bt,b as Rt}from"./chunk-NYDPS33K.js";import{a as mt,b as Gt,c as jt,d as st,e as pt}from"./chunk-P674TVHC.js";import"./chunk-FGPSBTFS.js";import"./chunk-JP44SOP7.js";import{a as Yt}from"./chunk-GCKSYCMI.js";import"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as Wt}from"./chunk-ZRPSM5PK.js";import"./chunk-FMV4LYKN.js";import"./chunk-3QG5QJ5P.js";import"./chunk-HCDKYABV.js";import{d as R,e as G}from"./chunk-CCXKODFV.js";import"./chunk-2DQJZ4SM.js";import{e as nt}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as $t,n as Lt}from"./chunk-BO4PPSB5.js";import{t as Vt,u as Dt}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as et,e as ct,h as L,i as X,l as gt,m as Nt,n as J,p as z,q as Ot,r as Q,s as kt,t as wt,u as Mt,x as q,y as it,z as B}from"./chunk-BSN7ZAXG.js";import{b as Ut,c as g}from"./chunk-6SF7AUOH.js";import"./chunk-OVEJFFL6.js";import{$b as A,Ca as O,Cd as F,Da as W,Ea as Y,Eb as h,Gb as p,Gc as v,Hc as y,K as Tt,M as Ft,Ma as ht,Nb as b,Ob as w,Pa as k,Qb as M,Rb as U,Sb as m,Tb as c,Ub as _,Vb as V,Wb as D,Yb as H,Z as tt,bc as l,ea as P,ja as N,jb as s,nc as f,oc as at,pa as u,pc as Z,rc as At,sc as Et,ta as x,tc as Pt,uc as S,v as E,vc as I,vd as $,wc as lt,yd as T}from"./chunk-PQDPS2ID.js";import"./chunk-GNOSNGXM.js";var K=function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t}(K||{});var ot=function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t}(ot||{});var Ct=(()=>{let o=class o{constructor(){this.shopeeUploadService=u(mt),this.formBuilder=u(q)}getAttributes(n){return this.shopeeUploadService.getAttributes(n.channelId,n.categoryId).pipe(E(i=>this.setLabelToIndonesian(i)))}setLabelToIndonesian(n=[]){let i,a;return n=n.map(r=>(i=r?.multi_lang?.find(d=>d.language=="id"),r.attribute_value_list=r?.attribute_value_list?.map(d=>(a=d?.multi_lang?.find(C=>C.language=="id"),d.name=a?.value,d)),r.name=i?.value?i?.value:r.name,r)),n}createFormGroup(n){let i=this.formBuilder.group({}),a=[];return n.forEach(r=>{if(a=[],r.mandatory&&a.push(ct.required),r?.attribute_info?.format_type==ot.FORMAT_QUANTITATIVE_WITH_UNIT&&r?.attribute_info?.input_type==K.FREE_TEXT_FILED){let d=this.formBuilder.group({unit:new gt(null),value:new gt(null,a)});i.addControl(JSON.stringify(r.attribute_id),d)}else i.addControl(JSON.stringify(r.attribute_id),this.formBuilder.control(null,a))}),i}getFilteredAttributes(n,i){let a=JSON.parse(JSON.stringify(n)),r=Object.keys(i),d=a.filter(C=>r.findIndex(ft=>parseInt(ft)==C.attribute_id||C.mandatory)!=-1);return d=this.filterSelectedAttributes(d,i),d}filterSelectedAttributes(n,i){return n.map(r=>{switch(r.attribute_info.input_type){case K.MULTI_COMBO_BOX:g.IsNotEmpty(i[r.attribute_id])?r.attribute_value_list=r.attribute_value_list.filter(d=>i[r.attribute_id]?.findIndex(C=>C==d.value_id)!=-1):r.attribute_value_list=[];break;case K.FREE_TEXT_FILED:r.attribute_info.format_type==ot.FORMAT_QUANTITATIVE_WITH_UNIT?r.attribute_value_list=this.setSelectedQuantitativeAttr(i[r.attribute_id]?.value,i[r.attribute_id]?.unit):g.IsNotEmpty(i[r.attribute_id])&&(r.attribute_value_list=[{value_id:0,name:i[r.attribute_id]}]);break;default:r.attribute_value_list=r.attribute_value_list.filter(d=>d.value_id==i[r.attribute_id])}return r}).filter(r=>r?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(n,i){let a=[];return g.IsNotEmpty(n)&&(a=[{value_id:0,original_value_name:JSON.stringify(n),value_unit:i}]),a}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();var bt=function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t}(bt||{});var vt=()=>[];function ne(t,o){t&1&&(m(0,"span",5),f(1,"*"),c())}function oe(t,o){if(t&1&&_(0,"ng-select",6),t&2){let e=l().$implicit;p("multiple",!0)("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(4,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function re(t,o){if(t&1&&_(0,"input",8),t&2){let e=l(2).$implicit;p("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function ae(t,o){if(t&1&&(m(0,"option",15),f(1),c()),t&2){let e=o.$implicit;p("value",e),s(),at(e)}}function le(t,o){if(t&1&&(m(0,"div",10),_(1,"input",12),m(2,"select",13)(3,"option",14),f(4,"Unit"),c(),M(5,ae,2,2,"option",15,w),c()()),t&2){let e=l(3).$implicit;p("formGroupName",e.attribute_id),s(),p("placeholder","Isi "+(e==null?null:e.name)),s(2),p("value",null),s(2),U(e==null||e.attribute_info==null?null:e.attribute_info.attribute_unit_list)}}function ce(t,o){if(t&1&&_(0,"input",11),t&2){let e=l(3).$implicit;p("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function me(t,o){if(t&1&&h(0,le,7,3,"div",10)(1,ce,1,2,"input",11),t&2){let e=l(2).$implicit,n=l(2);b((e==null||e.attribute_info==null?null:e.attribute_info.format_type)==n.formatType.FORMAT_QUANTITATIVE_WITH_UNIT?0:1)}}function se(t,o){if(t&1&&_(0,"datepicker",9),t&2){let e=l(2).$implicit;p("formControlName",e.attribute_id)}}function pe(t,o){if(t&1&&h(0,re,1,2,"input",8)(1,me,2,1)(2,se,1,1,"datepicker",9),t&2){let e,n=l().$implicit,i=l(2);b((e=n==null||n.attribute_info==null?null:n.attribute_info.input_validation_type)===i.validationType.VALIDATOR_STRING_TYPE?0:e===i.validationType.VALIDATOR_FLOAT_TYPE?1:e===i.validationType.VALIDATOR_DATE_TYPE?2:-1)}}function de(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(3,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function ue(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:lt(3,vt))("placeholder","Pilih "+(e==null?null:e.name))}}function _e(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),h(2,ne,2,0,"span",5),m(3,"span"),f(4),c()(),h(5,oe,1,5,"ng-select",6)(6,pe,3,1)(7,de,1,4,"ng-select",7)(8,ue,1,4,"ng-select",7),c()),t&2){let e,n=o.$implicit,i=l(2);s(2),b(n.mandatory?2:-1),s(2),Z(" ",n==null?null:n.name," "),s(),b((e=n==null||n.attribute_info==null?null:n.attribute_info.input_type)===i.inputType.MULTI_COMBO_BOX?5:e===i.inputType.FREE_TEXT_FILED?6:e===i.inputType.SINGLE_COMBO_BOX?7:8)}}function fe(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,_e,9,3,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var Zt=(()=>{let o=class o{constructor(){this.formCategoryService=u(Ct),this.attributesChanges=new k,this.inputType=K,this.formatType=ot,this.validationType=bt}ngOnChanges(){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.formCategoryService.getAttributes({categoryId:this.categoryId,channelId:this.channelId,channelType:this.channelType}).pipe(P(n=>{this.form=this.formCategoryService.createFormGroup(n),this.listenToFormChange(n)}),tt(1)))}listenToFormChange(n){let i=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{i=this.formCategoryService.getFilteredAttributes(n,a),this.attributesChanges.emit(i)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["shopee-attribute-form"]],inputs:{channelType:"channelType",categoryId:"categoryId",channelId:"channelId",channelProductUpload:"channelProductUpload"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([Ct]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","value_id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","value_id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"],[1,"attribute-datepicker",3,"formControlName"],[1,"d-flex","align-items-center",3,"formGroupName"],["type","text","autoNum","",1,"form-control",3,"formControlName","placeholder"],["formControlName","value","type","text","autoNum","",1,"form-control","me-1",2,"width","200px",3,"placeholder"],["name","unit","id","unit","formControlName","unit",1,"form-control"],["disabled","","selected","",3,"value"],[3,"value"]],template:function(i,a){i&1&&(h(0,fe,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,wt,Mt,et,kt,L,X,z,Q,Ot,Yt,Qt,zt],styles:["input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{height:36px;border-radius:4px} datepicker.attribute-datepicker>mat-form-field.mat-mdc-form-field>.mat-mdc-text-field-wrapper{height:36px} datepicker.attribute-datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:11px!important;padding-bottom:11px!important;height:36px;min-height:36px!important} datepicker.attribute-datepicker mat-datepicker-toggle>button.mat-mdc-icon-button.mat-mdc-button-base{--mdc-icon-button-state-layer-size: 36px}"]});let t=o;return t})();var yt=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q),this.uploadProductService=u(pt)}getAttributes(n,i){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:i}]).pipe(Tt(r=>this.uploadProductService.selectedProduct$.pipe(E(d=>(r=this.mappingAttributeSalesProperty(r,d),r)))))}mappingAttributeSalesProperty(n,i){let a=0;return n.filter(r=>(r.type=="SALES_PROPERTY"&&(a+=1),a>1?(a=0,!1):!0)).map(r=>(r.type=="SALES_PROPERTY"&&(r.name="Jenis Variant",r.is_multiple_selection=!1,r.is_required=this.isProductHasMoreVariant(i),r.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),r))}isProductHasMoreVariant(n){let i=!1,a=[];return n.forEach(r=>{r.Variants&&a.push(r.Variants.length)}),i=a.some(r=>r>1),i}createFormGroup(n){let i=this.formBuilder.group({}),a=[];return n.forEach(r=>{a=[],r.is_required&&a.push(ct.required),i.addControl(r.id,this.formBuilder.control(null,a))}),i}getFilteredAttributes(n,i){let a=JSON.parse(JSON.stringify(n)),r=Object.keys(i),d=a.filter(C=>r.findIndex(ft=>parseInt(ft)==C.id)!=-1);return d=this.filterSelectedAttributes(d,i),d}filterSelectedAttributes(n,i){return n.map(r=>(g.IsNotEmpty(r.values)?r.is_multiple_selection?r.values=r.values.filter(d=>i[r.id]?.includes(d.id)):r.values=r.values.filter(d=>d.id==i[r.id]):i[r.id]&&(r.values=[{id:null,name:i[r.id]}]),r)).filter(r=>r?.values?.length>0)}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function he(t,o){t&1&&(m(0,"span",5),f(1,"*"),c())}function ge(t,o){if(t&1&&_(0,"ng-select",6),t&2){let e=l().$implicit;p("multiple",!0)("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function Ce(t,o){if(t&1&&_(0,"ng-select",7),t&2){let e=l().$implicit;p("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function be(t,o){if(t&1&&_(0,"input",8),t&2){let e=l().$implicit;p("formControlName",e.id)("placeholder",e==null?null:e.name)}}function ve(t,o){if(t&1&&(m(0,"small",5),f(1),c()),t&2){let e=l().$implicit;s(),Z(" ",e==null?null:e.name," is mandatory ")}}function ye(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),h(2,he,2,0,"span",5),m(3,"span"),f(4),c()(),h(5,ge,1,4,"ng-select",6)(6,Ce,1,3,"ng-select",7)(7,be,1,2,"input",8)(8,ve,2,1,"small",5),c()),t&2){let e=o.$implicit;s(2),b(e.is_required?2:-1),s(2),Z(" ",e==null?null:e.name," "),s(),b(e.is_multiple_selection?5:e.values!==null&&e.values.length>0?6:7),s(3),b(e.is_required?8:-1)}}function xe(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,ye,9,4,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var Kt=(()=>{let o=class o{constructor(){this.tiktokAttributeFormService=u(yt),this.attributesChanges=new k}ngOnChanges(){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(this.channelId,this.categoryId).pipe(E(n=>n.filter(i=>!(i.type=="PRODUCT_PROPERTY"&&(g.IsEmpty(i.values)||i.values?.length==0)&&i.is_customizable==!1))),P(n=>{this.form=this.tiktokAttributeFormService.createFormGroup(n),this.listenToFormChange(n)}),tt(1)))}listenToFormChange(n){let i=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{i=this.tiktokAttributeFormService.getFilteredAttributes(n,a),this.attributesChanges.emit(i)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["tiktok-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([yt]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(i,a){i&1&&(h(0,xe,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,et,L,X,z,Q,it]});let t=o;return t})();var xt=(()=>{let o=class o{constructor(){this.woocommerceUploadService=u(st)}getAttributes(n,i){return this.woocommerceUploadService.getAttributes(n,i).pipe(E(a=>a.map(r=>({key:r.name,label:r.name}))))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();var te=(()=>{let o=class o{constructor(){this.wooAttributeFormService=u(xt),this.channelId=ht(),this.categoryId=ht(),this.attributesChanges=new k}ngOnChanges(){g.IsNotEmpty(this.categoryId())&&g.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(n){this.attributesChanges.emit([n.key])}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([xt]),O,I],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(i,a){i&1&&(m(0,"div",0)(1,"div",1)(2,"div",2),f(3,"Atribut"),c(),m(4,"ng-select",3),v(5,"async"),A("change",function(d){return a.onSelectAttribute(d)}),c()()()),i&2&&(s(4),p("items",y(5,1,a.attributes$)))},dependencies:[F,T,it,G,R,B]});let t=o;return t})();var St=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q)}getAttributes(n,i){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:i}]).pipe(E(r=>r))}createFormGroup(n){let i=this.formBuilder.group({});return n.forEach(a=>{i.addControl(a.variant,this.formBuilder.control(null))}),i}convertAttributes(n={}){return Object.values(n).filter(a=>a!==null).map(a=>JSON.stringify(a))}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function Se(t,o){if(t&1&&(m(0,"div",3)(1,"div",4),f(2),c(),_(3,"ng-select",5),c()),t&2){let e=o.$implicit;s(2),Z(" ",e==null?null:e.variant," "),s(),p("formControlName",e.variant)("items",e.values)("placeholder","Pilih "+(e==null?null:e.variant))}}function Ie(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2),M(3,Se,4,4,"div",3,w),c()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(2),U(e)}}var ee=(()=>{let o=class o{constructor(){this.tokpedAttrFormService=u(St),this.attributesChanges=new k}ngOnInit(){}ngOnChanges(n){g.IsNotEmpty(this.categoryId)&&g.IsNotEmpty(this.channelId)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(this.channelId,this.categoryId).pipe(P(i=>{this.form=this.tokpedAttrFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){let n=[];this.formSubscription=this.form.valueChanges.subscribe(i=>{n=this.tokpedAttrFormService.convertAttributes(i),this.attributesChanges.emit(n)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([St]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(i,a){i&1&&(h(0,Ie,5,1,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,G,R,B,J,L,X,z,Q]});let t=o;return t})();var It=(()=>{let o=class o{constructor(){this.httpService=u(nt),this.formBuilder=u(q)}getAttributes(n){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:n}]).pipe(P(a=>(a.Options.StatusOptions=a.Options.Status.map(r=>({id:r,name:r})),a)))}createFormGroup(n){let i=this.formBuilder.group({});return Object.keys(n.Attribute).forEach(r=>{i.addControl(r,this.formBuilder.control(null))}),i}};o.\u0275fac=function(i){return new(i||o)},o.\u0275prov=N({token:o,factory:o.\u0275fac});let t=o;return t})();function Te(t,o){if(t&1&&(V(0),m(1,"form",1)(2,"div",2)(3,"div",3)(4,"div",4),f(5," Brand "),c(),_(6,"input",5),c(),m(7,"div",6)(8,"div",4),f(9," Product Type "),c(),_(10,"input",7),c(),m(11,"div",6)(12,"div",4),f(13," Status "),c(),_(14,"ng-select",8),c()()(),D()),t&2){let e=o.ngIf,n=l();s(),p("formGroup",n.form),s(13),p("items",e.Options.StatusOptions)}}var ie=(()=>{let o=class o{constructor(){this.attributesChanges=new k,this.shopifyFormService=u(It)}ngOnChanges(n){n.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId).pipe(P(i=>{this.form=this.shopifyFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(Ft(500)).subscribe(n=>{this.attributesChanges.emit([n])})}ngOnDestroy(){this.formSubscription.unsubscribe()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["shopify-attribute-form"]],inputs:{channelId:"channelId"},outputs:{attributesChanges:"attributesChanges"},standalone:!0,features:[S([It]),O,I],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(i,a){i&1&&(h(0,Te,15,2,"ng-container",0),v(1,"async")),i&2&&p("ngIf",y(1,1,a.attributes$))},dependencies:[F,$,T,B,J,et,L,X,z,Q,G,R]});let t=o;return t})();function Fe(t,o){if(t&1&&(m(0,"div",6),_(1,"app-product-card",9),c()),t&2){let e=o.$implicit;s(),p("productId",e==null?null:e.ID)("title",e==null?null:e.Name)("image",e==null?null:e.ThumbnailUrl)("description",(e==null||e.Variants==null?null:e.Variants.length)>1?(e==null||e.Variants==null?null:e.Variants.length)+" Variants":null)("imageForZoom",e==null?null:e.ImageUrl)("code",e==null||e.Variants[0]==null?null:e.Variants[0].Code)("showFooter",!1)}}function Ae(t,o){if(t&1){let e=H();V(0),m(1,"mat-checkbox",21),Pt("ngModelChange",function(i){W(e);let a=l().$implicit;return Et(a.selected,i)||(a.selected=i),Y(i)}),A("ngModelChange",function(){let i=W(e).ngIf,a=l(),r=a.$implicit,d=a.$index,C=l();return Y(C.onSelectChannel(r,d,i))}),c(),D()}if(t&2){let e=l().$implicit;s(),At("ngModel",e.selected)}}function Ee(t,o){t&1&&(m(0,"div",18),_(1,"input",22),c())}function Pe(t,o){if(t&1){let e=H();m(0,"app-channel-category-select",23),A("selectedCategory",function(i){W(e);let a=l().$index,r=l();return Y(r.onCategoryChange(a,i))}),c()}if(t&2){let e=l().$implicit,n=l();p("disabled",!e.selected||e.selected&&e.type==n.channelType.Lazada)("channelId",e.id)("channelType",e.type)("categoryId",e.categoryId)}}function Ne(t,o){if(t&1){let e=H();m(0,"shopee-attribute-form",27),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)("channelType",e.type)}}function Oe(t,o){if(t&1){let e=H();m(0,"tiktok-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function ke(t,o){if(t&1){let e=H();m(0,"wooocommerce-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function we(t,o){if(t&1){let e=H();m(0,"tokopedia-attribute-form",28),A("attributesChanges",function(i){W(e);let a=l(2).$index,r=l();return Y(r.onAttributesChange(a,i))}),c()}if(t&2){let e=l(2).$implicit;p("categoryId",e.categoryId)("channelId",e.id)}}function Me(t,o){if(t&1&&(m(0,"div",20)(1,"div",24),h(2,Ne,1,3,"shopee-attribute-form",25)(3,Oe,1,2,"tiktok-attribute-form",26)(4,ke,1,2,"wooocommerce-attribute-form",26)(5,we,1,2,"tokopedia-attribute-form",26),c()()),t&2){let e,n=l().$implicit,i=l();s(2),b((e=n.type)===i.channelType.Shopee?2:e===i.channelType.Tiktok?3:e===i.channelType.WooCommerce?4:e===i.channelType.Tokopedia?5:-1)}}function Ue(t,o){if(t&1){let e=H();m(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",29),A("attributesChanges",function(i){W(e);let a=l().$index,r=l();return Y(r.onAttributesChange(a,i))}),c()()()}if(t&2){let e=l().$implicit;s(2),p("channelId",e.id)}}function Ve(t,o){if(t&1&&(m(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),h(6,Ae,2,1,"ng-container",14),v(7,"async"),c(),m(8,"div"),_(9,"app-channel-logo",15),c(),m(10,"div",16)(11,"span"),f(12),c()()()(),m(13,"div",12)(14,"div",17),h(15,Ee,2,0,"div",18)(16,Pe,1,4,"app-channel-category-select",19),c()()(),h(17,Me,6,1,"div",20)(18,Ue,3,1,"div",20),c()()),t&2){let e=o.$implicit,n=l();s(6),p("ngIf",y(7,8,n.defaultCategories$)),s(3),p("typeId",e.type)("showChannelName",!1),s(),p("matTooltip",e.name)("matTooltipShowDelay",2500),s(2),at(e.name),s(3),b(e.type==n.channelType.Shopify?15:16),s(2),b(e.categoryId&&n.channelType.Lazada!=e.type&&e.selected?17:n.channelType.Shopify==e.type&&e.selected?18:-1)}}var oo=(()=>{let o=class o{constructor(){this.uploadProductService=u(pt),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=Ut,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(tt(1))}onCategoryChange(n,i){this.channelProductUploads.update(a=>a.map((r,d)=>(d==n&&(r.categoryId=i,r.attributes=[]),r)))}onAttributesChange(n,i){this.channelProductUploads.update(a=>a.map((r,d)=>(d==n&&(r.attributes=i),r)))}onSelectChannel(n,i,a){this.channelProductUploads.update(r=>r.map((d,C)=>{if(C==i&&n.selected){let _t=this.findCategoryByChannelId(n.id,a);d.categoryId=_t?.DefaultCategoryID}return C==i&&!n.selected&&(d.categoryId=null),d}))}findCategoryByChannelId(n,i){return i.find(a=>a.ID===n)}onUploadProduct(){this.uploadProductService.onUploadProduct(this.channelProductUploads())}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}};o.\u0275fac=function(i){return new(i||o)},o.\u0275cmp=x({type:o,selectors:[["app-product-upload"]],standalone:!0,features:[S([mt,Gt,jt,st]),I],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],[4,"ngIf"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltip","Cannot change category, please change category in admin.shopify.com","matTooltipPosition","above"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(i,a){if(i&1&&(m(0,"mainpanel",0)(1,"actions")(2,"button",1),A("click",function(){return a.onUploadProduct()}),_(3,"i",2),f(4," Upload "),c()(),m(5,"content")(6,"div",3)(7,"h3",4),f(8,"Product To Upload"),c(),m(9,"div",5),M(10,Fe,2,7,"div",6,w),v(12,"async"),c(),m(13,"h3",7),f(14,"Channel To Upload"),c(),M(15,Ve,19,10,"div",8,w),c()()()),i&2){let r;p("hideSearchBox",!0)("hideSearchDropdown",!0),s(2),p("disabled",((r=a.channelProductUploads())==null?null:r.length)==0),s(8),U(y(12,3,a.selectedProducts$)),s(5),U(a.channelProductUploads())}},dependencies:[F,$,T,Ht,Lt,$t,Jt,Xt,Rt,Bt,it,L,Nt,Dt,Vt,Zt,Kt,te,ee,ie,Wt,qt],encapsulation:2});let t=o;return t})();export{oo as ProductUploadComponent};
@@ -1,4 +1,4 @@
1
- import{a as ne,b as oe,c as re,d as ae,e as le,f as pe,g as se}from"./chunk-TPGBOTD4.js";import{b as ie}from"./chunk-4LFFAE2I.js";import{a as ee,b as te}from"./chunk-UN2U4YFQ.js";import{a as X}from"./chunk-FYZFHN47.js";import{i as Q}from"./chunk-HK66WK22.js";import{e as J}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Y,n as Z}from"./chunk-BO4PPSB5.js";import"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as G,h as z,m as K,y as q}from"./chunk-BSN7ZAXG.js";import"./chunk-6SF7AUOH.js";import{n as W,p as j,r as $}from"./chunk-OVEJFFL6.js";import{$b as y,Cd as H,Da as g,Ea as h,Eb as c,Gb as s,Pa as M,Sb as o,Tb as r,Ub as d,Vb as f,Wb as _,Yb as S,bc as u,fb as k,ja as D,jb as p,ka as T,kb as I,mc as v,nc as m,oa as U,oc as O,pc as B,rc as L,sc as F,ta as C,tc as R,ua as N,uc as P,ud as w,vd as V,wd as A,xc as x}from"./chunk-PQDPS2ID.js";import"./chunk-GNOSNGXM.js";var ge=e=>[e];function he(e,t){if(e&1&&(f(0),o(1,"a",9),m(2),r(),_()),e&2){let a=t.$implicit;p(),s("routerLink",x(2,ge,a.url)),p(),B(" ",a.title,"")}}var ce=(()=>{let t=class t{constructor(){this.tabs=[{Title:"Download By Url",Url:"/menu/products/download/by-url",Description:"Download products information by product URL as a parameter"}],this.moreMenu=[{title:"Sold In Channel",url:"/menu/products/status/sold-in-channel"},{title:"In POS",url:"/menu/products/status/in-pos"},{title:"Not In Channel",url:"/menu/products/status/not-in-channel"},{title:"Duplicate SKU",url:"/menu/products/status/duplicate-sku"}]}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=C({type:t,selectors:[["app-download"]],decls:12,vars:2,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-block"],[4,"ngFor","ngForOf"],[1,"dropdown-item",3,"routerLink"]],template:function(i,l){i&1&&(o(0,"nav",0)(1,"div",1)(2,"div"),d(3,"nav-tab",2),r()(),o(4,"div")(5,"div",3)(6,"a",4),d(7,"i",5),r(),o(8,"div",6)(9,"div",7),c(10,he,3,4,"ng-container",8),r()()()()(),d(11,"router-outlet")),i&2&&(p(3),s("Tabs",l.tabs),p(7),s("ngForOf",l.moreMenu))},dependencies:[w,ee,W,j]});let e=t;return e})();var E=(()=>{let t=class t{constructor(n){this.httpService=n}download(n){return this.httpService.post("/api/Product/downloadurl",n)}};t.\u0275fac=function(i){return new(i||t)(U(J))},t.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();var Ce=e=>({"background-color":e});function ye(e,t){if(e&1&&(o(0,"th"),m(1),r()),e&2){let a=t.$implicit;p(),O(a.column)}}function ve(e,t){if(e&1&&(f(0),o(1,"td"),d(2,"span",6),r(),_()),e&2){let a=t.$implicit,n=u().$implicit;p(2),s("innerHTML",n[a.prop],k)}}function xe(e,t){if(e&1&&(o(0,"tr",5),c(1,ve,3,1,"ng-container",3),r()),e&2){let a=t.$implicit,n=u();s("ngStyle",x(2,Ce,a.Status>200?"#F4D6D5":"#DEE9C9")),p(),s("ngForOf",n.configs)}}var de=(()=>{let t=class t{constructor(){this.eventClose=new M}ngOnInit(){}onClose(){this.eventClose.emit()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=C({type:t,selectors:[["app-response-api-list"]],inputs:{configs:"configs",data:"data",status:"status"},outputs:{eventClose:"onClose"},decls:7,vars:2,consts:[[1,"table-responsive"],[1,"table"],[1,"thead-light"],[4,"ngFor","ngForOf"],[3,"ngStyle",4,"ngFor","ngForOf"],[3,"ngStyle"],[3,"innerHTML"]],template:function(i,l){i&1&&(o(0,"div",0)(1,"table",1)(2,"thead",2)(3,"tr"),c(4,ye,2,1,"th",3),r()(),o(5,"tbody"),c(6,xe,2,4,"tr",4),r()()()),i&2&&(p(4),s("ngForOf",l.configs),p(2),s("ngForOf",l.data))},dependencies:[w,A]});let e=t;return e})();function be(e,t){if(e&1){let a=S();f(0),o(1,"button",15),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onNewStepperState(l))}),d(2,"i",16),m(3," New "),r(),_()}}function Ee(e,t){if(e&1){let a=S();f(0),o(1,"button",15),y("click",function(){g(a),u();let i=v(11);return h(i.previous())}),m(2," Back "),r(),_()}}function Ie(e,t){if(e&1){let a=S();f(0),o(1,"button",17),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onStepperNext(l))}),m(2," Next "),r(),_()}}function De(e,t){if(e&1){let a=S();f(0),o(1,"button",18),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onSubmit(l))}),m(2,"Download"),r(),_()}if(e&2){let a=u();p(),s("disabled",!a.urls)}}function Te(e,t){e&1&&(d(0,"i",19),o(1,"span"),m(2,"Instruction"),r())}function Ue(e,t){e&1&&(o(0,"div",20)(1,"div",21)(2,"div",22)(3,"h4",23),m(4,"Note"),r()(),o(5,"div",24)(6,"ol",25)(7,"li"),m(8," Use this form to Download Products from Tokopedia using product URL "),r(),o(9,"li"),m(10," Copy Product URL from "),o(11,"a",26),m(12,"https://seller.tokopedia.com/ "),r(),m(13," and paste in this form "),r(),o(14,"li"),m(15," Use New Line when you want to input several product URLs "),r()()()()())}function Ne(e,t){e&1&&(d(0,"i",27),o(1,"span"),m(2,"Download"),r())}function Me(e,t){if(e&1){let a=S();o(0,"div",20)(1,"textarea",28),R("ngModelChange",function(i){g(a);let l=u();return F(l.urls,i)||(l.urls=i),h(i)}),r()()}if(e&2){let a=u();p(),s("placeholder",a.urlPlaceholder),L("ngModel",a.urls)}}function ke(e,t){e&1&&(d(0,"i",29),o(1,"span"),m(2,"Finish"),r())}function Oe(e,t){if(e&1&&(o(0,"div",20),d(1,"app-response-api-list",30),r()),e&2){let a=u();p(),s("data",a.downloadResponses)("configs",a.configs)}}function Be(e,t){e&1&&(o(0,"h6"),m(1,"1"),r())}function Le(e,t){e&1&&(o(0,"h6"),m(1,"2"),r())}function Fe(e,t){e&1&&(o(0,"h6"),m(1,"3"),r())}var ue=(()=>{let t=class t{constructor(n,i){this.downloadService=n,this.authService=i,this.configs=[{column:"Url",prop:"URL"},{column:"POS",prop:"Name"},{column:"Exception",prop:"Message"}],this.downloadResponses=[],this.stepperState="DOWNLOAD",this.urlPlaceholder=`https://tokopedia.com/tokoriyanadi/kaos-polos-biru
1
+ import{a as ne,b as oe,c as re,d as ae,e as le,f as pe,g as se}from"./chunk-TPGBOTD4.js";import{b as ie}from"./chunk-4LFFAE2I.js";import{a as ee,b as te}from"./chunk-UN2U4YFQ.js";import{a as X}from"./chunk-KNWBPJ23.js";import{i as Q}from"./chunk-2DQJZ4SM.js";import{e as J}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Y,n as Z}from"./chunk-BO4PPSB5.js";import"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as G,h as z,m as K,y as q}from"./chunk-BSN7ZAXG.js";import"./chunk-6SF7AUOH.js";import{n as W,p as j,r as $}from"./chunk-OVEJFFL6.js";import{$b as y,Cd as H,Da as g,Ea as h,Eb as c,Gb as s,Pa as M,Sb as o,Tb as r,Ub as d,Vb as f,Wb as _,Yb as S,bc as u,fb as k,ja as D,jb as p,ka as T,kb as I,mc as v,nc as m,oa as U,oc as O,pc as B,rc as L,sc as F,ta as C,tc as R,ua as N,uc as P,ud as w,vd as V,wd as A,xc as x}from"./chunk-PQDPS2ID.js";import"./chunk-GNOSNGXM.js";var ge=e=>[e];function he(e,t){if(e&1&&(f(0),o(1,"a",9),m(2),r(),_()),e&2){let a=t.$implicit;p(),s("routerLink",x(2,ge,a.url)),p(),B(" ",a.title,"")}}var ce=(()=>{let t=class t{constructor(){this.tabs=[{Title:"Download By Url",Url:"/menu/products/download/by-url",Description:"Download products information by product URL as a parameter"}],this.moreMenu=[{title:"Sold In Channel",url:"/menu/products/status/sold-in-channel"},{title:"In POS",url:"/menu/products/status/in-pos"},{title:"Not In Channel",url:"/menu/products/status/not-in-channel"},{title:"Duplicate SKU",url:"/menu/products/status/duplicate-sku"}]}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=C({type:t,selectors:[["app-download"]],decls:12,vars:2,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-block"],[4,"ngFor","ngForOf"],[1,"dropdown-item",3,"routerLink"]],template:function(i,l){i&1&&(o(0,"nav",0)(1,"div",1)(2,"div"),d(3,"nav-tab",2),r()(),o(4,"div")(5,"div",3)(6,"a",4),d(7,"i",5),r(),o(8,"div",6)(9,"div",7),c(10,he,3,4,"ng-container",8),r()()()()(),d(11,"router-outlet")),i&2&&(p(3),s("Tabs",l.tabs),p(7),s("ngForOf",l.moreMenu))},dependencies:[w,ee,W,j]});let e=t;return e})();var E=(()=>{let t=class t{constructor(n){this.httpService=n}download(n){return this.httpService.post("/api/Product/downloadurl",n)}};t.\u0275fac=function(i){return new(i||t)(U(J))},t.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();var Ce=e=>({"background-color":e});function ye(e,t){if(e&1&&(o(0,"th"),m(1),r()),e&2){let a=t.$implicit;p(),O(a.column)}}function ve(e,t){if(e&1&&(f(0),o(1,"td"),d(2,"span",6),r(),_()),e&2){let a=t.$implicit,n=u().$implicit;p(2),s("innerHTML",n[a.prop],k)}}function xe(e,t){if(e&1&&(o(0,"tr",5),c(1,ve,3,1,"ng-container",3),r()),e&2){let a=t.$implicit,n=u();s("ngStyle",x(2,Ce,a.Status>200?"#F4D6D5":"#DEE9C9")),p(),s("ngForOf",n.configs)}}var de=(()=>{let t=class t{constructor(){this.eventClose=new M}ngOnInit(){}onClose(){this.eventClose.emit()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=C({type:t,selectors:[["app-response-api-list"]],inputs:{configs:"configs",data:"data",status:"status"},outputs:{eventClose:"onClose"},decls:7,vars:2,consts:[[1,"table-responsive"],[1,"table"],[1,"thead-light"],[4,"ngFor","ngForOf"],[3,"ngStyle",4,"ngFor","ngForOf"],[3,"ngStyle"],[3,"innerHTML"]],template:function(i,l){i&1&&(o(0,"div",0)(1,"table",1)(2,"thead",2)(3,"tr"),c(4,ye,2,1,"th",3),r()(),o(5,"tbody"),c(6,xe,2,4,"tr",4),r()()()),i&2&&(p(4),s("ngForOf",l.configs),p(2),s("ngForOf",l.data))},dependencies:[w,A]});let e=t;return e})();function be(e,t){if(e&1){let a=S();f(0),o(1,"button",15),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onNewStepperState(l))}),d(2,"i",16),m(3," New "),r(),_()}}function Ee(e,t){if(e&1){let a=S();f(0),o(1,"button",15),y("click",function(){g(a),u();let i=v(11);return h(i.previous())}),m(2," Back "),r(),_()}}function Ie(e,t){if(e&1){let a=S();f(0),o(1,"button",17),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onStepperNext(l))}),m(2," Next "),r(),_()}}function De(e,t){if(e&1){let a=S();f(0),o(1,"button",18),y("click",function(){g(a);let i=u(),l=v(11);return h(i.onSubmit(l))}),m(2,"Download"),r(),_()}if(e&2){let a=u();p(),s("disabled",!a.urls)}}function Te(e,t){e&1&&(d(0,"i",19),o(1,"span"),m(2,"Instruction"),r())}function Ue(e,t){e&1&&(o(0,"div",20)(1,"div",21)(2,"div",22)(3,"h4",23),m(4,"Note"),r()(),o(5,"div",24)(6,"ol",25)(7,"li"),m(8," Use this form to Download Products from Tokopedia using product URL "),r(),o(9,"li"),m(10," Copy Product URL from "),o(11,"a",26),m(12,"https://seller.tokopedia.com/ "),r(),m(13," and paste in this form "),r(),o(14,"li"),m(15," Use New Line when you want to input several product URLs "),r()()()()())}function Ne(e,t){e&1&&(d(0,"i",27),o(1,"span"),m(2,"Download"),r())}function Me(e,t){if(e&1){let a=S();o(0,"div",20)(1,"textarea",28),R("ngModelChange",function(i){g(a);let l=u();return F(l.urls,i)||(l.urls=i),h(i)}),r()()}if(e&2){let a=u();p(),s("placeholder",a.urlPlaceholder),L("ngModel",a.urls)}}function ke(e,t){e&1&&(d(0,"i",29),o(1,"span"),m(2,"Finish"),r())}function Oe(e,t){if(e&1&&(o(0,"div",20),d(1,"app-response-api-list",30),r()),e&2){let a=u();p(),s("data",a.downloadResponses)("configs",a.configs)}}function Be(e,t){e&1&&(o(0,"h6"),m(1,"1"),r())}function Le(e,t){e&1&&(o(0,"h6"),m(1,"2"),r())}function Fe(e,t){e&1&&(o(0,"h6"),m(1,"3"),r())}var ue=(()=>{let t=class t{constructor(n,i){this.downloadService=n,this.authService=i,this.configs=[{column:"Url",prop:"URL"},{column:"POS",prop:"Name"},{column:"Exception",prop:"Message"}],this.downloadResponses=[],this.stepperState="DOWNLOAD",this.urlPlaceholder=`https://tokopedia.com/tokoriyanadi/kaos-polos-biru
2
2
  https://tokopedia.com/tokoriyanadi/Celana-Chinos-Coklat`,this.currentDomain=this.authService.getDomain()}onStepperChange(n){this.stepperState=n.selectedStep.state}onSubmit(n){let i=this.urls.split(/\r?\n/);this.downloadService.download(i).subscribe(l=>{this.downloadResponses=l,this.mappingLinkToProduct(),this.onStepperNext(n)})}mappingLinkToProduct(){this.downloadResponses=this.downloadResponses.map(n=>(n.Name=n?.Name?`<a href="${this.currentDomain}/menu/Products/Catalog/Products/Info?ID=${n.ID}" target="_blank">
3
3
  ${n?.Name}
4
4
  </a>`:"-",n))}onNewStepperState(n){this.downloadResponses=[],this.urls=null,this.stepperState="DOWNLOAD",n.reset(),this.onStepperNext(n)}onStepperNext(n){n.selected.completed=!0,n.next()}};t.\u0275fac=function(i){return new(i||t)(I(E),I(Q))},t.\u0275cmp=C({type:t,selectors:[["app-by-url"]],features:[P([{provide:ne,useValue:{displayDefaultIndicatorType:!1}}])],decls:24,vars:11,consts:[["stepper",""],["headerTitle","Tokopedia - Product Download By Url",3,"hideSearchBox","hideSearchDropdown"],[4,"ngIf"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-12"],["linear","",1,"stepper-downloadByUrl",3,"selectionChange","selectedIndex"],["state","GUIDE",3,"editable","completed"],["matStepLabel",""],["matStepContent",""],["state","DOWNLOAD",3,"editable","completed"],["state","FINISH"],["matStepperIcon","GUIDE"],["matStepperIcon","DOWNLOAD"],["matStepperIcon","FINISH"],[1,"btn","btn-outline-secondary","btn-fill","btn-lg",3,"click"],["aria-hidden","true",1,"fa","fa-file-alt","me-2"],["type","button",1,"btn","btn-outline-secondary","btn-fill","btn-lg","ms-3",3,"click"],["role","button",1,"btn","btn-success","btn-fill","btn-lg","text-white","ms-3",3,"click","disabled"],[1,"fa-solid","fa-info","me-3"],[1,"mt-8"],[1,"card","border","w-50"],[1,"card-header","py-6"],[1,"text-primary"],[1,"card-body",2,"padding-left","0px"],[1,"mt-6"],["href","https://seller.tokopedia.com","target","_blank"],[1,"fa-solid","fa-download","me-3"],["name","url","cols","30","rows","25",1,"form-control",3,"ngModelChange","placeholder","ngModel"],[1,"fa-sharp","fa-solid","fa-flag","me-3"],["status","error",3,"data","configs"]],template:function(i,l){if(i&1){let fe=S();o(0,"mainpanel",1)(1,"actions"),c(2,be,4,0,"ng-container",2)(3,Ee,3,0,"ng-container",2)(4,Ie,3,0,"ng-container",2)(5,De,3,1,"ng-container",2),r(),o(6,"content")(7,"div",3)(8,"div",4)(9,"div",5)(10,"mat-stepper",6,0),y("selectionChange",function(_e){return g(fe),h(l.onStepperChange(_e))}),o(12,"mat-step",7),c(13,Te,3,0,"ng-template",8)(14,Ue,16,0,"ng-template",9),r(),o(15,"mat-step",10),c(16,Ne,3,0,"ng-template",8)(17,Me,2,2,"ng-template",9),r(),o(18,"mat-step",11),c(19,ke,3,0,"ng-template",8)(20,Oe,2,2,"ng-template",9),r(),c(21,Be,2,0,"ng-template",12)(22,Le,2,0,"ng-template",13)(23,Fe,2,0,"ng-template",14),r()()()()()()}i&2&&(s("hideSearchBox",!0)("hideSearchDropdown",!0),p(2),s("ngIf",l.stepperState=="FINISH"),p(),s("ngIf",l.stepperState=="DOWNLOAD"),p(),s("ngIf",l.stepperState=="GUIDE"),p(),s("ngIf",l.stepperState=="DOWNLOAD"),p(5),s("selectedIndex",1),p(2),s("editable",l.stepperState!="FINISH")("completed",!0),p(3),s("editable",l.stepperState!="FINISH")("completed",!1))},dependencies:[V,G,z,K,Y,le,oe,pe,re,ae,de],styles:[`@import"https://fonts.googleapis.com/icon?family=Material+Icons";.card-header{background-color:#00000008}mat-stepper.stepper-downloadByUrl>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container{position:relative;width:60%;left:18%}
@@ -1 +1 @@
1
- import{a as ct}from"./chunk-6MEL53S4.js";import{a as Ct}from"./chunk-BQ7NR3ET.js";import{a as ht,b as ft}from"./chunk-UMNGKENU.js";import{f as gt}from"./chunk-HCDKYABV.js";import{b as D,c as E,i as k,j as w}from"./chunk-BO4PPSB5.js";import{t as P}from"./chunk-HUUFOAKH.js";import{X as mt}from"./chunk-E5GGIVK7.js";import{h as st,m as pt}from"./chunk-BSN7ZAXG.js";import{b as m,c as f}from"./chunk-6SF7AUOH.js";import{o as dt}from"./chunk-OVEJFFL6.js";import{$b as v,Bd as rt,Da as F,Ea as L,Eb as C,Fb as z,Gb as p,Gc as x,Hc as O,Jc as ot,Nb as G,Ob as et,Qb as nt,Rb as it,Sb as a,Tb as r,Ub as y,Vb as H,Wb as J,Yb as R,Z as X,bc as h,gb as I,jb as l,kb as g,mc as at,nc as s,oc as u,pa as Z,pc as S,rc as V,sc as U,sd as B,ta as T,tc as A,ud as K,v as Q,vd as $,xb as tt,xc as W,yd as lt}from"./chunk-PQDPS2ID.js";function bt(n,d){if(n&1&&(a(0,"mat-option",10)(1,"div",11),y(2,"img",12),a(3,"span"),s(4),r()()()),n&2){let t=d.$implicit;p("value",t.ID)("disabled",t.disabled),l(),p("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),l(),p("src",t.Img,I),l(2),u(t.Name)}}function Tt(n,d){if(n&1){let t=R();a(0,"div",13)(1,"label",14),s(2,"Scan Type"),r(),a(3,"mat-radio-group",15),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.ScanFull,e)||(o.filter.ScanFull=e),L(e)}),a(4,"mat-radio-button",16),s(5," Full (Include Inactive Products) "),r(),a(6,"mat-radio-button",17),s(7," Active "),r()()()}if(n&2){let t=h();l(3),V("ngModel",t.filter.ScanFull),l(),p("value",!0),l(2),p("value",!1)}}function It(n,d){n&1&&(a(0,"span"),s(1,"Never"),r())}function xt(n,d){if(n&1&&(a(0,"span"),s(1),x(2,"async"),r()),n&2){let t=h(2);l(),u(O(2,1,t.lastSync$))}}function Ot(n,d){if(n&1){let t=R();a(0,"div",8)(1,"label",3)(2,"span",18),s(3,"Last Scan:"),r(),C(4,It,2,0,"span"),x(5,"async"),C(6,xt,3,3,"span"),r(),a(7,"mat-radio-group",19),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.UpdatedProduct,e)||(o.filter.UpdatedProduct=e),L(e)}),a(8,"mat-radio-button",20),s(9," Scan All Products "),r(),a(10,"mat-radio-button",21),s(11),r()()()}if(n&2){let t=h();l(4),G(O(5,6,t.lastSync$)==null?4:6),l(3),V("ngModel",t.filter.UpdatedProduct),l(),p("value",!1),l(2),p("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"),l(),S(" ",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Pt(n,d){if(n&1){let t=R();a(0,"div",8)(1,"label",3),s(2," Scan Option "),r(),a(3,"mat-radio-group",22),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.Async,e)||(o.filter.Async=e),L(e)}),a(4,"mat-radio-button",23),s(5," Asynchronous (Get Notified when Complete) "),r(),a(6,"mat-radio-button",24),s(7," Synchronous (Wait until Complete) "),r()()()}if(n&2){let t=h();l(3),V("ngModel",t.filter.Async),l(),p("value",!0),l(2),p("value",!1)}}var te=(()=>{let d=class d{constructor(i,e,o){this.dialogRef=i,this.data=e,this.router=o,this.channelService=Z(ct),this.channelType=m,this.disabledChannelOption=!1,this.filter={ChannelID:f.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=f.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=f.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(i=>(i.disabled=!0,(i.TypeID==m.Tiktok||i.TypeID==m.Tokopedia||i.TypeID==m.Lazada||i.TypeID==m.WooCommerce)&&(i.disabled=!1),i)).sort(i=>i.disabled?1:-1))}onSelectChannel(i){let e=this.filterChannelById(i);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate(),this.getLastSync(i)}getLastSync(i){this.lastSync$=this.channelService.getLastSync(i).pipe(Q(e=>f.IsNotEmpty(e.LastSync)?f.convertToReadableDate(e.LastSync):null),X(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&f.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(i){let e;return this.channelOptions&&(e=this.channelOptions.find(o=>o.ID==i)),e}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(i){return f.IsNotEmpty(i)}onClose(){this.dialogRef.close()}};d.\u0275fac=function(e){return new(e||d)(g(D),g(E),g(dt))},d.\u0275cmp=T({type:d,selectors:[["app-scan-dialog"]],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(e,o){e&1&&(a(0,"modal-material",0),v("onOk",function(){return o.submit()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),a(1,"div",1)(2,"div",2)(3,"label",3),s(4,"Select a Channel"),r(),a(5,"mat-form-field",4)(6,"mat-select",5),A("ngModelChange",function(c){return U(o.filter.ChannelID,c)||(o.filter.ChannelID=c),c}),v("ngModelChange",function(c){return o.onSelectChannel(c)}),C(7,bt,5,5,"mat-option",6),r()(),C(8,Tt,8,3,"div",7)(9,Ot,12,8,"div",8)(10,Pt,8,3,"div",9),r()()()),e&2&&(p("dynamicValidated",o.isNotEmpty(o.filter.ChannelID))("config",o.modalConfig),l(6),p("disabled",o.disabledChannelOption),V("ngModel",o.filter.ChannelID),l(),p("ngForOf",o.channelOptions),l(),p("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)),l(),G(o.hasScanUpdate&&o.selectedChannel?9:-1),l(),p("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)))},dependencies:[K,$,st,pt,ht,ft,gt,Ct,mt,P,w,lt],encapsulation:2});let n=d;return n})();var M=function(n){return n.Tokopedia="https://seller.tokopedia.com",n.Shoope="https://seller.shopee.co.id",n.Tiktok="https://seller-id.tiktok.com",n.WooCommerce="https://woocommerce.dealpos.app",n.Lazada="https://sellercenter.lazada.co.id",n}(M||{});var Dt=n=>({"is-disabled":n});function Et(n,d){if(n&1&&(H(0),a(1,"tr")(2,"td",11),s(3),r(),a(4,"td",11),s(5),r(),a(6,"td",12)(7,"p",13),s(8,"Product Not in Channel!"),r()()(),J()),n&2){let t=h().$implicit;l(3),S(" ",t==null?null:t.Model,""),l(2),S(" ",t==null?null:t.Code,"")}}function kt(n,d){if(n&1&&(a(0,"td",11),s(1),r()),n&2){let t=h(3).$implicit;z("rowspan",t.Channel.length),l(),S(" ",t==null?null:t.Model,"")}}function wt(n,d){if(n&1&&(a(0,"td",11),s(1),r()),n&2){let t=h(3).$implicit;z("rowspan",t.Channel.length),l(),S(" ",t==null?null:t.Code,"")}}function Nt(n,d){if(n&1&&(a(0,"tr"),C(1,kt,2,2,"td",14)(2,wt,2,2,"td",14),a(3,"td",11)(4,"div",15)(5,"a",16),y(6,"img",17),r(),a(7,"div",18),s(8),r()()(),a(9,"td",11),s(10),x(11,"number"),r(),a(12,"td",19),s(13),x(14,"number"),r(),a(15,"td",19)(16,"a",20),y(17,"i",21),a(18,"span",22),s(19,"Edit"),r()()()()),n&2){let t=d.$implicit,i=d.index,e=h(3);l(),p("ngIf",i==0),l(),p("ngIf",i==0),l(3),p("href",t.Url,I)("title",t.Title),l(),p("src",e.getChannelLogo(t.TypeID),I),l(),p("matTooltip",(t==null||t.Name==null?null:t.Name.length)>55?t==null?null:t.Name:""),l(),S(" ",t.Name," "),l(2),u(O(11,12,t.Price)),l(3),u(O(14,14,t.Inventory)),l(3),p("href",e.getHyperlinkSellerCenter(t),I)("ngClass",W(16,Dt,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 Vt(n,d){if(n&1&&C(0,Nt,20,18,"tr",9),n&2){let t=h().$implicit;p("ngForOf",t==null?null:t.Channel)}}function Ut(n,d){if(n&1&&(H(0),C(1,Et,9,2,"ng-container",10)(2,Vt,1,1,"ng-template",null,0,ot),J()),n&2){let t=d.$implicit,i=at(3);l(),p("ngIf",!t.Channel||t.Channel.length<1)("ngIfElse",i)}}var de=(()=>{let d=class d{constructor(i,e){this.data=i,this.dialogRef=e,this.channelType=m,this.variants=i.variants,this.title=i.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(i){return f.getChannelLogoByTypeId(i)}getHyperlinkSellerCenter(i){let e="javascript:void(0)";switch(i.TypeID){case m.Shopee:e=`${M.Shoope}/portal/product/${i.ChannelItemID}`;break;case m.Tiktok:e=`${M.Tiktok}/product/edit/${i.ChannelItemID}`;break;case m.Tokopedia:e=`${M.Tokopedia}/edit-product/${i.ChannelItemID}`;break;case m.WooCommerce:e=`${M.WooCommerce}/wp-admin/post.php?post=${i.ChannelItemID}&action=edit`;break;case m.Lazada:e=`${M.Lazada}/apps/product/publish?productId=${i.ChannelItemID}`;break}return e}};d.\u0275fac=function(e){return new(e||d)(g(E),g(D))},d.\u0275cmp=T({type:d,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[["printChannelModal",""],[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["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,"ngFor","ngForOf"],[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"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,o){e&1&&(a(0,"modal-material",1),v("onCancel",function(){return o.dialogRef.close()}),a(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),s(6," VARIANT "),a(7,"sup"),y(8,"i",6),r()(),a(9,"th",5),s(10,"SKU"),r(),a(11,"th",5),s(12," PRODUCT "),a(13,"sup"),y(14,"i",7),r()(),a(15,"th",5),s(16,"PRICE"),r(),a(17,"th",8),s(18,"INVENTORY"),r(),y(19,"th",5),r()(),a(20,"tbody"),C(21,Ut,4,2,"ng-container",9),r()()()()),e&2&&(p("config",o.modalConfig),l(21),p("ngForOf",o.variants))},dependencies:[B,K,$,P,w,rt],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}"]});let n=d;return n})();var At=n=>({"bg-gradient-warning":n});function Ft(n,d){if(n&1&&(a(0,"tr",5)(1,"td"),s(2),r(),a(3,"td",6),s(4),r()()),n&2){let t=d.$implicit;p("matTooltip",t.duplicateMessage),l(2),u(t==null?null:t.Name),l(),p("ngClass",W(4,At,t.isDuplicate)),l(),u(t!=null&&t.ChannelVariationSKU?t==null?null:t.ChannelVariationSKU:"Not Assigned")}}var Ce=(()=>{let d=class d{constructor(i,e){this.data=i,this.dialogRef=e,this.variants=tt([])}ngOnInit(){this.initModalConfig(),this.initVariants()}initVariants(){let i=this.data?.variants,e={},o=[],_=i.filter(c=>f.IsEmpty(c.ChannelVariationSKU));i.filter(c=>f.IsNotEmpty(c.ChannelVariationSKU)).forEach((c,b,Y)=>{e[c.ChannelVariationSKU]=Y.filter(N=>N.ChannelVariationSKU===c.ChannelVariationSKU)}),Object.keys(e).forEach(c=>{e[c].length>1&&(e[c]=e[c].map((b,Y,N)=>{let q=`SKU ${b.ChannelVariationSKU} is duplicated with variant`;return N.forEach((j,Mt)=>{j.Name!==b.Name&&(q+=` ${N.length>2?j.Name+(Mt!==N.length-1?",":""):j.Name}`)}),b.duplicateMessage=q,b.isDuplicate=!0,b})),o.push(...e[c])}),o.push(..._),this.variants.set(o)}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.modalConfig.bodyScrollable=!0}};d.\u0275fac=function(e){return new(e||d)(g(E),g(D))},d.\u0275cmp=T({type:d,selectors:[["app-modal-variants"]],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(e,o){e&1&&(a(0,"modal-material",0),v("onCancel",function(){return o.dialogRef.close()}),a(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),s(6,"Variant"),r(),a(7,"th",4),s(8,"SKU"),r()()(),a(9,"tbody"),nt(10,Ft,5,6,"tr",5,et),r()()()()),e&2&&(p("config",o.modalConfig),l(10),it(o.variants()))},dependencies:[B,P,w],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}"]});let n=d;return n})();export{te as a,de as b,Ce as c};
1
+ import{a as ct}from"./chunk-7AFVU7XM.js";import{a as Ct}from"./chunk-BQ7NR3ET.js";import{a as ht,b as ft}from"./chunk-UMNGKENU.js";import{f as gt}from"./chunk-HCDKYABV.js";import{b as D,c as E,i as k,j as w}from"./chunk-BO4PPSB5.js";import{t as P}from"./chunk-HUUFOAKH.js";import{X as mt}from"./chunk-E5GGIVK7.js";import{h as st,m as pt}from"./chunk-BSN7ZAXG.js";import{b as m,c as f}from"./chunk-6SF7AUOH.js";import{o as dt}from"./chunk-OVEJFFL6.js";import{$b as v,Bd as rt,Da as F,Ea as L,Eb as C,Fb as z,Gb as p,Gc as x,Hc as O,Jc as ot,Nb as G,Ob as et,Qb as nt,Rb as it,Sb as a,Tb as r,Ub as y,Vb as H,Wb as J,Yb as R,Z as X,bc as h,gb as I,jb as l,kb as g,mc as at,nc as s,oc as u,pa as Z,pc as S,rc as V,sc as U,sd as B,ta as T,tc as A,ud as K,v as Q,vd as $,xb as tt,xc as W,yd as lt}from"./chunk-PQDPS2ID.js";function bt(n,d){if(n&1&&(a(0,"mat-option",10)(1,"div",11),y(2,"img",12),a(3,"span"),s(4),r()()()),n&2){let t=d.$implicit;p("value",t.ID)("disabled",t.disabled),l(),p("matTooltip",t.disabled?"Single Product Scan disabled for this type of Channel":null),l(),p("src",t.Img,I),l(2),u(t.Name)}}function Tt(n,d){if(n&1){let t=R();a(0,"div",13)(1,"label",14),s(2,"Scan Type"),r(),a(3,"mat-radio-group",15),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.ScanFull,e)||(o.filter.ScanFull=e),L(e)}),a(4,"mat-radio-button",16),s(5," Full (Include Inactive Products) "),r(),a(6,"mat-radio-button",17),s(7," Active "),r()()()}if(n&2){let t=h();l(3),V("ngModel",t.filter.ScanFull),l(),p("value",!0),l(2),p("value",!1)}}function It(n,d){n&1&&(a(0,"span"),s(1,"Never"),r())}function xt(n,d){if(n&1&&(a(0,"span"),s(1),x(2,"async"),r()),n&2){let t=h(2);l(),u(O(2,1,t.lastSync$))}}function Ot(n,d){if(n&1){let t=R();a(0,"div",8)(1,"label",3)(2,"span",18),s(3,"Last Scan:"),r(),C(4,It,2,0,"span"),x(5,"async"),C(6,xt,3,3,"span"),r(),a(7,"mat-radio-group",19),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.UpdatedProduct,e)||(o.filter.UpdatedProduct=e),L(e)}),a(8,"mat-radio-button",20),s(9," Scan All Products "),r(),a(10,"mat-radio-button",21),s(11),r()()()}if(n&2){let t=h();l(4),G(O(5,6,t.lastSync$)==null?4:6),l(3),V("ngModel",t.filter.UpdatedProduct),l(),p("value",!1),l(2),p("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"),l(),S(" ",t.selectedChannel.TypeID==t.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Pt(n,d){if(n&1){let t=R();a(0,"div",8)(1,"label",3),s(2," Scan Option "),r(),a(3,"mat-radio-group",22),A("ngModelChange",function(e){F(t);let o=h();return U(o.filter.Async,e)||(o.filter.Async=e),L(e)}),a(4,"mat-radio-button",23),s(5," Asynchronous (Get Notified when Complete) "),r(),a(6,"mat-radio-button",24),s(7," Synchronous (Wait until Complete) "),r()()()}if(n&2){let t=h();l(3),V("ngModel",t.filter.Async),l(),p("value",!0),l(2),p("value",!1)}}var te=(()=>{let d=class d{constructor(i,e,o){this.dialogRef=i,this.data=e,this.router=o,this.channelService=Z(ct),this.channelType=m,this.disabledChannelOption=!1,this.filter={ChannelID:f.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=f.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=f.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.isSingleChannel?"Scan Single Product":"Scan Channel Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(i=>(i.disabled=!0,(i.TypeID==m.Tiktok||i.TypeID==m.Tokopedia||i.TypeID==m.Lazada||i.TypeID==m.WooCommerce)&&(i.disabled=!1),i)).sort(i=>i.disabled?1:-1))}onSelectChannel(i){let e=this.filterChannelById(i);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate(),this.getLastSync(i)}getLastSync(i){this.lastSync$=this.channelService.getLastSync(i).pipe(Q(e=>f.IsNotEmpty(e.LastSync)?f.convertToReadableDate(e.LastSync):null),X(1))}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&f.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(i){let e;return this.channelOptions&&(e=this.channelOptions.find(o=>o.ID==i)),e}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(i){return f.IsNotEmpty(i)}onClose(){this.dialogRef.close()}};d.\u0275fac=function(e){return new(e||d)(g(D),g(E),g(dt))},d.\u0275cmp=T({type:d,selectors:[["app-scan-dialog"]],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(e,o){e&1&&(a(0,"modal-material",0),v("onOk",function(){return o.submit()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),a(1,"div",1)(2,"div",2)(3,"label",3),s(4,"Select a Channel"),r(),a(5,"mat-form-field",4)(6,"mat-select",5),A("ngModelChange",function(c){return U(o.filter.ChannelID,c)||(o.filter.ChannelID=c),c}),v("ngModelChange",function(c){return o.onSelectChannel(c)}),C(7,bt,5,5,"mat-option",6),r()(),C(8,Tt,8,3,"div",7)(9,Ot,12,8,"div",8)(10,Pt,8,3,"div",9),r()()()),e&2&&(p("dynamicValidated",o.isNotEmpty(o.filter.ChannelID))("config",o.modalConfig),l(6),p("disabled",o.disabledChannelOption),V("ngModel",o.filter.ChannelID),l(),p("ngForOf",o.channelOptions),l(),p("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)),l(),G(o.hasScanUpdate&&o.selectedChannel?9:-1),l(),p("ngIf",!o.isSingleChannel&&o.isNotEmpty(o.filter.ChannelID)))},dependencies:[K,$,st,pt,ht,ft,gt,Ct,mt,P,w,lt],encapsulation:2});let n=d;return n})();var M=function(n){return n.Tokopedia="https://seller.tokopedia.com",n.Shoope="https://seller.shopee.co.id",n.Tiktok="https://seller-id.tiktok.com",n.WooCommerce="https://woocommerce.dealpos.app",n.Lazada="https://sellercenter.lazada.co.id",n}(M||{});var Dt=n=>({"is-disabled":n});function Et(n,d){if(n&1&&(H(0),a(1,"tr")(2,"td",11),s(3),r(),a(4,"td",11),s(5),r(),a(6,"td",12)(7,"p",13),s(8,"Product Not in Channel!"),r()()(),J()),n&2){let t=h().$implicit;l(3),S(" ",t==null?null:t.Model,""),l(2),S(" ",t==null?null:t.Code,"")}}function kt(n,d){if(n&1&&(a(0,"td",11),s(1),r()),n&2){let t=h(3).$implicit;z("rowspan",t.Channel.length),l(),S(" ",t==null?null:t.Model,"")}}function wt(n,d){if(n&1&&(a(0,"td",11),s(1),r()),n&2){let t=h(3).$implicit;z("rowspan",t.Channel.length),l(),S(" ",t==null?null:t.Code,"")}}function Nt(n,d){if(n&1&&(a(0,"tr"),C(1,kt,2,2,"td",14)(2,wt,2,2,"td",14),a(3,"td",11)(4,"div",15)(5,"a",16),y(6,"img",17),r(),a(7,"div",18),s(8),r()()(),a(9,"td",11),s(10),x(11,"number"),r(),a(12,"td",19),s(13),x(14,"number"),r(),a(15,"td",19)(16,"a",20),y(17,"i",21),a(18,"span",22),s(19,"Edit"),r()()()()),n&2){let t=d.$implicit,i=d.index,e=h(3);l(),p("ngIf",i==0),l(),p("ngIf",i==0),l(3),p("href",t.Url,I)("title",t.Title),l(),p("src",e.getChannelLogo(t.TypeID),I),l(),p("matTooltip",(t==null||t.Name==null?null:t.Name.length)>55?t==null?null:t.Name:""),l(),S(" ",t.Name," "),l(2),u(O(11,12,t.Price)),l(3),u(O(14,14,t.Inventory)),l(3),p("href",e.getHyperlinkSellerCenter(t),I)("ngClass",W(16,Dt,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 Vt(n,d){if(n&1&&C(0,Nt,20,18,"tr",9),n&2){let t=h().$implicit;p("ngForOf",t==null?null:t.Channel)}}function Ut(n,d){if(n&1&&(H(0),C(1,Et,9,2,"ng-container",10)(2,Vt,1,1,"ng-template",null,0,ot),J()),n&2){let t=d.$implicit,i=at(3);l(),p("ngIf",!t.Channel||t.Channel.length<1)("ngIfElse",i)}}var de=(()=>{let d=class d{constructor(i,e){this.data=i,this.dialogRef=e,this.channelType=m,this.variants=i.variants,this.title=i.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(i){return f.getChannelLogoByTypeId(i)}getHyperlinkSellerCenter(i){let e="javascript:void(0)";switch(i.TypeID){case m.Shopee:e=`${M.Shoope}/portal/product/${i.ChannelItemID}`;break;case m.Tiktok:e=`${M.Tiktok}/product/edit/${i.ChannelItemID}`;break;case m.Tokopedia:e=`${M.Tokopedia}/edit-product/${i.ChannelItemID}`;break;case m.WooCommerce:e=`${M.WooCommerce}/wp-admin/post.php?post=${i.ChannelItemID}&action=edit`;break;case m.Lazada:e=`${M.Lazada}/apps/product/publish?productId=${i.ChannelItemID}`;break}return e}};d.\u0275fac=function(e){return new(e||d)(g(E),g(D))},d.\u0275cmp=T({type:d,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[["printChannelModal",""],[3,"onCancel","config"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["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,"ngFor","ngForOf"],[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"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,o){e&1&&(a(0,"modal-material",1),v("onCancel",function(){return o.dialogRef.close()}),a(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th",5),s(6," VARIANT "),a(7,"sup"),y(8,"i",6),r()(),a(9,"th",5),s(10,"SKU"),r(),a(11,"th",5),s(12," PRODUCT "),a(13,"sup"),y(14,"i",7),r()(),a(15,"th",5),s(16,"PRICE"),r(),a(17,"th",8),s(18,"INVENTORY"),r(),y(19,"th",5),r()(),a(20,"tbody"),C(21,Ut,4,2,"ng-container",9),r()()()()),e&2&&(p("config",o.modalConfig),l(21),p("ngForOf",o.variants))},dependencies:[B,K,$,P,w,rt],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}"]});let n=d;return n})();var At=n=>({"bg-gradient-warning":n});function Ft(n,d){if(n&1&&(a(0,"tr",5)(1,"td"),s(2),r(),a(3,"td",6),s(4),r()()),n&2){let t=d.$implicit;p("matTooltip",t.duplicateMessage),l(2),u(t==null?null:t.Name),l(),p("ngClass",W(4,At,t.isDuplicate)),l(),u(t!=null&&t.ChannelVariationSKU?t==null?null:t.ChannelVariationSKU:"Not Assigned")}}var Ce=(()=>{let d=class d{constructor(i,e){this.data=i,this.dialogRef=e,this.variants=tt([])}ngOnInit(){this.initModalConfig(),this.initVariants()}initVariants(){let i=this.data?.variants,e={},o=[],_=i.filter(c=>f.IsEmpty(c.ChannelVariationSKU));i.filter(c=>f.IsNotEmpty(c.ChannelVariationSKU)).forEach((c,b,Y)=>{e[c.ChannelVariationSKU]=Y.filter(N=>N.ChannelVariationSKU===c.ChannelVariationSKU)}),Object.keys(e).forEach(c=>{e[c].length>1&&(e[c]=e[c].map((b,Y,N)=>{let q=`SKU ${b.ChannelVariationSKU} is duplicated with variant`;return N.forEach((j,Mt)=>{j.Name!==b.Name&&(q+=` ${N.length>2?j.Name+(Mt!==N.length-1?",":""):j.Name}`)}),b.duplicateMessage=q,b.isDuplicate=!0,b})),o.push(...e[c])}),o.push(..._),this.variants.set(o)}initModalConfig(){this.modalConfig=new k,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0,this.modalConfig.bodyScrollable=!0}};d.\u0275fac=function(e){return new(e||d)(g(E),g(D))},d.\u0275cmp=T({type:d,selectors:[["app-modal-variants"]],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(e,o){e&1&&(a(0,"modal-material",0),v("onCancel",function(){return o.dialogRef.close()}),a(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),s(6,"Variant"),r(),a(7,"th",4),s(8,"SKU"),r()()(),a(9,"tbody"),nt(10,Ft,5,6,"tr",5,et),r()()()()),e&2&&(p("config",o.modalConfig),l(10),it(o.variants()))},dependencies:[B,P,w],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}"]});let n=d;return n})();export{te as a,de as b,Ce as c};
@@ -1,4 +1,4 @@
1
- import{a as Qe,b as j,c as Je}from"./chunk-YC44HHHF.js";import"./chunk-B2TH5YJH.js";import{a as Ye,b as Ge,c as Ue,e as je,f as Ke,g as He}from"./chunk-TPGBOTD4.js";import"./chunk-4LFFAE2I.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import{f as Le,g as Be,h as Ae,i as $e,j as ze}from"./chunk-FGPSBTFS.js";import{a as Re}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as ke,b as Ne,c as We}from"./chunk-UMNGKENU.js";import"./chunk-FMV4LYKN.js";import"./chunk-HCDKYABV.js";import{c as Ee,d as Pe,e as Ie}from"./chunk-CCXKODFV.js";import{g as te,i as ie}from"./chunk-HK66WK22.js";import{b as Te,e as be}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Fe,n as Oe}from"./chunk-BO4PPSB5.js";import{t as Me,u as Ve}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as ve,h as ye,m as xe,y as De}from"./chunk-BSN7ZAXG.js";import{b as ee,c as D}from"./chunk-6SF7AUOH.js";import{p as Se,r as Ce}from"./chunk-OVEJFFL6.js";import{$b as S,Cd as k,Da as c,Ea as u,Eb as w,Gb as m,Gc as L,Hc as U,Ic as we,Jc as J,Ma as N,Nb as E,Pa as H,Sb as r,Tb as a,Ub as C,Vb as W,Wb as R,Yb as x,Z as Y,aa as se,bc as h,ea as G,ec as me,fc as ce,fd as q,gb as de,hc as ue,ic as he,ja as pe,jb as l,jc as fe,m as le,mc as b,nc as p,oc as F,pa as y,pc as v,rc as P,sc as I,sd as B,ta as V,tc as M,uc as Q,ud as A,v as K,vc as O,vd as $,xb as g,xc as _e,yc as ge,yd as X,zd as Z}from"./chunk-PQDPS2ID.js";import{a as re,b as oe}from"./chunk-GNOSNGXM.js";var et=e=>({"over-due":e});function tt(e,o){if(e&1&&(r(0,"tr",8)(1,"td"),p(2),a(),r(3,"td"),p(4),a(),r(5,"td"),p(6),a(),r(7,"td"),p(8),a()()),e&2){let s=o.$implicit,t=o.index;m("ngClass",_e(5,et,s.Exception)),l(2),F(t+1),l(2),F(s.Number),l(2),F(s.Status),l(2),F(s.Exception)}}function it(e,o){if(e&1&&(W(0),w(1,tt,9,7,"tr",7),R()),e&2){let s,t=h();l(),m("ngForOf",(s=t.downloadResult())==null?null:s.Body)}}function nt(e,o){e&1&&(r(0,"tr",9)(1,"td",10)(2,"div",11),C(3,"i",12),a(),r(4,"h4",13),p(5," There is no order to processed "),a()()())}var qe=(()=>{let o=class o{constructor(){this.downloadResult=N()}ngOnInit(){}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["complete-step"]],inputs:{downloadResult:[1,"downloadResult"]},standalone:!0,features:[O],decls:16,vars:2,consts:[["EMPTY_DOWNLOAD",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"table"],[1,"thead-light"],["width","1%"],[4,"ngIf","ngIfElse"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1&&(r(0,"div",1)(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr"),C(5,"th",5),r(6,"th"),p(7,"Order Number"),a(),r(8,"th"),p(9,"Status"),a(),r(10,"th"),p(11,"Exception"),a()()(),r(12,"tbody"),w(13,it,2,1,"ng-container",6)(14,nt,6,0,"ng-template",null,0,J),a()()()()),n&2){let d,f=b(15);l(13),m("ngIf",((d=i.downloadResult())==null||d.Body==null?null:d.Body.length)>0)("ngIfElse",f)}},dependencies:[k,B,A,$]});let e=o;return e})();var z=(()=>{let o=class o{constructor(){this.httpService=y(be),this.toastr=y(Te),this.datePipe=y(Z)}gerChannelDetailById(t){return this.httpService.post(te.GetChannelDetail,{ID:t})}getOrderPreview(t){return this.httpService.post(te.GetOrderPreviewV2,t)}getDownloadOrder(t){return this.httpService.post(te.GetDownloadOrderV2,t)}onPreviewOrder(t){return this.validateDatePreview(t)?this.getOrderPreview(t).pipe(G(n=>{n.Data?.length===0&&this.toastrEmptyPreview(t)})):le}toastrEmptyPreview(t){let n=this.datePipe.transform(t.From,"dd MMM yyyy"),i=this.datePipe.transform(t.To,"dd MMM yyyy"),d=t.TimeFrom?t.TimeFrom:"",f=t.TimeTo?t.TimeTo:"";this.toastr.info(`There is no orders from ${n} ${d} to ${i} ${f}!`,"No Orders!")}validateDatePreview(t){let n=!0;return t.downloadType==!0?D.getDaysDiff(t?.From,t?.To)+1>7&&(this.toastr.warning("Dates cannot be more than 7 days apart!","Warning"),n=!1):D.getDaysDiff(t?.From,t?.To)+1>14&&(this.toastr.warning("Dates cannot be more than 14 days apart!","Warning"),n=!1),n}getDateTitle(t,n){let i=D.formatTitleFromDate(new Date(t),new Date(n)),d=this.datePipe.transform(t,i),f=this.datePipe.transform(n,"dd MMM yyyy");return`${i==null?"":d+"-"} ${f}`}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=pe({token:o,factory:o.\u0275fac});let e=o;return e})();function at(e,o){if(e&1&&(r(0,"ng-option",13),C(1,"img",14),p(2),a()),e&2){let s=o.$implicit;m("value",s.ID),l(),m("src",s==null?null:s.Img,de),l(),v("",s.Name," ")}}function rt(e,o){if(e&1){let s=x();r(0,"div",8)(1,"div",4)(2,"h5"),p(3,"Type"),a(),r(4,"p",5),p(5,"Select Type want to download"),a()(),r(6,"div",4)(7,"div",15)(8,"div")(9,"mat-radio-group",16),M("ngModelChange",function(n){c(s);let i=h();return I(i.downloadType,n)||(i.downloadType=n),u(n)}),S("ngModelChange",function(){c(s);let n=h();return u(n.onDownloadTypeChange())}),r(10,"mat-radio-button",17),p(11," Orders "),a(),r(12,"mat-radio-button",18),p(13," Disbursement "),a()()()(),r(14,"div",19)(15,"div",20),C(16,"i",21),a(),r(17,"p",22),p(18," If there are completed transactions, to obtain payment and service fee, you need to download disbursement. "),a()()()()}if(e&2){let s=h();l(9),P("ngModel",s.downloadType),l(),m("value",!1),l(2),m("value",!0)}}function ot(e,o){e&1&&(r(0,"p",5),p(1," Select Disbursement date "),r(2,"span",23),p(3,"(payment date / order complete date)"),a(),p(4," of the channel you want to download (Max 1 Week). "),a())}function lt(e,o){e&1&&(r(0,"p",5),p(1," Select transaction date of the channel you want to download (Max 2 Weeks) "),a())}function st(e,o){if(e&1){let s=x();r(0,"div",12)(1,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.startTime,n)||(i.startTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onStartTimeChange())}),a(),r(2,"span",25),p(3,"-"),a(),r(4,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.endTime,n)||(i.endTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onEndTimeChange())}),a()()}if(e&2){let s=h();l(),P("time",s.startTime),l(3),P("time",s.endTime)}}var Xe=(()=>{let o=class o{constructor(){this.reset=N(!1),this.authService=y(ie),this.downloadService=y(z),this.downloadType=g(!1),this.selectedChannelId=g(null),this.channelOptions=g(this.authService.getChannels()),this.channelType=ee,this.selectedChannel=g(null),this.showTimePicker=g(!1),this.startDate=g(null),this.endDate=g(null),this.startTime=g("00:00"),this.endTime=g("23:59"),this.filterData=new H,q(()=>{this.reset()&&this.resetFilter()},{allowSignalWrites:!0})}resetFilter(){this.selectedChannelId.update(()=>null),this.startDate.update(()=>null),this.endDate.update(()=>null),this.startTime.update(()=>null),this.endTime.update(()=>null),this.downloadType.update(()=>!1),this.selectedChannel.update(()=>null),this.showTimePicker.update(()=>!1),this.channelDetail$=null}onSelectChannel(){this.selectedChannel.update(()=>this.channelOptions().find(t=>t.ID===this.selectedChannelId())),this.selectedChannel()?this.channelDetail$=this.downloadService.gerChannelDetailById(this.selectedChannelId()).pipe(K(t=>t?.Model),Y(1)):this.channelDetail$=null,this.emitFilterData()}onFilterDateChange(){let t=1;this.startDate()&&this.endDate()&&(t=D.getDaysDiff(this.startDate(),this.endDate())),this.showTimePicker.update(()=>t==0),this.emitFilterData()}onDownloadTypeChange(){this.emitFilterData()}onStartTimeChange(){this.emitFilterData()}onEndTimeChange(){this.emitFilterData()}emitFilterData(){this.filterData.emit({channelId:this.selectedChannelId(),startDate:this.startDate(),endDate:this.endDate(),downloadType:this.downloadType(),startTime:this.startTime(),endTime:this.endTime()})}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["filter-step"]],inputs:{reset:[1,"reset"]},outputs:{filterData:"onFilterChange"},standalone:!0,features:[Q([z]),O],decls:27,vars:11,consts:[["picker",""],[1,"row","pt-2",2,"width","63%","margin-right","40px"],[1,"col-12"],[1,"row"],[1,"col-6"],[1,"text-muted"],["appendTo","body","placeholder","Select Channel",3,"ngModelChange","clearable","ngModel"],[3,"value",4,"ngFor","ngForOf"],[1,"row","mt-6"],["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,"mt-8"],[3,"value"],[2,"width","18px","margin-right","10px",3,"src"],[1,"form-label-group","radio","download-type",2,"margin-bottom","0px"],["name","dowloadType",3,"ngModelChange","ngModel"],["matTooltip","Download from Create sales order until create logistics status",1,"me-5",3,"value"],["matTooltip","Download only Payment and write off",1,"me-5",3,"value"],[1,"d-flex","border","mb-4","pt-6","px-6","mt-3",2,"background","#1f87ac0a","border-radius","5px"],[1,"me-3","pt-1"],[1,"fa","fa-lightbulb","fs-5"],[1,"mb-6"],[1,"fw-bold"],[3,"timeChange","time"],[1,"mx-4"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"h5"),p(5,"Select a Channel"),a(),r(6,"p",5),p(7,"Select Channel want to download order"),a()(),r(8,"div",4)(9,"ng-select",6),M("ngModelChange",function(_){return c(d),I(i.selectedChannelId,_)||(i.selectedChannelId=_),u(_)}),S("ngModelChange",function(){return c(d),u(i.onSelectChannel())}),w(10,at,3,3,"ng-option",7),a()()(),w(11,rt,19,3,"div",8),L(12,"async"),r(13,"div",8)(14,"div",4)(15,"h5"),p(16,"Date Range"),a(),w(17,ot,5,0,"p",5)(18,lt,2,0,"p",5),a(),r(19,"div",4)(20,"div",2)(21,"mat-date-range-input",9)(22,"input",10),M("ngModelChange",function(_){return c(d),I(i.startDate,_)||(i.startDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())}),a(),r(23,"input",11),M("ngModelChange",function(_){return c(d),I(i.endDate,_)||(i.endDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())})("ngModelChange",function(){return c(d),u(i.onFilterDateChange())}),a()(),C(24,"mat-date-range-picker",null,0),a(),w(26,st,5,2,"div",12),a()()()()}if(n&2){let d,f,_=b(25);l(9),m("clearable",!1),P("ngModel",i.selectedChannelId),l(),m("ngForOf",i.channelOptions()),l(),E((d=U(12,9,i.channelDetail$))!=null&&d.ServiceFeeWriteOff&&((d=i.selectedChannel())==null?null:d.TypeID)==i.channelType.Tokopedia?11:-1),l(6),E(i.downloadType()&&((f=i.selectedChannel())==null?null:f.TypeID)==i.channelType.Tokopedia?17:18),l(4),m("rangePicker",_),l(),P("ngModel",i.startDate),l(),P("ngModel",i.endDate),l(3),E(i.showTimePicker()?26:-1)}},dependencies:[k,A,X,Ie,Pe,Ee,We,ke,Ne,De,ve,ye,xe,Je,$e,Ae,ze,Le,Be],styles:[".vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.mt-1rem[_ngcontent-%COMP%]{margin-top:1rem}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}.form-label-group.radio.download-type[_ngcontent-%COMP%]{height:45.5938px!important;border-radius:.375rem!important}"]});let e=o;return e})();var T=function(e){return e.ALL="all",e.SYNC="sync",e.WRONG="wrong",e.UNSYNC="unsync",e}(T||{});var pt=(e,o)=>({"over-due-today":e,"over-due":o});function dt(e,o){if(e&1&&(r(0,"th",21),p(1),a()),e&2){let s=h();l(),v(" ",s.selectedChannel()?"Created Date":"Last Status Update"," ")}}function mt(e,o){if(e&1&&(r(0,"td"),p(1),L(2,"date"),a()),e&2){let s=h().$implicit;l(),v(" ",we(2,1,s.Date,"dd MMM yyyy HH:mm:ss")," ")}}function ct(e,o){if(e&1&&(r(0,"span"),p(1),a()),e&2){let s=h().$implicit;l(),v(" ",s.ActionString," ")}}function ut(e,o){if(e&1&&(r(0,"li"),p(1),a()),e&2){let s=o.$implicit;l(),v(" ",s," ")}}function ht(e,o){if(e&1&&(r(0,"ul",27),w(1,ut,2,1,"li",22),a()),e&2){let s=h().$implicit;l(),m("ngForOf",s.ActionString)}}function ft(e,o){if(e&1&&(r(0,"span",28),C(1,"i",29),a()),e&2){let s=h().$implicit;ce("title","Delivery : ",s.DeliveryState,`
1
+ import{a as Qe,b as j,c as Je}from"./chunk-YC44HHHF.js";import"./chunk-B2TH5YJH.js";import{a as Ye,b as Ge,c as Ue,e as je,f as Ke,g as He}from"./chunk-TPGBOTD4.js";import"./chunk-4LFFAE2I.js";import"./chunk-46AOM3SM.js";import"./chunk-OULUJ2IO.js";import{f as Le,g as Be,h as Ae,i as $e,j as ze}from"./chunk-FGPSBTFS.js";import{a as Re}from"./chunk-YIB7FZAQ.js";import"./chunk-ADRVUMMW.js";import{a as ke,b as Ne,c as We}from"./chunk-UMNGKENU.js";import"./chunk-FMV4LYKN.js";import"./chunk-HCDKYABV.js";import{c as Ee,d as Pe,e as Ie}from"./chunk-CCXKODFV.js";import{g as te,i as ie}from"./chunk-2DQJZ4SM.js";import{b as Te,e as be}from"./chunk-4SAJUEHO.js";import"./chunk-KCDL7SWP.js";import{m as Fe,n as Oe}from"./chunk-BO4PPSB5.js";import{t as Me,u as Ve}from"./chunk-HUUFOAKH.js";import"./chunk-E5GGIVK7.js";import{c as ve,h as ye,m as xe,y as De}from"./chunk-BSN7ZAXG.js";import{b as ee,c as D}from"./chunk-6SF7AUOH.js";import{p as Se,r as Ce}from"./chunk-OVEJFFL6.js";import{$b as S,Cd as k,Da as c,Ea as u,Eb as w,Gb as m,Gc as L,Hc as U,Ic as we,Jc as J,Ma as N,Nb as E,Pa as H,Sb as r,Tb as a,Ub as C,Vb as W,Wb as R,Yb as x,Z as Y,aa as se,bc as h,ea as G,ec as me,fc as ce,fd as q,gb as de,hc as ue,ic as he,ja as pe,jb as l,jc as fe,m as le,mc as b,nc as p,oc as F,pa as y,pc as v,rc as P,sc as I,sd as B,ta as V,tc as M,uc as Q,ud as A,v as K,vc as O,vd as $,xb as g,xc as _e,yc as ge,yd as X,zd as Z}from"./chunk-PQDPS2ID.js";import{a as re,b as oe}from"./chunk-GNOSNGXM.js";var et=e=>({"over-due":e});function tt(e,o){if(e&1&&(r(0,"tr",8)(1,"td"),p(2),a(),r(3,"td"),p(4),a(),r(5,"td"),p(6),a(),r(7,"td"),p(8),a()()),e&2){let s=o.$implicit,t=o.index;m("ngClass",_e(5,et,s.Exception)),l(2),F(t+1),l(2),F(s.Number),l(2),F(s.Status),l(2),F(s.Exception)}}function it(e,o){if(e&1&&(W(0),w(1,tt,9,7,"tr",7),R()),e&2){let s,t=h();l(),m("ngForOf",(s=t.downloadResult())==null?null:s.Body)}}function nt(e,o){e&1&&(r(0,"tr",9)(1,"td",10)(2,"div",11),C(3,"i",12),a(),r(4,"h4",13),p(5," There is no order to processed "),a()()())}var qe=(()=>{let o=class o{constructor(){this.downloadResult=N()}ngOnInit(){}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["complete-step"]],inputs:{downloadResult:[1,"downloadResult"]},standalone:!0,features:[O],decls:16,vars:2,consts:[["EMPTY_DOWNLOAD",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"table"],[1,"thead-light"],["width","1%"],[4,"ngIf","ngIfElse"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1&&(r(0,"div",1)(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr"),C(5,"th",5),r(6,"th"),p(7,"Order Number"),a(),r(8,"th"),p(9,"Status"),a(),r(10,"th"),p(11,"Exception"),a()()(),r(12,"tbody"),w(13,it,2,1,"ng-container",6)(14,nt,6,0,"ng-template",null,0,J),a()()()()),n&2){let d,f=b(15);l(13),m("ngIf",((d=i.downloadResult())==null||d.Body==null?null:d.Body.length)>0)("ngIfElse",f)}},dependencies:[k,B,A,$]});let e=o;return e})();var z=(()=>{let o=class o{constructor(){this.httpService=y(be),this.toastr=y(Te),this.datePipe=y(Z)}gerChannelDetailById(t){return this.httpService.post(te.GetChannelDetail,{ID:t})}getOrderPreview(t){return this.httpService.post(te.GetOrderPreviewV2,t)}getDownloadOrder(t){return this.httpService.post(te.GetDownloadOrderV2,t)}onPreviewOrder(t){return this.validateDatePreview(t)?this.getOrderPreview(t).pipe(G(n=>{n.Data?.length===0&&this.toastrEmptyPreview(t)})):le}toastrEmptyPreview(t){let n=this.datePipe.transform(t.From,"dd MMM yyyy"),i=this.datePipe.transform(t.To,"dd MMM yyyy"),d=t.TimeFrom?t.TimeFrom:"",f=t.TimeTo?t.TimeTo:"";this.toastr.info(`There is no orders from ${n} ${d} to ${i} ${f}!`,"No Orders!")}validateDatePreview(t){let n=!0;return t.downloadType==!0?D.getDaysDiff(t?.From,t?.To)+1>7&&(this.toastr.warning("Dates cannot be more than 7 days apart!","Warning"),n=!1):D.getDaysDiff(t?.From,t?.To)+1>14&&(this.toastr.warning("Dates cannot be more than 14 days apart!","Warning"),n=!1),n}getDateTitle(t,n){let i=D.formatTitleFromDate(new Date(t),new Date(n)),d=this.datePipe.transform(t,i),f=this.datePipe.transform(n,"dd MMM yyyy");return`${i==null?"":d+"-"} ${f}`}};o.\u0275fac=function(n){return new(n||o)},o.\u0275prov=pe({token:o,factory:o.\u0275fac});let e=o;return e})();function at(e,o){if(e&1&&(r(0,"ng-option",13),C(1,"img",14),p(2),a()),e&2){let s=o.$implicit;m("value",s.ID),l(),m("src",s==null?null:s.Img,de),l(),v("",s.Name," ")}}function rt(e,o){if(e&1){let s=x();r(0,"div",8)(1,"div",4)(2,"h5"),p(3,"Type"),a(),r(4,"p",5),p(5,"Select Type want to download"),a()(),r(6,"div",4)(7,"div",15)(8,"div")(9,"mat-radio-group",16),M("ngModelChange",function(n){c(s);let i=h();return I(i.downloadType,n)||(i.downloadType=n),u(n)}),S("ngModelChange",function(){c(s);let n=h();return u(n.onDownloadTypeChange())}),r(10,"mat-radio-button",17),p(11," Orders "),a(),r(12,"mat-radio-button",18),p(13," Disbursement "),a()()()(),r(14,"div",19)(15,"div",20),C(16,"i",21),a(),r(17,"p",22),p(18," If there are completed transactions, to obtain payment and service fee, you need to download disbursement. "),a()()()()}if(e&2){let s=h();l(9),P("ngModel",s.downloadType),l(),m("value",!1),l(2),m("value",!0)}}function ot(e,o){e&1&&(r(0,"p",5),p(1," Select Disbursement date "),r(2,"span",23),p(3,"(payment date / order complete date)"),a(),p(4," of the channel you want to download (Max 1 Week). "),a())}function lt(e,o){e&1&&(r(0,"p",5),p(1," Select transaction date of the channel you want to download (Max 2 Weeks) "),a())}function st(e,o){if(e&1){let s=x();r(0,"div",12)(1,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.startTime,n)||(i.startTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onStartTimeChange())}),a(),r(2,"span",25),p(3,"-"),a(),r(4,"app-timepicker",24),M("timeChange",function(n){c(s);let i=h();return I(i.endTime,n)||(i.endTime=n),u(n)}),S("timeChange",function(){c(s);let n=h();return u(n.onEndTimeChange())}),a()()}if(e&2){let s=h();l(),P("time",s.startTime),l(3),P("time",s.endTime)}}var Xe=(()=>{let o=class o{constructor(){this.reset=N(!1),this.authService=y(ie),this.downloadService=y(z),this.downloadType=g(!1),this.selectedChannelId=g(null),this.channelOptions=g(this.authService.getChannels()),this.channelType=ee,this.selectedChannel=g(null),this.showTimePicker=g(!1),this.startDate=g(null),this.endDate=g(null),this.startTime=g("00:00"),this.endTime=g("23:59"),this.filterData=new H,q(()=>{this.reset()&&this.resetFilter()},{allowSignalWrites:!0})}resetFilter(){this.selectedChannelId.update(()=>null),this.startDate.update(()=>null),this.endDate.update(()=>null),this.startTime.update(()=>null),this.endTime.update(()=>null),this.downloadType.update(()=>!1),this.selectedChannel.update(()=>null),this.showTimePicker.update(()=>!1),this.channelDetail$=null}onSelectChannel(){this.selectedChannel.update(()=>this.channelOptions().find(t=>t.ID===this.selectedChannelId())),this.selectedChannel()?this.channelDetail$=this.downloadService.gerChannelDetailById(this.selectedChannelId()).pipe(K(t=>t?.Model),Y(1)):this.channelDetail$=null,this.emitFilterData()}onFilterDateChange(){let t=1;this.startDate()&&this.endDate()&&(t=D.getDaysDiff(this.startDate(),this.endDate())),this.showTimePicker.update(()=>t==0),this.emitFilterData()}onDownloadTypeChange(){this.emitFilterData()}onStartTimeChange(){this.emitFilterData()}onEndTimeChange(){this.emitFilterData()}emitFilterData(){this.filterData.emit({channelId:this.selectedChannelId(),startDate:this.startDate(),endDate:this.endDate(),downloadType:this.downloadType(),startTime:this.startTime(),endTime:this.endTime()})}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["filter-step"]],inputs:{reset:[1,"reset"]},outputs:{filterData:"onFilterChange"},standalone:!0,features:[Q([z]),O],decls:27,vars:11,consts:[["picker",""],[1,"row","pt-2",2,"width","63%","margin-right","40px"],[1,"col-12"],[1,"row"],[1,"col-6"],[1,"text-muted"],["appendTo","body","placeholder","Select Channel",3,"ngModelChange","clearable","ngModel"],[3,"value",4,"ngFor","ngForOf"],[1,"row","mt-6"],["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,"mt-8"],[3,"value"],[2,"width","18px","margin-right","10px",3,"src"],[1,"form-label-group","radio","download-type",2,"margin-bottom","0px"],["name","dowloadType",3,"ngModelChange","ngModel"],["matTooltip","Download from Create sales order until create logistics status",1,"me-5",3,"value"],["matTooltip","Download only Payment and write off",1,"me-5",3,"value"],[1,"d-flex","border","mb-4","pt-6","px-6","mt-3",2,"background","#1f87ac0a","border-radius","5px"],[1,"me-3","pt-1"],[1,"fa","fa-lightbulb","fs-5"],[1,"mb-6"],[1,"fw-bold"],[3,"timeChange","time"],[1,"mx-4"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"h5"),p(5,"Select a Channel"),a(),r(6,"p",5),p(7,"Select Channel want to download order"),a()(),r(8,"div",4)(9,"ng-select",6),M("ngModelChange",function(_){return c(d),I(i.selectedChannelId,_)||(i.selectedChannelId=_),u(_)}),S("ngModelChange",function(){return c(d),u(i.onSelectChannel())}),w(10,at,3,3,"ng-option",7),a()()(),w(11,rt,19,3,"div",8),L(12,"async"),r(13,"div",8)(14,"div",4)(15,"h5"),p(16,"Date Range"),a(),w(17,ot,5,0,"p",5)(18,lt,2,0,"p",5),a(),r(19,"div",4)(20,"div",2)(21,"mat-date-range-input",9)(22,"input",10),M("ngModelChange",function(_){return c(d),I(i.startDate,_)||(i.startDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())}),a(),r(23,"input",11),M("ngModelChange",function(_){return c(d),I(i.endDate,_)||(i.endDate=_),u(_)}),S("click",function(){c(d);let _=b(25);return u(_.open())})("ngModelChange",function(){return c(d),u(i.onFilterDateChange())}),a()(),C(24,"mat-date-range-picker",null,0),a(),w(26,st,5,2,"div",12),a()()()()}if(n&2){let d,f,_=b(25);l(9),m("clearable",!1),P("ngModel",i.selectedChannelId),l(),m("ngForOf",i.channelOptions()),l(),E((d=U(12,9,i.channelDetail$))!=null&&d.ServiceFeeWriteOff&&((d=i.selectedChannel())==null?null:d.TypeID)==i.channelType.Tokopedia?11:-1),l(6),E(i.downloadType()&&((f=i.selectedChannel())==null?null:f.TypeID)==i.channelType.Tokopedia?17:18),l(4),m("rangePicker",_),l(),P("ngModel",i.startDate),l(),P("ngModel",i.endDate),l(3),E(i.showTimePicker()?26:-1)}},dependencies:[k,A,X,Ie,Pe,Ee,We,ke,Ne,De,ve,ye,xe,Je,$e,Ae,ze,Le,Be],styles:[".vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.mt-1rem[_ngcontent-%COMP%]{margin-top:1rem}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}.form-label-group.radio.download-type[_ngcontent-%COMP%]{height:45.5938px!important;border-radius:.375rem!important}"]});let e=o;return e})();var T=function(e){return e.ALL="all",e.SYNC="sync",e.WRONG="wrong",e.UNSYNC="unsync",e}(T||{});var pt=(e,o)=>({"over-due-today":e,"over-due":o});function dt(e,o){if(e&1&&(r(0,"th",21),p(1),a()),e&2){let s=h();l(),v(" ",s.selectedChannel()?"Created Date":"Last Status Update"," ")}}function mt(e,o){if(e&1&&(r(0,"td"),p(1),L(2,"date"),a()),e&2){let s=h().$implicit;l(),v(" ",we(2,1,s.Date,"dd MMM yyyy HH:mm:ss")," ")}}function ct(e,o){if(e&1&&(r(0,"span"),p(1),a()),e&2){let s=h().$implicit;l(),v(" ",s.ActionString," ")}}function ut(e,o){if(e&1&&(r(0,"li"),p(1),a()),e&2){let s=o.$implicit;l(),v(" ",s," ")}}function ht(e,o){if(e&1&&(r(0,"ul",27),w(1,ut,2,1,"li",22),a()),e&2){let s=h().$implicit;l(),m("ngForOf",s.ActionString)}}function ft(e,o){if(e&1&&(r(0,"span",28),C(1,"i",29),a()),e&2){let s=h().$implicit;ce("title","Delivery : ",s.DeliveryState,`
2
2
  Payment : `,s.PaymentState,"")}}function _t(e,o){if(e&1&&(r(0,"tr")(1,"td"),p(2),a(),r(3,"td"),p(4),a(),w(5,mt,3,4,"td",23),r(6,"td")(7,"span"),p(8),a(),p(9),a(),r(10,"td",24)(11,"span"),p(12),a(),p(13),a(),r(14,"td"),w(15,ct,2,1,"span",23)(16,ht,2,1,"ul",25),a(),r(17,"td"),w(18,ft,2,3,"span",26),a()()),e&2){let s,t=o.$implicit,n=o.index,i=h(2);l(2),F(n+1),l(2),F(t.Number),l(),m("ngIf",((s=i.selectedChannel())==null?null:s.TypeID)!=i.channelType.Shopee&&((s=i.selectedChannel())==null?null:s.TypeID)!==i.channelType.Tiktok),l(3),v("",t.ChannelStatus," - "),l(),v("",t.ChannelStatusDescription," "),l(),m("ngClass",ge(12,pt,(t==null?null:t.Action)==i.actionPreviewOrder.Update,(t==null?null:t.Action)==i.actionPreviewOrder.New))("matTooltip",t.POSStatus==91||t.POSStatusDescription=="Conflict"?"There is a missed status at POS, usually fulfillment has not been recorded but the payment has been recorded":""),l(2),v("",t.POSStatus," - "),l(),v("",t.POSStatusDescription," "),l(2),m("ngIf",t.ActionString.length==1),l(),m("ngIf",t.ActionString.length>1),l(2),m("ngIf",t.ChannelStatus!=99&&t.POSStatus!=99)}}function gt(e,o){if(e&1&&(W(0),w(1,_t,19,15,"tr",22),R()),e&2){let s=h();l(),m("ngForOf",s.displayPreviewData())}}function wt(e,o){e&1&&(r(0,"tr",30)(1,"td",31)(2,"div",32),C(3,"i",33),a(),r(4,"h4",34),p(5," There is no order to processed "),a()()())}var Ze=(()=>{let o=class o{constructor(){this.orderPreview=N(),this.selectedChannel=N(),this.channelType=ee,this.allData=g(0),this.syncData=g(0),this.wrongData=g(0),this.unsyncData=g(0),this.pillStatus=g(T.ALL),this.actionPreviewOrder=j,this.previewStatus=T,this.displayPreviewData=g([]),this.exportOrders=new H,q(()=>{this.orderPreview()&&(this.filterPreviewData(T.ALL),this.initLengthStatusData())},{allowSignalWrites:!0})}filterPreviewData(t){this.pillStatus.update(()=>t),this.displayPreviewData.update(()=>this.filterDataByStatus(t))}initLengthStatusData(){this.wrongData.update(()=>this.filterDataByStatus(T.WRONG).length),this.syncData.update(()=>this.filterDataByStatus(T.SYNC).length),this.allData.update(()=>this.orderPreview().length),this.unsyncData.update(()=>this.filterDataByStatus(T.UNSYNC).length)}filterDataByStatus(t){let n=[];switch(t){case T.ALL:n=this.orderPreview();break;case T.SYNC:n=this.orderPreview().filter(i=>i.Action==j.DoNothing);break;case T.WRONG:n=this.orderPreview().filter(i=>i.Action==j.Update);break;case T.UNSYNC:n=this.orderPreview().filter(i=>i.Action==j.New);break}return n}onExportOrders(){this.exportOrders.emit()}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["preview-step"]],inputs:{orderPreview:[1,"orderPreview"],selectedChannel:[1,"selectedChannel"]},outputs:{exportOrders:"onExportOrders"},standalone:!0,features:[O],decls:41,vars:11,consts:[["EMPTY",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"row","mx-1","mb-5"],[1,"col-12","d-flex","justify-content-between","align-items-end",2,"padding-left","0px","padding-right","0px"],[1,"nav","nav-pills"],[1,"nav-item","me-3"],[1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],[1,"nav-item","mx-3"],["matTooltip","All Invoice which is already available in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices that have different status between marketplace and POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices which is not exist in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"table"],[1,"thead-light"],["width","1%"],["width","25%"],["width","15%",4,"ngIf"],["width","10%"],[4,"ngIf","ngIfElse"],["width","15%"],[4,"ngFor","ngForOf"],[4,"ngIf"],["matTooltipClass","custom-width-tooltip",3,"ngClass","matTooltip"],["class","ps-5",4,"ngIf"],[3,"title",4,"ngIf"],[1,"ps-5"],[3,"title"],[1,"fas","fa-info-circle","ms-2"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1){let d=x();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div")(5,"ul",5)(6,"li",6)(7,"button",7),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.ALL))}),p(8),a()(),r(9,"li",8)(10,"button",9),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.SYNC))}),p(11),a()(),r(12,"li",8)(13,"button",10),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.WRONG))}),p(14),a()(),r(15,"li",8)(16,"button",11),S("click",function(){return c(d),u(i.filterPreviewData(i.previewStatus.UNSYNC))}),p(17),a()()()(),r(18,"div")(19,"button",12),S("click",function(){return c(d),u(i.onExportOrders())}),C(20,"i",13),r(21,"span"),p(22,"Export"),a()()()()(),r(23,"table",14)(24,"thead",15)(25,"tr"),C(26,"th",16),r(27,"th",17),p(28,"Number"),a(),w(29,dt,2,1,"th",18),r(30,"th",19),p(31,"Channel Status"),a(),r(32,"th",19),p(33,"POS Status"),a(),r(34,"th"),p(35,"Action"),a(),C(36,"th",16),a()(),r(37,"tbody"),w(38,gt,2,1,"ng-container",20)(39,wt,6,0,"ng-template",null,0,J),a()()()()}if(n&2){let d,f,_=b(40);l(7),m("ngClass",i.pillStatus()=="all"?"btn-secondary text-white":"btn-outline-dark"),l(),v(" All (",i.allData(),") "),l(2),m("ngClass",i.pillStatus()=="sync"?"btn-success":"btn-outline-success"),l(),v(" Existing (",i.syncData(),") "),l(2),m("ngClass",i.pillStatus()=="wrong"?"btn-warning text-white":"btn-outline-warning"),l(),v(" Wrong Status (",i.wrongData(),") "),l(2),m("ngClass",i.pillStatus()=="unsync"?"btn-danger":"btn-outline-danger"),l(),v(" Missing (",i.unsyncData(),") "),l(12),m("ngIf",((d=i.selectedChannel())==null?null:d.TypeID)!=i.channelType.Shopee&&((d=i.selectedChannel())==null?null:d.TypeID)!==i.channelType.Tiktok),l(9),m("ngIf",((f=i.displayPreviewData())==null?null:f.length)>0)("ngIfElse",_)}},dependencies:[k,B,A,$,Z,Ve,Me]});let e=o;return e})();var St=["stepper"];function Ct(e,o){e&1&&(r(0,"a",2),p(1," Download V1 "),a())}function vt(e,o){if(e&1){let s=x();r(0,"div",3)(1,"button",20),S("click",function(){c(s);let n=h();return u(n.onStepperBack())}),p(2," Back "),a(),r(3,"button",21),S("click",function(){c(s);let n=h();return u(n.onNextStep())}),p(4," Next "),a()()}if(e&2){let s=h();l(3),m("disabled",s.disabledNextFilter())}}function yt(e,o){if(e&1){let s=x();r(0,"button",22),S("click",function(){c(s);let n=h();return u(n.onNextStep())}),p(1," Next "),a()}if(e&2){let s=h();m("disabled",s.disabledNextFilter())}}function xt(e,o){if(e&1){let s=x();r(0,"button",23),S("click",function(){c(s);let n=h();return u(n.onNewDownload())}),C(1,"i",24),p(2," New "),a()}}function Dt(e,o){e&1&&(C(0,"i",25),r(1,"span"),p(2,"Filter"),a())}function Tt(e,o){e&1&&(C(0,"i",26),r(1,"span"),p(2,"Preview"),a())}function bt(e,o){if(e&1){let s=x();W(0),r(1,"preview-step",27),S("onExportOrders",function(){c(s);let n=h();return u(n.onExportOrders())}),a(),R()}if(e&2){let s=o.ngIf;l(),m("orderPreview",s)}}function Et(e,o){e&1&&(C(0,"i",28),r(1,"span"),p(2,"Finish"),a())}function Pt(e,o){if(e&1&&(W(0),C(1,"complete-step",29),R()),e&2){let s=o.ngIf;l(),m("downloadResult",s)}}function It(e,o){e&1&&(r(0,"h6"),p(1,"1"),a())}function Mt(e,o){e&1&&(r(0,"h6"),p(1,"2"),a())}function Vt(e,o){e&1&&(r(0,"h6"),p(1,"3"),a())}var Yi=(()=>{let o=class o{constructor(){this.downloadService=y(z),this.orderService=y(Qe),this.productService=y(Re),this.authService=y(ie),this.stepperSelectedIndex=g(0),this.disabledNextFilter=g(!0),this.isResetFilter=g(!1),this.pageTitle=g("Download to POS"),this.cacheKey=g(D.GuidEMpty)}onFilterChange(t){this.filter=t,this.validateDisabledNext()}validateDisabledNext(){this.disabledNextFilter.update(()=>D.IsEmpty(this.filter?.channelId)||!D.isValidDate(this.filter.startDate)||!D.isValidDate(this.filter.endDate))}onNextStep(){switch(this.stepper.selectedIndex){case 0:this.onPreview();let t=this.productService.findChannelById(this.filter.channelId,this.authService.getChannels());this.setPageTitle(`Preview ${t?.Name}`);break;case 1:this.onDownload(),this.setPageTitle("Download");break}}onStepperNext(){this.stepper.selected.completed=!0,this.stepper.next()}onPreview(){let t={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,IsDisbursement:this.filter.downloadType};D.IsNotEmpty(this.filter.startTime)&&(t=oe(re({},t),{TimeFrom:this.filter.startTime+":00",TimeTo:this.filter.endTime+":00"})),this.orderPreview$=this.downloadService.onPreviewOrder(t).pipe(G(n=>{n.Data?.length>0&&(this.cacheKey.update(()=>n.CacheKey),this.onStepperNext())}),K(n=>n.Data),Y(1))}onExportOrders(){let t={ID:this.filter.channelId,From:this.filter.startDate?JSON.stringify(this.filter.startDate):null,To:this.filter.endDate?JSON.stringify(this.filter.endDate):null},n=`Orders ${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)}`;this.orderService.exportOrders(t,n).subscribe()}onDownload(){let t={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,ListPreview:[],IsDisbursement:this.filter.downloadType,CacheKey:this.cacheKey()};this.downloadPreview$=this.orderPreview$.pipe(se(n=>(t.ListPreview=n,this.downloadService.getDownloadOrder(t))),G(()=>{this.onStepperNext()}),Y(1))}setPageTitle(t){this.pageTitle.update(()=>`
3
3
  ${t} (${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)})
4
4
  `)}onStepperBack(){this.stepper.previous(),this.pageTitle.update(()=>"Download to POS")}onNewDownload(){this.isResetFilter.update(()=>!0),this.stepper.reset(),this.stepperSelectedIndex.update(()=>0),this.orderPreview$=null,this.downloadPreview$=null,this.pageTitle.update(()=>"Download to POS")}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=V({type:o,selectors:[["app-download-v2"]],viewQuery:function(n,i){if(n&1&&ue(St,5),n&2){let d;he(d=fe())&&(i.stepper=d.first)}},standalone:!0,features:[Q([z,{provide:Ye,useValue:{displayDefaultIndicatorType:!1}}]),O],decls:27,vars:21,consts:[["stepper",""],[3,"hideSearchBox","hideSearchDropdown","headerTitle","description"],["routerLink","/menu/Order/Download/V1",1,"btn","btn-outline-secondary","btn-fill","me-3"],[1,"btn-group","me-3"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"disabled"],[1,"btn","btn-outline-secondary","btn-fill"],[1,"container-fluid","pt-5","mt-5"],[1,"row"],[1,"col-12"],[1,"d-flex","justify-content-center"],["linear","",1,"w-100","stepper-download",3,"selectedIndexChange","ngClass","selectedIndex"],["state","filter",3,"completed","editable"],["matStepLabel",""],[1,"w-100",3,"onFilterChange","reset"],["state","preview",3,"editable","completed"],[4,"ngIf"],["state","finish"],["matStepperIcon","filter"],["matStepperIcon","preview"],["matStepperIcon","finish"],[1,"btn","btn-outline-secondary",3,"click"],["type","button",1,"btn","btn-outline-secondary","bg-success","text-white",3,"click","disabled"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"click","disabled"],[1,"btn","btn-outline-secondary","btn-fill",3,"click"],["aria-hidden","true",1,"fa","fa-file-alt","me-2"],[1,"fa-solid","fa-filter","me-3"],[1,"fa-solid","fa-file","me-3"],[3,"onExportOrders","orderPreview"],[1,"fa-solid","fa-flag","me-3"],[3,"downloadResult"]],template:function(n,i){if(n&1){let d=x();r(0,"mainpanel",1)(1,"actions"),w(2,Ct,2,0,"a",2)(3,vt,5,1,"div",3)(4,yt,2,1,"button",4)(5,xt,3,0,"button",5),a(),r(6,"content")(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"mat-stepper",10,0),M("selectedIndexChange",function(_){return c(d),I(i.stepperSelectedIndex,_)||(i.stepperSelectedIndex=_),u(_)}),r(13,"mat-step",11),w(14,Dt,3,0,"ng-template",12),r(15,"filter-step",13),S("onFilterChange",function(_){return c(d),u(i.onFilterChange(_))}),a()(),r(16,"mat-step",14),w(17,Tt,3,0,"ng-template",12)(18,bt,2,1,"ng-container",15),L(19,"async"),a(),r(20,"mat-step",16),w(21,Et,3,0,"ng-template",12)(22,Pt,2,1,"ng-container",15),L(23,"async"),a(),w(24,It,2,0,"ng-template",17)(25,Mt,2,0,"ng-template",18)(26,Vt,2,0,"ng-template",19),a()()()()()()()}if(n&2){let d=b(12);m("hideSearchBox",!0)("hideSearchDropdown",!0)("headerTitle",i.pageTitle())("description",i.pageTitle()),l(2),E(i.stepperSelectedIndex()==0?2:-1),l(),E(i.stepperSelectedIndex()==1?3:-1),l(),E(i.stepperSelectedIndex()==0?4:-1),l(),E(i.stepperSelectedIndex()==2?5:-1),l(6),me("ngClass","last-edited-step-"+d.selectedIndex),P("selectedIndex",i.stepperSelectedIndex),l(2),m("completed",!1)("editable",i.stepperSelectedIndex()!=2),l(2),m("reset",i.isResetFilter()),l(),m("editable",i.stepperSelectedIndex()!=2)("completed",!1),l(2),m("ngIf",U(19,17,i.orderPreview$)),l(4),m("ngIf",U(23,19,i.downloadPreview$))}},dependencies:[k,B,$,X,qe,Xe,Ze,He,je,Ge,Ke,Ue,Oe,Fe,Ce,Se],styles:[`@import"https://fonts.googleapis.com/icon?family=Material+Icons";.vertical-radio{display:flex;flex-direction:column;margin:15px 0}.mt-1rem{margin-top:1rem}.dateRange{padding-top:.8rem;padding-bottom:.8rem}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container{position:relative;width:60%;left:18%}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container>div.mat-horizontal-stepper-content:nth-child(1){display:flex;justify-content:left}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container{margin-top:30px}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container>mat-step-header.mat-horizontal-stepper-header{pointer-events:none!important}.form-label-group.radio.download-type{height:45.5938px!important;border-radius:.375rem!important}
@@ -1 +1 @@
1
- import{g as r}from"./chunk-HK66WK22.js";import{b as l,e as C}from"./chunk-4SAJUEHO.js";import{b as o,c}from"./chunk-6SF7AUOH.js";import{ea as s,ja as u,oa as h,v as p}from"./chunk-PQDPS2ID.js";var y=(()=>{let n=class n{constructor(t,e){this.httpService=t,this.toastr=e}saveChannel(t){return this.httpService.post("/api/Channel/SubmitChannel",t)}getLastSync(t){return this.httpService.get(`${r.ChannelGetLastSyncByID}/?ID=${t}`)}getChannel(t){return this.httpService.post(r.GetChannel,t)}getChannelLoader(){return this.httpService.get(r.GetChannelLoader)}testShopID(t){return this.httpService.post(r.TestShopID,t).pipe(s(e=>{this.showTostrSuccessTestShopID(e)}))}updateChannelIndex(t){return this.httpService.post(r.UpdateChannelIndex,t)}deleteChannel(t){return this.httpService.post(r.DeleteChannel,t)}mapChannelImage(t){return t.map(e=>(e.img=c.getChannelLogoByTypeId(e.TypeID),e))}showTostrSuccessTestShopID(t){let e="";for(var i in t)e+=i+" : "+t[i]+"<br/>";this.toastr.success(e,"Success",{enableHtml:!0,closeButton:!0,positionClass:"toast-bottom-right"})}getRegisterByOutletName(t){return this.httpService.post(r.GetRegisterByOutletName,{Outlet:t})}getChannelRowCount(t){return this.httpService.post(r.GetChannelRowCount,t).pipe(p(e=>e.Count))}getChannelWarehouse(t){return this.httpService.get(`${r.GetChannelWarehouse}/?ChannelID=${t}`)}unSynchronizedWarehouse(t){return this.httpService.delete(`${r.UnSynchronizedWarehouse}?ID=${t}`)}authorizedChannel(t){let e=this.getApiAuthorize(t);return this.httpService.post(`/api/${e}`,null).pipe(s(i=>{window.open(i.Url,"_blank")}))}getApiAuthorize(t){let e;switch(t){case o.Shopee:e="ChannelAuthorization/ShopeeV2_URL";break;case o.Tiktok:e="ChannelAuthorization/Tiktok_URL";break;case o.Lazada:e="ChannelAuthorization/Lazada_URL";break}return e}};n.\u0275fac=function(e){return new(e||n)(h(C),h(l))},n.\u0275prov=u({token:n,factory:n.\u0275fac,providedIn:"root"});let a=n;return a})();export{y as a};
1
+ import{g as r}from"./chunk-2DQJZ4SM.js";import{b as l,e as C}from"./chunk-4SAJUEHO.js";import{b as o,c}from"./chunk-6SF7AUOH.js";import{ea as s,ja as u,oa as h,v as p}from"./chunk-PQDPS2ID.js";var y=(()=>{let n=class n{constructor(t,e){this.httpService=t,this.toastr=e}saveChannel(t){return this.httpService.post("/api/Channel/SubmitChannel",t)}getLastSync(t){return this.httpService.get(`${r.ChannelGetLastSyncByID}/?ID=${t}`)}getChannel(t){return this.httpService.post(r.GetChannel,t)}getChannelLoader(){return this.httpService.get(r.GetChannelLoader)}testShopID(t){return this.httpService.post(r.TestShopID,t).pipe(s(e=>{this.showTostrSuccessTestShopID(e)}))}updateChannelIndex(t){return this.httpService.post(r.UpdateChannelIndex,t)}deleteChannel(t){return this.httpService.post(r.DeleteChannel,t)}mapChannelImage(t){return t.map(e=>(e.img=c.getChannelLogoByTypeId(e.TypeID),e))}showTostrSuccessTestShopID(t){let e="";for(var i in t)e+=i+" : "+t[i]+"<br/>";this.toastr.success(e,"Success",{enableHtml:!0,closeButton:!0,positionClass:"toast-bottom-right"})}getRegisterByOutletName(t){return this.httpService.post(r.GetRegisterByOutletName,{Outlet:t})}getChannelRowCount(t){return this.httpService.post(r.GetChannelRowCount,t).pipe(p(e=>e.Count))}getChannelWarehouse(t){return this.httpService.get(`${r.GetChannelWarehouse}/?ChannelID=${t}`)}unSynchronizedWarehouse(t){return this.httpService.delete(`${r.UnSynchronizedWarehouse}?ID=${t}`)}authorizedChannel(t){let e=this.getApiAuthorize(t);return this.httpService.post(`/api/${e}`,null).pipe(s(i=>{window.open(i.Url,"_blank")}))}getApiAuthorize(t){let e;switch(t){case o.Shopee:e="ChannelAuthorization/ShopeeV2_URL";break;case o.Tiktok:e="ChannelAuthorization/Tiktok_URL";break;case o.Lazada:e="ChannelAuthorization/Lazada_URL";break}return e}};n.\u0275fac=function(e){return new(e||n)(h(C),h(l))},n.\u0275prov=u({token:n,factory:n.\u0275fac,providedIn:"root"});let a=n;return a})();export{y as a};