marketplacepos 3.11.1 → 3.11.4

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 (127) hide show
  1. package/Marketplace/3rdpartylicenses.txt +40 -40
  2. package/Marketplace/chunk-3LQ5TKLD.js +1 -0
  3. package/Marketplace/chunk-3PX6SSDC.js +1 -0
  4. package/Marketplace/chunk-5LCXVQBT.js +1 -0
  5. package/Marketplace/chunk-5SE72MGC.js +2 -0
  6. package/Marketplace/chunk-5ZUWMFL5.js +1 -0
  7. package/Marketplace/chunk-6B64VOO7.js +1 -0
  8. package/Marketplace/chunk-6DRNAUKE.js +8 -0
  9. package/Marketplace/chunk-6F6NSBIF.js +1 -0
  10. package/Marketplace/chunk-6HBK3C7G.js +1 -0
  11. package/Marketplace/chunk-6WGRXHNE.js +47 -0
  12. package/Marketplace/chunk-AL67KXJV.js +2 -0
  13. package/Marketplace/chunk-BD2QQPDK.js +1 -0
  14. package/Marketplace/chunk-BMZAGAK3.js +1 -0
  15. package/Marketplace/chunk-C45X4NQK.js +5 -0
  16. package/Marketplace/chunk-D72PMDHY.js +1 -0
  17. package/Marketplace/chunk-DEH6NGKQ.js +1 -0
  18. package/Marketplace/chunk-DT3B54LD.js +4 -0
  19. package/Marketplace/chunk-G5LCLRIW.js +1 -0
  20. package/Marketplace/chunk-GRMIXZTT.js +1 -0
  21. package/Marketplace/{chunk-56R3B6EL.js → chunk-GSSZWMCP.js} +4 -4
  22. package/Marketplace/chunk-INNTQ5YN.js +1 -0
  23. package/Marketplace/chunk-IPGAIBF6.js +5 -0
  24. package/Marketplace/chunk-JM3LERUP.js +7 -0
  25. package/Marketplace/chunk-JPAJ6YR6.js +1 -0
  26. package/Marketplace/chunk-K3G6FMDF.js +1 -0
  27. package/Marketplace/chunk-KBYAFLE5.js +1 -0
  28. package/Marketplace/chunk-KUVW5SH2.js +1 -0
  29. package/Marketplace/chunk-KYJA5TD4.js +1 -0
  30. package/Marketplace/chunk-L4DP3Q4W.js +1 -0
  31. package/Marketplace/chunk-MK34PW5S.js +1 -0
  32. package/Marketplace/{chunk-TMXG5A2R.js → chunk-MSAVOLLA.js} +2 -2
  33. package/Marketplace/chunk-MSGMWJHN.js +1 -0
  34. package/Marketplace/chunk-MYMGWQRE.js +6 -0
  35. package/Marketplace/chunk-N4S3Q3EC.js +1 -0
  36. package/Marketplace/chunk-NRVXDIHY.js +1 -0
  37. package/Marketplace/chunk-NSM4JDXS.js +1 -0
  38. package/Marketplace/chunk-OHTJCLX7.js +4 -0
  39. package/Marketplace/chunk-PRYDCJG5.js +1 -0
  40. package/Marketplace/chunk-PZJCL4YS.js +1 -0
  41. package/Marketplace/chunk-PZOGC5DT.js +1 -0
  42. package/Marketplace/chunk-QK22WK2Q.js +1 -0
  43. package/Marketplace/chunk-SP6QPE3M.js +1 -0
  44. package/Marketplace/chunk-SQDLJ6C7.js +3 -0
  45. package/Marketplace/chunk-SRYGE2HW.js +1 -0
  46. package/Marketplace/chunk-TCC7PQV3.js +1 -0
  47. package/Marketplace/chunk-TDHJ34QP.js +1 -0
  48. package/Marketplace/chunk-TDK2QBFI.js +1 -0
  49. package/Marketplace/chunk-U5YOE633.js +5 -0
  50. package/Marketplace/chunk-UILE7H6I.js +1 -0
  51. package/Marketplace/chunk-VK32VX4W.js +2 -0
  52. package/Marketplace/chunk-VO5VAOZH.js +1 -0
  53. package/Marketplace/chunk-W3EAYQL3.js +1 -0
  54. package/Marketplace/chunk-WQ7LUTQ2.js +1 -0
  55. package/Marketplace/chunk-XDNW2F3I.js +3 -0
  56. package/Marketplace/chunk-XOYXFFE6.js +1 -0
  57. package/Marketplace/chunk-YZ67XPSX.js +1 -0
  58. package/Marketplace/chunk-ZIW2YTBP.js +1 -0
  59. package/Marketplace/chunk-ZKBLXGXT.js +2 -0
  60. package/Marketplace/index.html +5 -4
  61. package/Marketplace/main-RSHB3ATI.js +1 -0
  62. package/Marketplace/polyfills-Y3W47ZLP.js +2 -0
  63. package/Marketplace/scripts-TB7H6DN4.js +5 -0
  64. package/Marketplace/styles-D4MZYFH2.css +1 -0
  65. package/package.json +1 -1
  66. package/Marketplace/chunk-27WF5XZ4.js +0 -1
  67. package/Marketplace/chunk-2B2NRXVD.js +0 -1
  68. package/Marketplace/chunk-2J5KIMJG.js +0 -1
  69. package/Marketplace/chunk-2XUETMFD.js +0 -7
  70. package/Marketplace/chunk-34W6ODFY.js +0 -1
  71. package/Marketplace/chunk-36YTJB5U.js +0 -3
  72. package/Marketplace/chunk-3FV4VZY5.js +0 -4
  73. package/Marketplace/chunk-3M3TUG3Y.js +0 -1
  74. package/Marketplace/chunk-3WESNZYZ.js +0 -4
  75. package/Marketplace/chunk-4HCIBOMI.js +0 -1
  76. package/Marketplace/chunk-4JMSYMIL.js +0 -1
  77. package/Marketplace/chunk-5DXPVZPM.js +0 -3
  78. package/Marketplace/chunk-5QWCH2MN.js +0 -8
  79. package/Marketplace/chunk-6OCGOSYU.js +0 -5
  80. package/Marketplace/chunk-6RTNGXAA.js +0 -1
  81. package/Marketplace/chunk-7IY5O4IO.js +0 -1
  82. package/Marketplace/chunk-AEGUGM6R.js +0 -1
  83. package/Marketplace/chunk-CWR3EUXB.js +0 -2
  84. package/Marketplace/chunk-DJAIEPHT.js +0 -1
  85. package/Marketplace/chunk-DJWYB3IP.js +0 -1
  86. package/Marketplace/chunk-DMYPGAP6.js +0 -1
  87. package/Marketplace/chunk-EFARFDMO.js +0 -1
  88. package/Marketplace/chunk-EONYNPVG.js +0 -1
  89. package/Marketplace/chunk-FHVEGV4R.js +0 -1
  90. package/Marketplace/chunk-FMMN3KTC.js +0 -1
  91. package/Marketplace/chunk-GNBJF4YQ.js +0 -1
  92. package/Marketplace/chunk-HTPOQKQV.js +0 -1
  93. package/Marketplace/chunk-I6MPDIYA.js +0 -1
  94. package/Marketplace/chunk-IQOBZ4KW.js +0 -1
  95. package/Marketplace/chunk-J2RJWRY7.js +0 -6
  96. package/Marketplace/chunk-JQLRFJ7L.js +0 -2
  97. package/Marketplace/chunk-LAR65HEV.js +0 -39
  98. package/Marketplace/chunk-LSVERPQC.js +0 -1
  99. package/Marketplace/chunk-M7LNCX6S.js +0 -1
  100. package/Marketplace/chunk-MSXYPVTU.js +0 -1
  101. package/Marketplace/chunk-NDXXUZJP.js +0 -1
  102. package/Marketplace/chunk-NQA3MADS.js +0 -1
  103. package/Marketplace/chunk-NTO57GBJ.js +0 -1
  104. package/Marketplace/chunk-OG7GSPJM.js +0 -1
  105. package/Marketplace/chunk-PAOA6DW4.js +0 -1
  106. package/Marketplace/chunk-PJFUFZDK.js +0 -1
  107. package/Marketplace/chunk-PUT3J5LU.js +0 -1
  108. package/Marketplace/chunk-Q4YKWFBH.js +0 -1
  109. package/Marketplace/chunk-RRSW335I.js +0 -1
  110. package/Marketplace/chunk-S5WITFO4.js +0 -1
  111. package/Marketplace/chunk-TVL547JR.js +0 -2
  112. package/Marketplace/chunk-TXGX5F7A.js +0 -1
  113. package/Marketplace/chunk-UBKA24B2.js +0 -1
  114. package/Marketplace/chunk-UCUYPEVP.js +0 -1
  115. package/Marketplace/chunk-UE36JAUR.js +0 -1
  116. package/Marketplace/chunk-VBIHRHCP.js +0 -1
  117. package/Marketplace/chunk-VGATQ2BG.js +0 -2
  118. package/Marketplace/chunk-XBBNBXKA.js +0 -5
  119. package/Marketplace/chunk-XCMMTIOL.js +0 -1
  120. package/Marketplace/chunk-XT6FL25D.js +0 -1
  121. package/Marketplace/chunk-Z3KG4YMT.js +0 -5
  122. package/Marketplace/main-Z4RBEQWQ.js +0 -1
  123. package/Marketplace/polyfills-WYDKZVNK.js +0 -2
  124. package/Marketplace/scripts-M46NWPTC.js +0 -5
  125. package/Marketplace/styles-EMWW7N6T.css +0 -1
  126. /package/Marketplace/{chunk-ZCIDRSQR.js → chunk-662E5VTA.js} +0 -0
  127. /package/Marketplace/{chunk-CF5HBP53.js → chunk-IWVYX6KY.js} +0 -0
@@ -0,0 +1 @@
1
+ import{$ as y,A as z,E as F,I as H,L as G,La as Q,N as S,R as C,Ra as X,T as j,X as V,Xc as ee,aa as Y,ac as _,ba as A,ca as d,d as g,da as P,ia as Z,ja as J,m as f,n as c,oa as q,q as v,s as p,t as I,w as M,za as W}from"./chunk-6DRNAUKE.js";import{a as m,b as O}from"./chunk-GRMIXZTT.js";var D={REMOVE:"remove",SHOW:"show"},ie=(()=>{let r=class r{constructor(){this.strategiesSource=new g({}),this.strategies$=this.strategiesSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),L=new A("USE_CONFIGURATION_STORE"),B=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.configurationStore=t,this.strategiesSource=this.isolate?new g({}):this.configurationStore.strategiesSource,this.strategies$=this.strategiesSource.asObservable(),this.onAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onAuthorisedDefaultStrategy,this.onUnAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onUnAuthorisedDefaultStrategy}setDefaultOnAuthorizedStrategy(e){this.isolate?this.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onAuthorisedDefaultStrategy=this.configurationStore.onAuthorisedDefaultStrategy)}setDefaultOnUnauthorizedStrategy(e){this.isolate?this.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onUnAuthorisedDefaultStrategy=this.configurationStore.onUnAuthorisedDefaultStrategy)}addPermissionStrategy(e,t){this.strategiesSource.value[e]=t}getStrategy(e){return this.strategiesSource.value[e]}getAllStrategies(){return this.strategiesSource.value}getDefinedStrategy(e){if(this.strategiesSource.value[e]||this.isPredefinedStrategy(e))return e;throw new Error(`No ' ${e} ' strategy is found please define one`)}isPredefinedStrategy(e){return e===D.SHOW||e===D.REMOVE}};r.\u0275fac=function(t){return new(t||r)(d(L),d(ie))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();function l(s){return typeof s=="function"}function K(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;{let r=Object.getPrototypeOf(s);return r===null||r===Object.prototype}}function se(s){return!!s&&typeof s=="string"}function R(s){return typeof s=="boolean"}function ne(s){return Object.prototype.toString.call(s)==="[object Promise]"}function T(s){return Array.isArray(s)?s.length>0:!!s}function w(s){return se(s)?[s]:s}var re=(()=>{let r=class r{constructor(){this.permissionsSource=new g({}),this.permissions$=this.permissionsSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),$=new A("USE_PERMISSIONS_STORE"),E=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.permissionsStore=t,this.permissionsSource=this.isolate?new g({}):this.permissionsStore.permissionsSource,this.permissions$=this.permissionsSource.asObservable()}flushPermissions(){this.permissionsSource.next({})}hasPermission(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),this.hasArrayPermission(e))}loadPermissions(e,t){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),{});this.permissionsSource.next(i)}addPermission(e,t){if(Array.isArray(e)){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),this.permissionsSource.value);this.permissionsSource.next(i)}else{let i=this.reducePermission(this.permissionsSource.value,e,t);this.permissionsSource.next(i)}}removePermission(e){let t=m({},this.permissionsSource.value);delete t[e],this.permissionsSource.next(t)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,t,i){return i&&l(i)?O(m({},e),{[t]:{name:t,validationFunction:i}}):O(m({},e),{[t]:{name:t}})}hasArrayPermission(e){let t=e.map(i=>{if(this.hasPermissionValidationFunction(i)){let n=this.permissionsSource.value[i].validationFunction,o=m({},this.permissionsSource.value);return c(null).pipe(v(()=>n(i,o)),j(h=>R(h)?c(h):h),F(()=>c(!1)))}return c(!!this.permissionsSource.value[i])});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&l(this.permissionsSource.value[e].validationFunction)}};r.\u0275fac=function(t){return new(t||r)(d($),d(re))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),k=class{constructor(){this.rolesSource=new g({}),this.roles$=this.rolesSource.asObservable()}},N=new A("USE_ROLES_STORE"),b=(()=>{let r=class r{constructor(e=!1,t,i){this.isolate=e,this.rolesStore=t,this.permissionsService=i,this.rolesSource=this.isolate?new g({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,t){let i=O(m({},this.rolesSource.value),{[e]:{name:e,validationFunction:t}});this.rolesSource.next(i)}addRoleWithPermissions(e,t){this.permissionsService.addPermission(t),this.addRole(e,t)}addRoles(e){Object.keys(e).forEach((t,i)=>{this.addRole(t,e[t])})}addRolesWithPermissions(e){Object.keys(e).forEach((t,i)=>{this.addRoleWithPermissions(t,e[t])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let t=m({},this.rolesSource.value);delete t[e],this.rolesSource.next(t)}getRoles(){return this.rolesSource.value}getRole(e){return this.rolesSource.value[e]}hasOnlyRoles(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([i,n])=>i||n))}hasRoleKey(e){let t=e.map(i=>{if(!!this.rolesSource.value[i]&&!!this.rolesSource.value[i].validationFunction&&l(this.rolesSource.value[i].validationFunction)&&!ne(this.rolesSource.value[i].validationFunction)){let o=this.rolesSource.value[i].validationFunction,h=m({},this.rolesSource.value);return c(null).pipe(v(()=>o(i,h)),j(x=>R(x)?c(x):x),F(()=>c(!1)))}return c(!1)});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasRolePermission(e,t){return f(t).pipe(p(i=>e[i]&&Array.isArray(e[i].validationFunction)?f(e[i].validationFunction).pipe(p(n=>this.permissionsService.hasPermission(n)),G(n=>n===!0)):c(!1)),S(i=>i===!0,!1)).toPromise()}};r.\u0275fac=function(t){return new(t||r)(d(N),d(k),d(E))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),Pe=(()=>{let r=class r{constructor(){this.permissionsAuthorized=new W,this.permissionsUnauthorized=new W,this.firstMergeUnusedRun=1,this.permissionsService=P(E),this.configurationService=P(B),this.rolesService=P(b),this.viewContainer=P(X),this.changeDetector=P(_),this.templateRef=P(Q)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let t=e.ngxPermissionsOnly,i=e.ngxPermissionsExcept;if(t||i){if(t&&t.firstChange||i&&i.firstChange)return;z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun),H(1)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,t])=>{if(e||t){this.handleUnauthorisedPermission(this.ngxPermissionsExceptElse||this.ngxPermissionsElse);return}if(this.ngxPermissionsOnly)throw!1;this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)}).catch(()=>{this.ngxPermissionsOnly?this.validateOnlyPermissions():this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)})}validateOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsOnly),this.rolesService.hasOnlyRoles(this.ngxPermissionsOnly)]).then(([e,t])=>{e||t?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&!this.currentAuthorizedState)){if(this.currentAuthorizedState=!1,this.permissionsUnauthorized.emit(),this.getUnAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getUnAuthorizedStrategyInput());return}this.configurationService.onUnAuthorisedDefaultStrategy&&!this.elseBlockDefined()?this.applyStrategy(this.configurationService.onUnAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}handleAuthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&this.currentAuthorizedState)){if(this.currentAuthorizedState=!0,this.permissionsAuthorized.emit(),this.getAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getAuthorizedStrategyInput());return}this.configurationService.onAuthorisedDefaultStrategy&&!this.thenBlockDefined()?this.applyStrategy(this.configurationService.onAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}applyStrategyAccordingToStrategyType(e){if(se(e)){this.applyStrategy(e);return}if(l(e)){this.showTemplateBlockInView(this.templateRef),e(this.templateRef);return}}showTemplateBlockInView(e){this.viewContainer.clear(),e&&(this.viewContainer.createEmbeddedView(e),this.changeDetector.markForCheck())}getAuthorisedTemplates(){return this.ngxPermissionsOnlyThen||this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef}elseBlockDefined(){return!!this.ngxPermissionsExceptElse||!!this.ngxPermissionsElse}thenBlockDefined(){return!!this.ngxPermissionsExceptThen||!!this.ngxPermissionsThen}getAuthorizedStrategyInput(){return this.ngxPermissionsOnlyAuthorisedStrategy||this.ngxPermissionsExceptAuthorisedStrategy||this.ngxPermissionsAuthorisedStrategy}getUnAuthorizedStrategyInput(){return this.ngxPermissionsOnlyUnauthorisedStrategy||this.ngxPermissionsExceptUnauthorisedStrategy||this.ngxPermissionsUnauthorisedStrategy}applyStrategy(e){if(e===D.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===D.REMOVE){this.viewContainer.clear();return}let t=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),t(this.templateRef)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275dir=J({type:r,selectors:[["","ngxPermissionsOnly",""],["","ngxPermissionsExcept",""]],inputs:{ngxPermissionsOnly:"ngxPermissionsOnly",ngxPermissionsOnlyThen:"ngxPermissionsOnlyThen",ngxPermissionsOnlyElse:"ngxPermissionsOnlyElse",ngxPermissionsExcept:"ngxPermissionsExcept",ngxPermissionsExceptElse:"ngxPermissionsExceptElse",ngxPermissionsExceptThen:"ngxPermissionsExceptThen",ngxPermissionsThen:"ngxPermissionsThen",ngxPermissionsElse:"ngxPermissionsElse",ngxPermissionsOnlyAuthorisedStrategy:"ngxPermissionsOnlyAuthorisedStrategy",ngxPermissionsOnlyUnauthorisedStrategy:"ngxPermissionsOnlyUnauthorisedStrategy",ngxPermissionsExceptUnauthorisedStrategy:"ngxPermissionsExceptUnauthorisedStrategy",ngxPermissionsExceptAuthorisedStrategy:"ngxPermissionsExceptAuthorisedStrategy",ngxPermissionsUnauthorisedStrategy:"ngxPermissionsUnauthorisedStrategy",ngxPermissionsAuthorisedStrategy:"ngxPermissionsAuthorisedStrategy"},outputs:{permissionsAuthorized:"permissionsAuthorized",permissionsUnauthorized:"permissionsUnauthorized"},features:[q]});let s=r;return s})(),oe="default";var te=(()=>{let r=class r{constructor(e,t,i){this.permissionsService=e,this.rolesService=t,this.router=i}canActivate(e,t){return this.hasPermissions(e,t)}canActivateChild(e,t){return this.hasPermissions(e,t)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,t){let i=e&&e.data?e.data.permissions:{},n=this.transformPermission(i,e,t);return this.isParameterAvailable(n.except)?this.passingExceptPermissionsValidation(n,e,t):this.isParameterAvailable(n.only)?this.passingOnlyPermissionsValidation(n,e,t):!0}transformPermission(e,t,i){let n=l(e.only)?e.only(t,i):w(e.only),o=l(e.except)?e.except(t,i):w(e.except),h=e.redirectTo;return{only:n,except:o,redirectTo:h}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,t,i){if(e.redirectTo&&(l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let n="";return f(e.except).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)||(n=o)}))),S(o=>o.some(h=>h===!0),!1),p(o=>n?(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):!o&&e.only?this.onlyRedirectCheck(e,t,i):c(!o))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([n,o])=>n||o?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,t,i),!1):e.only?this.checkOnlyPermissions(e,t,i):!0)}redirectToAnotherRoute(e,t,i,n){let o=l(e)?e(n,t,i):e;if(this.isRedirectionWithParameters(o)){o.navigationCommands=this.transformNavigationCommands(o.navigationCommands,t,i),o.navigationExtras=this.transformNavigationExtras(o.navigationExtras,t,i),this.router.navigate(o.navigationCommands,o.navigationExtras);return}Array.isArray(o)?this.router.navigate(o):this.router.navigate([o])}isRedirectionWithParameters(e){return K(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,t,i){return l(e)?e(t,i):e}transformNavigationExtras(e,t,i){return l(e)?e(t,i):e}onlyRedirectCheck(e,t,i){let n="";return f(e.only).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)&&(n=o)}))),S(o=>l(e.redirectTo)?o.some(h=>h===!0):o.every(h=>h===!1),!1),p(o=>l(e.redirectTo)?o?c(!0):(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):(n&&this.handleRedirectOfFailedPermission(e,n,t,i),c(!o)))).toPromise()}handleRedirectOfFailedPermission(e,t,i,n){this.isFailedPermissionPropertyOfRedirectTo(e,t)?this.redirectToAnotherRoute(e.redirectTo[t],i,n,t):l(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,i,n,t):this.redirectToAnotherRoute(e.redirectTo[oe],i,n,t)}isFailedPermissionPropertyOfRedirectTo(e,t){return!!e.redirectTo&&e.redirectTo[t]}checkOnlyPermissions(e,t,i){let n=m({},e);return Promise.all([this.permissionsService.hasPermission(n.only),this.rolesService.hasOnlyRoles(n.only)]).then(([o,h])=>o||h?!0:(n.redirectTo&&this.redirectToAnotherRoute(n.redirectTo,t,i),!1))}passingOnlyPermissionsValidation(e,t,i){return l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,t,i):this.checkOnlyPermissions(e,t,i)}};r.\u0275fac=function(t){return new(t||r)(d(E),d(b),d(ee))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();var Se=(()=>{let r=class r{static forRoot(e={}){return{ngModule:r,providers:[re,k,ie,E,te,b,B,{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:r,providers:[{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate},B,E,b,te]}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=Z({type:r}),r.\u0275inj=Y({});let s=r;return s})();var u=function(s){return s.SHOOPE="https://res.cloudinary.com/pos/image/upload/v1598262220/icons/marketplace_icons/shopee.png",s.WOOCOMMERCE="https://res.cloudinary.com/pos/image/upload/w_50/v1632447439/icons/WooCommerce/woocommerce-icon.webp",s.TOKOPEDIA="https://res.cloudinary.com/pos/image/upload/v1598262221/icons/marketplace_icons/tokopedia.png",s.TIKTOK="https://res.cloudinary.com/pos/image/upload/w_30/v1645761611/icons/Marketplace%20logo/tiktok.png",s.LAZADA="https://res.cloudinary.com/pos/image/upload/v1680681836/icons/marketplace_icons/Lazadanew.png",s.KALCARE="https://res.cloudinary.com/pos/image/upload/v1654230268/icons/marketplace_icons/kalcare.png",s.SHOPIFY="https://res.cloudinary.com/pos/image/upload/v1707987435/icons/marketplace_icons/shopify.png",s}(u||{});var a=function(s){return s[s.Tokopedia=1]="Tokopedia",s[s.WooCommerce=2]="WooCommerce",s[s.None=3]="None",s[s.KalCare=4]="KalCare",s[s.Shopee=5]="Shopee",s[s.Tiktok=6]="Tiktok",s[s.Lazada=7]="Lazada",s[s.Shopify=8]="Shopify",s}(a||{});var De=(()=>{let r=class r{static IsNotEmpty(e){return e!=""&&e!=r.GuidEMpty&&e!=null&&e!=null}static IsEmpty(e){return e==""||e==null||e==null||e==r.GuidEMpty}static getChannelLogoByTypeId(e){let t;switch(e){case a.Tokopedia:t=u.TOKOPEDIA;break;case a.Shopee:t=u.SHOOPE;break;case a.WooCommerce:t=u.WOOCOMMERCE;break;case a.Lazada:t=u.LAZADA;break;case a.Tiktok:t=u.TIKTOK;break;case a.KalCare:t=u.KALCARE;break;case a.Shopify:t=u.SHOPIFY;break}return t}static getChannelLogoByName(e=""){e=e.toLowerCase();let t;switch(e){case"tokopedia":t=u.TOKOPEDIA;break;case"shoppe":t=u.SHOOPE;break;case"woocommerce":t=u.WOOCOMMERCE;break;case"tiktok":t=u.TIKTOK;break;case"lazada":t=u.LAZADA;break;case"kalCare":t=u.KALCARE;break}return t}static getChannelName(e){let t;switch(e){case a.Shopee:t="Shopee";break;case a.Tokopedia:t="Tokopedia";break;case a.Lazada:t="Lazada";break;case a.Tiktok:t="Tiktok";break;case a.WooCommerce:t="WooCommerce";break;case a.KalCare:t="WooCommerce";break}return t}static assignChannelLogo(e){return e=e.map(t=>(t.logo=this.getChannelLogoByTypeId(t.TypeID),t)),e}static getCssChannelColor(e){let t;switch(e){case a.Shopee:t="#ee4d2d";break;case a.Tokopedia:t="var(--G500,#03AC0E)";break;case a.Lazada:t="#FF00B2";break;case a.Tiktok:t="black";break;case a.WooCommerce:t="#674399";break;case a.KalCare:t="rgb(128, 188, 0)";break}return t}static getDaysDiff(e,t){var i=t.getTime()-e.getTime(),n=i/(1e3*60*60*24);return n}static addDays(e,t){let i=new Date(Number(e));return i.setDate(e.getDate()-t),i}static isValidDate(e){return e instanceof Date&&!isNaN(e)}static getImageInfo(e){return new Promise((t,i)=>{let n=new Image;n.src=e,n.decode().then(()=>{t({img:e,height:n.height,width:n.width})}).catch(()=>{i(new Error(`Image load error for ${e}`))})})}static formatTitleFromDate(e,t){let i=null,n=new Date(e),o=new Date(t);return n.getDate()!=o.getDate()&&(i="dd"),n.getMonth()!=o.getMonth()&&(i="dd MMM"),n.getFullYear()!=o.getFullYear()&&(i="dd MMM yyyy"),i}static openDownloadFile(e,t){var i=window.URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click()}static compare(e,t,i){return(e<t?-1:1)*(i?1:-1)}static isDateExpired(e){let t=new Date,i=!1;return e.getTime()<t.getTime()&&(i=!0),i}};r.GuidEMpty="00000000-0000-0000-0000-000000000000",r.MinDate="0001-01-01T00:00:00";let s=r;return s})();export{u as a,a as b,De as c,E as d,Pe as e,Se as f};
@@ -0,0 +1 @@
1
+ import{a as Ke}from"./chunk-IWVYX6KY.js";import{a as He,b as Je,c as Ze}from"./chunk-G5LCLRIW.js";import{a as L,b as Pe,c as ve,d as be,e as ye}from"./chunk-IPGAIBF6.js";import{a as Se}from"./chunk-WQ7LUTQ2.js";import{b as qe}from"./chunk-BMZAGAK3.js";import{a as Xe,b as Ye}from"./chunk-N4S3Q3EC.js";import{a as ue}from"./chunk-662E5VTA.js";import{a as Y}from"./chunk-KBYAFLE5.js";import{a as X}from"./chunk-U5YOE633.js";import"./chunk-INNTQ5YN.js";import{a as ze,b as Ge}from"./chunk-SRYGE2HW.js";import{a as xe}from"./chunk-MYMGWQRE.js";import"./chunk-DT3B54LD.js";import{a as Re,b as Be,d as Ue,e as Ae}from"./chunk-AL67KXJV.js";import{a as Ce}from"./chunk-3LQ5TKLD.js";import{g as J}from"./chunk-OHTJCLX7.js";import{b as G,e as K}from"./chunk-K3G6FMDF.js";import"./chunk-JM3LERUP.js";import{B as je,C as q,D as We,q as fe,r as $e,u as Z}from"./chunk-ZKBLXGXT.js";import"./chunk-6B64VOO7.js";import{b as me,c as de,h as k,k as O,m as _e,u as ge,v as Oe}from"./chunk-SP6QPE3M.js";import{c as H,e as he,f as Le}from"./chunk-6F6NSBIF.js";import{Ab as m,B as R,Bb as N,Cb as y,Db as ce,Eb as T,Fb as V,Gb as D,Ha as M,Ia as l,Ib as Ne,Ja as b,Kb as E,Q as ae,Rb as S,Sb as v,Tb as se,Ub as ne,Wa as d,Wc as ke,X as B,Ya as p,_c as pe,aa as oe,fb as r,gb as c,ha as F,hb as P,ia as re,ib as I,ic as U,jb as w,kc as A,lb as f,lc as $,ob as C,oc as j,pa as g,q as ee,qa as u,qb as s,rc as W,sc as z,tb as le,za as Fe,zb as te}from"./chunk-6DRNAUKE.js";import"./chunk-GRMIXZTT.js";function gt(i,o){if(i&1){let n=f();r(0,"button",18),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.onUpdateItems(t))}),P(1,"i",19),m(2," Update "),c()}}function ut(i,o){if(i&1&&(r(0,"div"),d(1,gt,3,0,"button",17),c()),i&2){let n=o.ngIf,e=s(2);l(),p("ngIf",e.productService.hasSelectionVariant(n))}}function ht(i,o){if(i&1){let n=f();r(0,"div",20)(1,"app-table",21),S(2,"async"),C("onToggle",function(t){g(n);let a=s(2);return u(a.onShowDifferencePrice(t))})("onSubmit",function(t){g(n);let a=s(2);return u(a.updatePriceByVariant(t))}),c()()}if(i&2){let n=s().ngIf,e=s();l(),p("showProductToggle",!0)("data",v(2,4,e.paginationService.data$))("channel",e.channelOptions)("filter",n.Filter)}}function Ct(i,o){if(i&1){let n=f();r(0,"span",22),C("click",function(){g(n);let t=s(2);return u(t.getRowCount())}),r(1,"i",23),m(2,"?"),c()()}}function ft(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function xt(i,o){if(i&1){let n=f();r(0,"a",24),C("click",function(){g(n);let t=s(2);return u(t.onNextPage())}),P(1,"i",25),m(2," Next"),c()}}function St(i,o){if(i&1){let n=f();r(0,"a",26),C("click",function(){g(n);let t=s(2);return u(t.onLastPage())}),P(1,"i",27),m(2," Last"),c()}}function Pt(i,o){if(i&1){let n=f();r(0,"mainpanel",1),C("onSubmit",function(t){g(n);let a=s();return u(a.onSearch(t))}),r(1,"actions")(2,"div",2),d(3,ut,2,1,"div",3),S(4,"async"),c()(),r(5,"filters")(6,"div")(7,"label",4),m(8,"Page Number"),c(),r(9,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(10,"div",6)(11,"label",4),m(12,"Page Size"),c(),r(13,"input",5),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),r(14,"content")(15,"div",7)(16,"div",8),d(17,ht,3,6,"div",9),S(18,"async"),c(),r(19,"div",10)(20,"div",11)(21,"div",12),m(22),S(23,"async"),S(24,"number"),d(25,Ct,3,0,"span",13)(26,ft,3,3,"span",3),S(27,"async"),m(28),c()(),r(29,"div",14),d(30,xt,3,0,"a",15)(31,St,3,0,"a",16),c()()()()()}if(i&2){let n,e=s();p("pageData",e.pageData)("textButton","Search"),l(3),p("ngIf",v(4,12,e.paginationService.data$)),l(6),T("ngModel",e.searchFilter.PageNumber),l(4),T("ngModel",e.searchFilter.RowCount),l(4),p("ngIf",v(18,14,e.paginationService.data$)),l(5),y(" Showing 1 - ",v(24,18,(n=v(23,16,e.paginationService.data$))==null?null:n.length)," of "),l(3),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",!e.paginationService.hideCount&&v(27,20,e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(2),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),l(),p("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}var rt=(()=>{let o=class o{constructor(e,t,a,_,h,x){this.http=e,this.toastr=t,this.dialog=a,this.paginationService=_,this.productService=h,this.authService=x,this.loaderAPI="PriceLoader/LoadMultiple",this.getDataAPI="Price/GetMultipleChannelComparison",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterOptions=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Price",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!0},{Title:"Price Realtime",Url:"/menu/price/realtime",Active:!1}]},this.channelOptions=this.authService.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.getDataAPI,this.loader$=this.http.post(`/api/${this.loaderAPI}`).pipe(B(e=>{e.Filter={PageNumber:e.Filter.PageNumber,RowCount:e.Filter.RowCount,filterModel:1},this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onShowDifferencePrice(e){this.searchFilter.filterModel=1,e&&(this.searchFilter.filterModel=3),this.paginationService.reloadPagination(this.searchFilter)}onSearch(e){this.searchFilter.text=e,this.paginationService.reloadPagination(this.searchFilter)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let _=t.map(x=>({ID:x.ID,Code:x.Code,Price:x.UnitPrice}));var a=this.channelOptions.filter(x=>x.selected).map(x=>x.ID);let h={ListChannelID:a,ListPrice:_};this.http.post("/api/Price/UpdateChannel",h).subscribe(x=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+h.ListPrice.length+" items in "+h.ListChannelID.length+" channels","Success")})}}updatePriceByVariant(e){let t={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:e.Price-0,VariantID:e.ID};this.http.post("/api/Price/UpdatePriceByID",t).subscribe(a=>{let _=this.productService.findChannelById(t.ID,this.channelOptions);this.toastr.success("Successfully updated "+e.ItemName+"("+e.VarName+") price in "+_.Name+" to "+t.Price,"Success"),this.paginationService.reloadPagination(this.searchFilter)})}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>a!==void 0)).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/api/${this.rowCountAPI}`,{})}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/api/${this.rowCountAPI}`,{}).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}})}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(Y),b(X),b(J))},o.\u0275cmp=F({type:o,selectors:[["app-price-pos-channel"]],decls:2,vars:3,consts:[["headerTitle","Price Comparison",3,"pageData","textButton","onSubmit",4,"ngIf"],["headerTitle","Price Comparison",3,"onSubmit","pageData","textButton"],[1,"d-flex"],[4,"ngIf"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[1,"mt-5"],[1,"container-fluid","mt-3"],[1,"row"],["class","col-md-12",4,"ngIf"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary border-start-0","title","Load all products",3,"click",4,"ngIf"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"col-md-12"],["productToggleTitle","FILTER DIFFERENT PRICE","table","price",3,"onToggle","onSubmit","showProductToggle","data","channel","filter"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,Pt,32,22,"mainpanel",0),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[$,de,_e,k,O,q,be,j,W],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let i=o;return i})();var vt=i=>({"border-0 rounded":i});function bt(i,o){if(i&1&&(r(0,"mat-radio-button",3),m(1),c()),i&2){let n=o.$implicit,e=o.index,t=s();p("value",n.Key)("name",t.name)("title",t.tooltipsText[e]?t.tooltipsText[e]:""),l(),y(" ",n.Value,"")}}var Ie=(()=>{let o=class o{constructor(){this.modelChange=new Fe,this.border=!1,this.tooltipsText=[]}change(e){this.modelChange.emit(e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["radio-options"]],inputs:{model:"model",options:"options",border:"border",name:"name",tooltipsText:"tooltipsText"},outputs:{modelChange:"modelChange"},standalone:!0,features:[Ne],decls:3,vars:5,consts:[[1,"form-control","h-100","rounded-1",3,"ngClass"],[3,"ngModelChange","ngModel"],["class","me-5","data-toggle","tooltip","data-placement","right",3,"value","name","title",4,"ngFor","ngForOf"],["data-toggle","tooltip","data-placement","right",1,"me-5",3,"value","name","title"]],template:function(t,a){t&1&&(r(0,"div",0)(1,"mat-radio-group",1),C("ngModelChange",function(h){return a.change(h)}),d(2,bt,2,4,"mat-radio-button",2),c()()),t&2&&(p("ngClass",E(3,vt,a.border==!1)),l(),p("ngModel",a.model),l(),p("ngForOf",a.options))},dependencies:[z,U,A,Ze,He,Je,ge,k,O],styles:[".mat-radio-label{margin-top:auto;margin-bottom:auto}"]});let i=o;return i})();var lt=i=>[i],Dt=i=>({"text-decoration-line-through":i}),Et=i=>({"border-bottom":i}),Mt=i=>({"bg-gradient-warning":i});function Ft(i,o){if(i&1){let n=f();I(0),r(1,"div")(2,"label",25),m(3,"Filter by"),c(),r(4,"radio-options",26),D("modelChange",function(t){g(n);let a=s();return V(a.filterType,t)||(a.filterType=t),u(t)}),c()(),w()}if(i&2){let n=s();l(4),T("model",n.filterType),p("options",n.filterTypeOptions)("border",!0)}}function Nt(i,o){if(i&1){let n=f();r(0,"button",29),C("click",function(){g(n);let t=s().ngIf,a=s();return u(a.onUpdateItems(t))}),P(1,"i",30),m(2," Update "),c()}}function kt(i,o){if(i&1&&(I(0),r(1,"div",27),d(2,Nt,3,0,"button",28),c(),w()),i&2){let n=o.ngIf,e=s();l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function Ot(i,o){if(i&1&&(r(0,"th",31)(1,"div",32),P(2,"img",33),r(3,"div",34),m(4),S(5,"stringLimit"),c()()()),i&2){let n=o.$implicit;l(),p("matTooltip",(n.Name==null?null:n.Name.length)>20?n.Name:""),l(),p("src",n==null?null:n.Img,M),l(2),ce("",se(5,4,n.Name,20),"",(n.Name==null?null:n.Name.length)>20?"...":"","")}}function Lt(i,o){if(i&1){let n=f();r(0,"th")(1,"input",35),D("ngModelChange",function(t){g(n);let a=s();return V(a.checkboxState,t)||(a.checkboxState=t),u(t)}),C("ngModelChange",function(){g(n);let t=s();return u(t.onSelectAllData())}),c()()}if(i&2){let n=s();l(),T("ngModel",n.checkboxState)}}function Rt(i,o){i&1&&(I(0),r(1,"th",36)(2,"span"),m(3,"Expected"),c(),r(4,"span",37),m(5,"(POS)"),c()(),r(6,"th",36),m(7," Channel "),c(),w())}function Bt(i,o){if(i&1){let n=f();r(0,"img",49),C("click",function(t){g(n);let a=s(3).$implicit,_=s(2);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c()}if(i&2){let n=s(3).$implicit;le("src",n==null?null:n.ImageUrl,M)}}function Ut(i,o){i&1&&P(0,"img",50)}function At(i,o){if(i&1&&(I(0),r(1,"td",44),d(2,Bt,1,1,"img",45)(3,Ut,1,0,"ng-template",null,0,ne),c(),r(5,"td",46)(6,"h5",47),m(7),c(),r(8,"small",48),m(9),c()(),w()),i&2){let n=te(4),e=s().index,t=s().$implicit,a=s().ngIf;l(),p("rowSpan",t==null?null:t.Variants.length)("ngClass",E(7,Et,e+1==a.length)),l(),p("ngIf",t==null?null:t.ImageUrl)("ngIfElse",n),l(3),p("rowSpan",t==null?null:t.Variants.length),l(2),N(t==null?null:t.Name),l(2),y("(",t==null?null:t.Category,")")}}function $t(i,o){if(i&1){let n=f();r(0,"td",51)(1,"input",35),D("ngModelChange",function(t){g(n);let a=s().$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()()}if(i&2){let n=s().$implicit;l(),T("ngModel",n.selected)}}function jt(i,o){if(i&1){let n=f();I(0),r(1,"td",53),m(2),S(3,"number"),c(),r(4,"td",54),C("click",function(){let t=g(n).$implicit,a=s(2).$implicit,_=s().$implicit,h=s(2);return u(h.openTableDialog(a,_,t))}),r(5,"div",55)(6,"div",56),m(7),S(8,"number"),c(),r(9,"a",57),C("click",function(t){return g(n),u(t==null?null:t.stopPropagation())}),P(10,"i",43),c()()(),w()}if(i&2){let n=o.$implicit;l(2),y(" ",v(3,4,n.PriceExpected)," "),l(2),p("ngClass",E(8,Mt,n.Price!=n.PriceExpected)),l(3),y(" ",v(8,6,n.Price)," "),l(2),p("href",n.Url,M)}}function Wt(i,o){i&1&&(r(0,"td",58),m(1,"X"),c(),r(2,"td",58),m(3,"X"),c())}function zt(i,o){if(i&1&&(I(0),d(1,jt,11,10,"ng-container",52)(2,Wt,4,0,"ng-template",null,1,ne),w()),i&2){let n=o.$implicit,e=te(3),t=s().$implicit,a=s(3);l(),p("ngIf",a.getItemFromChannel(t,n.ID))("ngIfElse",e)}}function Gt(i,o){if(i&1&&(r(0,"tr"),d(1,At,10,9,"ng-container",3),r(2,"td",38),m(3),c(),r(4,"td",39)(5,"div",40)(6,"div",41),m(7),c(),r(8,"div",34)(9,"a",42),P(10,"i",43),c()()()(),d(11,$t,2,1,"ng-template",16)(12,zt,4,2,"ng-container",17),c()),i&2){let n=o.$implicit,e=o.index,t=s(3);l(),p("ngIf",e==0),l(2),N(n==null?null:n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(2),p("ngClass",E(8,Dt,n.isDiscontinued)),l(),y(" ",n==null?null:n.Code,""),l(2),p("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M),l(2),p("ngxPermissionsOnly",E(10,lt,t.rolePriceEdit)),l(),p("ngForOf",t.channelOptions)}}function Kt(i,o){if(i&1&&(r(0,"tbody"),d(1,Gt,13,12,"tr",17),c()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Ht(i,o){if(i&1&&(I(0),d(1,Kt,2,1,"tbody",17),w()),i&2){let n=o.ngIf;l(),p("ngForOf",n)}}function Jt(i,o){if(i&1){let n=f();r(0,"span",59),C("click",function(){g(n);let t=s();return u(t.getRowCount())}),r(1,"i",60),m(2,"?"),c()()}}function Zt(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n))}}function qt(i,o){if(i&1){let n=f();r(0,"a",61),C("click",function(){g(n);let t=s();return u(t.onNextPage())}),P(1,"i",62),m(2," Next"),c()}}function Xt(i,o){if(i&1){let n=f();r(0,"a",63),C("click",function(){g(n);let t=s();return u(t.onLastPage())}),P(1,"i",64),m(2," Last"),c()}}var ct=(()=>{let o=class o{constructor(e,t,a,_,h,x,we){this.http=e,this.toastr=t,this.dialog=a,this.productService=_,this.authService=h,this.biggerPictureService=x,this.paginationService=we,this.searchFilter=new Ke,this.checkboxState=!1,this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.rowCountAPI="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:L.ALL,Value:"All"},{Key:L.DIFFERENCE,Value:"Difference"}],this.filterType=L.ALL,this.pageData={Title:"Price Realtime",Nav:[{Title:"Price Cache",Url:"/menu/price",Active:!1}]},this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPagination()}initPagination(){this.paginationService.fetchDataEndpoint="Price/GetOutletPrice",this.initProduct(),this.initPageLoader()}initProduct(){this.data$=this.paginationService.data$.pipe(ee(e=>(e=e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.isDiscontinued=a.Discontinued=="Yes",a))),t)),e)),ae(1))}initPageLoader(){this.loader$=this.http.post("/api/PriceLoader/LoadMultiple",{}).pipe(B(e=>{this.searchFilter=e.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{}).pipe(B(e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e)}))}getRowCount(){this.paginationService.hideCount=!1,this.totalData$=this.http.post(`/api/${this.rowCountAPI}`,{})}onSelectAllData(){this.data$=this.data$.pipe(ee(e=>(e.map(t=>(t.Variants&&(t.Variants=t.Variants.map(a=>(a.selected=this.checkboxState,a))),t)),e)))}onFilter(e){let t={text:e,filterModel:this.filterType,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount};this.paginationService.reloadPagination(t)}updatePrice(e){let t=this.productService.selectedVariantProduct(e);if(t.length>0){let a=t.map(x=>x.ID),h={ListChannelID:this.channelOptions.filter(x=>x.selected).map(x=>x.ID),ListID:a};this.http.post("/api/Price/UpdateChannelOutletPrice",h).subscribe({next:x=>{this.resetSelectedChannel(),this.onFilter(),this.toastr.success("Successfully updated "+h.ListID.length+" items in "+h.ListChannelID.length+" channels","Success")},error:x=>{this.resetSelectedChannel()}})}}resetSelectedChannel(){this.channelOptions=this.channelOptions.map(e=>(e.selected=!1,e))}getItemFromChannel(e,t){return e.Channel.find(a=>a.ChannelID==t)}onUpdateItems(e){let t=this.productService.selectedVariantProduct(e);this.dialog.open(Se,{data:{selectedItems:t,channels:this.channelOptions},width:"600px"}).afterClosed().pipe(R(a=>H.IsNotEmpty(a))).subscribe(a=>{this.channelOptions=a,this.updatePrice(e)})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:a?.ChannelID,Table:"price",ChannelItemID:a?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateProductPrice(x,a)})}updateProductPrice(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{t.Price=a.Price;let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success")})}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(G),b(Z),b(X),b(J),b(xe),b(Y))},o.\u0275cmp=F({type:o,selectors:[["app-custom-channel-price"]],decls:42,vars:30,consts:[["elsePic",""],["elseCol",""],["headerTitle","Price Comparison",3,"onSubmit","pageData","hideSearchBox","hideSearchDropdown","textButton"],[4,"ngIf"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],[1,"channel-column"],["colspan","5"],["scope","col","colspan","2","class","text-center border-bottom-0 border text-uppercase",4,"ngFor","ngForOf"],["scope","col","colspan","2",1,"text-center","w-25"],["scope","col",1,"text-start","w-20"],["scope","col",1,"text-end","w-10"],[3,"ngxPermissionsOnly"],[4,"ngFor","ngForOf"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor: pointer",3,"click",4,"ngIf"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary border-start-0","title","Load all products",3,"click",4,"ngIf"],[1,"fw-bold","mb-2"],["name","filterModel",3,"modelChange","model","options","border"],[1,"d-flex"],["type","button","class","btn btn-success shadow rounded","data-toggle","modal",3,"click",4,"ngIf"],["type","button","data-toggle","modal",1,"btn","btn-success","shadow","rounded",3,"click"],[1,"fas","fa-chevron-circle-up"],["scope","col","colspan","2",1,"text-center","border-bottom-0","border","text-uppercase"],["matTooltipPosition","above",1,"d-flex","align-items-center","justify-content-center",2,"width","180px",3,"matTooltip"],[2,"width","16px","height","16px",3,"src"],[1,"ms-2"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"text-end","border-top-0","border","w-10"],[1,"ms-1"],[1,"text-start","border-bottom"],["matTooltipPosition","above",1,"text-end","border-bottom",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],["target","_blank",3,"href"],[1,"fas","fa-lg","fa-external-link-alt","external-link-custom"],[1,"text-center",3,"rowSpan","ngClass"],["class","border rounded w-img cursor-pointer",3,"src","click",4,"ngIf","ngIfElse"],[1,"text-start","border-bottom",2,"padding-left","0px",3,"rowSpan"],[1,"mb-0","item-name"],[1,"mt-1"],[1,"border","rounded","w-img","cursor-pointer",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img"],[1,"align-middle"],[4,"ngIf","ngIfElse"],[1,"text-end","border"],[1,"text-center","border","pointer","cell-hover",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-center"],[1,"me-2"],["target","_blank",3,"click","href"],[1,"table-white","border","text-end",2,"color","red"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){if(t&1&&(r(0,"mainpanel",2),C("onSubmit",function(h){return a.onFilter(h)}),r(1,"filters"),d(2,Ft,5,3,"ng-container",3),S(3,"async"),c(),r(4,"actions"),d(5,kt,3,1,"ng-container",3),S(6,"async"),c(),r(7,"content")(8,"div",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"table",8)(13,"thead",9)(14,"tr",10),P(15,"th",11),d(16,Ot,6,7,"th",12),c(),r(17,"tr")(18,"th",13)(19,"span"),m(20," Product "),c()(),r(21,"th",14),m(22,"Variant"),c(),r(23,"th",15),m(24,"SKU"),c(),d(25,Lt,2,1,"ng-template",16)(26,Rt,8,0,"ng-container",17),c()(),d(27,Ht,2,1,"ng-container",3),S(28,"async"),c()()()(),r(29,"div",18)(30,"div",19)(31,"div",20),m(32),S(33,"async"),S(34,"number"),d(35,Jt,3,0,"span",21)(36,Zt,3,3,"span",3),S(37,"async"),m(38),c()(),r(39,"div",22),d(40,qt,3,0,"a",23)(41,Xt,3,0,"a",24),c()()()()()),t&2){let _;p("pageData",a.pageData)("hideSearchBox",!1)("hideSearchDropdown",!1)("textButton","Search"),l(2),p("ngIf",v(3,16,a.loader$)),l(3),p("ngIf",v(6,18,a.data$)),l(11),p("ngForOf",a.channelOptions),l(9),p("ngxPermissionsOnly",E(28,lt,a.rolePriceEdit)),l(),p("ngForOf",a.channelOptions),l(),p("ngIf",v(28,20,a.data$)),l(5),y(" Showing 1 - ",v(34,24,(_=v(33,22,a.paginationService.data$))==null?null:_.length)," of "),l(3),p("ngIf",a.paginationService.hideCount),l(),p("ngIf",!a.paginationService.hideCount&&v(37,26,a.totalData$)),l(2),y(" records ~ ",a.paginationService.footerPageNumber," Page "),l(2),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage),l(),p("ngIf",a.paginationService.disableNextButton&&!a.paginationService.goToLastPage)}},dependencies:[U,A,$,me,k,O,q,fe,Ie,he,j,W,ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-20[_ngcontent-%COMP%]{width:20%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{font-weight:400;font-size:larger}.cell-hover[_ngcontent-%COMP%]:hover{background-color:#c9c9c9!important}"]});let i=o;return i})();var Ee=i=>[i],Yt=i=>({"text-decoration-line-through":i}),Qt=i=>({"bg-gradient-warning":i}),en=i=>({"ms-10":i});function tn(i,o){if(i&1&&(r(0,"span",10),P(1,"img",11),c(),m(2)),i&2){let n=o.item;l(),p("src",n==null?null:n.Img,M),l(),y(" ",n.Name," ")}}function nn(i,o){if(i&1){let n=f();r(0,"button",16),C("click",function(){g(n);let t=s().ngIf,a=s(2);return u(a.updateStock(t))}),P(1,"i",17),m(2," Update "),c()}}function an(i,o){if(i&1){let n=f();r(0,"actions")(1,"div",12),d(2,nn,3,0,"button",13),r(3,"button",14),C("click",function(){g(n);let t=s(2);return u(t.Export())}),P(4,"i",15),r(5,"span"),m(6,"Export"),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(2),p("ngIf",e.productService.hasSelectionVariant(n))}}function on(i,o){if(i&1){let n=f();r(0,"th")(1,"input",37),C("change",function(t){g(n);let a=s().ngIf,_=s(2);return u(_.onSelectAllSKU(t.target.checked,a))}),c()()}}function rn(i,o){if(i&1){let n=f();r(0,"input",54),D("ngModelChange",function(t){g(n);let a=s(4).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),C("ngModelChange",function(){g(n);let t=s(4).$implicit,a=s(3);return u(a.onCheckboxStateProduct(t))}),c()}if(i&2){let n=s(4).$implicit;T("ngModel",n.selected)}}function ln(i,o){if(i&1&&(I(0),d(1,rn,1,1,"ng-template",26),w()),i&2){let n=s(6);l(),p("ngxPermissionsOnly",E(1,Ee,n.rolePriceEdit))}}function cn(i,o){if(i&1){let n=f();I(0),r(1,"img",55),C("click",function(t){g(n);let a=s(3).$implicit,_=s(3);return u(_.onZoomImage(t,a==null?null:a.ImageUrl))}),c(),w()}if(i&2){let n=s(3).$implicit;l(),le("src",n.ThumbnailUrl,M)}}function sn(i,o){i&1&&P(0,"img",56)}function pn(i,o){if(i&1&&(I(0),P(1,"br"),r(2,"small"),m(3),c(),w()),i&2){let n=s(3).$implicit;l(3),y("(",n.Category,")")}}function mn(i,o){if(i&1&&(I(0),r(1,"td",49)(2,"div",50),d(3,ln,2,3,"ng-container",9),r(4,"div",39),d(5,cn,2,1,"ng-container",51)(6,sn,1,0,"ng-template",null,0,ne),c()()(),r(8,"td",52)(9,"span",53),m(10),c(),d(11,pn,4,1,"ng-container",9),c(),w()),i&2){let n=te(7),e=s(2).$implicit,t=s(3);l(),p("rowSpan",e.Variants.length),l(2),p("ngIf",(e.Variants==null?null:e.Variants.length)>1),l(),p("ngClass",E(8,en,(e.Variants==null?null:e.Variants.length)<=1)),l(),p("ngIf",e.ThumbnailUrl)("ngIfElse",n),l(3),p("rowSpan",e.Variants.length),l(2),N(e.Name),l(),p("ngIf",(e==null?null:e.CategoryID)!==null&&(e==null?null:e.CategoryID)!=t.guidEmpty)}}function dn(i,o){if(i&1){let n=f();r(0,"input",59),D("ngModelChange",function(t){g(n);let a=s(2).$implicit;return V(a.selected,t)||(a.selected=t),u(t)}),c()}if(i&2){let n=s(2).$implicit;T("ngModel",n.selected)}}function _n(i,o){if(i&1&&(r(0,"td",57),d(1,dn,1,1,"input",58),c()),i&2){let n=s().$implicit;l(),p("ngIf",n.Inventory>=0)}}function gn(i,o){i&1&&(r(0,"div",60),m(1,"Not Found"),c())}function un(i,o){if(i&1&&(r(0,"div"),m(1),S(2,"number"),c()),i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.UnitPrice),"")}}function hn(i,o){if(i&1&&(I(0),r(1,"div",44)(2,"a",45),P(3,"i",61),c()(),w()),i&2){let n=s().$implicit,e=s(4);l(2),p("href",e.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(n==null?null:n.ID),M)}}function Cn(i,o){if(i&1){let n=f();r(0,"div",62),C("click",function(){g(n);let t=s().$implicit,a=s().$implicit,_=s(2).ngIf,h=s();return u(h.openTableDialog(t,a,_))}),m(1),S(2,"number"),c()}if(i&2){let n=s().$implicit;l(),y(" ",v(2,1,n.Channel[0]==null?null:n.Channel[0].Price)," ")}}function fn(i,o){if(i&1){let n=f();r(0,"tr"),d(1,mn,12,10,"ng-container",9),r(2,"td",24),m(3),c(),r(4,"td",38)(5,"span",39),m(6),c()(),d(7,_n,2,1,"ng-template",26),r(8,"td",27)(9,"div",40),d(10,gn,2,0,"div",41)(11,un,3,3,"div",9)(12,hn,4,1,"ng-container",9),c()(),r(13,"td",42)(14,"div",40),d(15,Cn,3,3,"div",43),r(16,"div",44)(17,"a",45),P(18,"i",46),c()(),r(19,"div",44)(20,"div",47),C("click",function(){let t=g(n).$implicit,a=s(4);return u(a.refreshPrice(t))}),P(21,"i",48),c()()()()()}if(i&2){let n=o.$implicit,e=o.index,t=s(4);l(),p("ngIf",e==0),l(2),N(n.Model),l(),p("matTooltip",n.isDiscontinued?t.discontinuedVariantMsg:""),l(),p("ngClass",E(12,Yt,n.isDiscontinued)),l(),y(" ",n.Code," "),l(),p("ngxPermissionsOnly",E(14,Ee,t.rolePriceEdit)),l(3),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)!=null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngIf",(n.Channel[0]==null?null:n.Channel[0].Description)==null),l(),p("ngClass",E(16,Qt,n.UnitPrice!=(n.Channel[0]==null?null:n.Channel[0].Price))),l(2),p("ngIf",n.Channel.length>0),l(2),p("href",n.Channel[0]==null?null:n.Channel[0].Url,M)}}function xn(i,o){if(i&1&&(I(0),d(1,fn,22,18,"tr",31),w()),i&2){let n=o.$implicit;l(),p("ngForOf",n.Variants)}}function Sn(i,o){if(i&1){let n=f();r(0,"span",62),C("click",function(){g(n);let t=s(3);return u(t.getRowCount())}),r(1,"i",63),m(2,"?"),c()()}}function Pn(i,o){if(i&1&&(r(0,"span"),m(1),S(2,"number"),c()),i&2){let n=o.ngIf;l(),N(v(2,1,n.Total))}}function vn(i,o){if(i&1){let n=f();r(0,"a",67),C("click",function(){g(n);let t=s(4);return u(t.onNextPage())}),P(1,"i",68),m(2," Next"),c()}}function bn(i,o){if(i&1){let n=f();r(0,"a",69),C("click",function(){g(n);let t=s(4);return u(t.onLastPage())}),P(1,"i",70),m(2," Last"),c()}}function yn(i,o){if(i&1&&(r(0,"div",64),d(1,vn,3,0,"a",65)(2,bn,3,0,"a",66),c()),i&2){let n=s(3);l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage),l(),p("ngIf",n.paginationService.disableNextButton&&!n.paginationService.goToLastPage)}}function In(i,o){if(i&1){let n=f();r(0,"content")(1,"div",18)(2,"div",19)(3,"table",20)(4,"thead",21)(5,"tr")(6,"th",22),m(7," Product "),r(8,"div")(9,"mat-slide-toggle",23),D("ngModelChange",function(t){g(n);let a=s(2);return V(a.toggleDifferentInventory,t)||(a.toggleDifferentInventory=t),u(t)}),C("toggleChange",function(){g(n);let t=s(2);return u(t.onToggleDifferentInventory())}),r(10,"small",7),m(11,"FILTER DIFFERENT PRICE"),c()()()(),r(12,"th",24),m(13,"Variant"),c(),r(14,"th",25),m(15,"SKU"),c(),d(16,on,2,0,"ng-template",26),r(17,"th",27),m(18,"POS"),c(),r(19,"th",27)(20,"div",28),C("click",function(){g(n);let t=s(2);return u(t.openModalFilter())}),P(21,"img",29),r(22,"span",30),m(23),S(24,"stringLimit"),c()()()()(),r(25,"tbody"),d(26,xn,2,1,"ng-container",31),c()(),r(27,"div",32)(28,"div",33)(29,"div",34),m(30),S(31,"number"),d(32,Sn,3,0,"span",35)(33,Pn,3,3,"span",9),S(34,"async"),m(35),c()(),d(36,yn,3,2,"div",36),c()()()()}if(i&2){let n=o.ngIf,e=s(2);l(9),T("ngModel",e.toggleDifferentInventory),l(7),p("ngxPermissionsOnly",E(19,Ee,e.rolePriceEdit)),l(4),p("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?e.selectedChannel==null?null:e.selectedChannel.Name:""),l(),p("src",e.selectedChannel==null?null:e.selectedChannel.Img,M),l(2),ce(" ",se(24,12,e.selectedChannel==null?null:e.selectedChannel.Name,20),"",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=20?"...":""," "),l(3),p("ngForOf",n),l(4),y(" Showing 1 - ",v(31,15,n==null?null:n.length)," of "),l(2),p("ngIf",e.paginationService.hideCount),l(),p("ngIf",v(34,17,!e.paginationService.hideCount&&e.allDataCount$)),l(2),y(" records ~ ",e.paginationService.footerPageNumber," Page "),l(),p("ngIf",n.length>0)}}function wn(i,o){if(i&1){let n=f();r(0,"mainpanel",2),D("textChange",function(t){g(n);let a=s();return V(a.searchFilter.text,t)||(a.searchFilter.text=t),u(t)}),C("onSubmit",function(){g(n);let t=s();return u(t.onSearch())}),r(1,"filters")(2,"div")(3,"label",3),m(4,"Channel"),c(),r(5,"ng-select",4),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.ChannelID,t)||(a.searchFilter.ChannelID=t),u(t)}),d(6,tn,3,2,"ng-template",5),c()(),r(7,"div",6)(8,"label",7),m(9,"Page Number"),c(),r(10,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.PageNumber,t)||(a.searchFilter.PageNumber=t),u(t)}),c()(),r(11,"div",6)(12,"label",7),m(13,"Page Size"),c(),r(14,"input",8),D("ngModelChange",function(t){g(n);let a=s();return V(a.searchFilter.RowCount,t)||(a.searchFilter.RowCount=t),u(t)}),c()()(),d(15,an,7,1,"actions",9),S(16,"async"),d(17,In,37,21,"content",9),S(18,"async"),c()}if(i&2){let n=s();p("headerTitle",n.pageTitle),T("text",n.searchFilter.text),l(5),p("clearable",!1)("items",n.channelOptions),T("ngModel",n.searchFilter.ChannelID),l(5),T("ngModel",n.searchFilter.PageNumber),l(4),T("ngModel",n.searchFilter.RowCount),l(),p("ngIf",v(16,9,n.data$)),l(2),p("ngIf",v(18,11,n.data$))}}var st=(()=>{let o=class o{constructor(e,t,a,_,h,x,we,Me,dt){this.http=e,this.paginationService=t,this.toastr=a,this.dialog=_,this.productService=h,this.biggerPictureService=x,this.inventoryService=we,this.authService=Me,this.mainPanelService=dt,this.pageTitle="Price Single Channel Comparison",this.toggleDifferentInventory=!1,this.loaderEndpoint="PriceLoader/Load",this.dataEndpoint="Price/GetSingleChannelComparison",this.allDataCountEndpoint="Inventory/GetInventoryByChannelRowCount",this.rolePriceEdit=ue.price,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=H.GuidEMpty,this.hostName=this.authService.getDomain(),this.data$=this.paginationService.data$.pipe(ae(1),ee(_t=>_t.map(ie=>(ie.Variants&&(ie.Variants=ie.Variants.map(Te=>(Te.isDiscontinued=Te.Discontinued=="Yes",Te))),ie)))),this.channelOptions=Me.getChannels()}ngOnInit(){this.initPageLoader()}initPageLoader(){this.paginationService.fetchDataEndpoint=this.dataEndpoint,this.loader$=this.http.post(`/API/${this.loaderEndpoint}`).pipe(B(e=>{this.searchFilter=e.Filter,this.searchFilter.filterModel=L.ALL,this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}))}onToggleDifferentInventory(){this.toggleDifferentInventory?this.searchFilter.filterModel=L.ALL:this.searchFilter.filterModel=L.DIFFERENCE,this.onSearch()}onCheckboxStateProduct(e){e.Variants=e.Variants.map(t=>(t.selected=e.selected,t))}openModalFilter(){this.mainPanelService.openModalFilter()}updateStock(e){let a=this.productService.selectedVariantProduct(e).map(h=>({ID:h.ID,ChannelID:h.Channel[0].ChannelID,Code:h.Code,Price:h.UnitPrice})),_={ListChannelID:[this.searchFilter.ChannelID],ListPrice:a};this.http.post("/api/Price/UpdateChannel",_).subscribe(h=>{this.onSearch(),this.handlingUpdateStock(h.Response)})}handlingUpdateStock(e){if(e.success_list.length>0||e.failure_list.length>0){let t=e.failure_list,a=e.success_list;this.inventoryService.showToastrUpdateInventory("Price",a,t)}else this.toastr.error(e[0]?.Exception,"Error")}refreshPrice(e){let t={ChannelItemID:e?.Channel[0].ChannelItemID,ChannelVariationID:e?.Channel[0]?.ChannelVariationID,ChannelID:e?.Channel[0]?.ChannelID,VariantID:e.ID};this.http.post("/api/Price/RefreshPriceChannel",t).subscribe(a=>{this.toastr.success("Successfully updated","Success"),this.onSearch()})}onSearch(){this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}getRowCount(){this.paginationService.hideCount=!1,this.allDataCount$=this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter)}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}onLastPage(){this.http.post(`/API/${this.allDataCountEndpoint}`,this.searchFilter).subscribe({next:e=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,e.Total)}})}openTableDialog(e,t,a){let _=JSON.parse(JSON.stringify(e));this.dialog.open(Pe,{data:{Name:t.Name,Variant:_,ChannelID:_?.Channel[0]?.ChannelID,Table:"price",ChannelItemID:_?.Channel[0]?.ChannelItemID}}).afterClosed().pipe(R(x=>H.IsNotEmpty(x))).subscribe(x=>{this.updateItemAfterDialog(x,e)})}updateItemAfterDialog(e,t){let a={ID:e.ChannelID,ChannelItemID:e.ChannelItemID,ChannelVariantID:e.ChannelVariationID,Price:parseFloat(e.Price),VariantID:e.ID,SKU:e.Sku};this.http.post("/api/Price/UpdatePriceByID",a).subscribe(_=>{let h=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success(`Successfully updated ${e.ItemName} (${e.VarName}) inventory in ${h.Name} to ${a.Price}`,"Success"),t.Channel[0]&&(t.Channel[0].Price=a.Price)})}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(e=>e.ID==this.searchFilter.ChannelID)}onSelectAllSKU(e,t){t=t.map(a=>(a.Variants=a.Variants.map(_=>(_.selected=e,_)),a))}onZoomImage(e,t){this.biggerPictureService.openBiggerPicture(e,t)}Export(){let e={ChannelID:this.searchFilter.ChannelID,IsMarketplaceAppActive:this.searchFilter.IsMarketplaceAppActive,PageNumber:this.searchFilter.PageNumber,RowCount:this.searchFilter.RowCount,filterModel:this.searchFilter.filterModel};this.http.postFile("/api/price/GetExportSingleChannelComparison",e).subscribe(t=>{let a=window.URL.createObjectURL(t.file),_=document.createElement("a");_.download=this.getFilenameFromContentDisposition(t.title),_.href=a,_.click(),URL.revokeObjectURL(a),_.remove()})}getFilenameFromContentDisposition(e){let a=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(e);return a!=null&&a[1]?a[1].replace(/['"]/g,""):""}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(t){return new(t||o)(b(K),b(Y),b(G),b(Z),b(X),b(xe),b(ye),b(J),b(je))},o.\u0275cmp=F({type:o,selectors:[["app-price-single-channel"]],decls:2,vars:3,consts:[["elsePic",""],[3,"headerTitle","text","textChange","onSubmit",4,"ngIf"],[3,"textChange","onSubmit","headerTitle","text"],[1,"fw-bold","mb-2"],["bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text",3,"ngModelChange","clearable","items","ngModel"],["ng-option-tmp","","ng-label-tmp",""],[1,"mt-5"],[1,"fw-bold"],["type","number",1,"form-control","mt-2",3,"ngModelChange","ngModel"],[4,"ngIf"],[1,"me-2"],[2,"width","18px",3,"src"],[1,"d-flex"],["class","btn btn-success",3,"click",4,"ngIf"],[1,"btn","btn-outline-secondary","shadow","rounded","ms-2",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"container-fluid","mt-5"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["colspan","2",1,"text-center","ps-12",2,"width","36%"],["name","differentInventory",3,"ngModelChange","toggleChange","ngModel"],[1,"text-start"],[1,"text-end",2,"width","20%"],[3,"ngxPermissionsOnly"],[1,"text-end"],["role","button","matTooltipPosition","above",1,"d-inline-block",3,"click","matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],[4,"ngFor","ngForOf"],[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"font-weight-bold","font-italic","hidden-xxs"],["style","cursor:pointer",3,"click",4,"ngIf"],["class","btn-group",4,"ngIf"],["type","checkbox",1,"me-3",3,"change"],["matTooltipPosition","above",1,"text-end",3,"matTooltip"],[3,"ngClass"],[1,"d-flex","align-items-center","justify-content-end"],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],[1,"text-end",3,"ngClass"],["style","cursor: pointer;",3,"click",4,"ngIf"],[1,"ms-3"],["target","_blank",3,"href"],[1,"fas","external-link-custom","fa-lg","fa-external-link-alt"],["matTooltip","Refresh Unit Price according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","external-link-custom","fa-sync","fa-lg"],[1,"text-start",2,"width","0%",3,"rowSpan"],[1,"d-flex","align-items-center","justify-content-start"],[4,"ngIf","ngIfElse"],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModelChange","ngModel"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"click","src"],["src","//res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png",1,"border","rounded","w-img",2,"margin-left","20px"],[1,"align-middle"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],["type","checkbox",3,"ngModelChange","ngModel"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],[1,"fas","external-link-custom","fa-external-link-alt"],[2,"cursor","pointer",3,"click"],["title","Retreive rows count",1,"border","p-3"],[1,"btn-group"],["role","button","class","btn btn-outline-secondary btn-sm text-primary","title","Load more for 20 products",3,"click",4,"ngIf"],["role","button","class","btn btn-outline-secondary btn-sm text-primary border-start-0","title","Load all products",3,"click",4,"ngIf"],["role","button","title","Load more for 20 products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fas","fa-arrow-right"],["role","button","title","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary","border-start-0",3,"click"],[1,"fas","fa-share"]],template:function(t,a){t&1&&(d(0,wn,19,13,"mainpanel",1),S(1,"async")),t&2&&p("ngIf",v(1,1,a.loader$))},dependencies:[U,A,$,de,_e,me,k,O,q,Ue,Re,Be,Xe,fe,he,j,W,ve],styles:[".w-img[_ngcontent-%COMP%]{width:40px;height:40px}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}i.fas.custom-size[_ngcontent-%COMP%]{font-size:13px}.item-name[_ngcontent-%COMP%]{font-size:larger}"]});let i=o;return i})();var pt=(()=>{let o=class o{constructor(){this.priceTabs=[{Title:"Single Channel Comparison",Url:"/menu/price/SingleChannel"},{Title:"Multi Channel Comparison",Url:"/menu/price/pos"},{Title:"Custom Channel Price",Url:"/menu/price/OutletPrice"}]}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=F({type:o,selectors:[["app-price"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(t,a){t&1&&(r(0,"nav",0)(1,"div",1)(2,"div"),P(3,"nav-tab",2),c()()(),P(4,"router-outlet")),t&2&&(l(3),p("Tabs",a.priceTabs))},dependencies:[ze,ke]});let i=o;return i})();var Tn=[{path:"",component:pt,children:[{path:"",redirectTo:"SingleChannel",pathMatch:"full"},{path:"pos",component:rt,canActivate:[Ce],data:{title:"Global Price Comparison"}},{path:"OutletPrice",component:ct,canActivate:[Ce],data:{title:"Outlet Price Comparison"}},{path:"SingleChannel",component:st,canActivate:[Ce],data:{title:"Price Single Channel Comparison"}}]}],mt=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({imports:[z,pe.forChild(Tn)]});let i=o;return i})();var Ui=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=re({type:o}),o.\u0275inj=oe({providers:[ye],imports:[z,ge,Ge,We,pe,Ae,mt,Oe,Ye,qe,$e,Ie,be,Le.forChild()]});let i=o;return i})();export{Ui as PriceModule};