marketplacepos 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Marketplace/{chunk-WIPT5BVZ.js → chunk-2T3C7JV2.js} +2 -2
- package/Marketplace/{chunk-VZO27DX6.js → chunk-2TI26R6R.js} +2 -2
- package/Marketplace/{chunk-H65V337R.js → chunk-3FSLTDK2.js} +1 -1
- package/Marketplace/{chunk-T5BNV4KL.js → chunk-3I7X7G5V.js} +1 -1
- package/Marketplace/{chunk-7QK5UPRO.js → chunk-3RHXQKFB.js} +1 -1
- package/Marketplace/chunk-3SG3EKQ3.js +1 -0
- package/Marketplace/{chunk-AE6IHJSI.js → chunk-43GAJ6WD.js} +1 -1
- package/Marketplace/{chunk-EJ4H3OFV.js → chunk-4OCVE5TR.js} +1 -1
- package/Marketplace/{chunk-KOEWWMXB.js → chunk-55IYK2MP.js} +1 -1
- package/Marketplace/{chunk-W5LP6HWA.js → chunk-5GBQIVIY.js} +1 -1
- package/Marketplace/{chunk-ONRH4TTU.js → chunk-5J3KK3OL.js} +1 -1
- package/Marketplace/chunk-5KFJSI3K.js +1 -0
- package/Marketplace/{chunk-CBW7JGFJ.js → chunk-5L5KIUTY.js} +1 -1
- package/Marketplace/{chunk-QHJPUEQJ.js → chunk-6AEIRWBB.js} +1 -1
- package/Marketplace/{chunk-HD4CTBL2.js → chunk-6HBCXTS4.js} +1 -1
- package/Marketplace/{chunk-GSZGHECR.js → chunk-7KEJK435.js} +1 -1
- package/Marketplace/{chunk-RNMZG2RU.js → chunk-7LUEPJ2P.js} +1 -1
- package/Marketplace/{chunk-NY3NDLUY.js → chunk-7WXWLZE6.js} +1 -1
- package/Marketplace/{chunk-ZA6GABVQ.js → chunk-AKFKM77U.js} +1 -1
- package/Marketplace/{chunk-3KV2JLZD.js → chunk-AZBCL75Q.js} +1 -1
- package/Marketplace/{chunk-JEIL7GTU.js → chunk-C2BQDUEV.js} +1 -1
- package/Marketplace/{chunk-4SAZAICQ.js → chunk-C2JFVBCK.js} +1 -1
- package/Marketplace/{chunk-JHT6TPR2.js → chunk-DEWN3AM5.js} +1 -1
- package/Marketplace/{chunk-B2H2LMDP.js → chunk-DXK4LS22.js} +1 -1
- package/Marketplace/{chunk-ULZ3J3BD.js → chunk-DXSLWAQX.js} +1 -1
- package/Marketplace/{chunk-NE4U3Z2F.js → chunk-EAABO2EV.js} +1 -1
- package/Marketplace/{chunk-CQJJCQOZ.js → chunk-FEDAZTKI.js} +1 -1
- package/Marketplace/{chunk-P7MI7GDE.js → chunk-FQHOMORA.js} +1 -1
- package/Marketplace/{chunk-PL4TRYLK.js → chunk-GGNPOSPC.js} +1 -1
- package/Marketplace/{chunk-MCTEEYBG.js → chunk-GLWEQ2ER.js} +1 -1
- package/Marketplace/{chunk-QWKP6LGP.js → chunk-GWVXLAM4.js} +1 -1
- package/Marketplace/{chunk-UUY6BTJU.js → chunk-HQMAKO4U.js} +1 -1
- package/Marketplace/{chunk-N6VKSGEM.js → chunk-IATB7RKG.js} +1 -1
- package/Marketplace/{chunk-JGSLR6Q7.js → chunk-IJNIZXOB.js} +1 -1
- package/Marketplace/{chunk-ZSK75YJW.js → chunk-JVPANFAL.js} +1 -1
- package/Marketplace/{chunk-F2WJC5YO.js → chunk-L7OJXQ77.js} +2 -2
- package/Marketplace/{chunk-H65R6LYY.js → chunk-LRQNHNRY.js} +1 -1
- package/Marketplace/{chunk-LQUPRVED.js → chunk-M5Z572X7.js} +1 -1
- package/Marketplace/{chunk-ZMMTX4YX.js → chunk-MAI7CBHC.js} +1 -1
- package/Marketplace/{chunk-F7PVCSNW.js → chunk-MLVLUUHO.js} +1 -1
- package/Marketplace/{chunk-VM5LF2AQ.js → chunk-N46PJUA5.js} +1 -1
- package/Marketplace/{chunk-LU4CQUNV.js → chunk-NCBXZDJX.js} +1 -1
- package/Marketplace/{chunk-GSZSRSYG.js → chunk-NIBADICW.js} +1 -1
- package/Marketplace/{chunk-LPD77TVJ.js → chunk-NXJ4V4YK.js} +1 -1
- package/Marketplace/{chunk-37MHCWTD.js → chunk-O3LNYZ4M.js} +1 -1
- package/Marketplace/{chunk-MG7FPXZX.js → chunk-PYALJMBO.js} +1 -1
- package/Marketplace/{chunk-MQUFUG4I.js → chunk-QGZX7NE7.js} +1 -1
- package/Marketplace/{chunk-I66FBNYV.js → chunk-QQ47EB3G.js} +1 -1
- package/Marketplace/{chunk-HIX2BUDB.js → chunk-RZS2AMLW.js} +1 -1
- package/Marketplace/{chunk-27IVVEQ5.js → chunk-SEWZHFIK.js} +1 -1
- package/Marketplace/{chunk-QOBUHJEC.js → chunk-T4LIIUEO.js} +1 -1
- package/Marketplace/{chunk-LV7NKX2V.js → chunk-TCPJNRJT.js} +1 -1
- package/Marketplace/{chunk-T4IQWUBV.js → chunk-TEFJMIF6.js} +1 -1
- package/Marketplace/{chunk-RQWHADXY.js → chunk-TFNZ2JVX.js} +1 -1
- package/Marketplace/{chunk-4Z75AP5X.js → chunk-TGUXB6A6.js} +1 -1
- package/Marketplace/{chunk-IANWTXDM.js → chunk-TWKTPY5E.js} +1 -1
- package/Marketplace/{chunk-PSAPUCAJ.js → chunk-TXMYJ7NJ.js} +1 -1
- package/Marketplace/{chunk-JOI2R7DA.js → chunk-UCFGCNLH.js} +1 -1
- package/Marketplace/{chunk-6GVQC3OR.js → chunk-YJLWIQ6B.js} +1 -1
- package/Marketplace/{chunk-2SYJDDTX.js → chunk-Z7LEVL23.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-AUAZAZGD.js → main-FR3NRD5D.js} +1 -1
- package/Marketplace/{styles-DC4DACOA.css → styles-RDEF5CK2.css} +1 -1
- package/package.json +1 -1
- package/Marketplace/chunk-5CBOZ77Z.js +0 -1
- package/Marketplace/chunk-FX4KZMXX.js +0 -1
- /package/Marketplace/{chunk-QYP6WXYL.js → chunk-2XBPNKZX.js} +0 -0
- /package/Marketplace/{chunk-VS4FYYKI.js → chunk-GURYDDY4.js} +0 -0
- /package/Marketplace/{chunk-5DL35YCG.js → chunk-K3WUITRV.js} +0 -0
- /package/Marketplace/{chunk-FG5W5K4B.js → chunk-W3FHD4GW.js} +0 -0
- /package/Marketplace/{polyfills-FXABYPWM.js → polyfills-ROFNJMEJ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as o}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.
|
|
1
|
+
import{$ as o}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";var d=(()=>{let e=class e{constructor(){}getParseToken(){let t=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(t.Token.access_token)}GetRoles(){let r=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return r||[]}ParseToken(t){try{let n=t.split(".")[0].replace("-","+").replace("_","/"),c=JSON.parse(window.atob(n)),l=t.split(".")[1].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(l));return s.header=c,s}catch{return!1}}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=o({token:e,factory:e.\u0275fac,providedIn:"root"});let a=e;return a})();export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as f,A as b,E as F,Gb as X,I as L,Ia as q,Ic as Z,Ja as V,L as G,N as y,R as M,T as j,Ta as Q,X as C,aa as K,ba as E,ca as c,d,da as p,fa as N,ga as J,ia as Y,m as g,n as h,q as S,s as m,t as I,w as z}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";import{a as l,b as v}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-FG5W5K4B.js";var A={REMOVE:"remove",SHOW:"show"},ee=(()=>{let t=class t{constructor(){this.strategiesSource=new d({}),this.strategies$=this.strategiesSource.asObservable()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),B=new E("USE_CONFIGURATION_STORE"),$=(()=>{let t=class t{constructor(e=!1,i){this.isolate=e,this.configurationStore=i,this.strategiesSource=this.isolate?new d({}):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,i){this.strategiesSource.value[e]=i}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===A.SHOW||e===A.REMOVE}};t.\u0275fac=function(i){return new(i||t)(c(B),c(ee))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})();function u(r){return typeof r=="function"}function k(r){if(Object.prototype.toString.call(r)!=="[object Object]")return!1;{let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}}function ie(r){return!!r&&typeof r=="string"}function T(r){return typeof r=="boolean"}function te(r){return Object.prototype.toString.call(r)==="[object Promise]"}function O(r){return Array.isArray(r)?r.length>0:!!r}function R(r){return ie(r)?[r]:r}var se=(()=>{let t=class t{constructor(){this.permissionsSource=new d({}),this.permissions$=this.permissionsSource.asObservable()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),W=new E("USE_PERMISSIONS_STORE"),x=(()=>{let t=class t{constructor(e=!1,i){this.isolate=e,this.permissionsStore=i,this.permissionsSource=this.isolate?new d({}):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=R(e),this.hasArrayPermission(e))}loadPermissions(e,i){let s=e.reduce((o,n)=>this.reducePermission(o,n,i),{});this.permissionsSource.next(s)}addPermission(e,i){if(Array.isArray(e)){let s=e.reduce((o,n)=>this.reducePermission(o,n,i),this.permissionsSource.value);this.permissionsSource.next(s)}else{let s=this.reducePermission(this.permissionsSource.value,e,i);this.permissionsSource.next(s)}}removePermission(e){let i=l({},this.permissionsSource.value);delete i[e],this.permissionsSource.next(i)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,i,s){return s&&u(s)?v(l({},e),{[i]:{name:i,validationFunction:s}}):v(l({},e),{[i]:{name:i}})}hasArrayPermission(e){let i=e.map(s=>{if(this.hasPermissionValidationFunction(s)){let o=this.permissionsSource.value[s].validationFunction,n=l({},this.permissionsSource.value);return h(null).pipe(S(()=>o(s,n)),j(a=>T(a)?h(a):a),F(()=>h(!1)))}return h(!!this.permissionsSource.value[s])});return g(i).pipe(I(),y(s=>s!==!1,!1),S(s=>s!==!1)).toPromise().then(s=>s)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&u(this.permissionsSource.value[e].validationFunction)}};t.\u0275fac=function(i){return new(i||t)(c(W),c(se))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),U=class{constructor(){this.rolesSource=new d({}),this.roles$=this.rolesSource.asObservable()}},H=new E("USE_ROLES_STORE"),D=(()=>{let t=class t{constructor(e=!1,i,s){this.isolate=e,this.rolesStore=i,this.permissionsService=s,this.rolesSource=this.isolate?new d({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,i){let s=v(l({},this.rolesSource.value),{[e]:{name:e,validationFunction:i}});this.rolesSource.next(s)}addRoleWithPermissions(e,i){this.permissionsService.addPermission(i),this.addRole(e,i)}addRoles(e){Object.keys(e).forEach((i,s)=>{this.addRole(i,e[i])})}addRolesWithPermissions(e){Object.keys(e).forEach((i,s)=>{this.addRoleWithPermissions(i,e[i])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let i=l({},this.rolesSource.value);delete i[e],this.rolesSource.next(i)}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=R(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([s,o])=>s||o))}hasRoleKey(e){let i=e.map(s=>{if(!!this.rolesSource.value[s]&&!!this.rolesSource.value[s].validationFunction&&u(this.rolesSource.value[s].validationFunction)&&!te(this.rolesSource.value[s].validationFunction)){let n=this.rolesSource.value[s].validationFunction,a=l({},this.rolesSource.value);return h(null).pipe(S(()=>n(s,a)),j(P=>T(P)?h(P):P),F(()=>h(!1)))}return h(!1)});return g(i).pipe(I(),y(s=>s!==!1,!1),S(s=>s!==!1)).toPromise().then(s=>s)}hasRolePermission(e,i){return g(i).pipe(m(s=>e[s]&&Array.isArray(e[s].validationFunction)?g(e[s].validationFunction).pipe(m(o=>this.permissionsService.hasPermission(o)),G(o=>o===!0)):h(!1)),y(s=>s===!0,!1)).toPromise()}};t.\u0275fac=function(i){return new(i||t)(c(H),c(U),c(x))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),pe=(()=>{let t=class t{constructor(){this.permissionsAuthorized=new V,this.permissionsUnauthorized=new V,this.firstMergeUnusedRun=1,this.permissionsService=p(x),this.configurationService=p($),this.rolesService=p(D),this.viewContainer=p(Q),this.changeDetector=p(q),this.templateRef=p(X)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let i=e.ngxPermissionsOnly,s=e.ngxPermissionsExcept;if(i||s){if(i&&i.firstChange||s&&s.firstChange)return;b(this.permissionsService.permissions$,this.rolesService.roles$).pipe(M(this.firstMergeUnusedRun),L(1)).subscribe(()=>{if(O(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(O(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return b(this.permissionsService.permissions$,this.rolesService.roles$).pipe(M(this.firstMergeUnusedRun)).subscribe(()=>{if(O(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(O(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,i])=>{if(e||i){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,i])=>{e||i?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(T(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(!(T(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(ie(e)){this.applyStrategy(e);return}if(u(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===A.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===A.REMOVE){this.viewContainer.clear();return}let i=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),i(this.templateRef)}};t.\u0275fac=function(i){return new(i||t)},t.\u0275dir=J({type:t,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:[Y]});let r=t;return r})(),re="default";var _=(()=>{let t=class t{constructor(e,i,s){this.permissionsService=e,this.rolesService=i,this.router=s}canActivate(e,i){return this.hasPermissions(e,i)}canActivateChild(e,i){return this.hasPermissions(e,i)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,i){let s=e&&e.data?e.data.permissions:{},o=this.transformPermission(s,e,i);return this.isParameterAvailable(o.except)?this.passingExceptPermissionsValidation(o,e,i):this.isParameterAvailable(o.only)?this.passingOnlyPermissionsValidation(o,e,i):!0}transformPermission(e,i,s){let o=u(e.only)?e.only(i,s):R(e.only),n=u(e.except)?e.except(i,s):R(e.except),a=e.redirectTo;return{only:o,except:n,redirectTo:a}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,i,s){if(e.redirectTo&&(u(e.redirectTo)||k(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let o="";return g(e.except).pipe(m(n=>z([this.permissionsService.hasPermission(n),this.rolesService.hasOnlyRoles(n)]).pipe(C(a=>{a.every(w=>w===!1)||(o=n)}))),y(n=>n.some(a=>a===!0),!1),m(n=>o?(this.handleRedirectOfFailedPermission(e,o,i,s),h(!1)):!n&&e.only?this.onlyRedirectCheck(e,i,s):h(!n))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([o,n])=>o||n?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,i,s),!1):e.only?this.checkOnlyPermissions(e,i,s):!0)}redirectToAnotherRoute(e,i,s,o){let n=u(e)?e(o,i,s):e;if(this.isRedirectionWithParameters(n)){n.navigationCommands=this.transformNavigationCommands(n.navigationCommands,i,s),n.navigationExtras=this.transformNavigationExtras(n.navigationExtras,i,s),this.router.navigate(n.navigationCommands,n.navigationExtras);return}Array.isArray(n)?this.router.navigate(n):this.router.navigate([n])}isRedirectionWithParameters(e){return k(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,i,s){return u(e)?e(i,s):e}transformNavigationExtras(e,i,s){return u(e)?e(i,s):e}onlyRedirectCheck(e,i,s){let o="";return g(e.only).pipe(m(n=>z([this.permissionsService.hasPermission(n),this.rolesService.hasOnlyRoles(n)]).pipe(C(a=>{a.every(w=>w===!1)&&(o=n)}))),y(n=>u(e.redirectTo)?n.some(a=>a===!0):n.every(a=>a===!1),!1),m(n=>u(e.redirectTo)?n?h(!0):(this.handleRedirectOfFailedPermission(e,o,i,s),h(!1)):(o&&this.handleRedirectOfFailedPermission(e,o,i,s),h(!n)))).toPromise()}handleRedirectOfFailedPermission(e,i,s,o){this.isFailedPermissionPropertyOfRedirectTo(e,i)?this.redirectToAnotherRoute(e.redirectTo[i],s,o,i):u(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,s,o,i):this.redirectToAnotherRoute(e.redirectTo[re],s,o,i)}isFailedPermissionPropertyOfRedirectTo(e,i){return!!e.redirectTo&&e.redirectTo[i]}checkOnlyPermissions(e,i,s){let o=l({},e);return Promise.all([this.permissionsService.hasPermission(o.only),this.rolesService.hasOnlyRoles(o.only)]).then(([n,a])=>n||a?!0:(o.redirectTo&&this.redirectToAnotherRoute(o.redirectTo,i,s),!1))}passingOnlyPermissionsValidation(e,i,s){return u(e.redirectTo)||k(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,i,s):this.checkOnlyPermissions(e,i,s)}};t.\u0275fac=function(i){return new(i||t)(c(x),c(D),c(Z))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})();var ye=(()=>{let t=class t{static forRoot(e={}){return{ngModule:t,providers:[se,U,ee,x,_,D,$,{provide:W,useValue:e.permissionsIsolate},{provide:H,useValue:e.rolesIsolate},{provide:B,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:t,providers:[{provide:W,useValue:e.permissionsIsolate},{provide:H,useValue:e.rolesIsolate},{provide:B,useValue:e.configurationIsolate},$,x,D,_]}}};t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=N({type:t}),t.\u0275inj=K({});let r=t;return r})();export{x as a,pe as b,ye as c};
|
|
1
|
+
import{$ as f,A as b,E as F,Gb as X,I as L,Ia as q,Ic as Z,Ja as V,L as G,N as y,R as M,T as j,Ta as Q,X as C,aa as K,ba as E,ca as c,d,da as p,fa as N,ga as J,ia as Y,m as g,n as h,q as S,s as m,t as I,w as z}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";import{a as l,b as v}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-W3FHD4GW.js";var A={REMOVE:"remove",SHOW:"show"},ee=(()=>{let t=class t{constructor(){this.strategiesSource=new d({}),this.strategies$=this.strategiesSource.asObservable()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),B=new E("USE_CONFIGURATION_STORE"),$=(()=>{let t=class t{constructor(e=!1,i){this.isolate=e,this.configurationStore=i,this.strategiesSource=this.isolate?new d({}):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,i){this.strategiesSource.value[e]=i}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===A.SHOW||e===A.REMOVE}};t.\u0275fac=function(i){return new(i||t)(c(B),c(ee))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})();function u(r){return typeof r=="function"}function k(r){if(Object.prototype.toString.call(r)!=="[object Object]")return!1;{let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}}function ie(r){return!!r&&typeof r=="string"}function T(r){return typeof r=="boolean"}function te(r){return Object.prototype.toString.call(r)==="[object Promise]"}function O(r){return Array.isArray(r)?r.length>0:!!r}function R(r){return ie(r)?[r]:r}var se=(()=>{let t=class t{constructor(){this.permissionsSource=new d({}),this.permissions$=this.permissionsSource.asObservable()}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),W=new E("USE_PERMISSIONS_STORE"),x=(()=>{let t=class t{constructor(e=!1,i){this.isolate=e,this.permissionsStore=i,this.permissionsSource=this.isolate?new d({}):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=R(e),this.hasArrayPermission(e))}loadPermissions(e,i){let s=e.reduce((o,n)=>this.reducePermission(o,n,i),{});this.permissionsSource.next(s)}addPermission(e,i){if(Array.isArray(e)){let s=e.reduce((o,n)=>this.reducePermission(o,n,i),this.permissionsSource.value);this.permissionsSource.next(s)}else{let s=this.reducePermission(this.permissionsSource.value,e,i);this.permissionsSource.next(s)}}removePermission(e){let i=l({},this.permissionsSource.value);delete i[e],this.permissionsSource.next(i)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,i,s){return s&&u(s)?v(l({},e),{[i]:{name:i,validationFunction:s}}):v(l({},e),{[i]:{name:i}})}hasArrayPermission(e){let i=e.map(s=>{if(this.hasPermissionValidationFunction(s)){let o=this.permissionsSource.value[s].validationFunction,n=l({},this.permissionsSource.value);return h(null).pipe(S(()=>o(s,n)),j(a=>T(a)?h(a):a),F(()=>h(!1)))}return h(!!this.permissionsSource.value[s])});return g(i).pipe(I(),y(s=>s!==!1,!1),S(s=>s!==!1)).toPromise().then(s=>s)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&u(this.permissionsSource.value[e].validationFunction)}};t.\u0275fac=function(i){return new(i||t)(c(W),c(se))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),U=class{constructor(){this.rolesSource=new d({}),this.roles$=this.rolesSource.asObservable()}},H=new E("USE_ROLES_STORE"),D=(()=>{let t=class t{constructor(e=!1,i,s){this.isolate=e,this.rolesStore=i,this.permissionsService=s,this.rolesSource=this.isolate?new d({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,i){let s=v(l({},this.rolesSource.value),{[e]:{name:e,validationFunction:i}});this.rolesSource.next(s)}addRoleWithPermissions(e,i){this.permissionsService.addPermission(i),this.addRole(e,i)}addRoles(e){Object.keys(e).forEach((i,s)=>{this.addRole(i,e[i])})}addRolesWithPermissions(e){Object.keys(e).forEach((i,s)=>{this.addRoleWithPermissions(i,e[i])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let i=l({},this.rolesSource.value);delete i[e],this.rolesSource.next(i)}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=R(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([s,o])=>s||o))}hasRoleKey(e){let i=e.map(s=>{if(!!this.rolesSource.value[s]&&!!this.rolesSource.value[s].validationFunction&&u(this.rolesSource.value[s].validationFunction)&&!te(this.rolesSource.value[s].validationFunction)){let n=this.rolesSource.value[s].validationFunction,a=l({},this.rolesSource.value);return h(null).pipe(S(()=>n(s,a)),j(P=>T(P)?h(P):P),F(()=>h(!1)))}return h(!1)});return g(i).pipe(I(),y(s=>s!==!1,!1),S(s=>s!==!1)).toPromise().then(s=>s)}hasRolePermission(e,i){return g(i).pipe(m(s=>e[s]&&Array.isArray(e[s].validationFunction)?g(e[s].validationFunction).pipe(m(o=>this.permissionsService.hasPermission(o)),G(o=>o===!0)):h(!1)),y(s=>s===!0,!1)).toPromise()}};t.\u0275fac=function(i){return new(i||t)(c(H),c(U),c(x))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})(),pe=(()=>{let t=class t{constructor(){this.permissionsAuthorized=new V,this.permissionsUnauthorized=new V,this.firstMergeUnusedRun=1,this.permissionsService=p(x),this.configurationService=p($),this.rolesService=p(D),this.viewContainer=p(Q),this.changeDetector=p(q),this.templateRef=p(X)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let i=e.ngxPermissionsOnly,s=e.ngxPermissionsExcept;if(i||s){if(i&&i.firstChange||s&&s.firstChange)return;b(this.permissionsService.permissions$,this.rolesService.roles$).pipe(M(this.firstMergeUnusedRun),L(1)).subscribe(()=>{if(O(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(O(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return b(this.permissionsService.permissions$,this.rolesService.roles$).pipe(M(this.firstMergeUnusedRun)).subscribe(()=>{if(O(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(O(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,i])=>{if(e||i){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,i])=>{e||i?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(T(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(!(T(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(ie(e)){this.applyStrategy(e);return}if(u(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===A.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===A.REMOVE){this.viewContainer.clear();return}let i=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),i(this.templateRef)}};t.\u0275fac=function(i){return new(i||t)},t.\u0275dir=J({type:t,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:[Y]});let r=t;return r})(),re="default";var _=(()=>{let t=class t{constructor(e,i,s){this.permissionsService=e,this.rolesService=i,this.router=s}canActivate(e,i){return this.hasPermissions(e,i)}canActivateChild(e,i){return this.hasPermissions(e,i)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,i){let s=e&&e.data?e.data.permissions:{},o=this.transformPermission(s,e,i);return this.isParameterAvailable(o.except)?this.passingExceptPermissionsValidation(o,e,i):this.isParameterAvailable(o.only)?this.passingOnlyPermissionsValidation(o,e,i):!0}transformPermission(e,i,s){let o=u(e.only)?e.only(i,s):R(e.only),n=u(e.except)?e.except(i,s):R(e.except),a=e.redirectTo;return{only:o,except:n,redirectTo:a}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,i,s){if(e.redirectTo&&(u(e.redirectTo)||k(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let o="";return g(e.except).pipe(m(n=>z([this.permissionsService.hasPermission(n),this.rolesService.hasOnlyRoles(n)]).pipe(C(a=>{a.every(w=>w===!1)||(o=n)}))),y(n=>n.some(a=>a===!0),!1),m(n=>o?(this.handleRedirectOfFailedPermission(e,o,i,s),h(!1)):!n&&e.only?this.onlyRedirectCheck(e,i,s):h(!n))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([o,n])=>o||n?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,i,s),!1):e.only?this.checkOnlyPermissions(e,i,s):!0)}redirectToAnotherRoute(e,i,s,o){let n=u(e)?e(o,i,s):e;if(this.isRedirectionWithParameters(n)){n.navigationCommands=this.transformNavigationCommands(n.navigationCommands,i,s),n.navigationExtras=this.transformNavigationExtras(n.navigationExtras,i,s),this.router.navigate(n.navigationCommands,n.navigationExtras);return}Array.isArray(n)?this.router.navigate(n):this.router.navigate([n])}isRedirectionWithParameters(e){return k(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,i,s){return u(e)?e(i,s):e}transformNavigationExtras(e,i,s){return u(e)?e(i,s):e}onlyRedirectCheck(e,i,s){let o="";return g(e.only).pipe(m(n=>z([this.permissionsService.hasPermission(n),this.rolesService.hasOnlyRoles(n)]).pipe(C(a=>{a.every(w=>w===!1)&&(o=n)}))),y(n=>u(e.redirectTo)?n.some(a=>a===!0):n.every(a=>a===!1),!1),m(n=>u(e.redirectTo)?n?h(!0):(this.handleRedirectOfFailedPermission(e,o,i,s),h(!1)):(o&&this.handleRedirectOfFailedPermission(e,o,i,s),h(!n)))).toPromise()}handleRedirectOfFailedPermission(e,i,s,o){this.isFailedPermissionPropertyOfRedirectTo(e,i)?this.redirectToAnotherRoute(e.redirectTo[i],s,o,i):u(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,s,o,i):this.redirectToAnotherRoute(e.redirectTo[re],s,o,i)}isFailedPermissionPropertyOfRedirectTo(e,i){return!!e.redirectTo&&e.redirectTo[i]}checkOnlyPermissions(e,i,s){let o=l({},e);return Promise.all([this.permissionsService.hasPermission(o.only),this.rolesService.hasOnlyRoles(o.only)]).then(([n,a])=>n||a?!0:(o.redirectTo&&this.redirectToAnotherRoute(o.redirectTo,i,s),!1))}passingOnlyPermissionsValidation(e,i,s){return u(e.redirectTo)||k(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,i,s):this.checkOnlyPermissions(e,i,s)}};t.\u0275fac=function(i){return new(i||t)(c(x),c(D),c(Z))},t.\u0275prov=f({token:t,factory:t.\u0275fac});let r=t;return r})();var ye=(()=>{let t=class t{static forRoot(e={}){return{ngModule:t,providers:[se,U,ee,x,_,D,$,{provide:W,useValue:e.permissionsIsolate},{provide:H,useValue:e.rolesIsolate},{provide:B,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:t,providers:[{provide:W,useValue:e.permissionsIsolate},{provide:H,useValue:e.rolesIsolate},{provide:B,useValue:e.configurationIsolate},$,x,D,_]}}};t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=N({type:t}),t.\u0275inj=K({});let r=t;return r})();export{x as a,pe as b,ye as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as V,b as Me,c as Ve,d as ae,e as oe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-VZO27DX6.js";import{a as Te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-4Z75AP5X.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-LU4CQUNV.js";import{a as De,b as Ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-KOEWWMXB.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-5DL35YCG.js";import{a as ie}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-HD4CTBL2.js";import{a as te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-3KV2JLZD.js";import{a as ne}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-QOBUHJEC.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-QHJPUEQJ.js";import{a as be,b as Ie}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-MQUFUG4I.js";import{e as q}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-WIPT5BVZ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-JGSLR6Q7.js";import{b as Q,e as H}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-MG7FPXZX.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-VM5LF2AQ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-ZSK75YJW.js";import{a as we}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-ONRH4TTU.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-27IVVEQ5.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-JEIL7GTU.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-T4IQWUBV.js";import{a as fe,c as xe,d as Se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-NE4U3Z2F.js";import{a as se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-PL4TRYLK.js";import{B as ee,C as ye,q as W,r as ve,u as X}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-W5LP6HWA.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-7QK5UPRO.js";import{b as ge,c as K,h as J,k as Y,m as Z,u as Ce}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-IANWTXDM.js";import{c as T}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-QYP6WXYL.js";import{$a as x,B as P,Cb as f,Db as S,Eb as L,Fa as s,Ga as y,Hc as he,Lb as R,Lc as G,Oa as c,Ua as u,X as N,Xb as de,Za as l,Zb as _e,_a as r,_b as $,aa as B,ab as I,bb as w,bc as U,cc as ue,db as v,ea as F,ec as j,fa as O,fc as z,hb as h,ja as d,jb as p,ka as _,mb as pe,ob as A,pb as m,q as ce,qb as E,rb as b,sb as me,wb as re,za as k}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-FG5W5K4B.js";var Pe=(()=>{let o=class o{constructor(){this.inventoryTabs=[{Title:"Single Channel Comparison",Url:"/menu/inventory/bychannel"},{Title:"Multi Channel Comparison",Url:"/menu/inventory/pos"}]}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=F({type:o,selectors:[["app-inventory"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,a){n&1&&(l(0,"nav",0)(1,"div",1)(2,"div"),x(3,"nav-tab",2),r()()(),x(4,"router-outlet")),n&2&&(s(3),c("Tabs",a.inventoryTabs))},dependencies:[he,be]});let i=o;return i})();function Ge(i,o){if(i&1){let e=v();l(0,"button",22),h("click",function(){d(e);let n=p(3);return _(n.openScanDialog())}),x(1,"i",23),m(2," Scan Channel "),r()}}function Ke(i,o){if(i&1){let e=v();l(0,"button",24),h("click",function(){d(e);let n=p().ngIf,a=p(2);return _(a.onUpdateItems(n))}),x(1,"i",25),m(2," Update "),r()}}function Je(i,o){if(i&1&&(l(0,"actions")(1,"div",19)(2,"div"),u(3,Ge,3,0,"button",20)(4,Ke,3,0,"button",21),r()()()),i&2){let e=o.ngIf,t=p(2);s(3),c("ngIf",!t.productService.hasSelectionVariant(e)),s(1),c("ngIf",t.productService.hasSelectionVariant(e))}}function Ye(i,o){if(i&1){let e=v();l(0,"app-table",26),h("onToggle",function(n){d(e);let a=p(2);return _(a.onShowDifferenceStock(n))})("onSubmit",function(n){let g=d(e).ngIf,C=p(2);return _(C.updateStockByVariant(n,g))}),r()}if(i&2){let e=o.ngIf,t=p(2);c("data",e)("channel",t.channelOptions)("showProductToggle",!0)("filter",t.searchFilter)}}function Ze(i,o){if(i&1){let e=v();l(0,"span",27),h("click",function(){d(e);let n=p(2);return _(n.getRowCount())}),l(1,"i",28),m(2,"?"),r()()}}function qe(i,o){if(i&1&&(l(0,"span"),m(1),f(2,"number"),r()),i&2){let e=o.ngIf;s(1),E(S(2,1,e))}}function We(i,o){if(i&1){let e=v();l(0,"a",29),h("click",function(){d(e);let n=p(2);return _(n.nextPage())}),x(1,"i",30),m(2," Next"),r()}}function Xe(i,o){if(i&1){let e=v();l(0,"a",31),h("click",function(){d(e);let n=p(2);return _(n.getAllData())}),x(1,"i",32),m(2," Last"),r()}}function et(i,o){if(i&1){let e=v();l(0,"mainpanel",1),h("onSubmit",function(n){d(e);let a=p();return _(a.onSearch(n))}),u(1,Je,5,2,"actions",2),f(2,"async"),l(3,"filters")(4,"div")(5,"label",3),m(6,"PageNumber"),r(),l(7,"input",4),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.PageNumber=n)}),r()(),l(8,"div",5)(9,"label",6),m(10,"Page Size"),r(),l(11,"input",7),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.RowCount=n)}),r()()(),l(12,"content")(13,"div",8)(14,"div",9)(15,"div",10),u(16,Ye,1,4,"app-table",11),f(17,"async"),I(18),l(19,"div",12)(20,"div",13)(21,"div",14),m(22),f(23,"number"),f(24,"async"),u(25,Ze,3,0,"span",15)(26,qe,3,3,"span",2),f(27,"async"),m(28),r()(),l(29,"div",16),u(30,We,3,0,"a",17)(31,Xe,3,0,"a",18),r()(),w(),r()()()()()}if(i&2){let e=p(),t;c("pageData",e.pageData)("hideSearchBox",!1)("textButton","Search"),s(1),c("ngIf",S(2,13,e.paginationService.data$)),s(6),c("ngModel",e.searchFilter.PageNumber),s(4),c("ngModel",e.searchFilter.RowCount),s(5),c("ngIf",S(17,15,e.paginationService.data$)),s(6),b(" Showing 1 - ",S(23,17,(t=S(24,19,e.paginationService.data$))==null?null:t.length)," of "),s(3),c("ngIf",e.paginationService.hideCount),s(1),c("ngIf",S(27,21,!e.paginationService.hideCount&&e.allDataCount$)),s(2),b(" records ~ ",e.paginationService.footerPageNumber," Page "),s(2),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}var Fe=(()=>{let o=class o{constructor(t,n,a,g,C,M){this.http=t,this.toastr=n,this.dialog=a,this.paginationService=g,this.productService=C,this.authService=M,this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],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.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(N(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:V.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onSearch(t){this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,n){let a=this.productService.selectedVariantProduct(t);if(a.length>0){let C=a.map(D=>({ID:D.ID,Code:D.Code,Inventory:D.Inventory}));var g=n.filter(D=>D.selected).map(D=>D.ID);let M={ListChannelID:g,List:C};this.http.post("/api/Inventory/UpdateChannel",M).subscribe(D=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+M.List.length+" variants in "+M.ListChannelID.length+" channels","Success")})}}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(te,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.searchFilter.ScanFull=a.ScanFull,this.searchFilter.ChannelID=a.ChannelID,this.searchFilter.UpdatedProduct=a.UpdatedProduct,this.searchFilter.Async=a.Async,this.scanAll()})}scanAll(){this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{let n=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,n,!this.searchFilter.UpdatedProduct),this.initPageLoader()}this.searchFilter.ChannelID=T.GuidEMpty})}updateStockByVariant(t,n){let a={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku};this.http.post("/api/Inventory/UpdateQuantityByItem",a).subscribe(g=>{let C=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+C.Name+" to "+a.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=V.DIFFERENCE:this.searchFilter.filterModel=V.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let n=this.productService.selectedVariantProduct(t);this.dialog.open(Te,{data:{selectedItems:n,channels:JSON.parse(JSON.stringify(this.channelOptions))},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.updateStock(t,a)})}getRowCount(){this.paginationService.hideCount=!1;let t={text:this.searchFilter.text};this.allDataCount$=this.http.post(`/API/${this.allDataCountEndpoint}`,t)}nextPage(){this.paginationService.onNextPage(this.searchFilter)}getAllData(){this.http.post(`/API/${this.allDataCountEndpoint}`,{}).subscribe({next:t=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,t)}})}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(n){return new(n||o)(y(H),y(Q),y(X),y(ie),y(ne),y(q))},o.\u0275cmp=F({type:o,selectors:[["app-multi-channel-comparison"]],decls:2,vars:3,consts:[["headerTitle","Inventory Comparison",3,"pageData","hideSearchBox","textButton","onSubmit",4,"ngIf"],["headerTitle","Inventory Comparison",3,"pageData","hideSearchBox","textButton","onSubmit"],[4,"ngIf"],["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,"ngModel","ngModelChange"],[1,"mt-5"],["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,"ngModel","ngModelChange"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["table","inventory",3,"data","channel","showProductToggle","filter","onToggle","onSubmit",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"],[1,"d-flex"],["type","button","data-cy","scanInPos","class","btn btn-outline-secondary shadow rounded me-3",3,"click",4,"ngIf"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-3",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"data","channel","showProductToggle","filter","onToggle","onSubmit"],[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(n,a){n&1&&(u(0,et,32,23,"mainpanel",0),f(1,"async")),n&2&&c("ngIf",S(1,1,a.loader$))},dependencies:[$,K,Z,J,Y,ee,ae,W,U,j],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let i=o;return i})();function tt(i,o){if(i&1){let e=v();l(0,"button",41),h("click",function(){d(e);let n=p(3);return _(n.openScanDialog())}),x(1,"i",42),m(2," Scan Channel "),r()}}function nt(i,o){if(i&1){let e=v();l(0,"button",43),h("click",function(){d(e);let n=p().ngIf,a=p(2);return _(a.updateStock(n))}),x(1,"i",44),m(2," Update"),r()}}function it(i,o){if(i&1&&(l(0,"div"),u(1,tt,3,0,"button",39)(2,nt,3,0,"button",40),r()),i&2){let e=o.ngIf,t=p(2);s(1),c("ngIf",!t.productService.hasSelectionVariant(e)),s(1),c("ngIf",t.productService.hasSelectionVariant(e))}}function at(i,o){if(i&1&&(l(0,"span",45),x(1,"img",46),r(),m(2)),i&2){let e=o.item;s(1),c("src",e==null?null:e.logo,k),s(1),b(" ",e.Name," ")}}function ot(i,o){i&1&&(l(0,"div",47)(1,"span"),m(2," showing only different stock, please press next to populate more data "),r()())}function lt(i,o){if(i&1){let e=v();l(0,"th")(1,"input",48),h("ngModelChange",function(n){d(e);let a=p(2);return _(a.checkboxState=n)})("ngModelChange",function(){let a=d(e).ngIf,g=p(2);return _(g.onCheckboxStateChange(a))}),r()()}if(i&2){let e=p(2);s(1),c("ngModel",e.checkboxState)}}function rt(i,o){i&1&&(I(0),l(1,"th",49),m(2," Reserved "),r(),w())}function st(i,o){if(i&1){let e=v();l(0,"input",69),h("ngModelChange",function(n){d(e);let a=p(3).$implicit;return _(a.selected=n)})("ngModelChange",function(){d(e);let n=p(3).$implicit,a=p(2);return _(a.onCheckboxStateProduct(n))}),r()}if(i&2){let e=p(3).$implicit;c("ngModel",e.selected)}}function ct(i,o){if(i&1){let e=v();l(0,"img",70),h("click",function(n){d(e);let a=p(3).$implicit,g=p(2);return _(g.onZoomImage(n,a==null?null:a.ImageUrl))}),r()}if(i&2){let e=p(3).$implicit;pe("src",e==null?null:e.ThumbnailUrl,k)}}function pt(i,o){i&1&&x(0,"img",71)}function mt(i,o){if(i&1&&(I(0),x(1,"br"),l(2,"div",72),x(3,"i",73),l(4,"small"),m(5),r()(),w()),i&2){let e=p(3).$implicit;s(5),b("(",e==null?null:e.Category,")")}}function dt(i,o){if(i&1&&(I(0),l(1,"td",63)(2,"div",13),u(3,st,1,1,"input",64)(4,ct,1,1,"img",65)(5,pt,1,0,"ng-template",null,66,R),r()(),l(7,"td",67)(8,"span",68),m(9),r(),u(10,mt,6,1,"ng-container",3),r(),w()),i&2){let e=A(6),t=p().$implicit,n=p().$implicit,a=p(2);s(1),c("rowSpan",n==null?null:n.Variants.length),s(2),c("ngIf",(t==null?null:t.Inventory)>=0||n.Variants.length>1),s(1),c("ngIf",n==null?null:n.ThumbnailUrl)("ngIfElse",e),s(3),c("rowSpan",n==null?null:n.Variants.length),s(2),E(n==null?null:n.Name),s(1),c("ngIf",n.CategoryID!==null&&n.CategoryID!=a.guidEmpty)}}function _t(i,o){if(i&1){let e=v();I(0),l(1,"input",48),h("ngModelChange",function(n){d(e);let a=p(2).$implicit;return _(a.selected=n)}),r(),w()}if(i&2){let e=p(2).$implicit;s(1),c("ngModel",e.selected)}}function ut(i,o){if(i&1&&(I(0),u(1,_t,2,1,"ng-container",3),w()),i&2){let e=p().$implicit;s(1),c("ngIf",(e==null?null:e.Inventory)<=1e5)}}function ht(i,o){if(i&1){let e=v();l(0,"input",48),h("ngModelChange",function(n){d(e);let a=p(2).$implicit;return _(a.selected=n)}),r()}if(i&2){let e=p(2).$implicit;c("ngModel",e.selected)}}function gt(i,o){if(i&1&&u(0,ht,1,1,"input",74),i&2){let e=p().$implicit;c("ngIf",(e==null?null:e.Inventory)>=0)}}function Ct(i,o){i&1&&(l(0,"div",75),m(1,"Not Found"),r())}function ft(i,o){if(i&1&&(l(0,"div")(1,"span",76),m(2),f(3,"number"),r(),m(4," => "),l(5,"span",77),m(6),f(7,"number"),r()()),i&2){let e=p().$implicit;s(2),b(" ",S(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),E(S(7,4,e==null?null:e.Inventory))}}function xt(i,o){if(i&1&&(l(0,"div"),m(1),f(2,"number"),r()),i&2){let e=p().$implicit;s(1),b(" ",S(2,1,e==null?null:e.Inventory)," ")}}function St(i,o){if(i&1&&(I(0),l(1,"div",78)(2,"a",79),x(3,"i",80),r()(),w()),i&2){let e=p().$implicit,t=p(3);s(2),c("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),k)}}var vt=i=>({"bg-gradient-warning":i});function yt(i,o){if(i&1){let e=v();l(0,"td",81)(1,"div",52)(2,"div")(3,"span",82),h("click",function(){d(e);let n=p().$implicit,a=p(),g=a.$implicit,C=a.ngForOf,M=p(2);return _(M.openTableDialog(g,n,C))}),m(4),f(5,"number"),r()(),l(6,"div",78)(7,"a",79),x(8,"i",80),r()()()()}if(i&2){let e=p().$implicit;c("ngClass",re(5,vt,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(4),b(" ",S(5,3,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," "),s(3),c("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,k)}}function bt(i,o){if(i&1&&(I(0),l(1,"span",85),m(2),f(3,"number"),r(),w()),i&2){let e=p(2).$implicit;s(2),b(" (",S(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function It(i,o){i&1&&m(0," - ")}function wt(i,o){if(i&1&&(I(0),l(1,"td",83),u(2,bt,4,3,"ng-container",55)(3,It,1,0,"ng-template",null,84,R),r(),w()),i&2){let e=A(4),t=p().$implicit;s(2),c("ngIf",t==null||t.Channel[0]==null?null:t.Channel[0].InventoryReserved)("ngIfElse",e)}}function Tt(i,o){i&1&&(I(0),m(1," - "),w())}function Mt(i,o){if(i&1&&(l(0,"span",86),f(1,"date"),m(2),f(3,"date"),r()),i&2){let e=p().$implicit;c("matTooltip",L(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),b(" ",L(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}var Dt=i=>({"text-decoration-line-through":i});function Et(i,o){if(i&1){let e=v();l(0,"tr"),u(1,dt,11,7,"ng-container",3),l(2,"td",50),m(3),r(),l(4,"td",51)(5,"div",52)(6,"span",53),m(7),r()()(),l(8,"td",54),u(9,ut,2,1,"ng-container",55)(10,gt,1,1,"ng-template",null,56,R),r(),l(12,"td")(13,"div",52),u(14,Ct,2,0,"div",57)(15,ft,8,6,"div",3)(16,xt,3,3,"div",3)(17,St,4,1,"ng-container",3),r()(),u(18,yt,9,7,"td",58)(19,wt,5,2,"ng-container",3),l(20,"td",31),u(21,Tt,2,0,"ng-container",55)(22,Mt,4,8,"ng-template",null,59,R),r(),l(24,"td")(25,"div",60)(26,"span",61),h("click",function(){let a=d(e).$implicit,g=p(3);return _(g.refreshInventory(a==null||a.Channel[0]==null?null:a.Channel[0].ChannelItemID,a==null||a.Channel[0]==null?null:a.Channel[0].ChannelVariationID,a==null||a.Channel[0]==null?null:a.Channel[0].ChannelID,a==null?null:a.ID))}),x(27,"i",62),r()()()()}if(i&2){let e=o.$implicit,t=o.index,n=A(11),a=A(23),g=p(3);s(1),c("ngIf",t==0),s(2),E(e==null?null:e.Model),s(1),c("matTooltip",e.isDiscontinued?g.discontinuedVariantMsg:""),s(2),c("ngClass",re(15,Dt,e.isDiscontinued)),s(1),E(e==null?null:e.Code),s(2),c("ngIf",(e==null?null:e.Channel[0].TypeID)==1)("ngIfElse",n),s(5),c("ngIf",(e==null?null:e.I)==null),s(1),c("ngIf",(e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)),s(1),c("ngIf",(e==null?null:e.I)!=null&&(e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)),s(1),c("ngIf",(e==null?null:e.I)!=null),s(1),c("ngIf",e==null?null:e.Channel),s(1),c("ngIf",g.isShowReservedColumn),s(2),c("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==g.minDate)("ngIfElse",a)}}function Vt(i,o){if(i&1&&(l(0,"tbody"),u(1,Et,28,17,"tr",33),r()),i&2){let e=o.$implicit;s(1),c("ngForOf",e.Variants)}}function Pt(i,o){if(i&1){let e=v();l(0,"span",87),h("click",function(){d(e);let n=p(2);return _(n.getRowCount())}),l(1,"i",88),m(2,"?"),r()()}}function Ft(i,o){if(i&1&&(l(0,"span"),m(1),f(2,"number"),r()),i&2){let e=o.ngIf;s(1),E(S(2,1,e==null?null:e.Total))}}function kt(i,o){if(i&1){let e=v();l(0,"a",92),h("click",function(){d(e);let n=p(3);return _(n.onNextPage())}),x(1,"i",93),m(2," Next"),r()}}function Nt(i,o){if(i&1){let e=v();l(0,"a",94),h("click",function(){d(e);let n=p(3);return _(n.onLastPage())}),x(1,"i",95),m(2," Last"),r()}}function At(i,o){if(i&1&&(l(0,"div",89),u(1,kt,3,0,"a",90)(2,Nt,3,0,"a",91),r()),i&2){let e=p(2);s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}function Rt(i,o){if(i&1){let e=v();l(0,"mainpanel",1),h("onSubmit",function(n){d(e);let a=p();return _(a.onSearch(n))}),l(1,"actions")(2,"div",2),u(3,it,3,2,"div",3),f(4,"async"),r()(),l(5,"filters")(6,"div")(7,"label",4),m(8,"Channel"),r(),l(9,"ng-select",5),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.ChannelID=n)}),u(10,at,3,2,"ng-template",6),r()(),l(11,"div",7)(12,"label",8),m(13,"PageNumber"),r(),l(14,"input",9),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.PageNumber=n)}),r()(),l(15,"div",7)(16,"label",10),m(17,"Page Size"),r(),l(18,"input",11),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.RowCount=n)}),r()(),l(19,"div",7)(20,"label",12),m(21,"Quantity From - To"),r(),l(22,"div",13)(23,"input",14),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.QuantityFrom=n)}),r(),m(24," - "),l(25,"input",15),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.QuantityTo=n)}),r()()()(),l(26,"content")(27,"div",16)(28,"div",17)(29,"div",18),u(30,ot,3,0,"div",19),l(31,"table",20)(32,"thead",21)(33,"tr")(34,"th",22),m(35,"Product "),x(36,"br"),l(37,"mat-slide-toggle",23),h("toggleChange",function(){d(e);let n=p();return n.showDifferenceStock=!n.showDifferenceStock,_(n.onShowDifferenceStock())}),l(38,"small",12),m(39,"FILTER DIFFERENT INVENTORY"),r()()(),l(40,"th",24),m(41,"Variant"),r(),l(42,"th",25),m(43,"SKU"),r(),u(44,lt,2,1,"th",3),f(45,"async"),l(46,"th",26),m(47,"POS"),r(),l(48,"th",27)(49,"div",28),x(50,"img",29),l(51,"span",30),m(52),f(53,"stringLimit"),r()()(),u(54,rt,3,0,"ng-container",3),l(55,"th",31),m(56,"Last Sync"),r(),x(57,"th",32),r()(),u(58,Vt,2,1,"tbody",33),f(59,"async"),r(),l(60,"div",34)(61,"div",35)(62,"div",36),m(63),f(64,"number"),f(65,"async"),u(66,Pt,3,0,"span",37)(67,Ft,3,3,"span",3),f(68,"async"),m(69),r()(),u(70,At,3,2,"div",38),f(71,"async"),r()()()()()()}if(i&2){let e=p(),t,n;c("headerTitle","Inventory Comparison")("pageData",e.pageData)("hideSearchBox",!1),s(3),c("ngIf",S(4,24,e.paginationService.data$)),s(6),c("clearable",!1)("items",e.channelOptions)("ngModel",e.searchFilter.ChannelID),s(5),c("ngModel",e.searchFilter.PageNumber),s(4),c("ngModel",e.searchFilter.RowCount),s(5),c("ngModel",e.searchFilter.QuantityFrom),s(2),c("ngModel",e.searchFilter.QuantityTo),s(5),c("ngIf",(e.searchFilter==null?null:e.searchFilter.filterModel)==3),s(14),c("ngIf",S(45,26,e.paginationService.data$)),s(5),c("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=13?e.selectedChannel==null?null:e.selectedChannel.Name:""),s(1),c("src",e.selectedChannel==null?null:e.selectedChannel.logo,k),s(2),me(" ",L(53,28,e.selectedChannel==null?null:e.selectedChannel.Name,13),"",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>=13?"...":""," "),s(2),c("ngIf",e.isShowReservedColumn),s(4),c("ngForOf",S(59,31,e.products$)),s(5),b(" Showing 1 - ",S(64,33,(t=S(65,35,e.paginationService.data$))==null?null:t.length)," of "),s(3),c("ngIf",e.paginationService.hideCount),s(1),c("ngIf",S(68,37,!e.paginationService.hideCount&&e.rowCount$)),s(2),b(" records ~ ",e.paginationService.footerPageNumber," Page "),s(1),c("ngIf",((n=S(71,39,e.paginationService.data$))==null?null:n.length)>0)}}var ke=(()=>{let o=class o{constructor(t,n,a,g,C,M,D,Ae){this.http=t,this.toastr=n,this.dialog=a,this.paginationService=g,this.productService=C,this.authService=M,this.biggerPictureService=D,this.inventoryService=Ae,this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="/api/InventoryLoader/Load",this.rowCountApi="/api/Inventory/GetInventoryByChannelRowCount",this.minDate=T.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=T.GuidEMpty,this.Options=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.paginationService.data$.pipe(ce(t=>(t=t.map(n=>(n.Variants&&(n.Variants=n.Variants.map(a=>(a.isDiscontinued=n.Discontinued=="Yes",a))),n)),t)),N(t=>{this.checkShowReservedColumn(t)}))}checkShowReservedColumn(t){let n=0,a;t.forEach(g=>{a=g.Variants.find(C=>T.IsNotEmpty(C?.Channel[0]?.InventoryReserved)),a&&(n+=1)}),this.isShowReservedColumn=n>0}initPageLoader(){this.paginationService.fetchDataEndpoint="Inventory/GetSingleChannelComparison",this.loader$=this.http.post(this.loaderApi,{}).pipe(N(t=>{if(this.searchFilter={RowCount:t.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:t.Filter.ChannelID},this.initSelectedChannel(),this.paginationService.reloadPagination(this.searchFilter),!t.Filter.IsMarketplaceAppActive){let n=`Automatic inventory sync disabled.
|
|
2
|
-
Please enable Dealpos X Marketplace Apps integration in POS Configuration`;this.toastr.warning(n,"Warning")}}))}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(t=>t.ID==this.searchFilter.ChannelID)}onSearch(t){this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}updateStock(t){let n=this.productService.selectedVariantProduct(t);if(n.length>0){let a=n.map(C=>({ID:C.ID,Code:C.Code,Inventory:C.Inventory})),g={ListChannelID:[this.searchFilter.ChannelID],List:a};this.http.post("/api/Inventory/UpdateChannel",g).subscribe(C=>{this.searchFilter.PageNumber=1,this.paginationService.reloadPagination(this.searchFilter),this.checkboxState=!1,this.handlingUpdateStock(C)})}}handlingUpdateStock(t){if(t[0]?.StatusProduct){let n=t[0].StatusProduct.Fail_list,a=t[0].StatusProduct.Success_list;this.inventoryService.showToastrUpdateInventory("Stock",a,n)}else this.toastr.error(t[0]?.Exception,"Error")}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=T.GuidEMpty,this.dialog.open(te,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.searchFilter.ChannelID=a.ChannelID,this.searchFilter.ScanFull=a.ScanFull,this.searchFilter.UpdatedProduct=a.UpdatedProduct,this.searchFilter.Async=a.Async,this.scannALl()})}scannALl(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(n=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.searchFilter.ScanFull=!1,this.initPageLoader(),this.toastr.success("Successfully scanned from "+t?.Name,"Success"))})}refreshInventory(t,n,a,g){let C={ChannelItemID:t,ChannelVariationID:n,ChannelID:a,VariantID:g};this.http.post("/api/Inventory/RefreshInventoryChannel",C).subscribe(M=>{this.toastr.success("Successfully updated","Success"),this.paginationService.reloadPagination(this.searchFilter)})}onCheckboxStateProduct(t){t.Variants=t.Variants.map(n=>(n.Inventory>=0&&(n.selected=t.selected),n))}onCheckboxStateChange(t){t=t.map(n=>(n.Variants=n.Variants.map(a=>(a.selected=this.checkboxState,a)),n))}openTableDialog(t,n,a){this.dialog.open(Me,{data:{Name:t.Name,Variant:n,ChannelID:n?.Channel[0].ChannelID,Table:"inventory",ChannelItemID:t.ChannelItemID}}).afterClosed().pipe(P(C=>T.IsNotEmpty(C))).subscribe(C=>{this.updateItemAfterDialog(C,a)})}updateItemAfterDialog(t,n){let a={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku},g=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.http.post("/api/Inventory/UpdateQuantityByItem",a).subscribe(C=>{this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+g?.Name+" to "+a.NewQuantity,"Success")})}onShowDifferenceStock(){this.showDifferenceStock?this.searchFilter.filterModel=V.DIFFERENCE:this.searchFilter.filterModel=V.ALL,this.paginationService.reloadPagination(this.searchFilter)}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,PageNumber:1,text:this.searchFilter.text};this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`${this.rowCountApi}`,t)}onLastPage(){let t={ChannelID:this.searchFilter.ChannelID,PageNumber:1};this.http.post(`${this.rowCountApi}`,t).subscribe({next:n=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,n.Total)}})}onZoomImage(t,n){this.biggerPictureService.openBiggerPicture(t,n)}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(n){return new(n||o)(y(H),y(Q),y(X),y(ie),y(ne),y(q),y(we),y(oe))},o.\u0275cmp=F({type:o,selectors:[["app-single-channel-comparison"]],decls:2,vars:3,consts:[["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit",4,"ngIf"],["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit"],[1,"d-flex"],[4,"ngIf"],["for","ng-select",1,"fw-bold"],["id","ng-select","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text","mt-3",3,"clearable","items","ngModel","ngModelChange"],["ng-option-tmp",""],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModel","ngModelChange"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModel","ngModelChange"],[1,"fw-bold"],[1,"d-flex","align-items-center","justify-content-start"],["type","number","name","QuantityFrom",1,"w-25","me-2","mt-3","form-control",3,"ngModel","ngModelChange"],["type","number","name","QuantityTo",1,"w-25","ms-2","form-control","mt-2",3,"ngModel","ngModelChange"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["class","alert alert-warning d-flex justify-content-between text-dark","role","alert",4,"ngIf"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","ps-12",2,"width","25%"],[3,"toggleChange"],["scope","col",1,"text-start"],["scope","col",1,"text-end",2,"width","10%"],["scope","col",1,"text-end","w-10",2,"width","8%"],[1,"text-end",2,"width","140px"],["matTooltipPosition","above",1,"d-inline-block",3,"matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],[1,"text-center"],[2,"width","4%"],[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","button","data-cy","scanInPos","class","btn btn-outline-secondary shadow rounded me-3",3,"click",4,"ngIf"],["class","btn btn-success",3,"click",4,"ngIf"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-3",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"me-2"],[2,"width","18px",3,"src"],["role","alert",1,"alert","alert-warning","d-flex","justify-content-between","text-dark"],["type","checkbox",3,"ngModel","ngModelChange"],["matTooltip","Reserved Stock","matTooltipPosition","above",1,"text-end",2,"width","80px"],[1,"text-start"],["matTooltipPosition","above",1,"text-end",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],[1,"align-middle"],[4,"ngIf","ngIfElse"],["OTHER_CHANNEL",""],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],["class","text-end",3,"ngClass",4,"ngIf"],["SYNCDATE",""],[1,"ps-0","d-flex","justify-content-center","align-items-center"],["matTooltip","Refresh stock according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","fa-sync","fa-lg","external-link-custom"],[1,"text-start",2,"width","0%",3,"rowSpan"],["type","checkbox","class","me-3",3,"ngModel","ngModelChange",4,"ngIf"],["class","border rounded w-img cursor-pointer","style","margin-left: 20px",3,"src","click",4,"ngIf","ngIfElse"],["elsePic",""],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModel","ngModelChange"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"src","click"],["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,"d-flex","align-items-center"],["title","Category",1,"fa-solid","fa-tags","me-2",2,"opacity","60%"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],["title","Allocated"],["title","Inventory below minimum inventory"],[1,"ms-2","pb-1"],["target","_blank",3,"href"],[1,"fas","fa-lg","fa-external-link-alt","external-link-custom"],[1,"text-end",3,"ngClass"],[1,"cursor",3,"click"],[1,"text-end"],["EMPTY_RESERVED",""],[1,"text-danger"],["matTooltipShowDelay","500",3,"matTooltip"],[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(n,a){n&1&&(u(0,Rt,72,41,"mainpanel",0),f(1,"async")),n&2&&c("ngIf",S(1,1,a.loader$))},dependencies:[de,_e,$,K,Z,ge,J,Y,xe,fe,De,ee,W,U,j,ue,Ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}"]});let i=o;return i})();var Bt=[{path:"",component:Pe,children:[{path:"",redirectTo:"bychannel",pathMatch:"full"},{path:"pos",component:Fe,canActivate:[se],data:{title:"Inventory Comparison"}},{path:"bychannel",component:ke,canActivate:[se],data:{title:"Inventory Comparison"}}]}],Ne=(()=>{let o=class o{};o.\u0275fac=function(n){return new(n||o)},o.\u0275mod=O({type:o}),o.\u0275inj=B({imports:[z,G.forChild(Bt)]});let i=o;return i})();var Fn=(()=>{let o=class o{};o.\u0275fac=function(n){return new(n||o)},o.\u0275mod=O({type:o}),o.\u0275inj=B({providers:[oe],imports:[z,Ne,G,Ie,Ce,Se,Ee,ye,ae,ve]});let i=o;return i})();export{Fn as InventoryModule};
|
|
1
|
+
import{a as V,b as Me,c as Ve,d as ae,e as oe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2TI26R6R.js";import{a as Te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TGUXB6A6.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-NCBXZDJX.js";import{a as De,b as Ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-55IYK2MP.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-K3WUITRV.js";import{a as ie}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-6HBCXTS4.js";import{a as te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-AZBCL75Q.js";import{a as ne}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-T4LIIUEO.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-6AEIRWBB.js";import{a as be,b as Ie}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-QGZX7NE7.js";import{e as q}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2T3C7JV2.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-IJNIZXOB.js";import{b as Q,e as H}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-PYALJMBO.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-N46PJUA5.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-JVPANFAL.js";import{a as we}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5J3KK3OL.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-SEWZHFIK.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-C2BQDUEV.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TEFJMIF6.js";import{a as fe,c as xe,d as Se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-EAABO2EV.js";import{a as se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-GGNPOSPC.js";import{B as ee,C as ye,q as W,r as ve,u as X}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5GBQIVIY.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-3RHXQKFB.js";import{b as ge,c as K,h as J,k as Y,m as Z,u as Ce}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TWKTPY5E.js";import{c as T}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2XBPNKZX.js";import{$a as x,B as P,Cb as f,Db as S,Eb as L,Fa as s,Ga as y,Hc as he,Lb as R,Lc as G,Oa as c,Ua as u,X as N,Xb as de,Za as l,Zb as _e,_a as r,_b as $,aa as B,ab as I,bb as w,bc as U,cc as ue,db as v,ea as F,ec as j,fa as O,fc as z,hb as h,ja as d,jb as p,ka as _,mb as pe,ob as A,pb as m,q as ce,qb as E,rb as b,sb as me,wb as re,za as k}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-W3FHD4GW.js";var Pe=(()=>{let o=class o{constructor(){this.inventoryTabs=[{Title:"Single Channel Comparison",Url:"/menu/inventory/bychannel"},{Title:"Multi Channel Comparison",Url:"/menu/inventory/pos"}]}};o.\u0275fac=function(n){return new(n||o)},o.\u0275cmp=F({type:o,selectors:[["app-inventory"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,a){n&1&&(l(0,"nav",0)(1,"div",1)(2,"div"),x(3,"nav-tab",2),r()()(),x(4,"router-outlet")),n&2&&(s(3),c("Tabs",a.inventoryTabs))},dependencies:[he,be]});let i=o;return i})();function Ge(i,o){if(i&1){let e=v();l(0,"button",22),h("click",function(){d(e);let n=p(3);return _(n.openScanDialog())}),x(1,"i",23),m(2," Scan Channel "),r()}}function Ke(i,o){if(i&1){let e=v();l(0,"button",24),h("click",function(){d(e);let n=p().ngIf,a=p(2);return _(a.onUpdateItems(n))}),x(1,"i",25),m(2," Update "),r()}}function Je(i,o){if(i&1&&(l(0,"actions")(1,"div",19)(2,"div"),u(3,Ge,3,0,"button",20)(4,Ke,3,0,"button",21),r()()()),i&2){let e=o.ngIf,t=p(2);s(3),c("ngIf",!t.productService.hasSelectionVariant(e)),s(1),c("ngIf",t.productService.hasSelectionVariant(e))}}function Ye(i,o){if(i&1){let e=v();l(0,"app-table",26),h("onToggle",function(n){d(e);let a=p(2);return _(a.onShowDifferenceStock(n))})("onSubmit",function(n){let g=d(e).ngIf,C=p(2);return _(C.updateStockByVariant(n,g))}),r()}if(i&2){let e=o.ngIf,t=p(2);c("data",e)("channel",t.channelOptions)("showProductToggle",!0)("filter",t.searchFilter)}}function Ze(i,o){if(i&1){let e=v();l(0,"span",27),h("click",function(){d(e);let n=p(2);return _(n.getRowCount())}),l(1,"i",28),m(2,"?"),r()()}}function qe(i,o){if(i&1&&(l(0,"span"),m(1),f(2,"number"),r()),i&2){let e=o.ngIf;s(1),E(S(2,1,e))}}function We(i,o){if(i&1){let e=v();l(0,"a",29),h("click",function(){d(e);let n=p(2);return _(n.nextPage())}),x(1,"i",30),m(2," Next"),r()}}function Xe(i,o){if(i&1){let e=v();l(0,"a",31),h("click",function(){d(e);let n=p(2);return _(n.getAllData())}),x(1,"i",32),m(2," Last"),r()}}function et(i,o){if(i&1){let e=v();l(0,"mainpanel",1),h("onSubmit",function(n){d(e);let a=p();return _(a.onSearch(n))}),u(1,Je,5,2,"actions",2),f(2,"async"),l(3,"filters")(4,"div")(5,"label",3),m(6,"PageNumber"),r(),l(7,"input",4),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.PageNumber=n)}),r()(),l(8,"div",5)(9,"label",6),m(10,"Page Size"),r(),l(11,"input",7),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.RowCount=n)}),r()()(),l(12,"content")(13,"div",8)(14,"div",9)(15,"div",10),u(16,Ye,1,4,"app-table",11),f(17,"async"),I(18),l(19,"div",12)(20,"div",13)(21,"div",14),m(22),f(23,"number"),f(24,"async"),u(25,Ze,3,0,"span",15)(26,qe,3,3,"span",2),f(27,"async"),m(28),r()(),l(29,"div",16),u(30,We,3,0,"a",17)(31,Xe,3,0,"a",18),r()(),w(),r()()()()()}if(i&2){let e=p(),t;c("pageData",e.pageData)("hideSearchBox",!1)("textButton","Search"),s(1),c("ngIf",S(2,13,e.paginationService.data$)),s(6),c("ngModel",e.searchFilter.PageNumber),s(4),c("ngModel",e.searchFilter.RowCount),s(5),c("ngIf",S(17,15,e.paginationService.data$)),s(6),b(" Showing 1 - ",S(23,17,(t=S(24,19,e.paginationService.data$))==null?null:t.length)," of "),s(3),c("ngIf",e.paginationService.hideCount),s(1),c("ngIf",S(27,21,!e.paginationService.hideCount&&e.allDataCount$)),s(2),b(" records ~ ",e.paginationService.footerPageNumber," Page "),s(2),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}var Fe=(()=>{let o=class o{constructor(t,n,a,g,C,M){this.http=t,this.toastr=n,this.dialog=a,this.paginationService=g,this.productService=C,this.authService=M,this.loaderEndpoint="InventoryLoader/GetMultipleInventoryComparison",this.dataEndpoint="Inventory/GetMultipleChannelComparison",this.allDataCountEndpoint="Inventory/GetMultipleChannelComparisonRowCount",this.filterTypeOptions=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],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.loader$=this.http.post(`/API/${this.loaderEndpoint}`,{}).pipe(N(t=>{t.Filter={PageNumber:t.Filter.PageNumber,filterModel:V.ALL,RowCount:t.Filter.PageSize,HiddenIPOSInventory:t.Filter.HiddenIPOSInventory},this.searchFilter=t.Filter,this.paginationService.reloadPagination(this.searchFilter)}))}onSearch(t){this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter)}updateStock(t,n){let a=this.productService.selectedVariantProduct(t);if(a.length>0){let C=a.map(D=>({ID:D.ID,Code:D.Code,Inventory:D.Inventory}));var g=n.filter(D=>D.selected).map(D=>D.ID);let M={ListChannelID:g,List:C};this.http.post("/api/Inventory/UpdateChannel",M).subscribe(D=>{this.paginationService.reloadPagination(this.searchFilter),this.toastr.success("Successfully updated "+M.List.length+" variants in "+M.ListChannelID.length+" channels","Success")})}}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));this.dialog.open(te,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.searchFilter.ScanFull=a.ScanFull,this.searchFilter.ChannelID=a.ChannelID,this.searchFilter.UpdatedProduct=a.UpdatedProduct,this.searchFilter.Async=a.Async,this.scanAll()})}scanAll(){this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(t=>{if(this.searchFilter.Async)this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"});else{let n=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.successToastrScanAllProduct(t,n,!this.searchFilter.UpdatedProduct),this.initPageLoader()}this.searchFilter.ChannelID=T.GuidEMpty})}updateStockByVariant(t,n){let a={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku};this.http.post("/api/Inventory/UpdateQuantityByItem",a).subscribe(g=>{let C=this.productService.findChannelById(a.ID,this.channelOptions);this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+C.Name+" to "+a.NewQuantity,"Success")})}onShowDifferenceStock(t){t?this.searchFilter.filterModel=V.DIFFERENCE:this.searchFilter.filterModel=V.ALL,this.paginationService.reloadPagination(this.searchFilter)}onUpdateItems(t){let n=this.productService.selectedVariantProduct(t);this.dialog.open(Te,{data:{selectedItems:n,channels:JSON.parse(JSON.stringify(this.channelOptions))},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.updateStock(t,a)})}getRowCount(){this.paginationService.hideCount=!1;let t={text:this.searchFilter.text};this.allDataCount$=this.http.post(`/API/${this.allDataCountEndpoint}`,t)}nextPage(){this.paginationService.onNextPage(this.searchFilter)}getAllData(){this.http.post(`/API/${this.allDataCountEndpoint}`,{}).subscribe({next:t=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,t)}})}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(n){return new(n||o)(y(H),y(Q),y(X),y(ie),y(ne),y(q))},o.\u0275cmp=F({type:o,selectors:[["app-multi-channel-comparison"]],decls:2,vars:3,consts:[["headerTitle","Inventory Comparison",3,"pageData","hideSearchBox","textButton","onSubmit",4,"ngIf"],["headerTitle","Inventory Comparison",3,"pageData","hideSearchBox","textButton","onSubmit"],[4,"ngIf"],["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,"ngModel","ngModelChange"],[1,"mt-5"],["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,"ngModel","ngModelChange"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["table","inventory",3,"data","channel","showProductToggle","filter","onToggle","onSubmit",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"],[1,"d-flex"],["type","button","data-cy","scanInPos","class","btn btn-outline-secondary shadow rounded me-3",3,"click",4,"ngIf"],["type","button","class","btn btn-success shadow-sm rounded me-3",3,"click",4,"ngIf"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-3",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],["type","button",1,"btn","btn-success","shadow-sm","rounded","me-3",3,"click"],[1,"fas","fa-chevron-circle-up"],["table","inventory",3,"data","channel","showProductToggle","filter","onToggle","onSubmit"],[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(n,a){n&1&&(u(0,et,32,23,"mainpanel",0),f(1,"async")),n&2&&c("ngIf",S(1,1,a.loader$))},dependencies:[$,K,Z,J,Y,ee,ae,W,U,j],styles:[".no-bullet[_ngcontent-%COMP%]{list-style-type:none}"]});let i=o;return i})();function tt(i,o){if(i&1){let e=v();l(0,"button",41),h("click",function(){d(e);let n=p(3);return _(n.openScanDialog())}),x(1,"i",42),m(2," Scan Channel "),r()}}function nt(i,o){if(i&1){let e=v();l(0,"button",43),h("click",function(){d(e);let n=p().ngIf,a=p(2);return _(a.updateStock(n))}),x(1,"i",44),m(2," Update"),r()}}function it(i,o){if(i&1&&(l(0,"div"),u(1,tt,3,0,"button",39)(2,nt,3,0,"button",40),r()),i&2){let e=o.ngIf,t=p(2);s(1),c("ngIf",!t.productService.hasSelectionVariant(e)),s(1),c("ngIf",t.productService.hasSelectionVariant(e))}}function at(i,o){if(i&1&&(l(0,"span",45),x(1,"img",46),r(),m(2)),i&2){let e=o.item;s(1),c("src",e==null?null:e.logo,k),s(1),b(" ",e.Name," ")}}function ot(i,o){i&1&&(l(0,"div",47)(1,"span"),m(2," showing only different stock, please press next to populate more data "),r()())}function lt(i,o){if(i&1){let e=v();l(0,"th")(1,"input",48),h("ngModelChange",function(n){d(e);let a=p(2);return _(a.checkboxState=n)})("ngModelChange",function(){let a=d(e).ngIf,g=p(2);return _(g.onCheckboxStateChange(a))}),r()()}if(i&2){let e=p(2);s(1),c("ngModel",e.checkboxState)}}function rt(i,o){i&1&&(I(0),l(1,"th",49),m(2," Reserved "),r(),w())}function st(i,o){if(i&1){let e=v();l(0,"input",69),h("ngModelChange",function(n){d(e);let a=p(3).$implicit;return _(a.selected=n)})("ngModelChange",function(){d(e);let n=p(3).$implicit,a=p(2);return _(a.onCheckboxStateProduct(n))}),r()}if(i&2){let e=p(3).$implicit;c("ngModel",e.selected)}}function ct(i,o){if(i&1){let e=v();l(0,"img",70),h("click",function(n){d(e);let a=p(3).$implicit,g=p(2);return _(g.onZoomImage(n,a==null?null:a.ImageUrl))}),r()}if(i&2){let e=p(3).$implicit;pe("src",e==null?null:e.ThumbnailUrl,k)}}function pt(i,o){i&1&&x(0,"img",71)}function mt(i,o){if(i&1&&(I(0),x(1,"br"),l(2,"div",72),x(3,"i",73),l(4,"small"),m(5),r()(),w()),i&2){let e=p(3).$implicit;s(5),b("(",e==null?null:e.Category,")")}}function dt(i,o){if(i&1&&(I(0),l(1,"td",63)(2,"div",13),u(3,st,1,1,"input",64)(4,ct,1,1,"img",65)(5,pt,1,0,"ng-template",null,66,R),r()(),l(7,"td",67)(8,"span",68),m(9),r(),u(10,mt,6,1,"ng-container",3),r(),w()),i&2){let e=A(6),t=p().$implicit,n=p().$implicit,a=p(2);s(1),c("rowSpan",n==null?null:n.Variants.length),s(2),c("ngIf",(t==null?null:t.Inventory)>=0||n.Variants.length>1),s(1),c("ngIf",n==null?null:n.ThumbnailUrl)("ngIfElse",e),s(3),c("rowSpan",n==null?null:n.Variants.length),s(2),E(n==null?null:n.Name),s(1),c("ngIf",n.CategoryID!==null&&n.CategoryID!=a.guidEmpty)}}function _t(i,o){if(i&1){let e=v();I(0),l(1,"input",48),h("ngModelChange",function(n){d(e);let a=p(2).$implicit;return _(a.selected=n)}),r(),w()}if(i&2){let e=p(2).$implicit;s(1),c("ngModel",e.selected)}}function ut(i,o){if(i&1&&(I(0),u(1,_t,2,1,"ng-container",3),w()),i&2){let e=p().$implicit;s(1),c("ngIf",(e==null?null:e.Inventory)<=1e5)}}function ht(i,o){if(i&1){let e=v();l(0,"input",48),h("ngModelChange",function(n){d(e);let a=p(2).$implicit;return _(a.selected=n)}),r()}if(i&2){let e=p(2).$implicit;c("ngModel",e.selected)}}function gt(i,o){if(i&1&&u(0,ht,1,1,"input",74),i&2){let e=p().$implicit;c("ngIf",(e==null?null:e.Inventory)>=0)}}function Ct(i,o){i&1&&(l(0,"div",75),m(1,"Not Found"),r())}function ft(i,o){if(i&1&&(l(0,"div")(1,"span",76),m(2),f(3,"number"),r(),m(4," => "),l(5,"span",77),m(6),f(7,"number"),r()()),i&2){let e=p().$implicit;s(2),b(" ",S(3,2,e==null||e.I==null?null:e.I.Available),""),s(4),E(S(7,4,e==null?null:e.Inventory))}}function xt(i,o){if(i&1&&(l(0,"div"),m(1),f(2,"number"),r()),i&2){let e=p().$implicit;s(1),b(" ",S(2,1,e==null?null:e.Inventory)," ")}}function St(i,o){if(i&1&&(I(0),l(1,"div",78)(2,"a",79),x(3,"i",80),r()(),w()),i&2){let e=p().$implicit,t=p(3);s(2),c("href",t.hostName+"/menu/Products/Catalog/Variants/Info?ID="+(e==null?null:e.ID),k)}}var vt=i=>({"bg-gradient-warning":i});function yt(i,o){if(i&1){let e=v();l(0,"td",81)(1,"div",52)(2,"div")(3,"span",82),h("click",function(){d(e);let n=p().$implicit,a=p(),g=a.$implicit,C=a.ngForOf,M=p(2);return _(M.openTableDialog(g,n,C))}),m(4),f(5,"number"),r()(),l(6,"div",78)(7,"a",79),x(8,"i",80),r()()()()}if(i&2){let e=p().$implicit;c("ngClass",re(5,vt,(e==null?null:e.Inventory)!=(e==null||e.Channel[0]==null?null:e.Channel[0].Inventory))),s(4),b(" ",S(5,3,e==null||e.Channel[0]==null?null:e.Channel[0].Inventory)," "),s(3),c("href",e==null||e.Channel[0]==null?null:e.Channel[0].Url,k)}}function bt(i,o){if(i&1&&(I(0),l(1,"span",85),m(2),f(3,"number"),r(),w()),i&2){let e=p(2).$implicit;s(2),b(" (",S(3,1,e==null||e.Channel[0]==null?null:e.Channel[0].InventoryReserved),") ")}}function It(i,o){i&1&&m(0," - ")}function wt(i,o){if(i&1&&(I(0),l(1,"td",83),u(2,bt,4,3,"ng-container",55)(3,It,1,0,"ng-template",null,84,R),r(),w()),i&2){let e=A(4),t=p().$implicit;s(2),c("ngIf",t==null||t.Channel[0]==null?null:t.Channel[0].InventoryReserved)("ngIfElse",e)}}function Tt(i,o){i&1&&(I(0),m(1," - "),w())}function Mt(i,o){if(i&1&&(l(0,"span",86),f(1,"date"),m(2),f(3,"date"),r()),i&2){let e=p().$implicit;c("matTooltip",L(1,2,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMMM yyyy HH:mm:ss")),s(2),b(" ",L(3,5,e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync,"dd MMM yy HH:mm")," ")}}var Dt=i=>({"text-decoration-line-through":i});function Et(i,o){if(i&1){let e=v();l(0,"tr"),u(1,dt,11,7,"ng-container",3),l(2,"td",50),m(3),r(),l(4,"td",51)(5,"div",52)(6,"span",53),m(7),r()()(),l(8,"td",54),u(9,ut,2,1,"ng-container",55)(10,gt,1,1,"ng-template",null,56,R),r(),l(12,"td")(13,"div",52),u(14,Ct,2,0,"div",57)(15,ft,8,6,"div",3)(16,xt,3,3,"div",3)(17,St,4,1,"ng-container",3),r()(),u(18,yt,9,7,"td",58)(19,wt,5,2,"ng-container",3),l(20,"td",31),u(21,Tt,2,0,"ng-container",55)(22,Mt,4,8,"ng-template",null,59,R),r(),l(24,"td")(25,"div",60)(26,"span",61),h("click",function(){let a=d(e).$implicit,g=p(3);return _(g.refreshInventory(a==null||a.Channel[0]==null?null:a.Channel[0].ChannelItemID,a==null||a.Channel[0]==null?null:a.Channel[0].ChannelVariationID,a==null||a.Channel[0]==null?null:a.Channel[0].ChannelID,a==null?null:a.ID))}),x(27,"i",62),r()()()()}if(i&2){let e=o.$implicit,t=o.index,n=A(11),a=A(23),g=p(3);s(1),c("ngIf",t==0),s(2),E(e==null?null:e.Model),s(1),c("matTooltip",e.isDiscontinued?g.discontinuedVariantMsg:""),s(2),c("ngClass",re(15,Dt,e.isDiscontinued)),s(1),E(e==null?null:e.Code),s(2),c("ngIf",(e==null?null:e.Channel[0].TypeID)==1)("ngIfElse",n),s(5),c("ngIf",(e==null?null:e.I)==null),s(1),c("ngIf",(e==null?null:e.I)!=null&&(e==null?null:e.Inventory)!=(e==null||e.I==null?null:e.I.Available)),s(1),c("ngIf",(e==null?null:e.I)!=null&&(e==null?null:e.Inventory)==(e==null||e.I==null?null:e.I.Available)),s(1),c("ngIf",(e==null?null:e.I)!=null),s(1),c("ngIf",e==null?null:e.Channel),s(1),c("ngIf",g.isShowReservedColumn),s(2),c("ngIf",(e==null||e.Channel[0]==null?null:e.Channel[0].LastInventorySync)==g.minDate)("ngIfElse",a)}}function Vt(i,o){if(i&1&&(l(0,"tbody"),u(1,Et,28,17,"tr",33),r()),i&2){let e=o.$implicit;s(1),c("ngForOf",e.Variants)}}function Pt(i,o){if(i&1){let e=v();l(0,"span",87),h("click",function(){d(e);let n=p(2);return _(n.getRowCount())}),l(1,"i",88),m(2,"?"),r()()}}function Ft(i,o){if(i&1&&(l(0,"span"),m(1),f(2,"number"),r()),i&2){let e=o.ngIf;s(1),E(S(2,1,e==null?null:e.Total))}}function kt(i,o){if(i&1){let e=v();l(0,"a",92),h("click",function(){d(e);let n=p(3);return _(n.onNextPage())}),x(1,"i",93),m(2," Next"),r()}}function Nt(i,o){if(i&1){let e=v();l(0,"a",94),h("click",function(){d(e);let n=p(3);return _(n.onLastPage())}),x(1,"i",95),m(2," Last"),r()}}function At(i,o){if(i&1&&(l(0,"div",89),u(1,kt,3,0,"a",90)(2,Nt,3,0,"a",91),r()),i&2){let e=p(2);s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage),s(1),c("ngIf",e.paginationService.disableNextButton&&!e.paginationService.goToLastPage)}}function Rt(i,o){if(i&1){let e=v();l(0,"mainpanel",1),h("onSubmit",function(n){d(e);let a=p();return _(a.onSearch(n))}),l(1,"actions")(2,"div",2),u(3,it,3,2,"div",3),f(4,"async"),r()(),l(5,"filters")(6,"div")(7,"label",4),m(8,"Channel"),r(),l(9,"ng-select",5),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.ChannelID=n)}),u(10,at,3,2,"ng-template",6),r()(),l(11,"div",7)(12,"label",8),m(13,"PageNumber"),r(),l(14,"input",9),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.PageNumber=n)}),r()(),l(15,"div",7)(16,"label",10),m(17,"Page Size"),r(),l(18,"input",11),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.RowCount=n)}),r()(),l(19,"div",7)(20,"label",12),m(21,"Quantity From - To"),r(),l(22,"div",13)(23,"input",14),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.QuantityFrom=n)}),r(),m(24," - "),l(25,"input",15),h("ngModelChange",function(n){d(e);let a=p();return _(a.searchFilter.QuantityTo=n)}),r()()()(),l(26,"content")(27,"div",16)(28,"div",17)(29,"div",18),u(30,ot,3,0,"div",19),l(31,"table",20)(32,"thead",21)(33,"tr")(34,"th",22),m(35,"Product "),x(36,"br"),l(37,"mat-slide-toggle",23),h("toggleChange",function(){d(e);let n=p();return n.showDifferenceStock=!n.showDifferenceStock,_(n.onShowDifferenceStock())}),l(38,"small",12),m(39,"FILTER DIFFERENT INVENTORY"),r()()(),l(40,"th",24),m(41,"Variant"),r(),l(42,"th",25),m(43,"SKU"),r(),u(44,lt,2,1,"th",3),f(45,"async"),l(46,"th",26),m(47,"POS"),r(),l(48,"th",27)(49,"div",28),x(50,"img",29),l(51,"span",30),m(52),f(53,"stringLimit"),r()()(),u(54,rt,3,0,"ng-container",3),l(55,"th",31),m(56,"Last Sync"),r(),x(57,"th",32),r()(),u(58,Vt,2,1,"tbody",33),f(59,"async"),r(),l(60,"div",34)(61,"div",35)(62,"div",36),m(63),f(64,"number"),f(65,"async"),u(66,Pt,3,0,"span",37)(67,Ft,3,3,"span",3),f(68,"async"),m(69),r()(),u(70,At,3,2,"div",38),f(71,"async"),r()()()()()()}if(i&2){let e=p(),t,n;c("headerTitle","Inventory Comparison")("pageData",e.pageData)("hideSearchBox",!1),s(3),c("ngIf",S(4,24,e.paginationService.data$)),s(6),c("clearable",!1)("items",e.channelOptions)("ngModel",e.searchFilter.ChannelID),s(5),c("ngModel",e.searchFilter.PageNumber),s(4),c("ngModel",e.searchFilter.RowCount),s(5),c("ngModel",e.searchFilter.QuantityFrom),s(2),c("ngModel",e.searchFilter.QuantityTo),s(5),c("ngIf",(e.searchFilter==null?null:e.searchFilter.filterModel)==3),s(14),c("ngIf",S(45,26,e.paginationService.data$)),s(5),c("matTooltip",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>13?e.selectedChannel==null?null:e.selectedChannel.Name:""),s(1),c("src",e.selectedChannel==null?null:e.selectedChannel.logo,k),s(2),me(" ",L(53,28,e.selectedChannel==null?null:e.selectedChannel.Name,13),"",(e.selectedChannel==null||e.selectedChannel.Name==null?null:e.selectedChannel.Name.length)>13?"...":""," "),s(2),c("ngIf",e.isShowReservedColumn),s(4),c("ngForOf",S(59,31,e.products$)),s(5),b(" Showing 1 - ",S(64,33,(t=S(65,35,e.paginationService.data$))==null?null:t.length)," of "),s(3),c("ngIf",e.paginationService.hideCount),s(1),c("ngIf",S(68,37,!e.paginationService.hideCount&&e.rowCount$)),s(2),b(" records ~ ",e.paginationService.footerPageNumber," Page "),s(1),c("ngIf",((n=S(71,39,e.paginationService.data$))==null?null:n.length)>0)}}var ke=(()=>{let o=class o{constructor(t,n,a,g,C,M,D,Ae){this.http=t,this.toastr=n,this.dialog=a,this.paginationService=g,this.productService=C,this.authService=M,this.biggerPictureService=D,this.inventoryService=Ae,this.checkboxState=!1,this.showDifferenceStock=!1,this.loaderApi="/api/InventoryLoader/Load",this.rowCountApi="/api/Inventory/GetInventoryByChannelRowCount",this.minDate=T.MinDate,this.isShowReservedColumn=!0,this.discontinuedVariantMsg="This Variant is discontinued from POS, you must Non Active manually at the seller center so that it is not sold again on the channel.",this.guidEmpty=T.GuidEMpty,this.Options=[{Key:1,Value:"All"},{Key:3,Value:"Difference"}],this.pageData={Title:"Inventory Realtime",Nav:[{Title:"Inventory Cache",Url:"/menu/inventory",Active:!1},{Title:"Inventory Realtime",Url:"/menu/inventory/realtime",Active:!0}]}}ngOnInit(){this.channelOptions=this.authService.getChannels(),this.hostName=this.authService.getDomain(),this.initPageLoader(),this.products$=this.paginationService.data$.pipe(ce(t=>(t=t.map(n=>(n.Variants&&(n.Variants=n.Variants.map(a=>(a.isDiscontinued=n.Discontinued=="Yes",a))),n)),t)),N(t=>{this.checkShowReservedColumn(t)}))}checkShowReservedColumn(t){let n=0,a;t.forEach(g=>{a=g.Variants.find(C=>T.IsNotEmpty(C?.Channel[0]?.InventoryReserved)),a&&(n+=1)}),this.isShowReservedColumn=n>0}initPageLoader(){this.paginationService.fetchDataEndpoint="Inventory/GetSingleChannelComparison",this.loader$=this.http.post(this.loaderApi,{}).pipe(N(t=>{if(this.searchFilter={RowCount:t.Filter.PageSize,filterModel:1,PageNumber:1,ChannelID:t.Filter.ChannelID},this.initSelectedChannel(),this.paginationService.reloadPagination(this.searchFilter),!t.Filter.IsMarketplaceAppActive){let n=`Automatic inventory sync disabled.
|
|
2
|
+
Please enable Dealpos X Marketplace Apps integration in POS Configuration`;this.toastr.warning(n,"Warning")}}))}initSelectedChannel(){this.selectedChannel=this.channelOptions.find(t=>t.ID==this.searchFilter.ChannelID)}onSearch(t){this.searchFilter.text=t,this.paginationService.reloadPagination(this.searchFilter),this.initSelectedChannel()}updateStock(t){let n=this.productService.selectedVariantProduct(t);if(n.length>0){let a=n.map(C=>({ID:C.ID,Code:C.Code,Inventory:C.Inventory})),g={ListChannelID:[this.searchFilter.ChannelID],List:a};this.http.post("/api/Inventory/UpdateChannel",g).subscribe(C=>{this.searchFilter.PageNumber=1,this.paginationService.reloadPagination(this.searchFilter),this.checkboxState=!1,this.handlingUpdateStock(C)})}}handlingUpdateStock(t){if(t[0]?.StatusProduct){let n=t[0].StatusProduct.Fail_list,a=t[0].StatusProduct.Success_list;this.inventoryService.showToastrUpdateInventory("Stock",a,n)}else this.toastr.error(t[0]?.Exception,"Error")}openScanDialog(){let t=JSON.parse(JSON.stringify(this.searchFilter));t.ChannelID=T.GuidEMpty,this.dialog.open(te,{data:{filter:t,channelOptions:this.channelOptions},width:"600px"}).afterClosed().pipe(P(a=>T.IsNotEmpty(a))).subscribe(a=>{this.searchFilter.ChannelID=a.ChannelID,this.searchFilter.ScanFull=a.ScanFull,this.searchFilter.UpdatedProduct=a.UpdatedProduct,this.searchFilter.Async=a.Async,this.scannALl()})}scannALl(){let t=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.productService.scanAll(this.searchFilter.ChannelID,this.searchFilter.ScanFull,this.searchFilter.UpdatedProduct,this.searchFilter.Async).subscribe(n=>{this.searchFilter.Async?this.toastr.warning("You will be notified when the scan is completed.","Scan In Progress",{toastClass:"ngx-toastr toast-waiting"}):(this.searchFilter.ScanFull=!1,this.initPageLoader(),this.toastr.success("Successfully scanned from "+t?.Name,"Success"))})}refreshInventory(t,n,a,g){let C={ChannelItemID:t,ChannelVariationID:n,ChannelID:a,VariantID:g};this.http.post("/api/Inventory/RefreshInventoryChannel",C).subscribe(M=>{this.toastr.success("Successfully updated","Success"),this.paginationService.reloadPagination(this.searchFilter)})}onCheckboxStateProduct(t){t.Variants=t.Variants.map(n=>(n.Inventory>=0&&(n.selected=t.selected),n))}onCheckboxStateChange(t){t=t.map(n=>(n.Variants=n.Variants.map(a=>(a.selected=this.checkboxState,a)),n))}openTableDialog(t,n,a){this.dialog.open(Me,{data:{Name:t.Name,Variant:n,ChannelID:n?.Channel[0].ChannelID,Table:"inventory",ChannelItemID:t.ChannelItemID}}).afterClosed().pipe(P(C=>T.IsNotEmpty(C))).subscribe(C=>{this.updateItemAfterDialog(C,a)})}updateItemAfterDialog(t,n){let a={ID:t.ChannelID,ChannelItemID:t.ChannelItemID,ChannelVariantID:t.ChannelVariationID,NewQuantity:parseFloat(t.Inventory),VariantID:t.ID,SKU:t.Sku},g=this.productService.findChannelById(this.searchFilter.ChannelID,this.channelOptions);this.http.post("/api/Inventory/UpdateQuantityByItem",a).subscribe(C=>{this.toastr.success("Successfully updated "+t.ItemName+"("+t.VarName+") inventory in "+g?.Name+" to "+a.NewQuantity,"Success")})}onShowDifferenceStock(){this.showDifferenceStock?this.searchFilter.filterModel=V.DIFFERENCE:this.searchFilter.filterModel=V.ALL,this.paginationService.reloadPagination(this.searchFilter)}onNextPage(){this.paginationService.onNextPage(this.searchFilter)}getRowCount(){let t={ChannelID:this.searchFilter.ChannelID,PageNumber:1,text:this.searchFilter.text};this.paginationService.hideCount=!1,this.rowCount$=this.http.post(`${this.rowCountApi}`,t)}onLastPage(){let t={ChannelID:this.searchFilter.ChannelID,PageNumber:1};this.http.post(`${this.rowCountApi}`,t).subscribe({next:n=>{this.searchFilter.PageNumber=1,this.paginationService.getAllData(this.searchFilter,n.Total)}})}onZoomImage(t,n){this.biggerPictureService.openBiggerPicture(t,n)}ngOnDestroy(){this.paginationService.destroy()}};o.\u0275fac=function(n){return new(n||o)(y(H),y(Q),y(X),y(ie),y(ne),y(q),y(we),y(oe))},o.\u0275cmp=F({type:o,selectors:[["app-single-channel-comparison"]],decls:2,vars:3,consts:[["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit",4,"ngIf"],["textButton","Search",3,"headerTitle","pageData","hideSearchBox","onSubmit"],[1,"d-flex"],[4,"ngIf"],["for","ng-select",1,"fw-bold"],["id","ng-select","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel","appendTo","body",1,"center-text","mt-3",3,"clearable","items","ngModel","ngModelChange"],["ng-option-tmp",""],[1,"mt-5"],["for","PageNumber",1,"fw-bold"],["type","number","id","PageNumber","placeholder","PageNumber","name","PageNumber","data-toggle","tooltip","matTooltip","Page Number",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModel","ngModelChange"],["for","RowCount",1,"fw-bold"],["type","number","id","RowCount","placeholder","Page Size","name","RowCount","data-toggle","tooltip","matTooltip","Page Size",1,"mat-mdc-tooltip-trigger","form-control","ng-pristine","ng-valid","ng-touched","mt-3",3,"ngModel","ngModelChange"],[1,"fw-bold"],[1,"d-flex","align-items-center","justify-content-start"],["type","number","name","QuantityFrom",1,"w-25","me-2","mt-3","form-control",3,"ngModel","ngModelChange"],["type","number","name","QuantityTo",1,"w-25","ms-2","form-control","mt-2",3,"ngModel","ngModelChange"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],["class","alert alert-warning d-flex justify-content-between text-dark","role","alert",4,"ngIf"],[1,"table","border-bottom"],[1,"thead-light","sticky-top-thead"],["scope","col","colspan","2",1,"text-center","ps-12",2,"width","25%"],[3,"toggleChange"],["scope","col",1,"text-start"],["scope","col",1,"text-end",2,"width","10%"],["scope","col",1,"text-end","w-10",2,"width","8%"],[1,"text-end",2,"width","150px"],["matTooltipPosition","above",1,"d-inline-block",3,"matTooltip"],[2,"width","16px",3,"src"],[1,"ms-1"],[1,"text-center"],[2,"width","4%"],[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","button","data-cy","scanInPos","class","btn btn-outline-secondary shadow rounded me-3",3,"click",4,"ngIf"],["class","btn btn-success",3,"click",4,"ngIf"],["type","button","data-cy","scanInPos",1,"btn","btn-outline-secondary","shadow","rounded","me-3",3,"click"],[1,"fas","fa-lg","fa-crosshairs"],[1,"btn","btn-success",3,"click"],[1,"fas","fa-chevron-circle-up"],[1,"me-2"],[2,"width","18px",3,"src"],["role","alert",1,"alert","alert-warning","d-flex","justify-content-between","text-dark"],["type","checkbox",3,"ngModel","ngModelChange"],["matTooltip","Reserved Stock","matTooltipPosition","above",1,"text-end",2,"width","80px"],[1,"text-start"],["matTooltipPosition","above",1,"text-end",3,"matTooltip"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngClass"],[1,"align-middle"],[4,"ngIf","ngIfElse"],["OTHER_CHANNEL",""],["class","text-danger","matTooltip","This product is no longer available in POS","matTooltipPosition","above",4,"ngIf"],["class","text-end",3,"ngClass",4,"ngIf"],["SYNCDATE",""],[1,"ps-0","d-flex","justify-content-center","align-items-center"],["matTooltip","Refresh stock according to seller center",1,"pl-5","cursor-pointer",2,"color","var(--bs-link-color)",3,"click"],[1,"fas","fa-sync","fa-lg","external-link-custom"],[1,"text-start",2,"width","0%",3,"rowSpan"],["type","checkbox","class","me-3",3,"ngModel","ngModelChange",4,"ngIf"],["class","border rounded w-img cursor-pointer","style","margin-left: 20px",3,"src","click",4,"ngIf","ngIfElse"],["elsePic",""],[1,"text-start",3,"rowSpan"],[1,"item-name","mb-0"],["type","checkbox",1,"me-3",3,"ngModel","ngModelChange"],[1,"border","rounded","w-img","cursor-pointer",2,"margin-left","20px",3,"src","click"],["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,"d-flex","align-items-center"],["title","Category",1,"fa-solid","fa-tags","me-2",2,"opacity","60%"],["type","checkbox",3,"ngModel","ngModelChange",4,"ngIf"],["matTooltip","This product is no longer available in POS","matTooltipPosition","above",1,"text-danger"],["title","Allocated"],["title","Inventory below minimum inventory"],[1,"ms-2","pb-1"],["target","_blank",3,"href"],[1,"fas","fa-lg","fa-external-link-alt","external-link-custom"],[1,"text-end",3,"ngClass"],[1,"cursor",3,"click"],[1,"text-end"],["EMPTY_RESERVED",""],[1,"text-danger"],["matTooltipShowDelay","500",3,"matTooltip"],[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(n,a){n&1&&(u(0,Rt,72,41,"mainpanel",0),f(1,"async")),n&2&&c("ngIf",S(1,1,a.loader$))},dependencies:[de,_e,$,K,Z,ge,J,Y,xe,fe,De,ee,W,U,j,ue,Ve],styles:[".w-10[_ngcontent-%COMP%]{width:10%}.w-img[_ngcontent-%COMP%]{width:40px;height:40px}.item-name[_ngcontent-%COMP%]{margin-bottom:-14px!important;font-size:larger}input[type=checkbox][_ngcontent-%COMP%]{width:15px;height:15px}"]});let i=o;return i})();var Bt=[{path:"",component:Pe,children:[{path:"",redirectTo:"bychannel",pathMatch:"full"},{path:"pos",component:Fe,canActivate:[se],data:{title:"Inventory Comparison"}},{path:"bychannel",component:ke,canActivate:[se],data:{title:"Inventory Comparison"}}]}],Ne=(()=>{let o=class o{};o.\u0275fac=function(n){return new(n||o)},o.\u0275mod=O({type:o}),o.\u0275inj=B({imports:[z,G.forChild(Bt)]});let i=o;return i})();var Fn=(()=>{let o=class o{};o.\u0275fac=function(n){return new(n||o)},o.\u0275mod=O({type:o}),o.\u0275inj=B({providers:[oe],imports:[z,Ne,G,Ie,Ce,Se,Ee,ye,ae,ve]});let i=o;return i})();export{Fn as InventoryModule};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as fe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-WIPT5BVZ.js";import{b as de,e as pe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-MG7FPXZX.js";import{c as ge,d as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-NE4U3Z2F.js";import{A as k,q as j,s as x,t as O,z as D}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-W5LP6HWA.js";import{b as me,h as F,k as U,u as he}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-IANWTXDM.js";import{b as m,c as B}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-QYP6WXYL.js";import{$ as ne,$a as C,B as Z,Cb as q,Db as J,Fa as s,Ga as f,H as ee,Ja as H,K as te,Lb as N,Na as G,Oa as c,Pa as oe,T as W,Ua as u,V as P,Xb as re,Za as l,Zb as v,_a as r,_b as A,aa as ie,ab as I,bb as M,c as w,ca as K,db as Y,ea as _,ec as se,fa as ae,fc as ce,hb as g,ja as V,jb as h,ka as $,n as Q,ob as L,pb as d,q as X,qb as y,rb as T,wb as le,za as S}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";var b=function(i){return i.Tokopedia="https://seller.tokopedia.com",i.Shoope="https://seller.shopee.co.id",i.Tiktok="https://seller-id.tiktok.com",i.WooCommerce="https://woocommerce.dealpos.app",i.Lazada="https://sellercenter.lazada.co.id",i}(b||{});function Me(i,n){if(i&1&&(I(0),l(1,"tr")(2,"td",11),d(3),r(),l(4,"td",11),d(5),r(),l(6,"td",12)(7,"p",13),d(8,"Product Not in Channel!"),r()()(),M()),i&2){let a=h().$implicit;s(3),T(" ",a==null?null:a.Model,""),s(2),T(" ",a==null?null:a.Code,"")}}function Te(i,n){if(i&1&&(l(0,"td",11),d(1),r()),i&2){let a=h(3).$implicit;G("rowspan",a.Channel.length),s(1),T(" ",a==null?null:a.Model,"")}}function ve(i,n){if(i&1&&(l(0,"td",11),d(1),r()),i&2){let a=h(3).$implicit;G("rowspan",a.Channel.length),s(1),T(" ",a==null?null:a.Code,"")}}var xe=i=>({"is-disabled":i});function Oe(i,n){if(i&1&&(l(0,"tr"),u(1,Te,2,2,"td",14)(2,ve,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),C(6,"img",17),r(),l(7,"div",18),d(8),r()()(),l(9,"td",11),d(10),q(11,"number"),r(),l(12,"td",19),d(13),q(14,"number"),r(),l(15,"td",19)(16,"a",20),C(17,"i",21),l(18,"span",22),d(19,"Edit"),r()()()()),i&2){let a=n.$implicit,t=n.index,e=h(3);s(1),c("ngIf",t==0),s(1),c("ngIf",t==0),s(3),c("href",a.Url,S)("title",a.Title),s(1),c("src",e.getChannelLogo(a.TypeID),S),s(1),c("matTooltip",(a==null||a.Name==null?null:a.Name.length)>55?a==null?null:a.Name:""),s(1),T(" ",a.Name," "),s(2),y(J(11,12,a.Price)),s(3),y(J(14,14,a.Inventory)),s(3),c("href",e.getHyperlinkSellerCenter(a),S)("ngClass",le(16,xe,a.TypeID==e.channelType.KalCare))("matTooltip",a.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function De(i,n){if(i&1&&u(0,Oe,20,18,"tr",8),i&2){let a=h().$implicit;c("ngForOf",a==null?null:a.Channel)}}function ke(i,n){if(i&1&&(I(0),u(1,Me,9,2,"ng-container",9)(2,De,1,1,"ng-template",null,10,N),M()),i&2){let a=n.$implicit,t=L(3);s(1),c("ngIf",!a.Channel||a.Channel.length<1)("ngIfElse",t)}}var Re=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=m,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new D,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return B.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case m.ShopeeV2:e=`${b.Shoope}/portal/product/${t.ChannelItemID}`;break;case m.Tiktok:e=`${b.Tiktok}/product/edit/${t.ChannelItemID}`;break;case m.Tokopedia:e=`${b.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case m.WooCommerce:e=`${b.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case m.Lazada:e=`${b.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=_({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[[3,"config","onCancel"],["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"],["printChannelModal",""],[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&&(l(0,"modal-material",0),g("onCancel",function(){return o.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),d(6," VARIANT "),l(7,"sup"),C(8,"i",5),r()(),l(9,"th",4),d(10,"SKU"),r(),l(11,"th",4),d(12," PRODUCT "),l(13,"sup"),C(14,"i",6),r()(),l(15,"th",4),d(16,"PRICE"),r(),l(17,"th",7),d(18,"INVENTORY"),r(),C(19,"th",4),r()(),l(20,"tbody"),u(21,ke,4,2,"ng-container",8),r()()()()),e&2&&(c("config",o.modalConfig),s(21),c("ngForOf",o.variants))},dependencies:[re,v,A,j,k,se],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 i=n;return i})();var R=class{constructor(){this._input$=new w,this._destroy$=new w,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(ee(200),te(),X(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),Z(n=>n!==void 0),P(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let a=-1,t;return this._data.filter(o=>(t=JSON.stringify(o).toLowerCase(),a=t.indexOf(n),a!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,a){if(B.IsNotEmpty(n)){let t=this._data.filter(e=>e[a].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,a=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(a)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var be=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new R,this.selectedChange=new H,this.selectedLabel=new H}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=_({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo","clear","scrollToEnd","change"]],template:function(e,o){e&1&&(l(0,"ng-select",0),g("clear",function(){return o.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return o.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(E){return o.onSelectChange(E)}),r()),e&2&&(oe("width",o.width),c("disabled",o.disabled)("virtualScroll",!0)("typeahead",o.ngSelectInfiniteScroll.input$)("items",o.ngSelectInfiniteScroll.bufferData)("bindLabel",o.bindLabel)("bindValue",o.bindValue)("placeholder",o.placeholder)("ngModel",o.selected)("clearable",o.clearable)("appendTo",o.parent))},dependencies:[ge,F,U]});let i=n;return i})(),ot=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=ae({type:n}),n.\u0275inj=ie({imports:[ce,ue,he]});let i=n;return i})();var Se=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(W(o=>o!=null?Q(o):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let o={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",o).pipe(W(p=>this.LocalData.saveCategoriesByChannelType(p,t)))}};n.\u0275fac=function(e){return new(e||n)(K(fe),K(pe))},n.\u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})();function Ve(i,n){if(i&1){let a=Y();I(0),l(1,"ng-select-infinite",16),g("selectedChange",function(e){V(a);let o=h().index,p=h();return $(p.onSelectCategory(e,o))}),r(),M()}if(i&2){let a=h().$implicit;s(1),c("items",a.Categories)("clearable",!1)}}function $e(i,n){if(i&1&&(l(0,"div",17),C(1,"input",18),r()),i&2){let a=h().$implicit,t=h();c("matTooltip",t.channelType.WooCommerce==a.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(1),c("placeholder",t.getChannelCategory(a.TypeID))}}function Le(i,n){if(i&1){let a=Y();I(0),l(1,"tr")(2,"td",9)(3,"input",10),g("ngModelChange",function(e){let p=V(a).$implicit;return $(p.Selected=e)})("ngModelChange",function(){V(a);let e=h();return $(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",11),C(6,"img",12),l(7,"span",13),d(8),r()()(),l(9,"td"),u(10,Ve,2,2,"ng-container",14)(11,$e,2,2,"ng-template",null,15,N),r()(),M()}if(i&2){let a=n.$implicit,t=L(12);s(3),c("ngModel",a.Selected),s(3),c("src",a.Img,S),s(2),y(a.Name),s(2),c("ngIf",a.Categories.length>0)("ngIfElse",t)}}var ft=(()=>{let n=class n{constructor(t,e,o,p){this.data=t,this.channelService=e,this.dialogRef=o,this.toastrService=p,this.channelOptions=[],this.uploadResponse=[],this.channelType=m,this.enableBtnOk=!1,this.destroy$=new w,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new D,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(P(this.destroy$)).subscribe(o=>{this.setCategoriesChannelOption(e.channelType,o)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(o=>(o.TypeID==t&&(o.Categories=e),o))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case m.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,o,p)=>p.findIndex(E=>e.channelType==E.channelType)==o).filter(e=>e.channelType==m.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==m.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case m.ShopeeV2:e="Aksesoris Fashion";break;case m.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case m.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case m.Lazada:e="Fashion Accessories / Women Accessories / Others";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(f(O),f(Se),f(x),f(de))},n.\u0275cmp=_({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModel","ngModelChange"],[1,"d-flex","align-items-center"],["alt","",1,"channel-logo-size",3,"src"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["EMPTY",""],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"items","clearable","selectedChange"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,o){e&1&&(l(0,"modal-material",0),g("onOk",function(){return o.onSave()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),l(1,"div",1)(2,"table",2)(3,"thead")(4,"tr")(5,"th",3)(6,"input",4),g("change",function(E){return o.onSelectAllChannel(E.target.checked)}),r()(),l(7,"th",5)(8,"span",6),d(9,"CHANNEL"),r()(),l(10,"th",7)(11,"span",6),d(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,Le,13,5,"ng-container",8),r()()()()),e&2&&(c("dynamicValidated",o.enableBtnOk)("config",o.modalConfig),s(14),c("ngForOf",o.channelOptions))},dependencies:[v,A,me,F,U,j,k,be],styles:[`input[type=checkbox]{width:15px;height:15px}img.channel-logo-size{width:24px;height:24px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
|
|
1
|
+
import{d as fe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2T3C7JV2.js";import{b as de,e as pe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-PYALJMBO.js";import{c as ge,d as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-EAABO2EV.js";import{A as k,q as j,s as x,t as O,z as D}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5GBQIVIY.js";import{b as me,h as F,k as U,u as he}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TWKTPY5E.js";import{b as m,c as B}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2XBPNKZX.js";import{$ as ne,$a as C,B as Z,Cb as q,Db as J,Fa as s,Ga as f,H as ee,Ja as H,K as te,Lb as N,Na as G,Oa as c,Pa as oe,T as W,Ua as u,V as P,Xb as re,Za as l,Zb as v,_a as r,_b as A,aa as ie,ab as I,bb as M,c as w,ca as K,db as Y,ea as _,ec as se,fa as ae,fc as ce,hb as g,ja as V,jb as h,ka as $,n as Q,ob as L,pb as d,q as X,qb as y,rb as T,wb as le,za as S}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";var b=function(i){return i.Tokopedia="https://seller.tokopedia.com",i.Shoope="https://seller.shopee.co.id",i.Tiktok="https://seller-id.tiktok.com",i.WooCommerce="https://woocommerce.dealpos.app",i.Lazada="https://sellercenter.lazada.co.id",i}(b||{});function Me(i,n){if(i&1&&(I(0),l(1,"tr")(2,"td",11),d(3),r(),l(4,"td",11),d(5),r(),l(6,"td",12)(7,"p",13),d(8,"Product Not in Channel!"),r()()(),M()),i&2){let a=h().$implicit;s(3),T(" ",a==null?null:a.Model,""),s(2),T(" ",a==null?null:a.Code,"")}}function Te(i,n){if(i&1&&(l(0,"td",11),d(1),r()),i&2){let a=h(3).$implicit;G("rowspan",a.Channel.length),s(1),T(" ",a==null?null:a.Model,"")}}function ve(i,n){if(i&1&&(l(0,"td",11),d(1),r()),i&2){let a=h(3).$implicit;G("rowspan",a.Channel.length),s(1),T(" ",a==null?null:a.Code,"")}}var xe=i=>({"is-disabled":i});function Oe(i,n){if(i&1&&(l(0,"tr"),u(1,Te,2,2,"td",14)(2,ve,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),C(6,"img",17),r(),l(7,"div",18),d(8),r()()(),l(9,"td",11),d(10),q(11,"number"),r(),l(12,"td",19),d(13),q(14,"number"),r(),l(15,"td",19)(16,"a",20),C(17,"i",21),l(18,"span",22),d(19,"Edit"),r()()()()),i&2){let a=n.$implicit,t=n.index,e=h(3);s(1),c("ngIf",t==0),s(1),c("ngIf",t==0),s(3),c("href",a.Url,S)("title",a.Title),s(1),c("src",e.getChannelLogo(a.TypeID),S),s(1),c("matTooltip",(a==null||a.Name==null?null:a.Name.length)>55?a==null?null:a.Name:""),s(1),T(" ",a.Name," "),s(2),y(J(11,12,a.Price)),s(3),y(J(14,14,a.Inventory)),s(3),c("href",e.getHyperlinkSellerCenter(a),S)("ngClass",le(16,xe,a.TypeID==e.channelType.KalCare))("matTooltip",a.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function De(i,n){if(i&1&&u(0,Oe,20,18,"tr",8),i&2){let a=h().$implicit;c("ngForOf",a==null?null:a.Channel)}}function ke(i,n){if(i&1&&(I(0),u(1,Me,9,2,"ng-container",9)(2,De,1,1,"ng-template",null,10,N),M()),i&2){let a=n.$implicit,t=L(3);s(1),c("ngIf",!a.Channel||a.Channel.length<1)("ngIfElse",t)}}var Re=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=m,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new D,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return B.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case m.ShopeeV2:e=`${b.Shoope}/portal/product/${t.ChannelItemID}`;break;case m.Tiktok:e=`${b.Tiktok}/product/edit/${t.ChannelItemID}`;break;case m.Tokopedia:e=`${b.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case m.WooCommerce:e=`${b.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case m.Lazada:e=`${b.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=_({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[[3,"config","onCancel"],["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"],["printChannelModal",""],[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&&(l(0,"modal-material",0),g("onCancel",function(){return o.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),d(6," VARIANT "),l(7,"sup"),C(8,"i",5),r()(),l(9,"th",4),d(10,"SKU"),r(),l(11,"th",4),d(12," PRODUCT "),l(13,"sup"),C(14,"i",6),r()(),l(15,"th",4),d(16,"PRICE"),r(),l(17,"th",7),d(18,"INVENTORY"),r(),C(19,"th",4),r()(),l(20,"tbody"),u(21,ke,4,2,"ng-container",8),r()()()()),e&2&&(c("config",o.modalConfig),s(21),c("ngForOf",o.variants))},dependencies:[re,v,A,j,k,se],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 i=n;return i})();var R=class{constructor(){this._input$=new w,this._destroy$=new w,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(ee(200),te(),X(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),Z(n=>n!==void 0),P(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let a=-1,t;return this._data.filter(o=>(t=JSON.stringify(o).toLowerCase(),a=t.indexOf(n),a!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,a){if(B.IsNotEmpty(n)){let t=this._data.filter(e=>e[a].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,a=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(a)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var be=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new R,this.selectedChange=new H,this.selectedLabel=new H}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=_({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo","clear","scrollToEnd","change"]],template:function(e,o){e&1&&(l(0,"ng-select",0),g("clear",function(){return o.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return o.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(E){return o.onSelectChange(E)}),r()),e&2&&(oe("width",o.width),c("disabled",o.disabled)("virtualScroll",!0)("typeahead",o.ngSelectInfiniteScroll.input$)("items",o.ngSelectInfiniteScroll.bufferData)("bindLabel",o.bindLabel)("bindValue",o.bindValue)("placeholder",o.placeholder)("ngModel",o.selected)("clearable",o.clearable)("appendTo",o.parent))},dependencies:[ge,F,U]});let i=n;return i})(),ot=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=ae({type:n}),n.\u0275inj=ie({imports:[ce,ue,he]});let i=n;return i})();var Se=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(W(o=>o!=null?Q(o):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let o={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",o).pipe(W(p=>this.LocalData.saveCategoriesByChannelType(p,t)))}};n.\u0275fac=function(e){return new(e||n)(K(fe),K(pe))},n.\u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})();function Ve(i,n){if(i&1){let a=Y();I(0),l(1,"ng-select-infinite",16),g("selectedChange",function(e){V(a);let o=h().index,p=h();return $(p.onSelectCategory(e,o))}),r(),M()}if(i&2){let a=h().$implicit;s(1),c("items",a.Categories)("clearable",!1)}}function $e(i,n){if(i&1&&(l(0,"div",17),C(1,"input",18),r()),i&2){let a=h().$implicit,t=h();c("matTooltip",t.channelType.WooCommerce==a.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(1),c("placeholder",t.getChannelCategory(a.TypeID))}}function Le(i,n){if(i&1){let a=Y();I(0),l(1,"tr")(2,"td",9)(3,"input",10),g("ngModelChange",function(e){let p=V(a).$implicit;return $(p.Selected=e)})("ngModelChange",function(){V(a);let e=h();return $(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",11),C(6,"img",12),l(7,"span",13),d(8),r()()(),l(9,"td"),u(10,Ve,2,2,"ng-container",14)(11,$e,2,2,"ng-template",null,15,N),r()(),M()}if(i&2){let a=n.$implicit,t=L(12);s(3),c("ngModel",a.Selected),s(3),c("src",a.Img,S),s(2),y(a.Name),s(2),c("ngIf",a.Categories.length>0)("ngIfElse",t)}}var ft=(()=>{let n=class n{constructor(t,e,o,p){this.data=t,this.channelService=e,this.dialogRef=o,this.toastrService=p,this.channelOptions=[],this.uploadResponse=[],this.channelType=m,this.enableBtnOk=!1,this.destroy$=new w,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new D,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(P(this.destroy$)).subscribe(o=>{this.setCategoriesChannelOption(e.channelType,o)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(o=>(o.TypeID==t&&(o.Categories=e),o))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case m.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,o,p)=>p.findIndex(E=>e.channelType==E.channelType)==o).filter(e=>e.channelType==m.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==m.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case m.ShopeeV2:e="Aksesoris Fashion";break;case m.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case m.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case m.Lazada:e="Fashion Accessories / Women Accessories / Others";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(f(O),f(Se),f(x),f(de))},n.\u0275cmp=_({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModel","ngModelChange"],[1,"d-flex","align-items-center"],["alt","",1,"channel-logo-size",3,"src"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["EMPTY",""],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"items","clearable","selectedChange"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,o){e&1&&(l(0,"modal-material",0),g("onOk",function(){return o.onSave()})("onClose",function(){return o.onClose()})("onCancel",function(){return o.onClose()}),l(1,"div",1)(2,"table",2)(3,"thead")(4,"tr")(5,"th",3)(6,"input",4),g("change",function(E){return o.onSelectAllChannel(E.target.checked)}),r()(),l(7,"th",5)(8,"span",6),d(9,"CHANNEL"),r()(),l(10,"th",7)(11,"span",6),d(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,Le,13,5,"ng-container",8),r()()()()),e&2&&(c("dynamicValidated",o.enableBtnOk)("config",o.modalConfig),s(14),c("ngForOf",o.channelOptions))},dependencies:[v,A,me,F,U,j,k,be],styles:[`input[type=checkbox]{width:15px;height:15px}img.channel-logo-size{width:24px;height:24px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
|
|
2
2
|
`],encapsulation:2});let i=n;return i})();function Ne(i,n){if(i&1&&(l(0,"tr")(1,"td"),d(2),r(),l(3,"td"),d(4),r()()),i&2){let a=n.$implicit;s(2),y(a==null?null:a.Name),s(2),y(a==null?null:a.ChannelVariationSKU)}}var _t=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new D,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}};n.\u0275fac=function(e){return new(e||n)(f(O),f(x))},n.\u0275cmp=_({type:n,selectors:[["app-modal-variants"]],decls:11,vars:2,consts:[[3,"config","onCancel"],["content",""],[1,"table"],[1,"thead-light"],[4,"ngFor","ngForOf"]],template:function(e,o){e&1&&(l(0,"modal-material",0),g("onCancel",function(){return o.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th"),d(6,"Variant"),r(),l(7,"th"),d(8,"SKU"),r()()(),l(9,"tbody"),u(10,Ne,5,2,"tr",4),r()()()()),e&2&&(c("config",o.modalConfig),s(10),c("ngForOf",o.data.variants))},dependencies:[v,k],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}"]});let i=n;return i})();export{Re as a,ot as b,ft as c,_t as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.
|
|
1
|
+
import{a as b}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-DXSLWAQX.js";import{a as h,b as P}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-DXK4LS22.js";import{a as C}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-C2JFVBCK.js";import{b as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-GLWEQ2ER.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-RZS2AMLW.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5J3KK3OL.js";import{c as M}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-SEWZHFIK.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-C2BQDUEV.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TEFJMIF6.js";import{d as s}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-EAABO2EV.js";import{a as p}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-GGNPOSPC.js";import{C as u,r as f}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5GBQIVIY.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-3RHXQKFB.js";import{u as g}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TWKTPY5E.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2XBPNKZX.js";import{$a as c,Hc as l,Lc as m,aa as e,ea as d,fa as r,fc as i}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-W3FHD4GW.js";var _=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275cmp=d({type:t,selectors:[["app-products"]],decls:1,vars:0,template:function(n,v){n&1&&c(0,"router-outlet")},dependencies:[l],styles:[".badge-pill[_ngcontent-%COMP%]{padding-bottom:16px!important}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background:#dfeffc;border:1px solid #dfeffc}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #ddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000;width:80px;text-align:center}.modal-dialog[_ngcontent-%COMP%]{max-width:30%!important}.product[_ngcontent-%COMP%]{height:100%!important}.row[_ngcontent-%COMP%]{margin-left:0;margin-right:0}ul[_ngcontent-%COMP%]{list-style-type:none}.link[_ngcontent-%COMP%]{color:#0202ab;cursor:pointer}.px-1[_ngcontent-%COMP%]{padding-left:5px!important}.sku[_ngcontent-%COMP%]{color:#696969;font-style:italic}.badge-pill[_ngcontent-%COMP%]{height:16px}.itemTitle[_ngcontent-%COMP%]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.no-title[_ngcontent-%COMP%]{margin-top:.33em;margin-bottom:.33rem}.mb-upload[_ngcontent-%COMP%]{padding-bottom:.625rem}.my-1rem[_ngcontent-%COMP%]{margin-bottom:1rem!important;margin-top:1rem!important}.pr-rem[_ngcontent-%COMP%]{padding-right:.6rem}.text-larger[_ngcontent-%COMP%]{font-size:larger}.bg-lightpink[_ngcontent-%COMP%]{background-color:#f9dede}.bottom-buttons[_ngcontent-%COMP%]{margin-left:97px}@media (min-width: 1200px){.max-w-xl[_ngcontent-%COMP%]{max-width:205px}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}"]});let o=t;return o})();var y=[{path:"",component:_,children:[{path:"",redirectTo:"status",pathMatch:"full"},{path:"status",loadChildren:()=>import("https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-GWVXLAM4.js").then(o=>o.StatusModule),canActivate:[p]},{path:"download",loadChildren:()=>import("https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-43GAJ6WD.js").then(o=>o.DownloadModule),canActivate:[p]}]}],w=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,m.forChild(y)]});let o=t;return o})();var W=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=r({type:t}),t.\u0275inj=e({imports:[i,g,m,w,f,u,s,O,C,M,h,P,b]});let o=t;return o})();export{W as ProductModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.
|
|
1
|
+
import{a as B}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-3FSLTDK2.js";import{a as dt}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-GURYDDY4.js";import{a as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-C2JFVBCK.js";import{e as lt}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2T3C7JV2.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-IJNIZXOB.js";import{e as et}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-PYALJMBO.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-N46PJUA5.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-JVPANFAL.js";import{a as mt,c as ct,d as pt}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-EAABO2EV.js";import{B as k,C as st}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-5GBQIVIY.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-3RHXQKFB.js";import{h as nt,k as ot,u as at}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-TWKTPY5E.js";import{c as rt}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-2XBPNKZX.js";import{$a as D,Cb as d,Db as _,Eb as S,Fa as m,Ga as v,Gc as it,Jc as R,Lb as Y,Lc as $,Oa as c,Q as j,T as z,Ua as u,V as q,Xb as Z,Za as r,Zb as tt,_a as o,_b as M,aa as I,ab as g,bb as h,bc as P,c as A,cc as w,db as G,ea as y,ec as L,fa as N,fc as F,hb as T,ja as b,jb as f,ka as E,mb as J,ob as K,pb as l,q as C,qb as s,rb as x,vb as Q,wb as W,xb as X,ya as U,za as H}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-FEDAZTKI.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.3/Marketplace/chunk-W3FHD4GW.js";function It(t,e){if(t&1&&(r(0,"span",12),D(1,"img",13),o(),l(2)),t&2){let n=e.item;m(1),c("src",n.logo,H),m(1),x(" ",n.Name," ")}}function yt(t,e){if(t&1&&(g(0),l(1),d(2,"number"),r(3,"span"),l(4,"s"),o(),h()),t&2){let n=f().$implicit;m(1),x(" ",S(2,1,n.DurationInSecond,"1.1-1")," ")}}function Nt(t,e){t&1&&l(0," - ")}var bt=(t,e)=>({"bg-gradient-danger":t,"bg-gradient-warning":e}),Et=()=>["/menu/notification/detail"],Dt=t=>({ID:t});function Tt(t,e){if(t&1&&(g(0),r(1,"tr",14)(2,"td")(3,"a",15),D(4,"img",16),r(5,"span"),l(6),o()()(),r(7,"td")(8,"b"),l(9),o(),D(10,"div",17),o(),r(11,"td"),u(12,yt,5,4,"ng-container",18)(13,Nt,1,0,"ng-template",null,19,Y),o(),r(15,"td"),l(16),o(),r(17,"td"),l(18),d(19,"date"),o()(),h()),t&2){let n=e.$implicit,a=K(14);m(1),c("ngClass",X(14,bt,n.Status==1,n.Status==0)),m(2),c("routerLink",Q(17,Et))("queryParams",W(18,Dt,n.ID)),m(1),J("src",n.Img,H),m(2),s(n.Name),m(3),s(n.Label),m(1),c("innerHTML",n.Message,U),m(2),c("ngIf",n.DurationInSecond)("ngIfElse",a),m(4),s(n.StatusLabel),m(2),s(S(19,11,n.Created,"dd MMM yyyy HH:mm"))}}function Mt(t,e){if(t&1){let n=G();g(0),r(1,"div",4)(2,"div",20)(3,"app-custom-paginator",21),T("total",function(){b(n);let i=f(2);return E(i.getRowCount())})("next",function(){b(n);let i=f(2);return E(i.onNextPage())})("previous",function(){b(n);let i=f(2);return E(i.onPreviousPage())}),d(4,"async"),d(5,"async"),o()()(),h()}if(t&2){let n=f().ngIf,a=f();m(3),c("filter",a.filter)("totaldata",n==null?null:n.length)("paginationTotal",_(4,4,a.rowCount$))("hasClicked",_(5,6,a.rowCount$))}}function Pt(t,e){if(t&1&&(g(0),u(1,Mt,6,8,"ng-container",11),h()),t&2){let n=e.ngIf;m(1),c("ngIf",n.length>0)}}var ft=(()=>{let e=class e{constructor(a,i,p){this.http=a,this.notificationService=i,this.authService=p,this.filter=new dt,this.destroy$=new A,this.channelOptions=p.getChannels()}ngOnInit(){this.notificationService.clearNotification(),this.initPageLoader(),this.subscribeNotification()}subscribeNotification(){this.notificationService.getNotification().pipe(q(this.destroy$)).subscribe(a=>{a.length>0&&(this.getNotifications(),this.notificationService.clearNotification())})}initPageLoader(){this.http.post("/api/notification/Load",{}).subscribe(a=>{this.filter=a.Filter,this.filter.PageSize=this.filter.RowCount,this.getNotifications()})}onFilter(){this.rowCount$=null,this.getNotifications()}getNotifications(){let a={ChannelID:this.filter.ChannelID,RowCount:this.filter.PageSize,PageNumber:this.filter.PageNumber};this.notifications$=this.http.post("/api/notification/Get",a).pipe(C(i=>i.Data),C(i=>(i=this.setChannelLogoToNotifications(i),i=this.setTimeToSecond(i),i)),j(1))}setTimeToSecond(a){return a=a.map(i=>(i.DurationInSecond=parseInt(i.Duration)/1e3,i)),a}setChannelLogoToNotifications(a){return a=a.map(i=>(i.Img=rt.getChannelLogoByTypeId(i.TypeID),i)),a}onNextPage(){this.filter.PageNumber+=1,this.getNotifications()}onPreviousPage(){this.filter.PageNumber-=1,this.getNotifications()}getRowCount(){let a={ChannelID:this.filter.ChannelID};this.rowCount$=this.http.post("/api/notification/RowCount",a).pipe(C(i=>i.Count),j(1))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};e.\u0275fac=function(i){return new(i||e)(v(et),v(B),v(lt))},e.\u0275cmp=y({type:e,selectors:[["app-notification"]],decls:30,vars:9,consts:[["headerTitle","Notification","hideSearchBox","true",3,"onSubmit"],["appendTo","body","bindLabel","Name","name","channelid","bindValue","ID","placeholder","Select Channel",1,"center-text","mt-2",3,"clearable","items","ngModel","ngModelChange"],["ng-option-tmp",""],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[4,"ngFor","ngForOf"],[4,"ngIf"],[1,"me-2"],["alt","",2,"width","18px",3,"src"],[3,"ngClass"],[3,"routerLink","queryParams"],["alt","",1,"channelLogo-md","me-4",3,"src"],[3,"innerHTML"],[4,"ngIf","ngIfElse"],["timeNotAvailable",""],[1,"col-12"],[3,"filter","totaldata","paginationTotal","hasClicked","total","next","previous"]],template:function(i,p){i&1&&(r(0,"mainpanel",0),T("onSubmit",function(){return p.onFilter()}),r(1,"filters")(2,"div")(3,"h6"),l(4,"Channel"),o(),r(5,"ng-select",1),T("ngModelChange",function(vt){return p.filter.ChannelID=vt}),u(6,It,3,2,"ng-template",2),o()()(),r(7,"content")(8,"div",3)(9,"div",4)(10,"div",5)(11,"div",6)(12,"table",7)(13,"thead",8)(14,"tr",9)(15,"th"),l(16,"Channel"),o(),r(17,"th"),l(18,"Process"),o(),r(19,"th"),l(20,"Duration"),o(),r(21,"th"),l(22,"Status"),o(),r(23,"th"),l(24,"Created"),o()()(),r(25,"tbody"),u(26,Tt,20,20,"ng-container",10),d(27,"async"),o()()()()(),u(28,Pt,2,1,"ng-container",11),d(29,"async"),o()()()),i&2&&(m(5),c("clearable",!0)("items",p.channelOptions)("ngModel",p.filter.ChannelID),m(21),c("ngForOf",_(27,5,p.notifications$)),m(2),c("ngIf",_(29,7,p.notifications$)))},dependencies:[Z,tt,M,ct,mt,nt,ot,k,R,O,P,L,w]});let t=e;return t})();function wt(t,e){if(t&1&&(r(0,"div",10)(1,"div",13)(2,"div",7)(3,"h5"),l(4,"Perflog"),o()(),r(5,"div",8)(6,"div",14)(7,"div",15)(8,"pre"),l(9),o()()()()()()),t&2){let n=f().ngIf;m(9),s(n.Perflog)}}function Lt(t,e){if(t&1&&(g(0),r(1,"div",17)(2,"div",13)(3,"div",7)(4,"h5"),l(5,"StackTrace"),o()(),r(6,"div",8)(7,"div",14)(8,"div",15)(9,"pre"),l(10),o()()()()()(),h()),t&2){let n=f().ngIf;m(10),s(n==null?null:n.StackTrace)}}function Ft(t,e){if(t&1&&(g(0),r(1,"mainpanel",1)(2,"actions")(3,"a",2),l(4,"Back"),o()(),r(5,"content")(6,"div",3)(7,"div",4)(8,"div",5)(9,"div",6)(10,"div",7)(11,"h5"),l(12,"General"),o()(),r(13,"div",8)(14,"div",9)(15,"div",10)(16,"div",11)(17,"label"),l(18,"Created Date"),o(),r(19,"div")(20,"span"),l(21),d(22,"date"),o()()()(),r(23,"div",10)(24,"div",11)(25,"label"),l(26,"Status"),o(),r(27,"div")(28,"span"),l(29),o()()()()(),r(30,"div",12)(31,"div",10)(32,"div",11)(33,"label"),l(34,"Duration"),o(),r(35,"div")(36,"span"),l(37),d(38,"number"),o()()()(),r(39,"div",10)(40,"div",11)(41,"label"),l(42,"Label"),o(),r(43,"div")(44,"span"),l(45),o()()()()()()()()(),r(46,"div",4)(47,"div",10)(48,"div",13)(49,"div",7)(50,"h5"),l(51,"Message"),o()(),r(52,"div",8)(53,"div",14)(54,"div",15)(55,"pre"),l(56),o()()()()()(),u(57,wt,10,1,"div",16)(58,Lt,11,1,"ng-container",0),o()()()(),h()),t&2){let n=e.ngIf;m(1),c("headerTitle","Notification "+n.Name)("hideSearchBox",!0)("hideSearchDropdown",!0),m(20),s(S(22,10,n.Created,"dd MMM yyyy HH:mm:ss")),m(8),s(n.StatusLabel),m(8),x("",S(38,13,n.DurationInSecond,"1.1-1")," s"),m(8),s(n.Label),m(11),s(n.Message),m(1),c("ngIf",n==null?null:n.Perflog),m(1),c("ngIf",n==null?null:n.StackTrace)}}var ut=(()=>{let e=class e{constructor(a,i){this.activatedRoute=a,this.notificationService=i}ngOnInit(){this.notification$=this.activatedRoute.queryParams.pipe(z(a=>{let i=a.ID;return this.notificationService.getNotificationDetail(i).pipe(C(p=>(p.DurationInSecond=parseInt(p.Duration)/1e3,p)))}))}};e.\u0275fac=function(i){return new(i||e)(v(it),v(B))},e.\u0275cmp=y({type:e,selectors:[["app-detail"]],decls:2,vars:3,consts:[[4,"ngIf"],[3,"headerTitle","hideSearchBox","hideSearchDropdown"],["role","button","routerLink","/menu/notification",1,"btn","btn-secondary","btn-fill","btn-lg","me-3"],[1,"container-fluid","mt-8"],[1,"row"],[1,"col-12"],[1,"card","mb-8"],[1,"card-header"],[1,"card-body"],[1,"row","mt-6"],[1,"col-sm-6"],[1,"info-label-group"],[1,"row","mt-4"],[1,"card"],[1,"col-sm-12","mt-2"],[1,"form-group"],["class","col-sm-6",4,"ngIf"],[1,"col-sm-12"]],template:function(i,p){i&1&&(u(0,Ft,59,16,"ng-container",0),d(1,"async")),i&2&&c("ngIf",_(1,1,p.notification$))},dependencies:[M,k,R,P,L,w]});let t=e;return t})();var Rt=[{path:"",component:ft},{path:"detail",component:ut}],gt=(()=>{let e=class e{};e.\u0275fac=function(i){return new(i||e)},e.\u0275mod=N({type:e}),e.\u0275inj=I({imports:[F,$.forChild(Rt)]});let t=e;return t})();var me=(()=>{let e=class e{};e.\u0275fac=function(i){return new(i||e)},e.\u0275mod=N({type:e}),e.\u0275inj=I({imports:[F,gt,pt,at,st,$,O]});let t=e;return t})();export{me as NotificationModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={production:!0,version:"3.7.
|
|
1
|
+
var e={production:!0,version:"3.7.3",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"}};export{e as a};
|