marketplacepos 2.9.3 → 2.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Marketplace/213.73aa99e3f8dc5caa.js +1 -0
- package/Marketplace/{369.a12060880985ee8f.js → 369.881799be1b0c0cd7.js} +1 -1
- package/Marketplace/397.13ff3d72465810f8.js +1 -0
- package/Marketplace/767.eca7237ccb50aa86.js +1 -0
- package/Marketplace/835.6cfe266f3c9b5cc9.js +1 -0
- package/Marketplace/index.html +3 -2
- package/Marketplace/{main.6966bb7fcafbe0e4.js → main.4874ea507cbcab3a.js} +1 -1
- package/Marketplace/runtime.357a02c3b18dd5e6.js +1 -0
- package/package.json +1 -1
- package/Marketplace/213.d00d0a3f05c831f7.js +0 -1
- package/Marketplace/378.7f743ac9660ec6e6.js +0 -1
- package/Marketplace/397.8ba047b91801962d.js +0 -1
- package/Marketplace/767.d939ac65d1cb16fb.js +0 -1
- package/Marketplace/runtime.5db60124bb5bf7cb.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e,h={},v={};function r(e){var n=v[e];if(void 0!==n)return n.exports;var t=v[e]={id:e,loaded:!1,exports:{}};return h[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=h,e=[],r.O=(n,t,f,d)=>{if(!t){var a=1/0;for(c=0;c<e.length;c++){for(var[t,f,d]=e[c],b=!0,o=0;o<t.length;o++)(!1&d||a>=d)&&Object.keys(r.O).every(u=>r.O[u](t[o]))?t.splice(o--,1):(b=!1,d<a&&(a=d));if(b){e.splice(c--,1);var s=f();void 0!==s&&(n=s)}}return n}d=d||0;for(var c=e.length;c>0&&e[c-1][2]>d;c--)e[c]=e[c-1];e[c]=[t,f,d]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},(()=>{var n,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;r.t=function(t,f){if(1&f&&(t=this(t)),8&f||"object"==typeof t&&t&&(4&f&&t.__esModule||16&f&&"function"==typeof t.then))return t;var d=Object.create(null);r.r(d);var c={};n=n||[null,e({}),e([]),e(e)];for(var a=2&f&&t;"object"==typeof a&&!~n.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(b=>c[b]=()=>t[b]);return c.default=()=>t,r.d(d,c),d}})(),r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>(592===e?"common":e)+"."+{46:"40ebac81bd0fb91b",53:"3655b31ecb37ade9",213:"73aa99e3f8dc5caa",277:"e644e3531765ce65",360:"8279e3b4ceab63e1",369:"881799be1b0c0cd7",379:"aad8784dbdb3dd33",392:"f4537160149f627a",395:"2943aa5a44308399",397:"13ff3d72465810f8",425:"03f8f97da7452806",455:"c9dd08adf08a1b65",481:"64ffd74d20798f93",501:"7645c32a140dd7f8",512:"52dc49022c04fa43",533:"cc5ab7f3ce13770c",545:"4809f373cc63f3b4",592:"af67cc08f47a8d44",655:"ae475c8285604367",717:"5d253da5bb63552f",739:"0de1f18deac0ed90",767:"eca7237ccb50aa86",835:"6cfe266f3c9b5cc9",859:"3a4d26983bbb5254",874:"5b06431d2b5a1e8f",913:"ec8155bc121fb0a6",993:"5c22ca4b00b8c459",997:"1e5281aa64540dee"}[e]+".js",r.miniCssF=e=>{},r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="pos-marketplace:";r.l=(t,f,d,c)=>{if(e[t])e[t].push(f);else{var a,b;if(void 0!==d)for(var o=document.getElementsByTagName("script"),s=0;s<o.length;s++){var i=o[s];if(i.getAttribute("src")==t||i.getAttribute("data-webpack")==n+d){a=i;break}}a||(b=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+d),a.src=r.tu(t)),e[t]=[f];var p=(g,u)=>{a.onerror=a.onload=null,clearTimeout(l);var _=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),_&&_.forEach(y=>y(u)),g)return g(u)},l=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),b&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="https://cdn.jsdelivr.net/npm/marketplacepos@2.9.4/Marketplace/",(()=>{var e={666:0};r.f.j=(f,d)=>{var c=r.o(e,f)?e[f]:void 0;if(0!==c)if(c)d.push(c[2]);else if(666!=f){var a=new Promise((i,p)=>c=e[f]=[i,p]);d.push(c[2]=a);var b=r.p+r.u(f),o=new Error;r.l(b,i=>{if(r.o(e,f)&&(0!==(c=e[f])&&(e[f]=void 0),c)){var p=i&&("load"===i.type?"missing":i.type),l=i&&i.target&&i.target.src;o.message="Loading chunk "+f+" failed.\n("+p+": "+l+")",o.name="ChunkLoadError",o.type=p,o.request=l,c[1](o)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,d)=>{var o,s,[c,a,b]=d,i=0;if(c.some(l=>0!==e[l])){for(o in a)r.o(a,o)&&(r.m[o]=a[o]);if(b)var p=b(r)}for(f&&f(d);i<c.length;i++)r.o(e,s=c[i])&&e[s]&&e[s][0](),e[s]=0;return r.O(p)},t=self.webpackChunkpos_marketplace=self.webpackChunkpos_marketplace||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"marketplacepos","version":"2.9.
|
|
1
|
+
{"name":"marketplacepos","version":"2.9.4"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkpos_marketplace=self.webpackChunkpos_marketplace||[]).push([[213],{8231:(A,M,i)=>{i.d(M,{j:()=>C});var f=i(5412),g=i(1889),c=i(9694),_=i(6779),t=i(4650),I=i(284),v=i(6895),m=i(4006),D=i(1948),e=i(9549),n=i(4385),a=i(3238),o=i(266),r=i(6401);function d(h,s){if(1&h&&(t.TgZ(0,"mat-option",9)(1,"div",10),t._UZ(2,"img",11),t.TgZ(3,"span"),t._uU(4),t.qZA()()()),2&h){const l=s.$implicit;t.Q6J("value",l.ID)("disabled",l.disabled),t.xp6(1),t.Q6J("matTooltip",l.disabled?"Single Product Scan disabled for this type of Channel":null),t.xp6(1),t.Q6J("src",l.Img,t.LSH),t.xp6(2),t.Oqu(l.Name)}}function T(h,s){if(1&h){const l=t.EpF();t.TgZ(0,"div")(1,"h5",12),t._uU(2,"Scan Type"),t.qZA(),t.TgZ(3,"mat-radio-group",13),t.NdJ("ngModelChange",function(p){t.CHM(l);const S=t.oxw();return t.KtG(S.filter.ScanFull=p)}),t.TgZ(4,"mat-radio-button",14),t._uU(5," Full (Include Inactive Products) "),t.qZA(),t.TgZ(6,"mat-radio-button",15),t._uU(7," Active "),t.qZA()()()}if(2&h){const l=t.oxw();t.xp6(3),t.Q6J("ngModel",l.filter.ScanFull),t.xp6(1),t.Q6J("value",!0),t.xp6(2),t.Q6J("value",!1)}}function E(h,s){if(1&h){const l=t.EpF();t.TgZ(0,"div",16)(1,"h5",3),t._uU(2),t.ALo(3,"date"),t.qZA(),t.TgZ(4,"mat-radio-group",17),t.NdJ("ngModelChange",function(p){t.CHM(l);const S=t.oxw();return t.KtG(S.filter.UpdatedProduct=p)}),t.TgZ(5,"mat-radio-button",18),t._uU(6," Scan All Products "),t.qZA(),t.TgZ(7,"mat-radio-button",19),t._uU(8," Scan Updated Products "),t.qZA()()()}if(2&h){const l=t.oxw();t.xp6(2),t.hij(" Last Scan: ",t.xi3(3,4,l.selectedChannel.LastSync,"dd MMMM yyyy HH:mm")," "),t.xp6(2),t.Q6J("ngModel",l.filter.UpdatedProduct),t.xp6(1),t.Q6J("value",!1),t.xp6(2),t.Q6J("value",!0)}}function U(h,s){if(1&h){const l=t.EpF();t.TgZ(0,"div",16)(1,"h5",3),t._uU(2," Scan Option "),t.qZA(),t.TgZ(3,"mat-radio-group",20),t.NdJ("ngModelChange",function(p){t.CHM(l);const S=t.oxw();return t.KtG(S.filter.Async=p)}),t.TgZ(4,"mat-radio-button",21),t._uU(5," Asynchronous (Get Notified when Complete) "),t.qZA(),t.TgZ(6,"mat-radio-button",22),t._uU(7," Synchronous (Wait until Complete) "),t.qZA()()()}if(2&h){const l=t.oxw();t.xp6(3),t.Q6J("ngModel",l.filter.Async),t.xp6(1),t.Q6J("value",!0),t.xp6(2),t.Q6J("value",!1)}}class C{constructor(s,l,u){this.dialogRef=s,this.data=l,this.router=u,this.channelType=c.x,this.disabledChannelOption=!1,this.filter={ChannelID:g.g.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=!!g.g.IsNotEmpty(l.isSingleChannel)&&this.data.isSingleChannel,this.disabledChannelOption=!g.g.IsEmpty(l.disabledChannelOption)&&this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new _.O,this.modalConfig.title="Scan Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1,1==this.channelOptions.length&&(this.filter.ChannelID=this.data.channelOptions[0].ID,this.selectedChannel=this.data.channelOptions[0])}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(s=>(s.disabled=!0,(s.TypeID==c.x.Tiktok||s.TypeID==c.x.Tokopedia||s.TypeID==c.x.Lazada)&&(s.disabled=!1),s)).sort(s=>s.disabled?1:-1))}onSelectChannel(s){let l=this.filterChannelById(s);this.selectedChannel=1==this.channelOptions.length?this.channelOptions[0]:l,this.filter.Async=!0,l&&l.TypeID==c.x.Tokopedia?(this.filter.ScanFull=!0,this.isTokopedia=!0):(this.filter.ScanFull=!1,this.isTokopedia=!1),this.iniHasScanUpdate(),this.setDefaultConfigUpdate()}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&g.g.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==c.x.ShopeeV2||this.selectedChannel.TypeID==c.x.Tiktok||this.selectedChannel.TypeID==c.x.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.hasScanUpdate=!(this.selectedChannel?.TypeID==c.x.WooCommerce||this.selectedChannel?.TypeID==c.x.KalCare||this.selectedChannel?.TypeID==c.x.None||!g.g.IsNotEmpty(this.selectedChannel?.LastSync)||this.isSingleChannel)}filterChannelById(s){let l;return this.channelOptions&&(l=this.channelOptions.find(u=>u.ID==s)),l}submit(){this.selectedChannel.TypeID==c.x.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):(this.beforeSubmit(),this.dialogRef.close(this.filter))}beforeSubmit(){this.filter.UpdatedProduct&&(this.filter.Async=!1)}isNotEmpty(s){return g.g.IsNotEmpty(s)}onClose(){this.dialogRef.close()}}C.\u0275fac=function(s){return new(s||C)(t.Y36(f.so),t.Y36(f.WI),t.Y36(I.F0))},C.\u0275cmp=t.Xpm({type:C,selectors:[["app-scan-dialog"]],decls:11,vars:8,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"mx-4"],[1,"mb-3","fw-normal"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"disabled","ngModel","ngModelChange"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],[4,"ngIf"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mb-3","fw-normal","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"mt-8"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan only products that have been updated since the last channel scan",1,"me-5",3,"value"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(s,l){1&s&&(t.TgZ(0,"modal-material",0),t.NdJ("onOk",function(){return l.submit()})("onClose",function(){return l.onClose()})("onCancel",function(){return l.onClose()}),t.TgZ(1,"div",1)(2,"div",2)(3,"h5",3),t._uU(4,"Select a Channel"),t.qZA(),t.TgZ(5,"mat-form-field",4)(6,"mat-select",5),t.NdJ("ngModelChange",function(p){return l.filter.ChannelID=p})("ngModelChange",function(p){return l.onSelectChannel(p)}),t.YNc(7,d,5,5,"mat-option",6),t.qZA()(),t.YNc(8,T,8,3,"div",7),t.YNc(9,E,9,7,"div",8),t.YNc(10,U,8,3,"div",8),t.qZA()()()),2&s&&(t.Q6J("dynamicValidated",l.isNotEmpty(l.filter.ChannelID))("config",l.modalConfig),t.xp6(6),t.Q6J("disabled",l.disabledChannelOption)("ngModel",l.filter.ChannelID),t.xp6(1),t.Q6J("ngForOf",l.channelOptions),t.xp6(1),t.Q6J("ngIf",!l.isSingleChannel&&!l.isTokopedia&&l.isNotEmpty(l.filter.ChannelID)),t.xp6(1),t.Q6J("ngIf",l.hasScanUpdate),t.xp6(1),t.Q6J("ngIf",!(null!=l.filter&&l.filter.UpdatedProduct)&&!l.isSingleChannel&&l.isNotEmpty(l.filter.ChannelID)))},dependencies:[v.sg,v.O5,m.JJ,m.On,D.VQ,D.U0,e.KE,n.gD,a.ey,o.gM,r.M,v.uU],encapsulation:2})},9425:(A,M,i)=>{i.d(M,{b:()=>C});var f=i(1135),g=i(7579),c=i(2722),_=i(9300),t=i(4351),I=i(4004),v=i(4482),m=i(5403),D=i(8421),e=i(4671),n=i(5032),a=i(3269),r=i(5026),d=i(8505),T=i(4782),E=i(4650),U=i(1318);class C{constructor(s){this.http=s,this.pagination$=new f.X(null),this.destroy$=new g.x,this.data$=this.paginationFunction()}onNextPage(s){s.PageNumber+=1,this.pagination$.next(s)}setPageNumberFooter(s){this.footerPageNumber=s.PageNumber}setPaginationButtonState(s,l){this.disableNextButton=0==l||!(l<s.RowCount*s.PageNumber)}resetToFirstPage(s){s.PageNumber=1,this.pagination$.next(s),this.hideCount=!0,this.goToLastPage=!1}getAllData(s,l){s.RowCount=l,this.pagination$.next(s),this.goToLastPage=!0}destroy(){this.destroy$.next(!0),this.destroy$.complete(),this.pagination$=null,this.pagination$=new f.X(null),this.data$=this.paginationFunction()}paginationFunction(){return this.pagination$.pipe((0,c.R)(this.destroy$),(0,_.h)(s=>null!=s),(0,t.b)(s=>this.http.post(`/API/${this.fetchDataEndpoint}`,JSON.stringify(s)).pipe((0,I.U)(l=>l.Data))),function o(...h){const s=(0,a.jO)(h);return(0,v.e)((l,u)=>{const p=h.length,S=new Array(p);let y=h.map(()=>!1),N=!1;for(let P=0;P<p;P++)(0,D.Xf)(h[P]).subscribe((0,m.x)(u,O=>{S[P]=O,!N&&!y[P]&&(y[P]=!0,(N=y.every(e.y))&&(y=null))},n.Z));l.subscribe((0,m.x)(u,P=>{if(N){const O=[P,...S];u.next(s?s(...O):O)}}))})}(this.pagination$),(0,r.R)((s,l)=>{const[u,p]=s,[S]=l;return 1==p.PageNumber?[S,p]:[u.concat(S),p]}),(0,d.b)(([s,l])=>{this.setPageNumberFooter(l),this.setPaginationButtonState(l,s.length)}),(0,I.U)(([s])=>s),(0,T.d)())}}C.\u0275fac=function(s){return new(s||C)(E.LFG(U.O))},C.\u0275prov=E.Yz7({token:C,factory:C.\u0275fac,providedIn:"root"})},6082:(A,M,i)=>{i.d(M,{M:()=>m});var f=i(8505),g=i(262),c=i(2843),_=i(1889),t=i(4650),I=i(1318),v=i(7185);class m{constructor(e,n){this.httpService=e,this.toastrService=n}loader(e=_.g.GuidEMpty){return this.httpService.post("/api/product/Load",{ID:e})}LoadInPOS(e=_.g.GuidEMpty){return this.httpService.post("/api/product/LoadInPOS",{ID:e})}filterChannelByTypeId(e,n){return e.filter(a=>-1!==n.findIndex(o=>a.TypeID==o))}getProductStatistic(){return this.httpService.post("/api/product/ProductStatistic",{})}getTotalProductLive(e){return this.httpService.post("/api/product/TotalProductLive",{ID:e})}clearCacheChannel(e){return this.httpService.post("/api/Channel/ClearCacheChannel",{ID:e})}uploadSingleProduct(e,n){return this.httpService.post("api/product/UploadMultipleChannel",{Channel:n,Products:e}).pipe((0,f.b)(o=>{this.showToastrSuccessUploadSingle(o,e[0])}),(0,g.K)(o=>(this.showToastErrorUploadSingle(o,e[0]),(0,c._)(()=>new Error(o)))))}uploadMultipleProduct(e,n){return this.httpService.post("api/product/UploadMultipleProductAndMultipleChannel",{Channel:n,Products:e}).pipe((0,f.b)(o=>{this.showToastrUploadMultiple(o.Message)}),(0,g.K)(o=>(this.showToastrUploadMultiple(o.error?.Message),(0,c._)(()=>new Error(o)))))}uploadNotInChannel(e,n){return this.httpService.post("/api/product/UploadProductNotInChannelToChannel",{Products:e,Channel:n}).pipe((0,f.b)(o=>{this.showToastrUploadMultiple(o)}),(0,g.K)(o=>(this.showToastrUploadMultiple(o.error?.Message),(0,c._)(()=>new Error(o)))))}scanSingle(e,n){return this.httpService.post("/api/product/ScanSingle",{ID:e,SKU:n})}scanNotInChannel(e){return this.httpService.post("/api/product/ScanNotinChannel",{ID:e})}findAllSoldInChannel(e){return this.httpService.post("/api/product/GetSoldInChannel",e)}scanAll(e,n,a,o=!1){return this.httpService.post("/api/product/ScanOptimized",{ID:e,ScanFull:n,UpdatedProduct:a,Async:o})}scanCompareToPos(e){return this.httpService.post("/api/product/CompareMarketplaceToPOS",e)}getVariantCodesProduct(e){return e.Variants.map(a=>a.Code)}downloadMultipleProduct(e){let n=e.map(a=>({ChannelItemID:a.ChannelItemID,ChannelID:a.ChannelID}));return this.httpService.post("/api/product/DownloadMultipleProductFromChannel",n).pipe((0,f.b)(a=>{this.toastrService.success(`${a.Count} products downloaded to POS`,"Download Complete")}))}downloadProduct(e){return this.httpService.post("/api/product/DownloadProductFromChannel",{ChannelItemID:e.ChannelItemID,ChannelID:e.ChannelID}).pipe((0,f.b)(()=>{this.toastrService.success("Product successfully downloaded to POS","Download Complete")}))}getVariantCodesProducts(e=[]){let n=[];return e.forEach(a=>{a.Variants.forEach(o=>{n=[...n,o.Code]})}),n}filterUnselectedChannel(e,n){let o,a=[];if(e.forEach(r=>{a=[...a,...r.Channel]}),a&&0!=a.length){let r=[];o=n.filter(d=>(r=a.filter(T=>T.ChannelID==d.ID),r.length!==e.length))}else o=n;return o}findChannelById(e,n){return n.find(a=>a.ID==e)}sortChannel(e=[]){return e.sort((n,a)=>n.TypeID<a.TypeID?1:n.TypeID===a.TypeID?0:-1)}hasSelection(e=[]){return this.selectedProduct(e).length>0}selectedProduct(e=[]){return e.filter(n=>n.selected)}hasSelectionVariant(e){return this.selectedVariantProduct(e).length>0}selectedVariantProduct(e){let n=[];return e.forEach(a=>{n=[...n,...null!=a.Variants?a.Variants.filter(o=>o.selected):""]}),n}getChannelProduct(e){const n=e.Variants;let a=[];for(let o of n)if(null!=o.Channel)for(let r of o.Channel)0==a.filter(d=>d.ChannelID==r.ChannelID).length&&a.push(r);return this.sortChannel(a)}successToastrScanAllProduct(e,n,a){if(a){const o=e?.NotInPOS?.Product?e?.NotInPOS?.Product:0,r=e?.InChannel?.Product?e?.InChannel?.Product:0;this.toastrService.success(`\n ${o+r} found in ${n.Name} </br>\n (${r} In POS + ${o} Not In Pos)\n `,"Scan Complete!",{enableHtml:!0})}else this.toastrService.success(`${e.InChannel?e.InChannel.Product:0} product updates in ${n.Name} </br> \n since ${e.LastUpdate}`,"Scan Complete!",{enableHtml:!0})}checkProductHasScanButton(e,n){let a;return e.map(o=>(o.Channel=this.getChannelProduct(o),a=this.filterUnselectedChannel([o],n),o.hasScan=a.length>0,o))}checkProductHasUploadBtn(e,n){let a;return e.map(o=>(o.Channel=this.getChannelProduct(o),a=this.filterUnselectedChannel([o],n),o.hasUpload=a.length>0,o))}showToastrUploadMultiple(e=[]){let n=[],a=[];if(e.forEach(o=>{"string"==typeof o?.Response?a=[...a,`<li>${o.Response}</li>`]:(o?.Response?.Success.forEach(r=>{n=[...n,`<li>Product ${r} was <b>successfully</b> uploaded to ${o.Name}</li>`]}),o?.Response.Fail.forEach(r=>{a=[...a,`<li>${r} in <b>${o.Name}</b></li>`]}))}),a.length>0&&n.length>0){const o=[...n,...a];this.toastrService.warning(this.concatMessage(o),"Warning!",{enableHtml:!0})}else n.length>0&&0==a.length?this.toastrService.success(this.concatMessage(n),"Success",{enableHtml:!0}):this.toastrService.error(this.concatMessage(a),"Error",{enableHtml:!0})}concatMessage(e=[]){let n="";return e.forEach(a=>{n+=a}),`<ol>${n}</ol>`}showToastrSuccessUploadSingle(e,n){let a=e.filter(d=>0==d.Status),o=e.filter(d=>1==d.Status),r=this.generateToastrMessage(a,o,n);this.toastrService.success(r.message,"Success",{enableHtml:!0})}showToastErrorUploadSingle(e,n){let a=e?.error?.Message.filter(d=>0==d.Status),o=e?.error?.Message.filter(d=>1==d.Status),r=this.generateToastrMessage(a,o,n);"WARNING"==r.status?this.toastrService.warning(r.message,"Warning!",{enableHtml:!0}):this.toastrService.error(r.message,`Error - ${e.status}`,{enableHtml:!0})}generateToastrMessage(e,n,a){let r,o="";return 0==e.length&&n.length>0?(r="SUCCESS",o=this.createSuccessResponse(n,a)):e.length>0&&0==n.length?(r="ERROR",o=this.createErrResponse(e,a)):(r="WARNING",o=`${this.createSuccessResponse(n,a)} ${this.createErrResponse(e,a)}`),o=`<ol>${o}</ol>`,{status:r,message:o}}createErrResponse(e,n){let a="";return e.forEach((o,r)=>{a+=`<li><b>${o.Response}</b> for ${n.Name} in ${o.Name}</li>`}),a}createSuccessResponse(e,n){let a="";return e.forEach((o,r)=>{a+=`<li>Product ${n.Name} was <b>successfully</b> uploaded to ${o.Name}</li>`}),a}getHostName(){if(_.g.IsEmpty(this.hostName)){const e=localStorage.getItem("Authorization");this.hostName=JSON.parse(e)?.Host}return this.hostName}}m.\u0275fac=function(e){return new(e||m)(t.LFG(I.O),t.LFG(v._W))},m.\u0275prov=t.Yz7({token:m,factory:m.\u0275fac,providedIn:"root"})}}]);
|