@deenruv/admin-ui-plugin 1.0.0
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/README.md +5 -0
- package/lib/admin-ui/123.1d21e707f57ee3b4.js +33 -0
- package/lib/admin-ui/123.1d21e707f57ee3b4.js.map +1 -0
- package/lib/admin-ui/132.9c69fc8bd3b0cec4.js +2 -0
- package/lib/admin-ui/132.9c69fc8bd3b0cec4.js.map +1 -0
- package/lib/admin-ui/153.7eec6efd3edd54b4.js +321 -0
- package/lib/admin-ui/153.7eec6efd3edd54b4.js.map +1 -0
- package/lib/admin-ui/3rdpartylicenses.txt +1393 -0
- package/lib/admin-ui/473.fc9f902d000ba044.js +2 -0
- package/lib/admin-ui/473.fc9f902d000ba044.js.map +1 -0
- package/lib/admin-ui/53.7f3fee856943b03f.js +86 -0
- package/lib/admin-ui/53.7f3fee856943b03f.js.map +1 -0
- package/lib/admin-ui/625.64b1900ed11327c1.js +46 -0
- package/lib/admin-ui/625.64b1900ed11327c1.js.map +1 -0
- package/lib/admin-ui/697.ff9c92dd4b564093.js +73 -0
- package/lib/admin-ui/697.ff9c92dd4b564093.js.map +1 -0
- package/lib/admin-ui/99.b9d2442a2288abdb.js +379 -0
- package/lib/admin-ui/99.b9d2442a2288abdb.js.map +1 -0
- package/lib/admin-ui/assets/.gitkeep +0 -0
- package/lib/admin-ui/assets/logo-login.webp +0 -0
- package/lib/admin-ui/assets/logo-top.webp +0 -0
- package/lib/admin-ui/common.868070cec3f2418e.js +2 -0
- package/lib/admin-ui/common.868070cec3f2418e.js.map +1 -0
- package/lib/admin-ui/deenruv-ui-config.json +290 -0
- package/lib/admin-ui/favicon.ico +0 -0
- package/lib/admin-ui/fonts/fonts.scss +253 -0
- package/lib/admin-ui/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-cyrillic.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-greek-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-greek.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-latin-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-latin.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-vietnamese.woff2 +0 -0
- package/lib/admin-ui/i18n-messages/ar.json +814 -0
- package/lib/admin-ui/i18n-messages/cs.json +814 -0
- package/lib/admin-ui/i18n-messages/de.json +814 -0
- package/lib/admin-ui/i18n-messages/en.json +814 -0
- package/lib/admin-ui/i18n-messages/es.json +814 -0
- package/lib/admin-ui/i18n-messages/fa.json +814 -0
- package/lib/admin-ui/i18n-messages/fr.json +814 -0
- package/lib/admin-ui/i18n-messages/he.json +814 -0
- package/lib/admin-ui/i18n-messages/hr.json +814 -0
- package/lib/admin-ui/i18n-messages/it.json +814 -0
- package/lib/admin-ui/i18n-messages/nb.json +812 -0
- package/lib/admin-ui/i18n-messages/ne.json +814 -0
- package/lib/admin-ui/i18n-messages/pl.json +814 -0
- package/lib/admin-ui/i18n-messages/pt_BR.json +814 -0
- package/lib/admin-ui/i18n-messages/pt_PT.json +814 -0
- package/lib/admin-ui/i18n-messages/ru.json +814 -0
- package/lib/admin-ui/i18n-messages/sv.json +807 -0
- package/lib/admin-ui/i18n-messages/uk.json +814 -0
- package/lib/admin-ui/i18n-messages/zh_Hans.json +814 -0
- package/lib/admin-ui/i18n-messages/zh_Hant.json +814 -0
- package/lib/admin-ui/index.html +14 -0
- package/lib/admin-ui/inter-cyrillic-ext.f62cc866835dd717.woff2 +0 -0
- package/lib/admin-ui/inter-cyrillic.fd42267cbb1bfdb0.woff2 +0 -0
- package/lib/admin-ui/inter-greek-ext.f876a5a3ea45d9a5.woff2 +0 -0
- package/lib/admin-ui/inter-greek.0455348926d6f41d.woff2 +0 -0
- package/lib/admin-ui/inter-latin-ext.7df16007e26681f5.woff2 +0 -0
- package/lib/admin-ui/inter-latin.40c45725dc5f525d.woff2 +0 -0
- package/lib/admin-ui/inter-vietnamese.530676b65c9e977f.woff2 +0 -0
- package/lib/admin-ui/main.a1f6ce60f6b53c40.js +3241 -0
- package/lib/admin-ui/main.a1f6ce60f6b53c40.js.map +1 -0
- package/lib/admin-ui/polyfills.34e462102e9d0666.js +2 -0
- package/lib/admin-ui/polyfills.34e462102e9d0666.js.map +1 -0
- package/lib/admin-ui/polyfills.ts +66 -0
- package/lib/admin-ui/runtime.12183b5e8f8cfd14.js +2 -0
- package/lib/admin-ui/runtime.12183b5e8f8cfd14.js.map +1 -0
- package/lib/admin-ui/styles/_mixins.scss +60 -0
- package/lib/admin-ui/styles/_variables.scss +11 -0
- package/lib/admin-ui/styles/component/prosemirror.scss +511 -0
- package/lib/admin-ui/styles/global/_buttons.scss +147 -0
- package/lib/admin-ui/styles/global/_clarity.scss +140 -0
- package/lib/admin-ui/styles/global/_forms.scss +187 -0
- package/lib/admin-ui/styles/global/_global.scss +41 -0
- package/lib/admin-ui/styles/global/_overrides.scss +165 -0
- package/lib/admin-ui/styles/global/_sass-overrides.scss +8 -0
- package/lib/admin-ui/styles/global/_utilities.scss +155 -0
- package/lib/admin-ui/styles/rtl.scss +143 -0
- package/lib/admin-ui/styles/styles.scss +19 -0
- package/lib/admin-ui/styles/theme/dark.scss +591 -0
- package/lib/admin-ui/styles/theme/default.scss +254 -0
- package/lib/admin-ui/styles/ui-extension-theme.scss +13 -0
- package/lib/admin-ui/styles.2de83a2df5e76526.css +3 -0
- package/lib/admin-ui/styles.2de83a2df5e76526.css.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/src/api/metrics.resolver.d.ts +8 -0
- package/lib/src/api/metrics.resolver.js +41 -0
- package/lib/src/api/metrics.resolver.js.map +1 -0
- package/lib/src/config/metrics-strategies.d.ts +39 -0
- package/lib/src/config/metrics-strategies.js +92 -0
- package/lib/src/config/metrics-strategies.js.map +1 -0
- package/lib/src/constants.d.ts +7 -0
- package/lib/src/constants.js +286 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/plugin.d.ts +129 -0
- package/lib/src/plugin.js +332 -0
- package/lib/src/plugin.js.map +1 -0
- package/lib/src/service/metrics.service.d.ts +16 -0
- package/lib/src/service/metrics.service.js +144 -0
- package/lib/src/service/metrics.service.js.map +1 -0
- package/lib/src/types.d.ts +23 -0
- package/lib/src/types.js +14 -0
- package/lib/src/types.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkdeenruv_admin=self.webpackChunkdeenruv_admin||[]).push([[153],{6153:(pn,Lt,p)=>{p.r(Lt),p.d(Lt,{ASSET_DETAIL_QUERY:()=>oo,ApplyFacetDialogComponent:()=>pt,AssetDetailComponent:()=>kt,AssetListComponent:()=>Gt,AssignProductsToChannelDialogComponent:()=>Z,BulkAddFacetValuesDialogComponent:()=>mt,COLLECTION_DETAIL_QUERY:()=>ti,CatalogModule:()=>Ut,CollectionBreadcrumbPipe:()=>ht,CollectionContentsComponent:()=>_t,CollectionDataTableComponent:()=>gt,CollectionDetailComponent:()=>Et,CollectionListComponent:()=>Ot,CollectionTreeComponent:()=>Wt,CollectionTreeNodeComponent:()=>it,CollectionTreeService:()=>at,ConfirmVariantDeletionDialogComponent:()=>Kt,CreateFacetValueDialogComponent:()=>$t,CreateProductOptionGroupDialogComponent:()=>Rt,CreateProductVariantDialogComponent:()=>Ft,FACET_DETAIL_QUERY:()=>We,FACET_LIST_QUERY:()=>ts,FacetDetailComponent:()=>yt,FacetListComponent:()=>Vt,GET_PRODUCTS_WITH_FACET_VALUES_BY_IDS:()=>Ve,GET_PRODUCT_DETAIL:()=>rl,GET_VARIANTS_WITH_FACET_VALUES_BY_IDS:()=>Se,GenerateProductVariantsComponent:()=>St,GeneratedVariant:()=>Zn,MoveCollectionsDialogComponent:()=>Mt,OPTION_VALUE_INPUT_VALUE_ACCESSOR:()=>De,OptionValueInputComponent:()=>et,PRODUCT_LIST_QUERY:()=>Tc,PRODUCT_VARIANT_DETAIL_QUERY:()=>Rc,PRODUCT_VARIANT_DETAIL_QUERY_PRODUCT_VARIANT_FRAGMENT:()=>Fe,PRODUCT_VARIANT_LIST_QUERY:()=>Dc,PRODUCT_VARIANT_UPDATE_MUTATION:()=>Fc,ProductDetailComponent:()=>vt,ProductDetailService:()=>J,ProductListComponent:()=>xt,ProductOptionsEditorComponent:()=>It,ProductVariantDetailComponent:()=>Yt,ProductVariantListComponent:()=>ft,ProductVariantQuickJumpComponent:()=>jt,ProductVariantsEditorComponent:()=>Pt,ProductVariantsResolver:()=>Dt,ProductVariantsTableComponent:()=>Qt,UPDATE_PRODUCTS_BULK:()=>xe,UPDATE_VARIANTS_BULK:()=>Ne,UpdateProductOptionDialogComponent:()=>Zt,VariantPriceDetailComponent:()=>Nt,VariantPriceStrategyDetailComponent:()=>At,arrayToTree:()=>He,assignCollectionsToChannelBulkAction:()=>Le,assignFacetValuesToProductVariantsBulkAction:()=>dn,assignFacetValuesToProductsBulkAction:()=>an,assignFacetsToChannelBulkAction:()=>Qe,assignProductVariantsToChannelBulkAction:()=>sn,assignProductsToChannelBulkAction:()=>nn,createRoutes:()=>ke,deleteCollectionsBulkAction:()=>Ye,deleteFacetsBulkAction:()=>Ke,deleteProductVariantsBulkAction:()=>cn,deleteProductsBulkAction:()=>en,duplicateCollectionsBulkAction:()=>we,duplicateFacetsBulkAction:()=>ze,duplicateProductsBulkAction:()=>rn,moveCollectionsBulkAction:()=>Ue,productOptionsEditorBreadcrumb:()=>Ge,removeCollectionsFromChannelBulkAction:()=>Be,removeFacetsFromChannelBulkAction:()=>Ze,removeFacetsFromChannelBulkAction2:()=>Vr,removeProductVariantsFromChannelBulkAction:()=>ln,removeProductsFromChannelBulkAction:()=>on,replaceLast:()=>me});var P=p(808),u=p(9595),l=p(9214),Bt=p(6587),t=p(1410),f=p(5626),d=p(1217),D=p(4148),w=p(2132),N=p(4117),U=p(2913),V=p(2855),S=p(8547),st=p(7081),O=p(81),qt=p(4658),r=p(8422),C=p(2430);function me(o,n,e){if(!o)return"";const a=o.lastIndexOf(n);if(-1===a)return o;return o.substr(0,a)+o.substr(a).replace(n,e)}class J{constructor(n){this.dataService=n}getTaxCategories(){return this.dataService.settings.getTaxCategories().mapSingle(n=>n.taxCategories.items).pipe((0,r.t)(1))}createProductWithVariants(n,e,a){const i=this.dataService.product.createProduct(n),s=e.groups.filter(m=>0<m.values.length),c=this.createProductOptionGroups(s,a);return(0,w.p)(i,c).pipe((0,V.Z)(([{createProduct:m},_])=>(_.length?(0,w.p)(_.map(v=>this.dataService.product.addOptionGroupToProduct({productId:m.id,optionGroupId:v.id}))):(0,O.of)([])).pipe((0,f.T)(()=>({createProduct:m,optionGroups:_})))),(0,V.Z)(({createProduct:m,optionGroups:_})=>{const h=e.variants.map(F=>{const I=_.length?F.optionValues.map((G,k)=>{const y=_[k].options.find(rt=>rt.name===G);if(!y)throw new Error(`Could not find a matching ProductOption "${G}" when creating variant`);return y.id}):[];return{...F,optionIds:I}}),v=_.map(F=>F.options).reduce((F,I)=>[...F,...I],[]);return this.createProductVariants(m,h,v,a,e.stockLocationId)}))}createProductOptionGroups(n,e){return n.length?(0,w.p)(n.map(a=>this.dataService.product.createProductOptionGroups({code:(0,S.J)(a.name,"-"),translations:[{languageCode:e,name:a.name}],options:a.values.map(i=>({code:(0,S.J)(i,"-"),translations:[{languageCode:e,name:i}]}))}).pipe((0,f.T)(i=>i.createProductOptionGroup)))):(0,O.of)([])}createProductVariants(n,e,a,i,s){const c=e.map(m=>{const _=a.length?`${n.name} ${m.optionIds.map(h=>a.find(v=>v.id===h)).filter(st.notNullOrUndefined).map(h=>h.name).join(" ")}`:n.name;return{productId:n.id,price:m.price,sku:m.sku,translations:[{languageCode:i,name:_}],stockLevels:[{stockLocationId:s,stockOnHand:m.stock}],optionIds:m.optionIds}});return this.dataService.product.createProductVariants(c).pipe((0,f.T)(({createProductVariants:m})=>({createProductVariants:m,productId:n.id})))}updateProduct(n){const{product:e,languageCode:a,autoUpdate:i,productInput:s,variantsInput:c}=n,m=[],_=c||[];return(i?this.dataService.product.getProductVariantsForProduct({},e.id).mapSingle(({productVariants:v})=>v.items):(0,O.of)([])).pipe((0,V.Z)(v=>{if(s){m.push(this.dataService.product.updateProduct(s));const F=(0,l.RMk)(e,a)?.name??"",I=(0,l.RMk)(s,a)?.name;if(I&&F!==I&&i)for(const G of v){const k=(0,l.RMk)(G,a)?.name||"";let y;const rt=_.find(Pe=>Pe.id===G.id);rt?y=rt:(y={id:G.id,translations:[{languageCode:a,name:k}]},_.push(y));const zt=(0,l.RMk)(y,a);zt&&(zt.name?zt.name=me(zt.name,F,I):zt.name=[I,...G.options.map(Pe=>Pe.name)].join(" "))}}return _.length&&m.push(this.dataService.product.updateProductVariants(_)),(0,w.p)(m)}))}updateProductOptions(n,e,a,i){return(e?this.dataService.product.getProductVariantsForProduct({},a.id).mapSingle(({productVariants:c})=>c.items):(0,O.of)([])).pipe((0,V.Z)(c=>{let m=(0,O.of)([]);if(e){const _=new Map;for(const v of n){const F=(0,l.RMk)(v,i)?.name;let I;for(const G of c)I||G.options.map(k=>k.id).includes(v.id)&&(I||(I=(0,l.RMk)(G.options.find(k=>k.id===v.id),i)?.name));I&&F&&_.set(I,F)}const h=[];if(_.size){const v=Array.from(_.keys());for(const F of c){const I=(0,l.RMk)(F,i)?.name;if(!I||!v.some(k=>I.includes(k)))continue;const G=v.reduce((k,y)=>me(k,y,_.get(y)),I);h.push({id:F.id,translations:[{languageCode:i,name:G}]})}}m=h.length?this.dataService.product.updateProductVariants(h):(0,O.of)([])}return(0,w.p)(n.map(_=>this.dataService.product.updateProductOption(_))).pipe((0,V.Z)(()=>m))}))}deleteProductVariant(n,e){return this.dataService.product.deleteProductVariant(n).pipe((0,C.n)(a=>a.deleteProductVariant.result===l.syg.DELETED?this.dataService.product.getProduct(e).single$:(0,qt.$)(a.deleteProductVariant.message)))}static{this.\u0275fac=function(e){return new(e||J)(t.KVO(l.uSP))}}static{this.\u0275prov=t.jDH({token:J,factory:J.\u0275fac,providedIn:"root"})}}var b=p(4677),g=p(4806),R=p(273),L=p(4763),$=p(5889),H=p(1767),X=p(1534),bt=p(4585),Ct=p(5956),z=p(7595),un=p(4387),mn=p(501),_n=p(359),gn=p(915),A=p(8995),wt=p(8557),lt=p(3161),T=p(654),q=p(4612),ct=p(2953);function hn(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",6),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",e.detailForm.pristine||e.detailForm.invalid),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}function fn(o,n){if(1&o&&(t.qex(0,19),t.nrm(1,"vdr-tabbed-custom-fields",20),t.nI1(2,"hasPermission"),t.bVm()),2&o){const e=t.XpG().$implicit,a=t.XpG(2);t.R7$(),t.Y8G("customFields",a.optionGroupCustomFields)("customFieldsFormGroup",e.get("customFields"))("readonly",!t.bMT(2,3,a.updatePermission))}}function vn(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.value.id," ")}}function bn(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.value.createdAt,"short")," ")}}function Cn(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.value.updatedAt,"short")," ")}}function In(o,n){if(1&o&&(t.nrm(0,"input",28),t.nI1(1,"hasPermission")),2&o){const e=n.item,a=t.XpG(4);t.Y8G("formControl",e.get("name"))("readonly",!t.bMT(1,2,a.updatePermission))}}function Tn(o,n){if(1&o&&t.nrm(0,"input",29),2&o){const e=n.item;t.Y8G("formControl",e.get("code"))}}function Rn(o,n){if(1&o&&(t.nrm(0,"vdr-tabbed-custom-fields",30),t.nI1(1,"hasPermission")),2&o){const e=n.item,a=t.XpG(4);t.Y8G("customFields",a.optionCustomFields)("compact",!0)("customFieldsFormGroup",e.get("customFields"))("readonly",!t.bMT(1,4,a.updatePermission))}}function Fn(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-data-table-2",21),t.bIt("pageChange",function(i){t.eBV(e);const s=t.XpG().$implicit,c=t.XpG(2);return t.Njj(c.paginationSettings[s.value.id].currentPage=i)}),t.j41(1,"vdr-dt2-column",22),t.nI1(2,"translate"),t.DNE(3,vn,1,1,"ng-template"),t.k0s(),t.j41(4,"vdr-dt2-column",23),t.nI1(5,"translate"),t.DNE(6,bn,2,4,"ng-template"),t.k0s(),t.j41(7,"vdr-dt2-column",24),t.nI1(8,"translate"),t.DNE(9,Cn,2,4,"ng-template"),t.k0s(),t.j41(10,"vdr-dt2-column",25),t.nI1(11,"translate"),t.DNE(12,In,2,4,"ng-template"),t.k0s(),t.j41(13,"vdr-dt2-column",26),t.nI1(14,"translate"),t.DNE(15,Tn,1,1,"ng-template"),t.k0s(),t.j41(16,"vdr-dt2-column",27),t.nI1(17,"translate"),t.DNE(18,Rn,2,6,"ng-template"),t.k0s()()}if(2&o){const e=n.ngIf,a=t.XpG().$implicit,i=t.XpG(2);t.Y8G("items",e)("itemsPerPage",null==i.paginationSettings[a.value.id]?null:i.paginationSettings[a.value.id].itemsPerPage)("currentPage",null==i.paginationSettings[a.value.id]?null:i.paginationSettings[a.value.id].currentPage)("totalItems",e.length),t.R7$(),t.Y8G("heading",t.bMT(2,16,"common.id"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(5,18,"common.created-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(8,20,"common.updated-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(11,22,"common.name"))("optional",!1),t.R7$(3),t.Y8G("heading",t.bMT(14,24,"common.code"))("optional",!1),t.R7$(3),t.Y8G("heading",t.bMT(17,26,"common.custom-fields"))("hiddenByDefault",0===i.optionCustomFields.length)}}function Pn(o,n){if(1&o&&(t.j41(0,"vdr-card",10),t.nrm(1,"vdr-page-entity-info",11),t.j41(2,"div",12)(3,"vdr-form-field",13),t.nI1(4,"translate"),t.nrm(5,"input",14),t.nI1(6,"hasPermission"),t.k0s(),t.j41(7,"vdr-form-field",15),t.nI1(8,"translate"),t.nrm(9,"input",16),t.nI1(10,"hasPermission"),t.k0s()(),t.DNE(11,fn,3,5,"ng-container",17)(12,Fn,19,28,"vdr-data-table-2",18),t.k0s()),2&o){const e=n.$implicit,a=n.index,i=t.XpG(2);t.Y8G("formArrayName",a)("title",e.value.code),t.R7$(),t.Y8G("entity",e.value),t.R7$(2),t.Y8G("label",t.bMT(4,11,"common.name")),t.R7$(2),t.Y8G("id","name-"+a)("readonly",!t.bMT(6,13,i.updatePermission)),t.R7$(2),t.Y8G("label",t.bMT(8,15,"common.code")),t.R7$(2),t.Y8G("id","code-"+a)("readonly",!t.bMT(10,17,i.updatePermission)),t.R7$(2),t.Y8G("ngIf",i.optionGroupCustomFields.length),t.R7$(),t.Y8G("ngIf",i.getOptions(e))}}function Dn(o,n){if(1&o&&(t.j41(0,"form",7)(1,"div",8),t.DNE(2,Pn,13,19,"vdr-card",9),t.k0s()()),2&o){const e=t.XpG();t.Y8G("formGroup",e.detailForm),t.R7$(2),t.Y8G("ngForOf",e.getOptionGroups())}}class It extends l.igh{constructor(n,e,a,i,s,c,m,_,h){super(n,e,a,i,s),this.route=n,this.router=e,this.serverConfigService=a,this.dataService=i,this.permissionsService=s,this.productDetailService=c,this.formBuilder=m,this.changeDetector=_,this.notificationService=h,this.autoUpdateVariantNames=!0,this.paginationSettings={},this.updatePermission=[l.aXG.UpdateCatalog,l.aXG.UpdateProduct],this.optionGroupCustomFields=this.getCustomFieldConfig("ProductOptionGroup"),this.optionCustomFields=this.getCustomFieldConfig("ProductOption")}ngOnInit(){this.optionGroups$=this.route.snapshot.data.entity.pipe((0,f.T)(n=>n.optionGroups),(0,N.M)(n=>{for(const e of n)this.paginationSettings[e.id]={currentPage:1,itemsPerPage:10}})),this.detailForm=new d.J3({optionGroups:new d.Bm([])}),super.init()}getOptionGroups(){return this.detailForm.get("optionGroups").controls}getOptions(n){return n.get("options").controls}save(){if(this.detailForm.invalid||this.detailForm.pristine)return;const n=this.dataService.product.getProduct(this.id).mapSingle(e=>e.product);(0,D.z)(this.entity$,this.languageCode$,n).pipe((0,U.s)(1),(0,V.Z)(([{optionGroups:e},a,i])=>{const s=[],c=[];for(const m of this.getOptionGroups()){if(m.dirty){const _=e.find(h=>h.id===m.value.id);if(_){const h=this.getUpdatedOptionGroup(_,m,a);s.push(this.dataService.product.updateProductOptionGroup(h))}}for(const _ of this.getOptions(m))if(_.dirty){const h=e.find(v=>v.id===m.value.id)?.options.find(v=>v.id===_.value.id);if(h){const v=this.getUpdatedOption(h,_,a);c.push(v)}}}return c.length&&s.push(this.productDetailService.updateProductOptions(c,this.autoUpdateVariantNames,i,a)),(0,w.p)(s)})).subscribe(()=>{this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"ProductOptionGroup"})},e=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"ProductOptionGroup"})})}getUpdatedOptionGroup(n,e,a){return(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.optionGroupCustomFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||""}})}getUpdatedOption(n,e,a){return(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.optionCustomFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||""}})}setFormValues(n,e){const a=this.detailForm.get("optionGroups");for(const i of n.optionGroups){const s=(0,l.RMk)(i,e),c=this.setOptionGroupForm(i,a,s);this.setCustomFieldsForm(this.optionGroupCustomFields,c,i,s);let m=c.get("options");m||(m=this.formBuilder.array([]),c.addControl("options",m));for(const _ of i.options){const h=(0,l.RMk)(_,e),v=this.setOptionForm(_,m,h);this.setCustomFieldsForm(this.optionCustomFields,v,_,h)}}}setCustomFieldsForm(n,e,a,i){if(n.length){let s=e.get(["customFields"]);s||(s=this.formBuilder.group(n.reduce((c,m)=>({...c,[m.name]:""}),{})),e.addControl("customFields",s)),this.setCustomFieldFormValues(n,s,a,i)}}setOptionGroupForm(n,e,a){const i={id:n.id,createdAt:n.createdAt,updatedAt:n.updatedAt,code:n.code,name:a?.name??""};let s=e.controls.find(c=>c.value.id===n.id);return s?(s.get("id")?.setValue(i.id),s.get("code")?.setValue(i.code),s.get("name")?.setValue(i.name),s.get("createdAt")?.setValue(i.createdAt),s.get("updatedAt")?.setValue(i.updatedAt)):(s=this.formBuilder.group(i),e.push(s)),s}setOptionForm(n,e,a){const i={id:n.id,createdAt:n.createdAt,updatedAt:n.updatedAt,code:n.code,name:a?.name??""};let s=e.controls.find(c=>c.value.id===n.id);return s?(s.get("id")?.setValue(i.id),s.get("code")?.setValue(i.code),s.get("name")?.setValue(i.name),s.get("createdAt")?.setValue(i.createdAt),s.get("updatedAt")?.setValue(i.updatedAt)):(s=this.formBuilder.group(i),e.push(s)),s}static{this.\u0275fac=function(e){return new(e||It)(t.rXU(P.nX),t.rXU(P.Ix),t.rXU(l.BBL),t.rXU(l.uSP),t.rXU(l.Kne),t.rXU(J),t.rXU(d.ze),t.rXU(t.gRc),t.rXU(l.JEu))}}static{this.\u0275cmp=t.VBU({type:It,selectors:[["vdr-product-options-editor"]],features:[t.Vt3],decls:24,vars:17,consts:[[3,"languageCodeChange","availableLanguageCodes","currentLanguageCode"],[1,"flex","center"],[1,"mr-2"],["clrCheckbox","","type","checkbox","id","auto-update",3,"ngModelChange","ngModel"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["class","form",3,"formGroup",4,"ngIf"],[1,"btn","btn-primary",3,"click","disabled"],[1,"form",3,"formGroup"],["formGroupName","optionGroups"],[3,"formArrayName","title",4,"ngFor","ngForOf"],[3,"formArrayName","title"],[3,"entity"],[1,"form-grid"],["for","name",3,"label"],["type","text","formControlName","name",3,"id","readonly"],["for","code",3,"label"],["type","text","formControlName","code",3,"id","readonly"],["formGroupName","customFields",4,"ngIf"],["id","edit-options-list",3,"items","itemsPerPage","currentPage","totalItems","pageChange",4,"ngIf"],["formGroupName","customFields"],["entityName","ProductOptionGroup",3,"customFields","customFieldsFormGroup","readonly"],["id","edit-options-list",3,"pageChange","items","itemsPerPage","currentPage","totalItems"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","name",3,"heading","optional"],["id","code",3,"heading","optional"],["id","custom-fields",3,"heading","hiddenByDefault"],["type","text",3,"formControl","readonly"],["type","text",3,"formControl"],["entityName","ProductOption",3,"customFields","compact","customFieldsFormGroup","readonly"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-header"),t.nrm(1,"vdr-page-title"),t.j41(2,"vdr-page-header-description"),t.EFF(3),t.nI1(4,"translate"),t.k0s()(),t.j41(5,"vdr-page-body")(6,"vdr-page-block")(7,"vdr-action-bar")(8,"vdr-ab-left")(9,"vdr-language-selector",0),t.nI1(10,"async"),t.nI1(11,"async"),t.bIt("languageCodeChange",function(s){return a.setLanguage(s)}),t.k0s()(),t.j41(12,"vdr-ab-right")(13,"div",1)(14,"div",2)(15,"clr-checkbox-wrapper")(16,"input",3),t.mxI("ngModelChange",function(s){return t.DH7(a.autoUpdateVariantNames,s)||(a.autoUpdateVariantNames=s),s}),t.k0s(),t.j41(17,"label"),t.EFF(18),t.nI1(19,"translate"),t.k0s()()(),t.DNE(20,hn,3,4,"button",4),t.k0s()()()(),t.j41(21,"vdr-page-block"),t.DNE(22,Dn,3,2,"form",5),t.nI1(23,"async"),t.k0s()()),2&e&&(t.R7$(3),t.JRh(t.bMT(4,7,"catalog.page-description-options-editor")),t.R7$(6),t.Y8G("availableLanguageCodes",t.bMT(10,9,a.availableLanguages$))("currentLanguageCode",t.bMT(11,11,a.languageCode$)),t.R7$(7),t.R50("ngModel",a.autoUpdateVariantNames),t.R7$(2),t.JRh(t.bMT(19,13,"catalog.auto-update-product-variant-name")),t.R7$(2),t.Y8G("vdrIfPermissions",a.updatePermission),t.R7$(2),t.Y8G("ngIf",t.bMT(23,15,a.optionGroups$)))},dependencies:[b.aZZ,b.Jej,b.eAx,g.Sq,g.bT,d.qT,d.me,d.Zm,d.BC,d.cb,d.vS,d.l_,d.j4,d.JD,d.$R,d.v8,R.nG,R.wL,R.TX,L.K,$.V,H.t,X.p,bt.W,Ct.I,z.Y,un.y,mn.j,_n.M,gn.D,A.e,wt.E,lt.i,g.Jj,T.D9,q.E,ct.P],styles:[".option-group-header[_ngcontent-%COMP%]{display:flex;align-items:baseline}"],changeDetection:0})}}var x=p(1295),Tt=p(6851),E=p(9103),W=p(7420),tt=p(5907),K=p(3240);function kn(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.create-product-option-group"),"\n")}function Gn(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",7),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",8),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.confirm())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",e.form.invalid),t.R7$(),t.SpI(" ",t.bMT(5,5,"common.confirm")," ")}}class Rt{constructor(n){this.formBuilder=n,this.form=this.formBuilder.group({name:["",d.k0.required],code:["",d.k0.required]})}updateCode(){const n=this.form.get("name"),e=this.form.get("code");n&&e&&e.pristine&&e.setValue((0,S.J)(`${n.value}`,"-"))}confirm(){const{name:n,code:e}=this.form.value;!n||!e||this.resolveWith({code:e,options:[],translations:[{languageCode:this.languageCode,name:n}]})}cancel(){this.resolveWith()}static{this.\u0275fac=function(e){return new(e||Rt)(t.rXU(d.ok))}}static{this.\u0275cmp=t.VBU({type:Rt,selectors:[["vdr-create-product-option-group-dialog"]],decls:9,vars:7,consts:[["vdrDialogTitle",""],[1,"form-grid",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"input"],["for","code",3,"label"],["id","code","type","text","formControlName","code"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){1&e&&(t.DNE(0,kn,2,3,"ng-template",0),t.j41(1,"div",1)(2,"vdr-form-field",2),t.nI1(3,"translate"),t.j41(4,"input",3),t.bIt("input",function(){return a.updateCode()}),t.k0s()(),t.j41(5,"vdr-form-field",4),t.nI1(6,"translate"),t.nrm(7,"input",5),t.k0s()(),t.DNE(8,Gn,6,7,"ng-template",6)),2&e&&(t.R7$(),t.Y8G("formGroup",a.form),t.R7$(),t.Y8G("label",t.bMT(3,3,"common.name")),t.R7$(3),t.Y8G("label",t.bMT(6,5,"common.code")))},dependencies:[d.me,d.BC,d.cb,d.j4,d.JD,L.K,$.V,tt.b,K.M,T.D9],changeDetection:0})}}var te=p(2810),ee=p(1745);function En(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.create-product-variant"),"\n")}function Mn(o,n){if(1&o&&(t.j41(0,"vdr-form-field",7),t.nrm(1,"ng-select",12),t.k0s()),2&o){const e=n.$implicit;t.Y8G("label",e.name),t.R7$(),t.Y8G("items",e.options)("formControlName",e.code)}}function On(o,n){1&o&&(t.j41(0,"clr-alert",13)(1,"clr-alert-item")(2,"span",14),t.EFF(3),t.nI1(4,"translate"),t.k0s()()()),2&o&&(t.Y8G("clrAlertClosable",!1),t.R7$(3),t.SpI(" ",t.bMT(4,2,"catalog.cannot-create-variants-without-options")," "))}function $n(o,n){if(1&o&&(t.j41(0,"div",15)(1,"clr-alert",16)(2,"clr-alert-item")(3,"span",14),t.EFF(4),t.nI1(5,"translate"),t.k0s()()()()),2&o){const e=t.XpG();t.R7$(),t.Y8G("clrAlertClosable",!1),t.R7$(3),t.E5c(" ",t.bMT(5,4,"catalog.product-variant-exists"),": ",e.existingVariant.name," (",e.existingVariant.sku,") ")}}function yn(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",17),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",18),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.confirm())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",e.form.invalid||e.existingVariant||0===e.product.optionGroups.length),t.R7$(),t.SpI(" ",t.bMT(5,5,"common.confirm")," ")}}class Ft{constructor(n){this.formBuilder=n,this.form=this.formBuilder.group({name:["",d.k0.required],sku:["",d.k0.required],price:[""],options:this.formBuilder.record({})})}ngOnInit(){this.currencyCode=this.product.variants[0]?.currencyCode;for(const e of this.product.optionGroups)this.form.get("options").addControl(e.code,new d.MJ("",d.k0.required));this.form.get("options").valueChanges.subscribe(e=>{const a=this.form.get("name");if(!Object.values(e).every(c=>null==c)&&e&&a&&!a.dirty){const c=Object.entries(e).map(([m,_])=>this.product.optionGroups.find(h=>h.code===m)?.options.find(h=>h.id===_)?.name).join(" ");a.setValue(`${this.product.name} ${c}`)}Object.values(e).every(c=>null!=c)&&(this.existingVariant=this.product.variants.find(c=>Object.entries(e).every(([m,_])=>c.options.find(h=>h.groupId===this.getGroupIdFromCode(m))?.id===_)))})}confirm(){const{name:n,sku:e,options:a,price:i}=this.form.value;if(!n||!e||!a||null==i)return;const s=Object.values(a).filter(st.notNullOrUndefined);this.resolveWith({productId:this.product.id,sku:e,price:Number(i),optionIds:s,translations:[{languageCode:this.product.languageCode,name:n}]})}cancel(){this.resolveWith()}getGroupCodeFromId(n){return this.product.optionGroups.find(e=>e.id===n)?.code??""}getGroupIdFromCode(n){return this.product.optionGroups.find(e=>e.code===n)?.id??""}static{this.\u0275fac=function(e){return new(e||Ft)(t.rXU(d.ok))}}static{this.\u0275cmp=t.VBU({type:Ft,selectors:[["vdr-create-product-variant-dialog"]],decls:17,vars:14,consts:[["vdrDialogTitle",""],[3,"formGroup"],["formGroupName","options",1,"form-grid"],[3,"label",4,"ngFor","ngForOf"],["clrAlertType","warning","class","form-grid-span",3,"clrAlertClosable",4,"ngIf"],["class","mt-2",4,"ngIf"],[1,"form-grid","mt-2"],[3,"label"],["type","text","formControlName","name"],["type","text","formControlName","sku"],["name","price","formControlName","price",3,"currencyCode"],["vdrDialogButtons",""],["bindLabel","name","bindValue","id","appendTo","body",3,"items","formControlName"],["clrAlertType","warning",1,"form-grid-span",3,"clrAlertClosable"],[1,"alert-text"],[1,"mt-2"],["clrAlertType","warning",1,"",3,"clrAlertClosable"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){1&e&&(t.DNE(0,En,2,3,"ng-template",0),t.j41(1,"form",1)(2,"div",2),t.DNE(3,Mn,2,3,"vdr-form-field",3)(4,On,5,4,"clr-alert",4),t.k0s(),t.DNE(5,$n,6,6,"div",5),t.j41(6,"div",6)(7,"vdr-form-field",7),t.nI1(8,"translate"),t.nrm(9,"input",8),t.k0s(),t.j41(10,"vdr-form-field",7),t.nI1(11,"translate"),t.nrm(12,"input",9),t.k0s(),t.j41(13,"vdr-form-field",7),t.nI1(14,"translate"),t.nrm(15,"vdr-currency-input",10),t.k0s()()(),t.DNE(16,yn,6,7,"ng-template",11)),2&e&&(t.R7$(),t.Y8G("formGroup",a.form),t.R7$(2),t.Y8G("ngForOf",a.product.optionGroups),t.R7$(),t.Y8G("ngIf",0===a.product.optionGroups.length),t.R7$(),t.Y8G("ngIf",a.existingVariant),t.R7$(2),t.Y8G("label",t.bMT(8,8,"common.name")),t.R7$(3),t.Y8G("label",t.bMT(11,10,"catalog.sku")),t.R7$(3),t.Y8G("label",t.bMT(14,12,"catalog.price")),t.R7$(2),t.Y8G("currencyCode",a.currencyCode))},dependencies:[b.k8k,b.Bw1,b.tQl,g.Sq,g.bT,d.qT,d.me,d.BC,d.cb,d.j4,d.JD,d.$R,te.vr,ee.J,L.K,$.V,tt.b,K.M,T.D9],changeDetection:0})}}var Q=p(7145),dt=p(6637);const Vn=["textArea"],Sn=["editNameInput"];function xn(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-chip",7),t.bIt("iconClick",function(){const i=t.eBV(e).$implicit,s=t.XpG(2);return t.Njj(s.removeOption(i))}),t.j41(1,"span",8)(2,"input",9,1),t.bIt("blur",function(i){const s=t.eBV(e).index,c=t.XpG(2);return t.Njj(c.updateOption(s,i))})("click",function(i){return t.eBV(e),t.Njj(i.cancelBubble=!0)}),t.k0s()(),t.j41(4,"span",10),t.bIt("click",function(i){const s=t.eBV(e).index,c=t.XpG(2);return t.Njj(c.editName(s,i))}),t.EFF(5),t.k0s()()}if(2&o){const e=n.$implicit,a=n.last,i=n.index,s=t.XpG(2);t.AVh("selected",a&&s.lastSelected)("locked",e.locked),t.Y8G("icon",e.locked?"lock":"times")("colorFrom",s.groupName),t.R7$(),t.Y8G("hidden",s.editingIndex!==i),t.R7$(),t.Y8G("ngModel",e.name),t.R7$(2),t.AVh("editable",!e.locked&&!e.id),t.Y8G("hidden",s.editingIndex===i),t.R7$(),t.JRh(e.name)}}function Nn(o,n){if(1&o&&(t.j41(0,"div",5),t.DNE(1,xn,6,12,"vdr-chip",6),t.k0s()),2&o){const e=t.XpG();t.R7$(),t.Y8G("ngForOf",e.optionValues)}}const De={provide:d.kq,useExisting:(0,t.Rfq)(()=>et),multi:!0};class et{get optionValues(){return this.formValue??this.options??[]}constructor(n){this.changeDetector=n,this.groupName="",this.add=new t.bkB,this.remove=new t.bkB,this.edit=new t.bkB,this.disabled=!1,this.input="",this.isFocussed=!1,this.lastSelected=!1,this.editingIndex=-1}registerOnChange(n){this.onChangeFn=n}registerOnTouched(n){this.onTouchFn=n}setDisabledState(n){this.disabled=n,this.changeDetector.markForCheck()}writeValue(n){this.formValue=n||[]}focus(){this.textArea.nativeElement.focus()}editName(n,e){const a=this.optionValues[n];if(!a.locked&&!a.id){e.cancelBubble=!0,this.editingIndex=n;const i=this.nameInputs.get(n)?.nativeElement;setTimeout(()=>i?.focus())}}updateOption(n,e){const a=this.optionValues[n],i=e.target.value;a&&(i&&(a.name=i,this.edit.emit({index:n,option:a})),this.editingIndex=-1)}removeOption(n){n.locked||(this.formValue?(this.formValue=this.formValue?.filter(e=>e.name!==n.name),this.onChangeFn(this.formValue)):this.remove.emit(n))}handleKey(n){switch(n.key){case",":case"Enter":this.addOptionValue(),n.preventDefault();break;case"Backspace":this.lastSelected?(this.removeLastOption(),this.lastSelected=!1):""===this.input&&(this.lastSelected=!0);break;default:this.lastSelected=!1}}handleBlur(){this.isFocussed=!1,this.addOptionValue()}addOptionValue(){const n=this.parseInputIntoOptions(this.input).filter(e=>!(this.options??this.formValue)?.find(i=>i?.name===e.name));if(!this.formValue&&this.options)for(const e of n)this.add.emit(e);else this.formValue=(0,x.A)([...this.formValue,...n]),this.onChangeFn(this.formValue);this.input=""}parseInputIntoOptions(n){return n.split(/[,\n]/).map(e=>e.trim()).filter(e=>""!==e).map(e=>({name:e,locked:!1}))}removeLastOption(){if(this.optionValues.length){const n=this.optionValues[this.optionValues.length-1];this.removeOption(n)}}static{this.\u0275fac=function(e){return new(e||et)(t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:et,selectors:[["vdr-option-value-input"]],viewQuery:function(e,a){if(1&e&&(t.GBs(Vn,7),t.GBs(Sn,5,t.aKT)),2&e){let i;t.mGM(i=t.lsd())&&(a.textArea=i.first),t.mGM(i=t.lsd())&&(a.nameInputs=i)}},inputs:{groupName:"groupName",options:"options",disabled:"disabled"},outputs:{add:"add",remove:"remove",edit:"edit"},features:[t.Jv_([De])],decls:4,vars:5,consts:[["textArea",""],["editNameInput",""],[1,"input-wrapper",3,"click"],["class","chips",4,"ngIf"],[3,"keyup","focus","blur","ngModelChange","ngModel","disabled"],[1,"chips"],[3,"icon","selected","locked","colorFrom","iconClick",4,"ngFor","ngForOf"],[3,"iconClick","icon","colorFrom"],[3,"hidden"],["type","text",3,"blur","click","ngModel"],[1,"option-name",3,"click","hidden"]],template:function(e,a){if(1&e){const i=t.RV6();t.j41(0,"div",2),t.bIt("click",function(){t.eBV(i);const c=t.sdS(3);return t.Njj(c.focus())}),t.DNE(1,Nn,2,1,"div",3),t.j41(2,"textarea",4,0),t.bIt("keyup",function(c){return t.eBV(i),t.Njj(a.handleKey(c))})("focus",function(){return t.eBV(i),t.Njj(a.isFocussed=!0)})("blur",function(){return t.eBV(i),t.Njj(a.handleBlur())}),t.mxI("ngModelChange",function(c){return t.eBV(i),t.DH7(a.input,c)||(a.input=c),t.Njj(c)}),t.k0s()()}2&e&&(t.AVh("focus",a.isFocussed),t.R7$(),t.Y8G("ngIf",0<a.optionValues.length),t.R7$(),t.R50("ngModel",a.input),t.Y8G("disabled",a.disabled))},dependencies:[g.Sq,g.bT,d.me,d.BC,d.vS,Q.w,$.V],styles:[".input-wrapper[_ngcontent-%COMP%]{background-color:var(--color-form-input-bg);border-radius:3px!important;border:1px solid var(--color-grey-300)!important;cursor:text}.input-wrapper.focus[_ngcontent-%COMP%]{border-color:var(--color-primary-500)!important;box-shadow:0 0 1px 1px var(--color-primary-100)}.input-wrapper[_ngcontent-%COMP%] .chips[_ngcontent-%COMP%]{padding:5px}.input-wrapper[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{border:none;width:100%;height:24px;margin-top:3px;padding:0 6px}.input-wrapper[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]:focus{outline:none;box-shadow:none}.input-wrapper[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]:disabled{background-color:var(--color-component-bg-100)}vdr-chip[_ngcontent-%COMP%] .wrapper{margin:0 3px}vdr-chip.locked[_ngcontent-%COMP%]{opacity:.8}vdr-chip.selected[_ngcontent-%COMP%] .wrapper{border-color:var(--color-warning-500)!important;box-shadow:0 0 1px 1px var(--color-warning-400);opacity:.6}vdr-chip[_ngcontent-%COMP%] .option-name.editable[_ngcontent-%COMP%]:hover{outline:1px solid var(--color-component-bg-300);outline-offset:1px;border-radius:1px}vdr-chip[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{padding:0!important;margin-top:-2px;margin-bottom:-2px}"]})}}var Xt=p(3932);function An(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",19)(1,"vdr-form-field",20),t.nI1(2,"translate"),t.j41(3,"input",21),t.mxI("ngModelChange",function(i){const s=t.eBV(e).$implicit;return t.DH7(s.name,i)||(s.name=i),t.Njj(i)}),t.k0s()(),t.j41(4,"vdr-form-field",22),t.nI1(5,"translate"),t.j41(6,"vdr-option-value-input",23,0),t.bIt("add",function(i){const s=t.eBV(e).index,c=t.XpG();return t.Njj(c.addOption(s,i.name))})("remove",function(i){const s=t.eBV(e).index,c=t.XpG();return t.Njj(c.removeOption(s,i))}),t.k0s()(),t.j41(8,"div")(9,"button",24),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.removeOptionGroup(i))}),t.nrm(10,"clr-icon",25),t.k0s()()()}if(2&o){const e=n.$implicit;t.R7$(),t.Y8G("label",t.bMT(2,7,"catalog.option")),t.R7$(2),t.R50("ngModel",e.name),t.Y8G("readonly",!e.isNew),t.R7$(),t.Y8G("label",t.bMT(5,9,"catalog.option-values")),t.R7$(2),t.Y8G("options",e.values)("groupName",e.name)("disabled",""===e.name)}}function jn(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function Yn(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function Un(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function Ln(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.name," ")}}function Bn(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.sku," ")}}function wn(o,n){if(1&o&&(t.j41(0,"vdr-chip",28),t.EFF(1),t.k0s()),2&o){const e=n.ngIf,a=t.XpG(2).$implicit;t.Y8G("colorFrom",a.code),t.R7$(),t.JRh(e.name)}}function Xn(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",29)(1,"ng-select",30),t.bIt("change",function(i){t.eBV(e);const s=t.XpG().item,c=t.XpG().$implicit,m=t.XpG();return t.Njj(m.setOptionToAddToVariant(s.id,c.id,null==i?null:i.id))}),t.k0s(),t.j41(2,"button",31),t.bIt("click",function(){t.eBV(e);const i=t.XpG().item,s=t.XpG(2);return t.Njj(s.addOptionToVariant(i))}),t.nrm(3,"clr-icon",32),t.k0s()()}if(2&o){const e=t.XpG().item,a=t.XpG().$implicit,i=t.XpG();t.R7$(),t.Y8G("items",a.options),t.R7$(),t.AVh("primary",!(null==i.optionsToAddToVariant[e.id]||!i.optionsToAddToVariant[e.id][a.id])),t.Y8G("disabled",!(null!=i.optionsToAddToVariant[e.id]&&i.optionsToAddToVariant[e.id][a.id]))}}function Jn(o,n){if(1&o&&t.DNE(0,wn,2,2,"vdr-chip",27)(1,Xn,4,4,"ng-template",null,1,t.C5r),2&o){const e=n.item,a=t.sdS(2),i=t.XpG().$implicit,s=t.XpG();t.Y8G("ngIf",s.getOption(e,i.id))("ngIfElse",a)}}function Hn(o,n){if(1&o&&(t.j41(0,"vdr-dt2-column",26),t.DNE(1,Jn,3,2,"ng-template"),t.k0s()),2&o){const e=n.$implicit;t.Y8G("heading",e.name)("id",e.code)}}function Wn(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeCurrency")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.price,e.currencyCode)," ")}}function Kn(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeCurrency")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.priceWithTax,e.currencyCode)," ")}}function Qn(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",33),t.bIt("click",function(){const i=t.eBV(e).item,s=t.XpG();return t.Njj(s.deleteVariant(i))}),t.nrm(1,"clr-icon",34),t.k0s()}}class Zn{constructor(n){for(const e of Object.keys(n))this[e]=n[e]}}class Pt{constructor(n,e,a,i,s,c){this.route=n,this.dataService=e,this.productDetailService=a,this.notificationService=i,this.modalService=s,this.changeDetector=c,this.formValueChanged=!1,this.optionsChanged=!1,this.itemsPerPage=100,this.currentPage=1,this.searchTermControl=new d.MJ(""),this.selectionManager=new l.YlH({multiSelect:!0,itemsAreEqual:(m,_)=>m.id===_.id,additiveMode:!0}),this.optionsToAddToVariant={},this.refresh$=new Tt.B}ngOnInit(){this.languageCode=this.route.snapshot.paramMap.get("lang")||(0,l.WaW)(),this.dataService.settings.getActiveChannel().single$.subscribe(e=>{this.currencyCode=e.activeChannel.defaultCurrencyCode});const n=this.refresh$.pipe((0,C.n)(()=>this.dataService.product.getProductVariantsOptions(this.route.parent?.snapshot.paramMap.get("id")).mapSingle(e=>e.product)),(0,W.Z)(this.route.snapshot.data.product));this.variants$=n.pipe((0,C.n)(e=>this.searchTermControl.valueChanges.pipe((0,W.Z)(""),(0,f.T)(a=>a?e.variants.filter(i=>i.name.toLowerCase().includes(a.toLowerCase())):e.variants)))),this.optionGroups$=n.pipe((0,f.T)(e=>e.optionGroups)),this.totalItems$=this.variants$.pipe((0,f.T)(e=>e.length)),n.subscribe(e=>{this.product=e;const a=e.variants.map(s=>s.options.map(c=>c.id)).flat(),i=e.variants.map(s=>s.options.map(c=>c.groupId)).flat();this.optionGroups=e.optionGroups.map(s=>({id:s.id,isNew:!1,name:s.name,locked:i.includes(s.id),values:s.options.map(c=>({id:c.id,name:c.name,locked:a.includes(c.id)}))}))})}setItemsPerPage(n){this.itemsPerPage=n,this.currentPage=1}setPageNumber(n){this.currentPage=n}onFormChanged(n){this.formValueChanged=!0,n.enabled=!0}canDeactivate(){return!this.formValueChanged}addOptionGroup(){this.modalService.fromComponent(Rt,{locals:{languageCode:this.languageCode}}).pipe((0,C.n)(n=>n?this.dataService.product.createProductOptionGroups(n).pipe((0,C.n)(({createProductOptionGroup:e})=>this.dataService.product.addOptionGroupToProduct({optionGroupId:e.id,productId:this.product.id}))):E.w)).subscribe(n=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"ProductOptionGroup"}),this.refresh$.next(),this.changeDetector.markForCheck()})}removeOptionGroup(n){const e=n.id,a=this.product.variants.filter(i=>i.options.map(s=>s.groupId).includes(e)).length;this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-product-option-group"),body:a?(0,u.x)("catalog.confirm-delete-product-option-group-body"):"",translationVars:{name:n.name,count:a},buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(i=>i?this.dataService.product.removeOptionGroupFromProduct({optionGroupId:e,productId:this.product.id,force:!0}):E.w)).subscribe(({removeOptionGroupFromProduct:i})=>{"Product"===i.__typename?(this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"ProductOptionGroup"}),this.refresh$.next()):"ProductOptionInUseError"===i.__typename&&this.notificationService.error(i.message??"")})}addOption(n,e){const a=this.optionGroups[n];a&&a.id&&this.dataService.product.addOptionToGroup({productOptionGroupId:a.id,code:(0,S.J)(e,"-"),translations:[{name:e,languageCode:this.languageCode}]}).subscribe(({createProductOption:i})=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"ProductOption"}),this.refresh$.next()})}removeOption(n,{id:e,name:a}){const i=this.optionGroups[n];i&&this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-product-option"),translationVars:{name:a},buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(s=>s?this.dataService.product.deleteProductOption(e):E.w)).subscribe(({deleteProductOption:s})=>{s.result===l.syg.DELETED?(this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"ProductOption"}),i.values=i.values.filter(c=>c.id!==e),this.refresh$.next()):this.notificationService.error(s.message??"")})}setOptionToAddToVariant(n,e,a){this.optionsToAddToVariant[n]||(this.optionsToAddToVariant[n]={}),a?this.optionsToAddToVariant[n][e]=a:delete this.optionsToAddToVariant[n][e]}addOptionToVariant(n){const e=[...n.options.map(a=>a.id),...Object.values(this.optionsToAddToVariant[n.id])];this.dataService.product.updateProductVariants([{id:n.id,optionIds:(0,x.A)(e)}]).subscribe(({updateProductVariants:a})=>{this.refresh$.next()})}deleteVariant(n){this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-product-variant"),translationVars:{name:n.name},buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(e=>e?this.productDetailService.deleteProductVariant(n.id,this.product.id):E.w)).subscribe(()=>{this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"ProductVariant"}),this.refresh$.next()},e=>{this.notificationService.error((0,u.x)("common.notify-delete-error"),{entity:"ProductVariant"})})}createNewVariant(){this.modalService.fromComponent(Ft,{locals:{product:this.product}}).pipe((0,C.n)(n=>n?this.dataService.product.createProductVariants([n]):E.w)).subscribe(n=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"ProductVariant"}),this.refresh$.next()})}getOption(n,e){return n.options.find(a=>a.groupId===e)}static{this.\u0275fac=function(e){return new(e||Pt)(t.rXU(P.nX),t.rXU(l.uSP),t.rXU(J),t.rXU(l.JEu),t.rXU(l.Bg8),t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:Pt,selectors:[["vdr-product-variants-editor"]],decls:44,vars:55,consts:[["optionValueInputComponent",""],["selectOption",""],["class","option-groups",4,"ngFor","ngForOf"],[1,"button","mt-1",3,"click"],["shape","plus"],[3,"paddingX"],[1,"mx-3"],[1,"button",3,"click"],["id","manage-product-variant-list",3,"pageChange","itemsPerPageChange","items","itemsPerPage","totalItems","currentPage"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","name",3,"heading","optional"],["id","sku",3,"heading","optional"],[3,"heading","id",4,"ngFor","ngForOf"],["id","price",3,"heading","hiddenByDefault"],["id","price-with-tax",3,"heading","hiddenByDefault"],["id","delete",3,"heading","optional"],[1,"option-groups"],[3,"label"],["clrInput","","name","name",3,"ngModelChange","ngModel","readonly"],[1,"flex-spacer",3,"label"],[3,"add","remove","options","groupName","disabled"],[1,"button-small","mt-4",3,"click"],["shape","trash"],[3,"heading","id"],[3,"colorFrom",4,"ngIf","ngIfElse"],[3,"colorFrom"],[1,"flex","center"],["bindLabel","name","bindValue","id","appendTo","body",3,"change","items"],[1,"button-small","ml-1",3,"click","disabled"],["shape","floppy"],[1,"button-small",3,"click"],["shape","trash is-danger"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-card"),t.DNE(2,An,11,11,"div",2),t.j41(3,"button",3),t.bIt("click",function(){return a.addOptionGroup()}),t.nrm(4,"clr-icon",4),t.EFF(5),t.nI1(6,"translate"),t.k0s()(),t.j41(7,"vdr-card",5)(8,"div",6)(9,"button",7),t.bIt("click",function(){return a.createNewVariant()}),t.nrm(10,"clr-icon",4),t.EFF(11),t.nI1(12,"translate"),t.k0s()(),t.j41(13,"vdr-data-table-2",8),t.nI1(14,"async"),t.nI1(15,"async"),t.bIt("pageChange",function(s){return a.setPageNumber(s)})("itemsPerPageChange",function(s){return a.setItemsPerPage(s)}),t.nrm(16,"vdr-dt2-search",9),t.nI1(17,"translate"),t.j41(18,"vdr-dt2-column",10),t.nI1(19,"translate"),t.DNE(20,jn,1,1,"ng-template"),t.k0s(),t.j41(21,"vdr-dt2-column",11),t.nI1(22,"translate"),t.DNE(23,Yn,2,4,"ng-template"),t.k0s(),t.j41(24,"vdr-dt2-column",12),t.nI1(25,"translate"),t.DNE(26,Un,2,4,"ng-template"),t.k0s(),t.j41(27,"vdr-dt2-column",13),t.nI1(28,"translate"),t.DNE(29,Ln,1,1,"ng-template"),t.k0s(),t.j41(30,"vdr-dt2-column",14),t.nI1(31,"translate"),t.DNE(32,Bn,1,1,"ng-template"),t.k0s(),t.DNE(33,Hn,2,2,"vdr-dt2-column",15),t.nI1(34,"async"),t.j41(35,"vdr-dt2-column",16),t.nI1(36,"translate"),t.DNE(37,Wn,2,4,"ng-template"),t.k0s(),t.j41(38,"vdr-dt2-column",17),t.nI1(39,"translate"),t.DNE(40,Kn,2,4,"ng-template"),t.k0s(),t.j41(41,"vdr-dt2-column",18),t.nI1(42,"translate"),t.DNE(43,Qn,2,0,"ng-template"),t.k0s()()()()),2&e&&(t.R7$(2),t.Y8G("ngForOf",a.optionGroups),t.R7$(3),t.SpI(" ",t.bMT(6,27,"catalog.create-product-option-group")," "),t.R7$(2),t.Y8G("paddingX",!1),t.R7$(4),t.SpI(" ",t.bMT(12,29,"catalog.create-product-variant")," "),t.R7$(2),t.Y8G("items",t.bMT(14,31,a.variants$))("itemsPerPage",a.itemsPerPage)("totalItems",t.bMT(15,33,a.totalItems$))("currentPage",a.currentPage),t.R7$(3),t.Y8G("searchTermControl",a.searchTermControl)("searchTermPlaceholder",t.bMT(17,35,"catalog.filter-by-name")),t.R7$(2),t.Y8G("heading",t.bMT(19,37,"common.id"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(22,39,"common.created-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(25,41,"common.updated-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(28,43,"catalog.name"))("optional",!1),t.R7$(3),t.Y8G("heading",t.bMT(31,45,"catalog.sku"))("optional",!1),t.R7$(3),t.Y8G("ngForOf",t.bMT(34,47,a.optionGroups$)),t.R7$(2),t.Y8G("heading",t.bMT(36,49,"common.price"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(39,51,"common.price-with-tax"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(42,53,"common.delete"))("optional",!1))},dependencies:[b.U4n,b.icl,g.Sq,g.bT,d.me,d.BC,d.vS,te.vr,Q.w,L.K,$.V,Ct.I,z.Y,dt.E,A.e,lt.i,et,g.Jj,T.D9,ct.P,Xt.u],styles:[".option-groups[_ngcontent-%COMP%]{display:flex;width:100%;gap:var(--space-unit)}.values[_ngcontent-%COMP%]{flex:1;margin:0 6px}.variants-preview[_ngcontent-%COMP%] tr.disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100);color:var(--color-grey-400)}"]})}}class Dt extends l.fJp{constructor(n,e){super(n,{__typename:"Product",id:"",createdAt:"",updatedAt:"",name:"",languageCode:"",optionGroups:[],variants:[]},a=>e.product.getProductVariantsOptions(a).mapStream(i=>i.product))}static{this.\u0275fac=function(e){return new(e||Dt)(t.KVO(P.Ix),t.KVO(l.uSP))}}static{this.\u0275prov=t.jDH({token:Dt,factory:Dt.\u0275fac,providedIn:"root"})}}const ke=o=>[{path:"products",component:l.H1b,data:{locationId:"product-list",breadcrumb:(0,u.x)("breadcrumb.products")},children:o.getPageTabRoutes("product-list")},{path:"inventory",redirectTo:"products"},{path:"products/:id",component:l.H1b,data:{locationId:"product-detail",breadcrumb:{label:(0,u.x)("breadcrumb.products"),link:["../","products"]}},children:[{path:"manage-variants",component:Pt,canDeactivate:[l.N3W],data:{breadcrumb:({product:n})=>[{label:`${n.name}`,link:["../"]},{label:(0,u.x)("breadcrumb.manage-variants"),link:["manage-variants"]}]},resolve:{product:n=>(0,t.WQX)(l.uSP).product.getProductVariantsOptions(n.parent?.params.id).mapSingle(e=>e.product)}},...o.getPageTabRoutes("product-detail")]},{path:"products/:productId/variants/:id",component:l.H1b,data:{locationId:"product-variant-detail",breadcrumb:{label:(0,u.x)("breadcrumb.products"),link:["../","products"]}},children:o.getPageTabRoutes("product-variant-detail")},{path:"products/:id/options",component:It,resolve:(0,l.b0x)(Dt),canDeactivate:[l.N3W],data:{breadcrumb:Ge}},{path:"facets",component:l.H1b,data:{locationId:"facet-list",breadcrumb:(0,u.x)("breadcrumb.facets")},children:o.getPageTabRoutes("facet-list")},{path:"facets/:id",component:l.H1b,data:{locationId:"facet-detail",breadcrumb:{label:(0,u.x)("breadcrumb.facets"),link:["../","facets"]}},children:o.getPageTabRoutes("facet-detail")},{path:"collections",component:l.H1b,data:{locationId:"collection-list",breadcrumb:(0,u.x)("breadcrumb.collections")},children:o.getPageTabRoutes("collection-list")},{path:"collections/:id",component:l.H1b,data:{locationId:"collection-detail",breadcrumb:{label:(0,u.x)("breadcrumb.collections"),link:["../","collections"]}},children:o.getPageTabRoutes("collection-detail")},{path:"assets",component:l.H1b,data:{locationId:"asset-list",breadcrumb:(0,u.x)("breadcrumb.assets")},children:o.getPageTabRoutes("asset-list")},{path:"assets/:id",component:l.H1b,data:{locationId:"asset-detail",breadcrumb:{label:(0,u.x)("breadcrumb.assets"),link:["../","assets"]}},children:o.getPageTabRoutes("asset-detail")}];function Ge(o,n){return o.entity.pipe((0,f.T)(e=>[{label:(0,u.x)("breadcrumb.products"),link:["../","products"]},{label:`${e.name}`,link:["../","products",n.id]},{label:(0,u.x)("breadcrumb.product-options"),link:["options"]}]))}var Ee=p(6699);function zn(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.add-facets"))}function qn(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",3),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",4),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.selectValues())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",0===e.selectedValues.length),t.R7$(),t.SpI(" ",t.bMT(5,5,"catalog.add-facets")," ")}}class pt{constructor(n){this.changeDetector=n,this.selectedValues=[]}ngAfterViewInit(){setTimeout(()=>this.selector.focus(),0)}selectValues(){this.resolveWith(this.selectedValues)}cancel(){this.resolveWith()}static{this.\u0275fac=function(e){return new(e||pt)(t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:pt,selectors:[["vdr-apply-facet-dialog"]],viewQuery:function(e,a){if(1&e&&t.GBs(l.boc,5),2&e){let i;t.mGM(i=t.lsd())&&(a.selector=i.first)}},decls:3,vars:0,consts:[["vdrDialogTitle",""],[3,"selectedValuesChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){1&e&&(t.DNE(0,zn,2,3,"ng-template",0),t.j41(1,"vdr-facet-value-selector",1),t.bIt("selectedValuesChange",function(s){return a.selectedValues=s}),t.k0s(),t.DNE(2,qn,6,7,"ng-template",2))},dependencies:[Ee.b,tt.b,K.M,T.D9],changeDetection:0})}}var M=p(2985),nt=p(3869),to=p(3620),ot=p(7395);const eo=()=>["UpdateCatalog","UpdateAsset"];function no(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",3),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",e.detailForm.invalid||e.detailForm.pristine),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}const oo=M.J1`
|
|
2
|
+
query AssetDetailQuery($id: ID!) {
|
|
3
|
+
asset(id: $id) {
|
|
4
|
+
...Asset
|
|
5
|
+
tags {
|
|
6
|
+
...Tag
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
${l.eqi}
|
|
11
|
+
${l.I$f}
|
|
12
|
+
`;class kt extends l.wi7{constructor(n,e,a){super(),this.notificationService=n,this.dataService=e,this.formBuilder=a,this.customFields=this.getCustomFieldConfig("Asset"),this.detailForm=new d.gE({name:new d.MJ(""),tags:new d.MJ([]),customFields:this.formBuilder.group((0,l.HCD)(this.customFields))})}ngOnInit(){this.init()}ngOnDestroy(){this.destroy()}onAssetChange(n){this.detailForm.get("name")?.setValue(n.name),this.detailForm.get("tags")?.setValue(n.tags),this.detailForm.markAsDirty()}save(){this.dataService.product.updateAsset({id:this.id,name:this.detailForm.value.name,tags:this.detailForm.value.tags,customFields:this.detailForm.value.customFields}).subscribe(()=>{this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"Asset"})},n=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"Asset"})})}setFormValues(n,e){this.detailForm.get("name")?.setValue(n.name),this.detailForm.get("tags")?.setValue(n.tags.map(a=>a.id)),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n)}static{this.\u0275fac=function(e){return new(e||kt)(t.rXU(l.JEu),t.rXU(l.uSP),t.rXU(d.ze))}}static{this.\u0275cmp=t.VBU({type:kt,selectors:[["vdr-asset-detail"]],features:[t.Vt3],decls:10,vars:8,consts:[["locationId","asset-detail"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"assetChange","asset","editable","customFields","customFieldsForm"],[1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-action-bar"),t.nrm(2,"vdr-ab-left"),t.j41(3,"vdr-ab-right"),t.nrm(4,"vdr-action-bar-items",0),t.DNE(5,no,3,4,"button",1),t.nrm(6,"vdr-action-bar-dropdown-menu",0),t.k0s()()(),t.j41(7,"vdr-page-block")(8,"vdr-asset-preview",2),t.nI1(9,"async"),t.bIt("assetChange",function(s){return a.onAssetChange(s)}),t.k0s()()),2&e&&(t.R7$(5),t.Y8G("vdrIfPermissions",t.lJ4(7,eo)),t.R7$(3),t.Y8G("asset",t.bMT(9,5,a.entity$))("editable",!0)("customFields",a.customFields)("customFieldsForm",a.detailForm.get("customFields")))},dependencies:[R.nG,R.wL,R.TX,nt.l,to.E,X.p,ot.T,A.e,g.Jj,T.D9],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}"],changeDetection:0})}}var j=p(2612),ut=p(5168),Jt=p(4361),Me=p(2492),ao=p(401),_e=p(6755),ge=p(3283),io=p(8005),ro=p(4523),ne=p(1606);const so=()=>({}),lo=()=>["DeleteCatalog","DeleteAsset"];class Gt extends l.pDf{constructor(n,e,a,i,s){super(i,s),this.notificationService=n,this.modalService=e,this.dataService=a,this.searchTerm$=new j.t(void 0),this.filterByTags$=new j.t(void 0),this.uploading=!1,super.setQueryFn((...c)=>this.dataService.product.getAssetList(...c).refetchOnChannelChange(),c=>c.assets,(c,m)=>{const _=this.searchTerm$.value,h=this.filterByTags$.value?.map(v=>v.value);return{options:{skip:c,take:m,..._?{filter:{name:{contains:_}}}:{},sort:{createdAt:l.xBQ.DESC},tags:h,tagsOperator:l.umn.AND}}},{take:25,skip:0})}ngOnInit(){super.ngOnInit(),this.paginationConfig$=(0,D.z)(this.itemsPerPage$,this.currentPage$,this.totalItems$).pipe((0,f.T)(([n,e,a])=>({itemsPerPage:n,currentPage:e,totalItems:a}))),this.searchTerm$.pipe((0,ut.B)(250),(0,Jt.Q)(this.destroy$)).subscribe(()=>this.refresh()),this.filterByTags$.pipe((0,Jt.Q)(this.destroy$)).subscribe(()=>this.refresh()),this.allTags$=this.dataService.product.getTagList().mapStream(n=>n.tags.items)}filesSelected(n){n.length&&(this.uploading=!0,this.dataService.product.createAssets(n).pipe((0,Me.j)(()=>this.uploading=!1)).subscribe(({createAssets:e})=>{let a=0;for(const i of e)switch(i.__typename){case"Asset":a++;break;case"MimeTypeError":this.notificationService.error(i.message)}0<a&&(super.refresh(),this.notificationService.success((0,u.x)("asset.notify-create-assets-success"),{count:a}))}))}deleteAssets(n){this.showModalAndDelete(n.map(e=>e.id)).pipe((0,C.n)(e=>e.result===l.syg.DELETED?[!0]:this.showModalAndDelete(n.map(a=>a.id),e.message||"").pipe((0,f.T)(a=>a.result===l.syg.DELETED)))).subscribe(()=>{this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"Assets"}),this.refresh()},e=>{this.notificationService.error((0,u.x)("common.notify-delete-error"),{entity:"Assets"})})}showModalAndDelete(n,e){return this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-assets"),translationVars:{count:n.length},body:e,buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(a=>a?this.dataService.product.deleteAssets(n,!!e):E.w),(0,f.T)(a=>a.deleteAssets))}static{this.\u0275fac=function(e){return new(e||Gt)(t.rXU(l.JEu),t.rXU(l.Bg8),t.rXU(l.uSP),t.rXU(P.Ix),t.rXU(P.nX))}}static{this.\u0275cmp=t.VBU({type:Gt,selectors:[["vdr-asset-list"]],features:[t.Vt3],decls:17,vars:30,consts:[[1,"my-2"],[3,"searchTermChange","tagsChange","tags"],["dropZoneTarget",".content-area",3,"selectFiles","uploading"],[3,"deleteAssets","assets","multiSelect","canDelete"],[1,"paging-controls"],[3,"itemsPerPageChange","itemsPerPage"],[3,"pageChange","currentPage","itemsPerPage","totalItems"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"div",0)(2,"vdr-asset-search-input",1),t.nI1(3,"async"),t.bIt("searchTermChange",function(s){return a.searchTerm$.next(s)})("tagsChange",function(s){return a.filterByTags$.next(s)}),t.j41(4,"vdr-asset-file-input",2),t.bIt("selectFiles",function(s){return a.filesSelected(s)}),t.k0s()()(),t.j41(5,"vdr-asset-gallery",3),t.nI1(6,"async"),t.nI1(7,"async"),t.nI1(8,"paginate"),t.nI1(9,"hasPermission"),t.bIt("deleteAssets",function(s){return a.deleteAssets(s)}),t.k0s(),t.j41(10,"div",4)(11,"vdr-items-per-page-controls",5),t.nI1(12,"async"),t.bIt("itemsPerPageChange",function(s){return a.setItemsPerPage(s)}),t.k0s(),t.j41(13,"vdr-pagination-controls",6),t.nI1(14,"async"),t.nI1(15,"async"),t.nI1(16,"async"),t.bIt("pageChange",function(s){return a.setPageNumber(s)}),t.k0s()()()),2&e&&(t.R7$(2),t.Y8G("tags",t.bMT(3,9,a.allTags$)),t.R7$(2),t.Y8G("uploading",a.uploading),t.R7$(),t.Y8G("assets",t.i5U(8,15,t.bMT(6,11,a.items$),t.bMT(7,13,a.paginationConfig$)||t.lJ4(28,so)))("multiSelect",!0)("canDelete",t.bMT(9,18,t.lJ4(29,lo))),t.R7$(6),t.Y8G("itemsPerPage",t.bMT(12,20,a.itemsPerPage$)),t.R7$(2),t.Y8G("currentPage",t.bMT(14,22,a.currentPage$))("itemsPerPage",t.bMT(15,24,a.itemsPerPage$))("totalItems",t.bMT(16,26,a.totalItems$)))},dependencies:[ao.o,_e.w,ge.e,io.k,ro.u,A.e,g.Jj,ne.kf,q.E],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}vdr-asset-gallery[_ngcontent-%COMP%]{flex:1}.paging-controls[_ngcontent-%COMP%]{padding-top:6px;border-top:1px solid var(--color-component-border-100);display:flex;justify-content:space-between}.search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"]})}}var co=p(5945),he=p(141),Oe=p(7663),po=p(7555),$e=p(1530);const ye=o=>({channel:o}),uo=o=>({channelCode:o});function mo(o,n){1&o&&(t.qex(0),t.EFF(1),t.nI1(2,"translate"),t.bVm()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.assign-variants-to-channel")))}function _o(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.assign-products-to-channel"))}function go(o,n){if(1&o&&t.DNE(0,mo,3,3,"ng-container",14)(1,_o,2,3,"ng-template",null,1,t.C5r),2&o){const e=t.sdS(2),a=t.XpG();t.Y8G("ngIf",a.isProductVariantMode)("ngIfElse",e)}}function ho(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o){const e=t.XpG();t.SpI(" ",t.i5U(1,1,"catalog.price-in-channel",t.eq3(4,ye,null==e.selectedChannel?null:e.selectedChannel.code))," ")}}function fo(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.no-channel-selected")," ")}function vo(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeCurrency")),2&o){const e=t.XpG().$implicit,a=t.XpG();t.SpI(" ",t.i5U(1,1,e.pricePreview,null==a.selectedChannel?null:a.selectedChannel.defaultCurrencyCode)," ")}}function bo(o,n){1&o&&t.EFF(0," - ")}function Co(o,n){if(1&o&&(t.j41(0,"tr")(1,"td"),t.EFF(2),t.k0s(),t.j41(3,"td"),t.EFF(4),t.nI1(5,"localeCurrency"),t.k0s(),t.j41(6,"td"),t.DNE(7,vo,2,4,"ng-template",11)(8,bo,1,0,"ng-template",null,2,t.C5r),t.k0s()()),2&o){const e=n.$implicit,a=t.sdS(9),i=t.XpG();t.R7$(2),t.JRh(e.name),t.R7$(2),t.JRh(t.i5U(5,4,e.price,null==i.currentChannel?null:i.currentChannel.defaultCurrencyCode)),t.R7$(3),t.Y8G("ngIf",i.selectedChannel)("ngIfElse",a)}}function Io(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o){const e=t.XpG(2);t.SpI(" ",t.i5U(1,1,"catalog.assign-to-named-channel",t.eq3(4,uo,null==e.selectedChannel?null:e.selectedChannel.code))," ")}}function To(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.no-channel-selected")," ")}function Ro(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",15),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",16),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.assign())}),t.DNE(4,Io,2,6,"ng-template",11)(5,To,2,3,"ng-template",null,0,t.C5r),t.k0s()}if(2&o){const e=t.sdS(6),a=t.XpG();t.R7$(),t.JRh(t.bMT(2,4,"common.cancel")),t.R7$(2),t.Y8G("disabled",!a.selectedChannel),t.R7$(),t.Y8G("ngIf",a.selectedChannel)("ngIfElse",e)}}class Z{get isProductVariantMode(){return null!=this.productVariantIds}constructor(n,e){this.dataService=n,this.notificationService=e,this.priceFactorControl=new d.hs(1),this.selectedChannelIdControl=new d.hs}ngOnInit(){const n=this.dataService.client.userStatus().mapSingle(({userStatus:a})=>a.activeChannelId),e=this.dataService.settings.getChannels().mapSingle(a=>a.channels);(0,D.z)(n,e).subscribe(([a,i])=>{this.currentChannel=i.items.find(s=>s.id===a),this.availableChannels=i.items}),this.selectedChannelIdControl.valueChanges.subscribe(a=>{this.selectChannel(a)}),this.variantsPreview$=(0,D.z)((0,he.H)(this.getTopVariants(10)),this.priceFactorControl.valueChanges.pipe((0,W.Z)(1))).pipe((0,f.T)(([a,i])=>a.map(s=>({id:s.id,name:s.name,price:s.price,pricePreview:s.price*+i}))))}selectChannel(n){this.selectedChannel=this.availableChannels.find(e=>e.id===n[0])}assign(){const n=this.selectedChannel;n&&(this.isProductVariantMode?this.productVariantIds&&this.dataService.product.assignVariantsToChannel({channelId:n.id,productVariantIds:this.productVariantIds,priceFactor:+this.priceFactorControl.value}).subscribe(()=>{this.notificationService.success((0,u.x)("catalog.assign-variant-to-channel-success"),{channel:n.code,count:this.productVariantIds.length}),this.resolveWith(!0)}):this.dataService.product.assignProductsToChannel({channelId:n.id,productIds:this.productIds,priceFactor:+this.priceFactorControl.value}).subscribe(()=>{this.notificationService.success((0,u.x)("catalog.assign-product-to-channel-success"),{channel:n.code,count:this.productIds.length}),this.resolveWith(!0)}))}cancel(){this.resolveWith()}getTopVariants(n){var e=this;return(0,co.A)(function*(){return(yield(0,Oe.s)(e.dataService.product.getProductVariants({filterOperator:l.umn.OR,filter:{productId:{in:e.productIds},id:{in:e.productVariantIds}},take:n}).single$)).productVariants.items})()}static{this.\u0275fac=function(e){return new(e||Z)(t.rXU(l.uSP),t.rXU(l.JEu))}}static{this.\u0275cmp=t.VBU({type:Z,selectors:[["vdr-assign-products-to-channel-dialog"]],decls:36,vars:32,consts:[["noSelection",""],["productModeTitle",""],["noChannelSelected",""],["vdrDialogTitle",""],[1,"flex"],["clrInput","",3,"multiple","includeDefaultChannel","disableChannelIds","formControl"],[1,"flex-spacer"],["clrInput","","type","number","min","0","max","99999",3,"formControl"],[1,"channel-price-preview"],[1,"clr-control-label"],[1,"table"],[3,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],["vdrDialogButtons",""],[4,"ngIf","ngIfElse"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){if(1&e&&(t.DNE(0,go,3,2,"ng-template",3),t.j41(1,"div",4)(2,"clr-input-container")(3,"label"),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.nrm(6,"vdr-channel-assignment-control",5),t.k0s(),t.nrm(7,"div",6),t.j41(8,"clr-input-container")(9,"label"),t.EFF(10),t.nI1(11,"translate"),t.k0s(),t.nrm(12,"input",7),t.k0s()(),t.j41(13,"div",8)(14,"label",9),t.EFF(15),t.nI1(16,"translate"),t.k0s(),t.j41(17,"table",10)(18,"thead")(19,"tr")(20,"th"),t.EFF(21),t.nI1(22,"translate"),t.k0s(),t.j41(23,"th"),t.EFF(24),t.nI1(25,"channelCodeToLabel"),t.nI1(26,"translate"),t.nI1(27,"translate"),t.k0s(),t.j41(28,"th"),t.DNE(29,ho,2,6,"ng-template",11)(30,fo,2,3,"ng-template",null,0,t.C5r),t.k0s()()(),t.j41(32,"tbody"),t.DNE(33,Co,10,7,"tr",12),t.nI1(34,"async"),t.k0s()()(),t.DNE(35,Ro,7,6,"ng-template",13)),2&e){const i=t.sdS(31);t.R7$(4),t.JRh(t.bMT(5,13,"common.channel")),t.R7$(2),t.Y8G("multiple",!1)("includeDefaultChannel",!1)("disableChannelIds",a.currentChannelIds)("formControl",a.selectedChannelIdControl),t.R7$(4),t.JRh(t.bMT(11,15,"catalog.price-conversion-factor")),t.R7$(2),t.Y8G("formControl",a.priceFactorControl),t.R7$(3),t.JRh(t.bMT(16,17,"catalog.channel-price-preview")),t.R7$(6),t.JRh(t.bMT(22,19,"common.name")),t.R7$(3),t.SpI(" ",t.i5U(27,25,"catalog.price-in-channel",t.eq3(30,ye,t.bMT(26,23,t.bMT(25,21,null==a.currentChannel?null:a.currentChannel.code))))," "),t.R7$(5),t.Y8G("ngIf",a.selectedChannel)("ngIfElse",i),t.R7$(4),t.Y8G("ngForOf",t.bMT(34,28,a.variantsPreview$))}},dependencies:[b.aZZ,b.icl,b.Xu5,g.Sq,g.bT,d.me,d.Q0,d.BC,d.VZ,d.zX,d.l_,$.V,tt.b,K.M,po.$,g.Jj,T.D9,$e.i,Xt.u],styles:["vdr-channel-assignment-control[_ngcontent-%COMP%]{min-width:200px}.channel-price-preview[_ngcontent-%COMP%]{margin-top:24px}.channel-price-preview[_ngcontent-%COMP%] table.table[_ngcontent-%COMP%]{margin-top:6px}"],changeDetection:0})}}const Ve=M.J1`
|
|
13
|
+
query GetProductsWithFacetValuesByIds($ids: [String!]!) {
|
|
14
|
+
products(options: { filter: { id: { in: $ids } } }) {
|
|
15
|
+
items {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
facetValues {
|
|
19
|
+
id
|
|
20
|
+
name
|
|
21
|
+
code
|
|
22
|
+
facet {
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
code
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`,Se=M.J1`
|
|
32
|
+
query GetVariantsWithFacetValuesByIds($ids: [String!]!) {
|
|
33
|
+
productVariants(options: { filter: { id: { in: $ids } } }) {
|
|
34
|
+
items {
|
|
35
|
+
id
|
|
36
|
+
name
|
|
37
|
+
sku
|
|
38
|
+
facetValues {
|
|
39
|
+
id
|
|
40
|
+
name
|
|
41
|
+
code
|
|
42
|
+
facet {
|
|
43
|
+
id
|
|
44
|
+
name
|
|
45
|
+
code
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`,xe=M.J1`
|
|
52
|
+
mutation UpdateProductsBulk($input: [UpdateProductInput!]!) {
|
|
53
|
+
updateProducts(input: $input) {
|
|
54
|
+
id
|
|
55
|
+
name
|
|
56
|
+
facetValues {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
code
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`,Ne=M.J1`
|
|
64
|
+
mutation UpdateVariantsBulk($input: [UpdateProductVariantInput!]!) {
|
|
65
|
+
updateProductVariants(input: $input) {
|
|
66
|
+
id
|
|
67
|
+
name
|
|
68
|
+
facetValues {
|
|
69
|
+
id
|
|
70
|
+
name
|
|
71
|
+
code
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;var oe=p(5577);function Fo(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.edit-facet-values"),"\n")}function Po(o,n){if(1&o&&(t.j41(0,"div",14),t.EFF(1),t.k0s()),2&o){const e=t.XpG().$implicit;t.R7$(),t.JRh(e.sku)}}function Do(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-facet-value-chip",15),t.bIt("remove",function(){const i=t.eBV(e).$implicit,s=t.XpG().$implicit,c=t.XpG(2);return t.Njj(c.removeFacetValue(s,i.id))}),t.k0s()}if(2&o){const e=n.$implicit;t.Y8G("facetValue",e)}}function ko(o,n){if(1&o&&(t.j41(0,"tr")(1,"td",10)(2,"div"),t.EFF(3),t.k0s(),t.DNE(4,Po,2,1,"div",11),t.k0s(),t.j41(5,"td",12),t.DNE(6,Do,1,1,"vdr-facet-value-chip",13),t.k0s()()),2&o){const e=n.$implicit;t.R7$(3),t.JRh(e.name),t.R7$(),t.Y8G("ngIf",e.sku),t.R7$(2),t.Y8G("ngForOf",e.facetValues)}}function Go(o,n){if(1&o&&(t.j41(0,"table",8)(1,"tbody"),t.DNE(2,ko,7,3,"tr",9),t.k0s()()),2&o){const e=t.XpG();t.R7$(2),t.Y8G("ngForOf",e.items)}}function Eo(o,n){1&o&&(t.j41(0,"div",16),t.nrm(1,"clr-spinner"),t.k0s())}function Mo(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",17),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",18),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.addFacetValues())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",0===e.selectedValues.length&&!1===e.facetValuesRemoved),t.R7$(),t.SpI(" ",t.bMT(5,5,"common.update")," ")}}class mt{constructor(n,e){this.dataService=n,this.changeDetectorRef=e,this.mode="product",this.state="loading",this.selectedValues=[],this.items=[],this.facetValuesRemoved=!1}ngOnInit(){const n="product"===this.mode?this.dataService.query(Ve,{ids:this.ids??[]}).mapSingle(({products:e})=>e.items.map(a=>({...a,facetValues:[...a.facetValues]}))):this.dataService.query(Se,{ids:this.ids??[]}).mapSingle(({productVariants:e})=>e.items.map(a=>({...a,facetValues:[...a.facetValues]})));this.subscription=n.subscribe({next:e=>{this.items=e,this.state="ready",this.changeDetectorRef.markForCheck()}})}ngOnDestroy(){this.subscription?.unsubscribe()}cancel(){this.resolveWith()}removeFacetValue(n,e){n.facetValues=n.facetValues.filter(a=>a.id!==e),this.facetValuesRemoved=!0}addFacetValues(){const n=this.selectedValues.map(a=>a.id);return this.state="saving",("product"===this.mode?this.dataService.mutate(xe,{input:this.items?.map(a=>({id:a.id,facetValueIds:(0,x.A)([...a.facetValues.map(i=>i.id),...n])}))}):this.dataService.mutate(Ne,{input:this.items?.map(a=>({id:a.id,facetValueIds:(0,x.A)([...a.facetValues.map(i=>i.id),...n])}))})).subscribe(a=>{this.resolveWith(this.selectedValues)})}static{this.\u0275fac=function(e){return new(e||mt)(t.rXU(l.uSP),t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:mt,selectors:[["vdr-bulk-add-facet-values-dialog"]],decls:11,vars:5,consts:[["placeholder",""],["vdrDialogTitle",""],[1,"flex"],[1,"flex","center"],[1,"mr2"],[3,"selectedValuesChange"],["class","table",4,"ngIf","ngIfElse"],["vdrDialogButtons",""],[1,"table"],[4,"ngFor","ngForOf"],[1,"left","align-middle"],["class","sku",4,"ngIf"],[1,"left"],[3,"facetValue","remove",4,"ngFor","ngForOf"],[1,"sku"],[3,"remove","facetValue"],[1,"loading"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){if(1&e){const i=t.RV6();t.DNE(0,Fo,2,3,"ng-template",1),t.j41(1,"div",2)(2,"div",3)(3,"div",4),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.j41(6,"vdr-facet-value-selector",5),t.bIt("selectedValuesChange",function(c){return t.eBV(i),t.Njj(a.selectedValues=c)}),t.k0s()()(),t.DNE(7,Go,3,1,"table",6)(8,Eo,2,0,"ng-template",null,0,t.C5r)(10,Mo,6,7,"ng-template",7)}if(2&e){const i=t.sdS(9);t.R7$(4),t.SpI(" ",t.bMT(5,3,"catalog.add-facet-value")," "),t.R7$(3),t.Y8G("ngIf","loading"!==a.state)("ngIfElse",i)}},dependencies:[b.BkK,g.Sq,g.bT,Ee.b,oe.K,tt.b,K.M,T.D9],styles:[".loading[_ngcontent-%COMP%]{min-height:25vh;display:flex;justify-content:center;align-items:center}.sku[_ngcontent-%COMP%]{color:var(--color-text-300)}"],changeDetection:0})}}var Y=p(9942),fe=p(740),Oo=p(1221);const $o=o=>({$implicit:o}),yo=o=>["/catalog/products",o];function Vo(o,n){1&o&&t.eu8(0)}function So(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function xo(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function No(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function Ao(o,n){if(1&o&&(t.j41(0,"a",11)(1,"span"),t.EFF(2),t.k0s(),t.nrm(3,"clr-icon",12),t.k0s()),2&o){const e=n.item;t.Y8G("routerLink",t.eq3(2,yo,e.productId)),t.R7$(2),t.JRh(e.name)}}function jo(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.sku," ")}}class _t{constructor(n,e,a){this.route=n,this.router=e,this.dataService=a,this.previewUpdatedFilters=!1,this.filterTermControl=new d.hs(""),this.isLoading=!1,this.collectionIdChange$=new j.t(""),this.parentIdChange$=new j.t(""),this.filterChanges$=new j.t([]),this.inheritFiltersChanges$=new j.t(!0),this.refresh$=new j.t(!0),this.destroy$=new Tt.B}ngOnInit(){this.contentsCurrentPage$=this.route.queryParamMap.pipe((0,f.T)(c=>c.get("contentsPage")),(0,f.T)(c=>c?+c:1),(0,W.Z)(1),(0,Y.F)()),this.contentsItemsPerPage$=this.route.queryParamMap.pipe((0,f.T)(c=>c.get("contentsPerPage")),(0,f.T)(c=>c?+c:10),(0,W.Z)(10),(0,Y.F)());const n=this.filterTermControl.valueChanges.pipe((0,ut.B)(250),(0,N.M)(()=>this.setContentsPageNumber(1)),(0,W.Z)("")),e=this.filterChanges$.asObservable().pipe((0,fe.p)(()=>this.previewUpdatedFilters),(0,N.M)(()=>this.setContentsPageNumber(1)),(0,W.Z)([])),a=this.inheritFiltersChanges$.asObservable().pipe((0,fe.p)(()=>null!=this.inheritFilters),(0,Y.F)(),(0,N.M)(()=>this.setContentsPageNumber(1)),(0,W.Z)(!0)),s=(0,D.z)(this.collectionIdChange$,this.parentIdChange$,this.contentsCurrentPage$,this.contentsItemsPerPage$,n,e,a,this.refresh$).pipe((0,Jt.Q)(this.destroy$),(0,N.M)(()=>this.isLoading=!0),(0,ut.B)(50),(0,C.n)(([c,m,_,h,v,F,I])=>{const G=h,k=(_-1)*h;if(F.length&&this.previewUpdatedFilters){const y=v?{name:{contains:v}}:void 0;return this.dataService.collection.previewCollectionVariants({parentId:m,filters:F,inheritFilters:I},{take:G,skip:k,filter:y}).mapSingle(rt=>rt.previewCollectionVariants).pipe((0,Oo.W)(()=>(0,O.of)({items:[],totalItems:0})))}return c?this.dataService.collection.getCollectionContents(c,G,k,v).mapSingle(y=>y.collection?.productVariants):(0,O.of)(null)}),(0,N.M)(()=>this.isLoading=!1),(0,Me.j)(()=>this.isLoading=!1));this.contents$=s.pipe((0,f.T)(c=>c?c.items:[])),this.contentsTotalItems$=s.pipe((0,f.T)(c=>c?c.totalItems:0))}ngOnChanges(n){"collectionId"in n&&this.collectionIdChange$.next(n.collectionId.currentValue),"parentId"in n&&this.parentIdChange$.next(n.parentId.currentValue),"inheritFilters"in n&&this.inheritFiltersChanges$.next(n.inheritFilters.currentValue),"updatedFilters"in n&&this.updatedFilters&&this.filterChanges$.next(this.updatedFilters)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}setContentsPageNumber(n){this.setParam("contentsPage",n)}setContentsItemsPerPage(n){this.setParam("contentsPerPage",n)}refresh(){this.refresh$.next(!0)}setParam(n,e){this.router.navigate(["./"],{relativeTo:this.route,queryParams:{[n]:e},queryParamsHandling:"merge",replaceUrl:!0})}static{this.\u0275fac=function(e){return new(e||_t)(t.rXU(P.nX),t.rXU(P.Ix),t.rXU(l.uSP))}}static{this.\u0275cmp=t.VBU({type:_t,selectors:[["vdr-collection-contents"]],contentQueries:function(e,a,i){if(1&e&&t.wni(i,t.C4Q,7),2&e){let s;t.mGM(s=t.lsd())&&(a.headerTemplate=s.first)}},inputs:{collectionId:"collectionId",parentId:"parentId",inheritFilters:"inheritFilters",updatedFilters:"updatedFilters",previewUpdatedFilters:"previewUpdatedFilters"},features:[t.OA$],decls:27,vars:46,consts:[[1,"table-wrapper"],[1,"progress","loop"],[1,"header-title-row"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["id","collection-contents",3,"pageChange","itemsPerPageChange","items","itemsPerPage","totalItems","currentPage"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","name",3,"heading","optional"],["id","sku",3,"heading","optional"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"]],template:function(e,a){1&e&&(t.j41(0,"div",0),t.nrm(1,"div",1),t.j41(2,"div",2),t.DNE(3,Vo,1,0,"ng-container",3),t.nI1(4,"async"),t.k0s(),t.j41(5,"vdr-data-table-2",4),t.nI1(6,"async"),t.nI1(7,"async"),t.nI1(8,"async"),t.nI1(9,"async"),t.bIt("pageChange",function(s){return a.setContentsPageNumber(s)})("itemsPerPageChange",function(s){return a.setContentsItemsPerPage(s)}),t.nrm(10,"vdr-dt2-search",5),t.nI1(11,"translate"),t.j41(12,"vdr-dt2-column",6),t.nI1(13,"translate"),t.DNE(14,So,1,1,"ng-template"),t.k0s(),t.j41(15,"vdr-dt2-column",7),t.nI1(16,"translate"),t.DNE(17,xo,2,4,"ng-template"),t.k0s(),t.j41(18,"vdr-dt2-column",8),t.nI1(19,"translate"),t.DNE(20,No,2,4,"ng-template"),t.k0s(),t.j41(21,"vdr-dt2-column",9),t.nI1(22,"translate"),t.DNE(23,Ao,4,4,"ng-template"),t.k0s(),t.j41(24,"vdr-dt2-column",10),t.nI1(25,"translate"),t.DNE(26,jo,1,1,"ng-template"),t.k0s()()()),2&e&&(t.R7$(),t.AVh("visible",a.isLoading),t.R7$(2),t.Y8G("ngTemplateOutlet",a.headerTemplate)("ngTemplateOutletContext",t.eq3(44,$o,t.bMT(4,22,a.contentsTotalItems$))),t.R7$(2),t.AVh("loading",a.isLoading),t.Y8G("items",t.bMT(6,24,a.contents$))("itemsPerPage",t.bMT(7,26,a.contentsItemsPerPage$))("totalItems",t.bMT(8,28,a.contentsTotalItems$))("currentPage",t.bMT(9,30,a.contentsCurrentPage$)),t.R7$(5),t.Y8G("searchTermControl",a.filterTermControl)("searchTermPlaceholder",t.bMT(11,32,"catalog.filter-by-name")),t.R7$(2),t.Y8G("heading",t.bMT(13,34,"common.id"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(16,36,"common.created-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(19,38,"common.updated-at"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(22,40,"common.name"))("optional",!1),t.R7$(3),t.Y8G("heading",t.bMT(25,42,"catalog.sku"))("optional",!1))},dependencies:[b.U4n,g.T3,P.Wk,Ct.I,z.Y,dt.E,g.Jj,T.D9,ct.P],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] table{margin-top:-1px}vdr-data-table[_ngcontent-%COMP%]{opacity:1;transition:opacity .3s}vdr-data-table.loading[_ngcontent-%COMP%]{opacity:.5}.table-wrapper[_ngcontent-%COMP%]{position:relative}.progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;overflow:hidden;height:6px;opacity:0;transition:opacity .1s}.progress.visible[_ngcontent-%COMP%]{opacity:1}.sku[_ngcontent-%COMP%]{color:var(--color-text-200)}"],changeDetection:0})}}var B=p(2819),Yo=p(6871),Uo=p(9007),Lo=p(563),Bo=p(9323),wo=p(6475),Xo=p(3);const Jo=["collectionRow"],Ho=[[["vdr-bulk-action-menu"]]],Wo=["vdr-bulk-action-menu"],Ko=(o,n,e,a)=>({itemsPerPage:o,currentPage:n,totalItems:e,id:a}),Qo=(o,n)=>({item:o,i:n,depth:0}),Zo=(o,n,e)=>({currentStart:o,currentEnd:n,totalItems:e}),zo=(o,n)=>({depth:o,collection:n}),qo=o=>({rowItem:o}),Ae=(o,n)=>({item:o,depth:n});function ta(o,n){if(1&o&&t.nrm(0,"vdr-data-table-filter-presets",19),2&o){const e=t.XpG();t.Y8G("filters",e.filters)("dataTableId",e.id)}}function ea(o,n){if(1&o){const e=t.RV6();t.j41(0,"th",20)(1,"div",21),t.nrm(2,"div",22),t.j41(3,"input",23),t.bIt("change",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.onToggleAllClick())}),t.k0s()()()}if(2&o){const e=t.XpG();t.R7$(3),t.Y8G("checked",null==e.selectionManager?null:e.selectionManager.areAllCurrentItemsSelected())}}function na(o,n){1&o&&t.nrm(0,"clr-icon",33)}function oa(o,n){1&o&&t.nrm(0,"clr-icon",34)}function aa(o,n){1&o&&t.nrm(0,"clr-icon",35)}function ia(o,n){if(1&o&&(t.j41(0,"div",36),t.EFF(1),t.k0s()),2&o){const e=t.XpG().ngIf;t.R7$(),t.JRh(e.sortOrder)}}function ra(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",27)(1,"button",28),t.bIt("click",function(){const i=t.eBV(e).ngIf;return t.Njj(i.toggleSortOrder())}),t.DNE(2,na,1,0,"clr-icon",29)(3,oa,1,0,"clr-icon",30)(4,aa,1,0,"clr-icon",31),t.k0s(),t.DNE(5,ia,2,1,"div",32),t.k0s()}if(2&o){const e=n.ngIf;t.R7$(),t.AVh("active",e.sortOrder),t.R7$(),t.Y8G("ngIf",!e.sortOrder),t.R7$(),t.Y8G("ngIf","ASC"===e.sortOrder),t.R7$(),t.Y8G("ngIf","DESC"===e.sortOrder),t.R7$(),t.Y8G("ngIf",e.sortOrder)}}function sa(o,n){if(1&o&&(t.j41(0,"th")(1,"div",24)(2,"vdr-ui-extension-point",25)(3,"span"),t.EFF(4),t.k0s()(),t.DNE(5,ra,6,6,"div",26),t.k0s()()),2&o){const e=n.$implicit,a=t.XpG();t.AVh("expand",e.expand),t.R7$(),t.Y8G("ngClass",e.align),t.R7$(),t.Y8G("locationId",a.id)("metadata",e.id)("topPx",-6)("leftPx",-24),t.R7$(2),t.JRh(e.heading),t.R7$(),t.Y8G("ngIf",e.sort)}}function la(o,n){1&o&&t.eu8(0)}function ca(o,n){1&o&&t.eu8(0)}function da(o,n){if(1&o&&t.nrm(0,"vdr-data-table-filters",45),2&o){const e=n.$implicit,a=t.XpG(3);t.Y8G("filterWithValue",e)("filters",a.filters)}}function pa(o,n){if(1&o&&t.nrm(0,"vdr-data-table-filters",46),2&o){const e=t.XpG(3);t.Y8G("filters",e.filters)}}function ua(o,n){if(1&o&&(t.qex(0),t.j41(1,"div",42),t.DNE(2,da,1,2,"vdr-data-table-filters",43)(3,pa,1,1,"vdr-data-table-filters",44),t.nrm(4,"vdr-add-filter-preset-button",19),t.k0s(),t.bVm()),2&o){const e=t.XpG(2);t.R7$(2),t.Y8G("ngForOf",e.filters.activeFilters),t.R7$(),t.Y8G("ngIf",e.filters.length),t.R7$(),t.Y8G("filters",e.filters)("dataTableId",e.id)}}function ma(o,n){if(1&o){const e=t.RV6();t.j41(0,"tr")(1,"th",37)(2,"button",38),t.nI1(3,"translate"),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.toggleSearchFilterRow())}),t.nrm(4,"clr-icon",39),t.k0s(),t.j41(5,"div",40),t.DNE(6,la,1,0,"ng-container",41)(7,ca,1,0,"ng-container",41)(8,ua,5,4,"ng-container",12),t.k0s()()()}if(2&o){const e=t.XpG();t.R7$(),t.AVh("active",e.showSearchFilterRow),t.BMQ("colspan",e.visibleSortedColumns.length+(e.selectionManager?2:1)),t.R7$(),t.AVh("active",e.showSearchFilterRow),t.Y8G("title",t.bMT(3,11,"common.search-and-filter-list")),t.R7$(3),t.AVh("hidden",!e.showSearchFilterRow),t.R7$(),t.Y8G("ngTemplateOutlet",null==e.searchComponent?null:e.searchComponent.template),t.R7$(),t.Y8G("ngTemplateOutlet",e.customSearchTemplate),t.R7$(),t.Y8G("ngIf",e.filters)}}function _a(o,n){if(1&o&&(t.qex(0),t.eu8(1,47),t.bVm()),2&o){const e=n.$implicit,a=n.index;t.XpG();const i=t.sdS(24);t.R7$(),t.Y8G("ngTemplateOutlet",i)("ngTemplateOutletContext",t.l_i(2,Qo,e,a))}}function ga(o,n){if(1&o&&(t.j41(0,"tr")(1,"td"),t.nrm(2,"vdr-empty-placeholder",48),t.k0s()()),2&o){const e=t.XpG();t.R7$(),t.BMQ("colspan",e.visibleSortedColumns.length+(e.selectionManager?2:1)),t.R7$(),t.Y8G("emptyStateLabel",e.emptyStateLabel)}}function ha(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-items-per-page-controls",49),t.bIt("itemsPerPageChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.itemsPerPageChange.emit(i))}),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("itemsPerPage",e.itemsPerPage)}}function fa(o,n){if(1&o&&(t.j41(0,"div",50),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o){const e=t.XpG();t.R7$(),t.SpI(" ",t.i5U(2,1,"common.total-items",t.sMw(4,Zo,e.currentStart,e.currentEnd,e.totalItems))," ")}}function va(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-pagination-controls",51),t.bIt("pageChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.pageChange.emit(i))}),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("id",e.id)("currentPage",e.currentPage)("itemsPerPage",e.itemsPerPage)("totalItems",e.totalItems)}}function ba(o,n){if(1&o){const e=t.RV6();t.j41(0,"td",20)(1,"div",21)(2,"div",56),t.nI1(3,"translate"),t.nrm(4,"clr-icon",57),t.k0s(),t.j41(5,"input",58),t.bIt("click",function(i){t.eBV(e);const s=t.XpG().item,c=t.XpG();return t.Njj(c.onRowClick(s,i))}),t.k0s()()()}if(2&o){const e=t.XpG().item,a=t.XpG();t.AVh("active",a.activeIndex===a.absoluteIndex[e.id]),t.R7$(2),t.Y8G("title",t.bMT(3,4,"catalog.reorder-collection")),t.R7$(3),t.Y8G("checked",null==a.selectionManager?null:a.selectionManager.isSelected(e))}}function Ca(o,n){1&o&&t.eu8(0)}function Ia(o,n){if(1&o&&(t.qex(0),t.DNE(1,Ca,1,0,"ng-container",60),t.bVm()),2&o){const e=n.ngIf,a=t.XpG(2).item;t.R7$(),t.Y8G("ngComponentOutlet",e.config.component)("ngComponentOutletInputs",t.eq3(3,qo,a))("ngComponentOutletInjector",e.injector)}}function Ta(o,n){1&o&&t.eu8(0)}function Ra(o,n){if(1&o&&t.DNE(0,Ta,1,0,"ng-container",61),2&o){const e=t.XpG().$implicit,a=t.XpG(),i=a.item,s=a.depth;t.Y8G("ngTemplateOutlet",e.template)("ngTemplateOutletContext",t.l_i(2,Ae,i,s))}}function Fa(o,n){if(1&o&&(t.j41(0,"td")(1,"div",24),t.DNE(2,Ia,2,5,"ng-container",59)(3,Ra,1,5,"ng-template",null,2,t.C5r),t.k0s()()),2&o){const e=n.$implicit,a=t.sdS(4),i=t.XpG().item,s=t.XpG();t.AVh("active",s.activeIndex===s.absoluteIndex[i.id]),t.R7$(),t.Y8G("ngClass",e.align),t.R7$(),t.Y8G("ngIf",s.customComponents.get(e.id))("ngIfElse",a)}}function Pa(o,n){1&o&&t.eu8(0)}function Da(o,n){if(1&o&&(t.qex(0),t.DNE(1,Pa,1,0,"ng-container",61),t.bVm()),2&o){const e=n.$implicit,a=t.XpG().depth;t.XpG();const i=t.sdS(24);t.R7$(),t.Y8G("ngTemplateOutlet",i)("ngTemplateOutletContext",t.l_i(2,Ae,e,a+1))}}function ka(o,n){if(1&o&&(t.j41(0,"tr",52,1),t.DNE(2,ba,6,6,"td",53)(3,Fa,5,5,"td",54),t.nrm(4,"td"),t.k0s(),t.DNE(5,Da,2,5,"ng-container",55)),2&o){const e=n.item,a=n.depth,i=t.XpG();t.Y8G("cdkDragData",t.l_i(6,zo,a,e)),t.R7$(2),t.Y8G("ngIf",i.selectionManager),t.R7$(),t.Y8G("ngForOf",i.visibleSortedColumns),t.R7$(),t.AVh("active",i.activeIndex===i.absoluteIndex[e.id]),t.R7$(),t.Y8G("ngForOf",i.getSubcollections(e))}}class gt extends l.IMU{constructor(n,e,a,i){super(n,e,a),this.changeDetectorRef=n,this.localStorageService=e,this.dataService=a,this.dragDrop=i,this.changeOrder=new t.bkB,this.dragRefs=[],this.absoluteIndex={},this.sortPredicate=(s,c)=>this.dropList.getSortedItems()[s]?.data.collection.parentId===c.data.collection.parentId}ngOnChanges(n){if(super.ngOnChanges(n),n.subCollections||n.items){const e=[];for(const a of this.items??[]){e.push(a);const i=this.getSubcollections(a);e.push(...i.flat())}e.forEach((a,i)=>this.absoluteIndex[a.id]=i)}}ngAfterViewInit(){this.collectionRowList.changes.subscribe(n=>{this.dropList.getSortedItems().forEach(e=>this.dropList.removeItem(e));for(const e of n.toArray())e.dropContainer=this.dropList,e._dragRef._withDropContainer(this.dropList._dropListRef),this.dropList.addItem(e)})}getSubcollections(n){return this.subCollections?.filter(e=>e.parentId===n.id)??[]}onDrop(n){const e=2===n.item.data.collection.breadcrumbs.length,a=e?(this.currentPage-1)*this.itemsPerPage:0,i=n.item.data.collection.parentId,s=this.items.findIndex(m=>m.id===i),c=a+n.currentIndex-s-1;if(this.changeOrder.emit({collectionId:n.item.data.collection.id,index:c,parentId:n.item.data.collection.parentId}),e)this.items=[...this.items],this.items.splice(n.previousIndex,1),this.items.splice(n.currentIndex,0,n.item.data.collection);else{const m=this.items.find(_=>_.id===i);if(m){const _=this.getSubcollections(m),h=a+n.previousIndex-s-1;_.splice(h,1),_.splice(n.currentIndex,0,n.item.data.collection)}}this.changeDetectorRef.markForCheck()}static{this.\u0275fac=function(e){return new(e||gt)(t.rXU(t.gRc),t.rXU(l.sji),t.rXU(l.uSP),t.rXU(B.OX))}}static{this.\u0275cmp=t.VBU({type:gt,selectors:[["vdr-collection-data-table"]],viewQuery:function(e,a){if(1&e&&(t.GBs(B.O7,7),t.GBs(Jo,5,B.T1)),2&e){let i;t.mGM(i=t.lsd())&&(a.dropList=i.first),t.mGM(i=t.lsd())&&(a.collectionRowList=i)}},inputs:{subCollections:"subCollections"},outputs:{changeOrder:"changeOrder"},features:[t.Vt3,t.OA$],ngContentSelectors:Wo,decls:25,vars:27,consts:[["collectionRowTmp",""],["collectionRow",""],["defaultComponent",""],[3,"filters","dataTableId",4,"ngIf"],[1,"table-wrapper"],[1,"bulk-actions"],[1,""],[1,"heading-row"],["class","selection-col",4,"ngIf"],[3,"expand",4,"ngFor","ngForOf"],[1,"column-picker"],[3,"reorder","resetColumns","uiLanguage","columns"],[4,"ngIf"],["cdkDropList","","cdkDropListLockAxis","y",3,"cdkDropListDropped","cdkDropListSortPredicate"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"table-footer"],[3,"itemsPerPage","itemsPerPageChange",4,"ngIf"],["class","p5 total-items-count",4,"ngIf"],[3,"id","currentPage","itemsPerPage","totalItems","pageChange",4,"ngIf"],[3,"filters","dataTableId"],[1,"selection-col"],[1,"flex"],[1,"drag-handle-spacer"],["type","checkbox","clrCheckbox","",3,"change","checked"],[1,"cell-content",3,"ngClass"],["api","dataTable","display","block",3,"locationId","metadata","topPx","leftPx"],["class","sort-toggle",4,"ngIf"],[1,"sort-toggle"],[3,"click"],["shape","two-way-arrows left",4,"ngIf"],["shape","arrow up",4,"ngIf"],["shape","arrow down",4,"ngIf"],["class","sort-label",4,"ngIf"],["shape","two-way-arrows left"],["shape","arrow up"],["shape","arrow down"],[1,"sort-label"],[1,"filter-row"],[1,"button-ghost","toggle-search-filter-row",3,"click","title"],["shape","search"],[1,"filter-row-wrapper"],[4,"ngTemplateOutlet"],[1,"filters"],["class","mt-1",3,"filterWithValue","filters",4,"ngFor","ngForOf"],["class","mt-1",3,"filters",4,"ngIf"],[1,"mt-1",3,"filterWithValue","filters"],[1,"mt-1",3,"filters"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"emptyStateLabel"],[3,"itemsPerPageChange","itemsPerPage"],[1,"p5","total-items-count"],[3,"pageChange","id","currentPage","itemsPerPage","totalItems"],["cdkDrag","","cdkDragBoundary","tbody",3,"cdkDragData"],["class","selection-col",3,"active",4,"ngIf"],[3,"active",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],["cdkDragHandle","",1,"drag-handle",3,"title"],["shape","drag-handle"],["type","checkbox","clrCheckbox","",3,"click","checked"],[4,"ngIf","ngIfElse"],[4,"ngComponentOutlet","ngComponentOutletInputs","ngComponentOutletInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(e,a){if(1&e){const i=t.RV6();t.NAR(Ho),t.DNE(0,ta,1,2,"vdr-data-table-filter-presets",3),t.j41(1,"div",4)(2,"div",5),t.SdG(3),t.k0s(),t.j41(4,"table",6)(5,"thead")(6,"tr",7),t.DNE(7,ea,4,1,"th",8)(8,sa,6,9,"th",9),t.j41(9,"th")(10,"div",10)(11,"vdr-data-table-colum-picker",11),t.nI1(12,"async"),t.bIt("reorder",function(c){return t.eBV(i),t.Njj(a.onColumnReorder(c))})("resetColumns",function(){return t.eBV(i),t.Njj(a.onColumnsReset())}),t.k0s()()()(),t.DNE(13,ma,9,13,"tr",12),t.k0s(),t.j41(14,"tbody",13),t.bIt("cdkDropListDropped",function(c){return t.eBV(i),t.Njj(a.onDrop(c))}),t.DNE(15,_a,2,5,"ng-container",14),t.nI1(16,"paginate"),t.qex(17),t.DNE(18,ga,3,2,"tr",12),t.bVm(),t.k0s()()(),t.j41(19,"div",15),t.DNE(20,ha,1,1,"vdr-items-per-page-controls",16)(21,fa,3,8,"div",17)(22,va,1,4,"vdr-pagination-controls",18),t.k0s(),t.DNE(23,ka,6,9,"ng-template",null,0,t.C5r)}2&e&&(t.Y8G("ngIf",a.filters),t.R7$(4),t.AVh("no-select",a.disableSelect),t.R7$(),t.AVh("items-selected",null==a.selectionManager?null:a.selectionManager.selection.length),t.R7$(2),t.Y8G("ngIf",a.selectionManager),t.R7$(),t.Y8G("ngForOf",a.visibleSortedColumns),t.R7$(3),t.Y8G("uiLanguage",t.bMT(12,17,a.uiLanguage$))("columns",a.sortedColumns),t.R7$(2),t.Y8G("ngIf",a.searchComponent||a.customSearchTemplate||(null==a.filters?null:a.filters.length)),t.R7$(),t.Y8G("cdkDropListSortPredicate",a.sortPredicate),t.R7$(),t.Y8G("ngForOf",t.i5U(16,19,a.items,t.ziG(22,Ko,a.itemsPerPage,a.currentPage,a.totalItems,a.id)))("ngForTrackBy",a.trackByFn),t.R7$(3),t.Y8G("ngIf",!(null!=a.items&&a.items.length)),t.R7$(2),t.Y8G("ngIf",a.totalItems),t.R7$(),t.Y8G("ngIf",a.totalItems),t.R7$(),t.Y8G("ngIf",a.totalItems))},dependencies:[b.U4n,b.Jej,g.YU,g.OI,g.Sq,g.bT,g.T3,B.O7,B.T1,B.Fb,_e.w,ge.e,$.V,Yo.O,Uo.b,Lo.$,Bo.w,wo.M,Xo.Y,g.Jj,ne.kf,T.D9],styles:["[_nghost-%COMP%]{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{text-align:center}@media screen and (min-width: 992px){tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th[_ngcontent-%COMP%]:last-of-type, td[_ngcontent-%COMP%]:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr[_ngcontent-%COMP%]:first-of-type th[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr[_ngcontent-%COMP%]:last-of-type td[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-row-separator)}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper[_ngcontent-%COMP%]{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table[_ngcontent-%COMP%]{width:100%}table.no-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}.column-picker[_ngcontent-%COMP%]{width:24px}.sort-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:var(--color-primary-700)}.sort-toggle[_ngcontent-%COMP%] .sort-label[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row[_ngcontent-%COMP%]{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row[_ngcontent-%COMP%]{left:8px}}.toggle-search-filter-row.active[_ngcontent-%COMP%]{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row[_ngcontent-%COMP%]{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}th.filter-row.active[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border)}th.filter-row[_ngcontent-%COMP%] .filters[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden[_ngcontent-%COMP%]{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link[_ngcontent-%COMP%]{display:block;width:100%;height:100%}td.active[_ngcontent-%COMP%]{background-color:var(--color-table-row-active-bg)}.cell-content[_ngcontent-%COMP%]{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left[_ngcontent-%COMP%]{justify-content:flex-start}.cell-content.center[_ngcontent-%COMP%]{justify-content:center}.cell-content.right[_ngcontent-%COMP%]{justify-content:flex-end}.selection-col[_ngcontent-%COMP%]{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder[_ngcontent-%COMP%]{width:100%}.table-footer[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count[_ngcontent-%COMP%]{display:none}}",".bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 6);background-color:var(--color-surface-bg)}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 9.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 11.5)}}.drag-handle[_ngcontent-%COMP%]{cursor:grab}.drag-handle-spacer[_ngcontent-%COMP%]{width:16px}.cdk-drop-list-dragging[_ngcontent-%COMP%] .cdk-drag[_ngcontent-%COMP%]{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-animating[_ngcontent-%COMP%]{transition:transform .3s cubic-bezier(0,0,.2,1)}.cdk-drag-preview[_ngcontent-%COMP%]{opacity:0}.cdk-drag-placeholder[_ngcontent-%COMP%]{background-color:var(--color-primary-100)!important}"],changeDetection:0})}}var Ga=p(2770),ve=p(2595),Ea=p(5652),je=p(4053),ae=p(1787),ie=p(2981),re=p(6336),Ht=p(5483),se=p(9300),le=p(8097),ce=p(8205),de=p(3849);const Ma=["collectionContents"],Oa=o=>({pattern:o}),$a=()=>["/catalog/collections"],ya=o=>["/catalog/collections",o],Va=o=>({count:o}),Sa=()=>({standalone:!0});function xa(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",31),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.create())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",e.detailForm.invalid||e.detailForm.pristine),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.create")," ")}}function Na(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",31),t.bIt("click",function(){t.eBV(e);const i=t.XpG(2);return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG(2);t.Y8G("disabled",(e.detailForm.invalid||e.detailForm.pristine)&&!e.assetsChanged()),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}function Aa(o,n){if(1&o&&t.DNE(0,Na,3,4,"button",32),2&o){const e=t.XpG();t.Y8G("vdrIfPermissions",e.updatePermission)}}function ja(o,n){1&o&&(t.qex(0),t.EFF(1),t.nI1(2,"translate"),t.bVm()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.public")))}function Ya(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.private"))}function Ua(o,n){if(1&o&&(t.j41(0,"vdr-card"),t.nrm(1,"vdr-page-entity-info",33),t.k0s()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("entity",e)}}function La(o,n){1&o&&(t.j41(0,"a",38),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,$a)),t.R7$(),t.JRh(t.bMT(2,2,"catalog.root-collection")))}function Ba(o,n){if(1&o&&(t.j41(0,"a",38),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o){const e=t.XpG().$implicit;t.Y8G("routerLink",t.eq3(4,ya,e.id)),t.R7$(),t.JRh(t.bMT(2,2,e.name))}}function wa(o,n){if(1&o&&(t.qex(0),t.EFF(1),t.nI1(2,"translate"),t.bVm()),2&o){const e=t.XpG().$implicit;t.R7$(),t.JRh(t.bMT(2,1,e.name))}}function Xa(o,n){if(1&o&&(t.j41(0,"li"),t.DNE(1,La,3,5,"a",37)(2,Ba,3,6,"a",37)(3,wa,3,3,"ng-container",12),t.k0s()),2&o){const e=n.first,a=n.last;t.R7$(),t.Y8G("ngIf",e),t.R7$(),t.Y8G("ngIf",!e&&!a),t.R7$(),t.Y8G("ngIf",a)}}function Ja(o,n){if(1&o&&(t.j41(0,"vdr-page-block")(1,"nav",34)(2,"ul",35),t.DNE(3,Xa,4,3,"li",36),t.k0s()()()),2&o){const e=n.ngIf;t.R7$(3),t.Y8G("ngForOf",e.breadcrumbs)}}function Ha(o,n){if(1&o&&(t.j41(0,"vdr-card",39),t.nI1(1,"translate"),t.nrm(2,"vdr-tabbed-custom-fields",40),t.nI1(3,"hasPermission"),t.k0s()),2&o){const e=t.XpG();t.Y8G("title",t.bMT(1,4,"common.custom-fields")),t.R7$(2),t.Y8G("customFields",e.customFields)("customFieldsFormGroup",e.detailForm.get("customFields"))("readonly",!t.bMT(3,6,e.updatePermission))}}function Wa(o,n){1&o&&(t.qex(0),t.EFF(1),t.nI1(2,"translate"),t.bVm()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.inherit-filters-from-parent")))}function Ka(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.do-not-inherit-filters"))}function Qa(o,n){if(1&o){const e=t.RV6();t.qex(0),t.j41(1,"vdr-configurable-input",41),t.nI1(2,"hasPermission"),t.bIt("remove",function(){const i=t.eBV(e).index,s=t.XpG();return t.Njj(s.removeFilter(i))}),t.k0s(),t.bVm()}if(2&o){const e=n.$implicit,a=n.index,i=t.XpG();t.R7$(),t.Y8G("position",a)("operation",e)("operationDefinition",i.getFilterDefinition(e))("formControlName",a)("readonly",!t.bMT(2,5,i.updatePermission))}}function Za(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",47),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG(2);return t.Njj(s.addFilter(i))}),t.EFF(1),t.k0s()}if(2&o){const e=n.$implicit;t.R7$(),t.SpI(" ",e.description," ")}}function za(o,n){if(1&o&&(t.j41(0,"div")(1,"vdr-dropdown")(2,"button",42),t.nrm(3,"clr-icon",43),t.j41(4,"span"),t.EFF(5),t.nI1(6,"translate"),t.k0s(),t.nrm(7,"clr-icon",44),t.k0s(),t.j41(8,"vdr-dropdown-menu",45),t.DNE(9,Za,2,1,"button",46),t.k0s()()()),2&o){const e=t.XpG();t.R7$(5),t.JRh(t.bMT(6,2,"marketing.add-condition")),t.R7$(4),t.Y8G("ngForOf",e.allFilters)}}function qa(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",48)(1,"div",49),t.EFF(2),t.nI1(3,"translate"),t.nI1(4,"translate"),t.k0s(),t.j41(5,"clr-checkbox-wrapper")(6,"input",50),t.bIt("ngModelChange",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.toggleLivePreview())}),t.k0s(),t.j41(7,"label"),t.EFF(8),t.nI1(9,"translate"),t.k0s()()()}if(2&o){let e,a;const i=n.$implicit,s=t.XpG();t.R7$(2),t.Lme(" ",t.bMT(3,8,"catalog.collection-contents")," (",t.i5U(4,10,"common.results-count",t.eq3(15,Va,i)),") "),t.R7$(3),t.AVh("disabled",null==(e=s.detailForm.get("filters"))?null:e.pristine),t.R7$(),t.Y8G("ngModelOptions",t.lJ4(17,Sa))("disabled",null==(a=s.detailForm.get("filters"))?null:a.pristine)("ngModel",s.livePreview),t.R7$(2),t.JRh(t.bMT(9,13,"catalog.live-preview-contents"))}}const ti=M.J1`
|
|
76
|
+
query CollectionDetailQuery($id: ID!) {
|
|
77
|
+
collection(id: $id) {
|
|
78
|
+
...Collection
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
${l.IsE}
|
|
82
|
+
`;class Et extends l.wi7{constructor(n,e,a,i,s,c){super(),this.changeDetector=n,this.dataService=e,this.formBuilder=a,this.notificationService=i,this.modalService=s,this.localStorageService=c,this.customFields=this.getCustomFieldConfig("Collection"),this.detailForm=this.formBuilder.group({name:["",d.k0.required],slug:["",(0,l.ySm)(/^[\p{Letter}0-9._-]+$/)],description:"",visible:!1,inheritFilters:!0,filters:this.formBuilder.array([]),customFields:this.formBuilder.group((0,l.HCD)(this.customFields))}),this.assetChanges={},this.filters=[],this.allFilters=[],this.livePreview=!1,this.updatePermission=[l.aXG.UpdateCatalog,l.aXG.UpdateCollection],this.filterRemoved$=new Tt.B,this.livePreview=this.localStorageService.get("livePreviewCollectionContents")??!1}ngOnInit(){this.init(),this.dataService.collection.getCollectionFilters().single$.subscribe(a=>{this.allFilters=a.collectionFilters});const n=this.detailForm.get("filters"),e=this.detailForm.get("inheritFilters");this.inheritFilters$=e.valueChanges.pipe((0,Y.F)()),this.updatedFilters$=(0,Ga.h)(n.statusChanges,this.filterRemoved$).pipe((0,ut.B)(200),(0,fe.p)(()=>n.touched),(0,f.T)(()=>this.mapOperationsToInputs(this.filters,n.value).filter(a=>{for(const i of a.arguments)if(""===i.value)return!1;return!0}))),this.parentId$=this.route.paramMap.pipe((0,f.T)(a=>a.get("parentId")||void 0),(0,C.n)(a=>a?(0,O.of)(a):this.entity$.pipe((0,f.T)(i=>i.parent?.id))))}ngOnDestroy(){this.destroy()}getFilterDefinition(n){return this.allFilters.find(e=>e.code===n.code)}assetsChanged(){return!!Object.values(this.assetChanges).length}updateSlug(n){const e=this.detailForm.get(["slug"]),a=this.entity?(0,l.RMk)(this.entity,this.languageCode):void 0,i=!a||!a.slug;e&&e.pristine&&i&&e.setValue((0,S.J)(`${n}`,"-"))}addFilter(n){const e=this.detailForm.get("filters"),a=n.args.reduce((i,s)=>({...i,[s.name]:(0,l.gfn)(s.value)}),{});e.push(this.formBuilder.control({code:n.code,args:a})),this.filters.push({code:n.code,args:n.args.map(i=>({name:i.name,value:(0,l.gfn)(i.value)}))})}removeFilter(n){const e=this.detailForm.get("filters");-1!==n&&(e.removeAt(n),e.markAsDirty(),e.markAsTouched(),this.filters.splice(n,1),this.filterRemoved$.next())}create(){if(!this.detailForm.dirty)return;const n=this.getUpdatedCollection({id:"",createdAt:"",updatedAt:"",languageCode:this.languageCode,name:"",slug:"",isPrivate:!1,breadcrumbs:[],description:"",featuredAsset:null,assets:[],translations:[],inheritFilters:!0,filters:[],parent:{},children:null},this.detailForm,this.languageCode),e=this.route.snapshot.paramMap.get("parentId");e&&(n.parentId=e),this.dataService.collection.createCollection(n).subscribe(a=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"Collection"}),this.assetChanges={},this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",a.createCollection.id],{relativeTo:this.route})},a=>{this.notificationService.error((0,u.x)("common.notify-create-error"),{entity:"Collection"})})}save(){(0,D.z)(this.entity$,this.languageCode$).pipe((0,U.s)(1),(0,V.Z)(([n,e])=>{const a=this.getUpdatedCollection(n,this.detailForm,e);return this.dataService.collection.updateCollection(a)})).subscribe(()=>{this.assetChanges={},this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"Collection"}),this.contentsComponent.refresh()},n=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"Collection"})})}canDeactivate(){return super.canDeactivate()&&!this.assetChanges.assets&&!this.assetChanges.featuredAsset}toggleLivePreview(){this.livePreview=!this.livePreview,this.localStorageService.set("livePreviewCollectionContents",this.livePreview)}trackByFn(n,e){return JSON.stringify(e)}setFormValues(n,e){const a=(0,l.RMk)(n,e);this.detailForm.patchValue({name:a?a.name:"",slug:a?a.slug:"",description:a?a.description:"",visible:!n.isPrivate,inheritFilters:n.inheritFilters});const i=this.detailForm.get("filters");i.length!==n.filters.length&&(i.clear(),this.filters=[],n.filters.forEach(s=>this.addFilter(s))),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,a)}getUpdatedCollection(n,e,a){return{...(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.customFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||"",slug:n.slug||"",description:n.description||""}}),assetIds:this.assetChanges.assets?.map(s=>s.id),featuredAssetId:this.assetChanges.featuredAsset?.id,isPrivate:!e.value.visible,filters:this.mapOperationsToInputs(this.filters,this.detailForm.value.filters)}}mapOperationsToInputs(n,e){return n.map((a,i)=>({code:a.code,arguments:Object.entries(e[i].args).map(([s,c],m)=>({name:s,value:(0,l.CS_)(c)}))}))}static{this.\u0275fac=function(e){return new(e||Et)(t.rXU(t.gRc),t.rXU(l.uSP),t.rXU(d.ok),t.rXU(l.JEu),t.rXU(l.Bg8),t.rXU(l.sji))}}static{this.\u0275cmp=t.VBU({type:Et,selectors:[["vdr-collection-detail"]],viewQuery:function(e,a){if(1&e&&t.GBs(Ma,5),2&e){let i;t.mGM(i=t.lsd())&&(a.contentsComponent=i.first)}},features:[t.Vt3],decls:74,vars:89,consts:[["updateButton",""],["private",""],["noInherit",""],["collectionContents",""],[3,"languageCodeChange","disabled","availableLanguageCodes","currentLanguageCode"],["locationId","collection-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],[1,"form",3,"formGroup"],["for","visibility",3,"label"],["type","checkbox","clrToggle","","formControlName","visible","id","visibility",3,"vdrDisabled"],[1,"visible-toggle"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"form-grid"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"input","readonly"],["for","slug",3,"label","errors"],["id","slug","type","text","formControlName","slug",3,"readonly"],["for","slug",1,"form-grid-span",3,"label"],["formControlName","description",3,"readonly"],["formGroupName","customFields",3,"title",4,"ngIf"],["locationId","collection-detail",3,"entity$","detailForm"],[3,"title"],[3,"change","assets","featuredAsset","updatePermissions"],["for","inheritFilters",3,"label"],["type","checkbox","clrToggle","","formControlName","inheritFilters","id","inheritFilters",3,"vdrDisabled"],["formArrayName","filters"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"vdrIfPermissions"],[3,"title","paddingX"],[3,"collectionId","parentId","updatedFilters","inheritFilters","previewUpdatedFilters"],[1,"btn","btn-primary",3,"click","disabled"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"entity"],["role","navigation"],[1,"collection-breadcrumbs"],[4,"ngFor","ngForOf"],[3,"routerLink",4,"ngIf"],[3,"routerLink"],["formGroupName","customFields",3,"title"],["entityName","Collection",3,"customFields","customFieldsFormGroup","readonly"],[3,"remove","position","operation","operationDefinition","formControlName","readonly"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["shape","ellipsis-vertical"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],[1,"ml-3"],[1,"contents-title"],["type","checkbox","clrCheckbox","",3,"ngModelChange","ngModelOptions","disabled","ngModel"]],template:function(e,a){if(1&e){const i=t.RV6();t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left")(3,"vdr-language-selector",4),t.nI1(4,"async"),t.nI1(5,"async"),t.nI1(6,"async"),t.bIt("languageCodeChange",function(c){return t.eBV(i),t.Njj(a.setLanguage(c))}),t.k0s()(),t.j41(7,"vdr-ab-right"),t.nrm(8,"vdr-action-bar-items",5),t.DNE(9,xa,3,4,"button",6),t.nI1(10,"async"),t.DNE(11,Aa,1,1,"ng-template",null,0,t.C5r),t.nrm(13,"vdr-action-bar-dropdown-menu",5),t.k0s()()(),t.j41(14,"form",7)(15,"vdr-page-detail-layout")(16,"vdr-page-detail-sidebar")(17,"vdr-card")(18,"vdr-form-field",8),t.nI1(19,"translate"),t.j41(20,"clr-toggle-wrapper"),t.nrm(21,"input",9),t.nI1(22,"hasPermission"),t.j41(23,"label",10),t.DNE(24,ja,3,3,"ng-container",11)(25,Ya,2,3,"ng-template",null,1,t.C5r),t.k0s()()()(),t.DNE(27,Ua,2,1,"vdr-card",12),t.nI1(28,"async"),t.k0s(),t.DNE(29,Ja,4,1,"vdr-page-block",12),t.nI1(30,"async"),t.j41(31,"vdr-page-block")(32,"vdr-card")(33,"div",13)(34,"vdr-form-field",14),t.nI1(35,"translate"),t.j41(36,"input",15),t.nI1(37,"hasPermission"),t.bIt("input",function(c){return t.eBV(i),t.Njj(a.updateSlug(c.target.value))}),t.k0s()(),t.j41(38,"vdr-form-field",16),t.nI1(39,"translate"),t.nI1(40,"translate"),t.nrm(41,"input",17),t.nI1(42,"hasPermission"),t.k0s(),t.j41(43,"vdr-form-field",18),t.nI1(44,"translate"),t.nrm(45,"vdr-rich-text-editor",19),t.nI1(46,"hasPermission"),t.k0s()()(),t.DNE(47,Ha,4,8,"vdr-card",20),t.nrm(48,"vdr-custom-detail-component-host",21),t.j41(49,"vdr-card",22),t.nI1(50,"translate"),t.j41(51,"vdr-assets",23),t.bIt("change",function(c){return t.eBV(i),t.Njj(a.assetChanges=c)}),t.k0s()(),t.j41(52,"vdr-card",22),t.nI1(53,"translate"),t.j41(54,"vdr-form-field",24),t.nI1(55,"translate"),t.j41(56,"clr-toggle-wrapper"),t.nrm(57,"input",25),t.nI1(58,"hasPermission"),t.j41(59,"label",10),t.DNE(60,Wa,3,3,"ng-container",11)(61,Ka,2,3,"ng-template",null,2,t.C5r),t.k0s()()(),t.j41(63,"div",26),t.DNE(64,Qa,3,7,"ng-container",27),t.k0s(),t.DNE(65,za,10,4,"div",28),t.k0s(),t.j41(66,"vdr-card",29),t.nI1(67,"translate"),t.j41(68,"vdr-collection-contents",30,3),t.nI1(70,"async"),t.nI1(71,"async"),t.nI1(72,"async"),t.DNE(73,qa,10,18,"ng-template"),t.k0s()()()()()}if(2&e){const i=t.sdS(12),s=t.sdS(26),c=t.sdS(62);t.R7$(3),t.Y8G("disabled",t.bMT(4,41,a.isNew$))("availableLanguageCodes",t.bMT(5,43,a.availableLanguages$))("currentLanguageCode",t.bMT(6,45,a.languageCode$)),t.R7$(6),t.Y8G("ngIf",t.bMT(10,47,a.isNew$))("ngIfElse",i),t.R7$(5),t.Y8G("formGroup",a.detailForm),t.R7$(4),t.Y8G("label",t.bMT(19,49,"catalog.visibility")),t.R7$(3),t.Y8G("vdrDisabled",!t.bMT(22,51,a.updatePermission)),t.R7$(3),t.Y8G("ngIf",a.detailForm.value.visible)("ngIfElse",s),t.R7$(3),t.Y8G("ngIf",t.bMT(28,53,a.entity$)),t.R7$(2),t.Y8G("ngIf",t.bMT(30,55,a.entity$)),t.R7$(5),t.Y8G("label",t.bMT(35,57,"common.name")),t.R7$(2),t.Y8G("readonly",!t.bMT(37,59,a.updatePermission)),t.R7$(2),t.Y8G("label",t.bMT(39,61,"catalog.slug"))("errors",t.eq3(87,Oa,t.bMT(40,63,"catalog.slug-pattern-error"))),t.R7$(3),t.Y8G("readonly",!t.bMT(42,65,a.updatePermission)),t.R7$(2),t.Y8G("label",t.bMT(44,67,"common.description")),t.R7$(2),t.Y8G("readonly",!t.bMT(46,69,a.updatePermission)),t.R7$(2),t.Y8G("ngIf",a.customFields.length),t.R7$(),t.Y8G("entity$",a.entity$)("detailForm",a.detailForm),t.R7$(),t.Y8G("title",t.bMT(50,71,"catalog.assets")),t.R7$(2),t.Y8G("assets",null==a.entity?null:a.entity.assets)("featuredAsset",null==a.entity?null:a.entity.featuredAsset)("updatePermissions",a.updatePermission),t.R7$(),t.Y8G("title",t.bMT(53,73,"catalog.filters")),t.R7$(2),t.Y8G("label",t.bMT(55,75,"catalog.filter-inheritance")),t.R7$(3),t.Y8G("vdrDisabled",!t.bMT(58,77,a.updatePermission)),t.R7$(3),t.Y8G("ngIf",a.detailForm.value.inheritFilters)("ngIfElse",c),t.R7$(4),t.Y8G("ngForOf",a.filters)("ngForTrackBy",a.trackByFn),t.R7$(),t.Y8G("vdrIfPermissions",a.updatePermission),t.R7$(),t.Y8G("title",t.bMT(67,79,"common.contents"))("paddingX",!1),t.R7$(2),t.Y8G("collectionId",a.id)("parentId",t.bMT(70,81,a.parentId$))("updatedFilters",t.bMT(71,83,a.updatedFilters$))("inheritFilters",t.bMT(72,85,a.inheritFilters$))("previewUpdatedFilters",a.livePreview)}},dependencies:[b.U4n,b.aZZ,b.Jej,b.eAx,g.Sq,g.bT,d.qT,d.me,d.Zm,d.BC,d.cb,d.vS,d.j4,d.JD,d.$R,d.v8,P.Wk,R.nG,R.wL,R.TX,nt.l,ve.P,Ea.h,L.K,$.V,H.t,je.q,ae.P,ie.q,re.j,Ht.M,X.p,ot.T,se.y,bt.W,le.L,A.e,wt.E,ce.c,de.e,lt.i,_t,g.Jj,T.D9,q.E],styles:['@charset "UTF-8";.visible-toggle[_ngcontent-%COMP%]{margin-top:-3px!important}clr-checkbox-wrapper[_ngcontent-%COMP%]{transition:opacity .3s}clr-checkbox-wrapper.disabled[_ngcontent-%COMP%]{opacity:.5}.collection-breadcrumbs[_ngcontent-%COMP%]{list-style-type:none;background-color:var(--color-component-bg-200);padding:2px 6px;margin-bottom:6px;border-radius:var(--clr-global-borderradius)}.collection-breadcrumbs[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{font-size:.65rem;display:inline-block;margin-inline-end:10px}.collection-breadcrumbs[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:last-child{font-weight:600}.collection-breadcrumbs[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:not(:last-child):after{content:"\\203a";top:0;color:var(--color-grey-400);margin-inline-start:10px}'],changeDetection:0})}}class ht{transform(n){return n?.breadcrumbs.slice(1,-1)}static{this.\u0275fac=function(e){return new(e||ht)}}static{this.\u0275pipe=t.EJ8({name:"collectionBreadcrumb",type:ht,pure:!0})}}const ei=o=>({name:o});function ni(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.move-collections"),"\n")}function oi(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function ai(o,n){if(1&o&&t.nrm(0,"clr-icon",12),2&o){const e=t.XpG().depth;t.AVh("transparent",0===e)}}function ii(o,n){1&o&&t.nrm(0,"clr-icon",16)}function ri(o,n){1&o&&t.nrm(0,"clr-icon",17)}function si(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",13),t.bIt("click",function(){t.eBV(e);const i=t.XpG().item,s=t.XpG();return t.Njj(s.toggleExpanded(i))}),t.DNE(1,ii,1,0,"clr-icon",14)(2,ri,1,0,"clr-icon",15),t.k0s()}if(2&o){const e=t.XpG().item,a=t.XpG();t.R7$(),t.Y8G("ngIf",!a.expandedIds.includes(e.id)),t.R7$(),t.Y8G("ngIf",a.expandedIds.includes(e.id))}}function li(o,n){1&o&&(t.j41(0,"button",18),t.nrm(1,"clr-icon",19),t.k0s())}function ci(o,n){if(1&o){const e=t.RV6();t.nrm(0,"div",7),t.DNE(1,ai,1,2,"clr-icon",8)(2,si,3,2,"button",9)(3,li,2,0,"button",10),t.j41(4,"button",11),t.bIt("click",function(){const i=t.eBV(e).item,s=t.XpG();return t.Njj(s.resolveWith(i))}),t.j41(5,"span"),t.EFF(6),t.nI1(7,"translate"),t.k0s()()}if(2&o){const e=n.item,a=n.depth;t.Y8G("ngClass","indent-"+a),t.R7$(),t.Y8G("ngIf",!(null!=e.children&&e.children.length)&&"__"!==e.parentId),t.R7$(),t.Y8G("ngIf",null==e.children?null:e.children.length),t.R7$(),t.Y8G("ngIf","__"===e.parentId),t.R7$(3),t.JRh(t.i5U(7,5,"catalog.move-collection-to",t.eq3(8,ei,e.name)))}}function di(o,n){if(1&o&&(t.j41(0,"div")(1,"span",24),t.EFF(2,"/"),t.k0s(),t.EFF(3),t.k0s()),2&o){const e=n.$implicit;t.R7$(3),t.SpI("",e.name," ")}}function pi(o,n){if(1&o&&(t.qex(0),t.DNE(1,di,4,1,"div",23),t.bVm()),2&o){const e=t.XpG().ngIf;t.R7$(),t.Y8G("ngForOf",e)}}function ui(o,n){1&o&&(t.j41(0,"span",24),t.EFF(1,"/"),t.k0s())}function mi(o,n){if(1&o&&(t.qex(0),t.DNE(1,pi,2,1,"ng-container",21)(2,ui,2,0,"span",22),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",e.length),t.R7$(),t.Y8G("ngIf",!e.length)}}function _i(o,n){if(1&o&&(t.j41(0,"div",20),t.DNE(1,mi,3,2,"ng-container",21),t.nI1(2,"collectionBreadcrumb"),t.k0s()),2&o){const e=n.item;t.R7$(),t.Y8G("ngIf",t.bMT(2,1,e))}}function gi(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.slug," ")}}class Mt{constructor(n,e){this.dataService=n,this.i18nService=e,this.searchTermControl=new d.MJ(""),this.currentPage$=new j.t(1),this.itemsPerPage$=new j.t(10),this.expandedIds$=new Tt.B,this.expandedIds=[]}ngOnInit(){const n=this.dataService.collection.getCollections(),e=this.searchTermControl.valueChanges.pipe((0,ut.B)(250),(0,Y.F)(),(0,W.Z)("")),a=this.currentPage$.pipe((0,Y.F)()),i=this.itemsPerPage$.pipe((0,Y.F)());(0,D.z)(e,a,i).subscribe(([c,m,_])=>{const h=""===c;n.ref.refetch({options:{skip:(m-1)*_,take:_,filter:{name:{contains:c}},topLevelOnly:h}})});const s=this.dataService.collection.getCollections({take:1,topLevelOnly:!0}).mapSingle(c=>c.collections.items[0].parentId);this.items$=(0,D.z)(n.mapStream(({collections:c})=>c),s).pipe((0,f.T)(([c,m])=>[...m?[{id:m,name:this.i18nService.translate("catalog.root-collection"),slug:"",parentId:"__",position:0,featuredAsset:null,children:[],breadcrumbs:[],isPrivate:!1,createdAt:"",updatedAt:""}]:[],...c.items])),this.totalItems$=n.mapStream(c=>c.collections.totalItems),this.subCollections$=this.expandedIds$.pipe((0,N.M)(c=>this.expandedIds=c),(0,C.n)(c=>c.length?this.dataService.collection.getCollections({take:999,filter:{parentId:{in:c}}}).mapStream(m=>m.collections.items):(0,O.of)([])))}toggleExpanded(n){let e=this.expandedIds;e.includes(n.id)?e=e.filter(a=>a!==n.id):e.push(n.id),this.expandedIds$.next(e)}static{this.\u0275fac=function(e){return new(e||Mt)(t.rXU(l.uSP),t.rXU(l.W40))}}static{this.\u0275cmp=t.VBU({type:Mt,selectors:[["vdr-move-collections-dialog"]],decls:21,vars:33,consts:[["vdrDialogTitle",""],["id","move-collection-list",1,"mt-2",3,"pageChange","itemsPerPageChange","items","subCollections","itemsPerPage","totalItems","currentPage"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault"],["id","name",3,"heading","optional"],["id","breadcrumb",3,"heading"],["id","slug",3,"heading"],[3,"ngClass"],["class","child-arrow","shape","child-arrow",3,"transparent",4,"ngIf"],["class","icon-button folder-button",3,"click",4,"ngIf"],["class","icon-button folder-button","disabled","",4,"ngIf"],[1,"button-ghost",3,"click"],["shape","child-arrow",1,"child-arrow"],[1,"icon-button","folder-button",3,"click"],["shape","folder",4,"ngIf"],["shape","folder-open",4,"ngIf"],["shape","folder"],["shape","folder-open"],["disabled","",1,"icon-button","folder-button"],["shape","folder",1,"is-solid"],[1,"breadcrumb"],[4,"ngIf"],["class","separator",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"separator"]],template:function(e,a){1&e&&(t.DNE(0,ni,2,3,"ng-template",0),t.j41(1,"vdr-collection-data-table",1),t.nI1(2,"async"),t.nI1(3,"async"),t.nI1(4,"async"),t.nI1(5,"async"),t.nI1(6,"async"),t.bIt("pageChange",function(s){return a.currentPage$.next(s)})("itemsPerPageChange",function(s){return a.itemsPerPage$.next(s)}),t.nrm(7,"vdr-dt2-search",2),t.nI1(8,"translate"),t.j41(9,"vdr-dt2-column",3),t.nI1(10,"translate"),t.DNE(11,oi,1,1,"ng-template"),t.k0s(),t.j41(12,"vdr-dt2-column",4),t.nI1(13,"translate"),t.DNE(14,ci,8,10,"ng-template"),t.k0s(),t.j41(15,"vdr-dt2-column",5),t.nI1(16,"translate"),t.DNE(17,_i,3,3,"ng-template"),t.k0s(),t.j41(18,"vdr-dt2-column",6),t.nI1(19,"translate"),t.DNE(20,gi,1,1,"ng-template"),t.k0s()()),2&e&&(t.R7$(),t.Y8G("items",t.bMT(2,13,a.items$))("subCollections",t.bMT(3,15,a.subCollections$))("itemsPerPage",t.bMT(4,17,a.itemsPerPage$))("totalItems",t.bMT(5,19,a.totalItems$))("currentPage",t.bMT(6,21,a.currentPage$)),t.R7$(6),t.Y8G("searchTermControl",a.searchTermControl)("searchTermPlaceholder",t.bMT(8,23,"common.search-by-name")),t.R7$(2),t.Y8G("heading",t.bMT(10,25,"common.id"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(13,27,"common.name"))("optional",!1),t.R7$(3),t.Y8G("heading",t.bMT(16,29,"common.breadcrumb")),t.R7$(3),t.Y8G("heading",t.bMT(19,31,"common.slug")))},dependencies:[b.U4n,g.YU,g.Sq,g.bT,K.M,z.Y,dt.E,gt,g.Jj,T.D9,ht],styles:["[_nghost-%COMP%]{--indent-spacing: 18px}.indent-1[_ngcontent-%COMP%]{padding-inline-start:var(--indent-spacing)}.indent-2[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 2)}.indent-3[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 3)}.indent-4[_ngcontent-%COMP%], .indent-5[_ngcontent-%COMP%], .indent-6[_ngcontent-%COMP%], .indent-7[_ngcontent-%COMP%], .indent-8[_ngcontent-%COMP%], .indent-9[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 4)}.child-arrow[_ngcontent-%COMP%]{margin:1px 6px}.child-arrow.transparent[_ngcontent-%COMP%]{opacity:0}.breadcrumb[_ngcontent-%COMP%]{display:flex}.separator[_ngcontent-%COMP%]{color:var(--color-weight-500);margin:0 3px}"],changeDetection:0})}}const Ye=(0,l.AfA)({location:"collection-list",requiresPermission:o=>o.includes(l.aXG.DeleteCollection)||o.includes(l.aXG.DeleteCatalog),getItemName:o=>o.name,bulkDelete:(o,n)=>o.collection.deleteCollections(n).pipe((0,f.T)(e=>e.deleteCollections))}),Ue={location:"collection-list",label:(0,u.x)("catalog.move-collections"),icon:"drag-handle",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateCollection),onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{const i=o.get(l.Bg8),s=o.get(l.uSP),c=o.get(l.JEu);i.fromComponent(Mt,{size:"xl",closable:!0}).pipe((0,C.n)(m=>{if(m){const _=n.map(h=>({collectionId:h.id,parentId:m.id,index:0}));return s.collection.moveCollection(_)}return E.w})).subscribe(m=>{c.success((0,u.x)("catalog.move-collections-success"),{count:n.length}),a(),e.refresh()})}},Le=(0,l.oUe)({location:"collection-list",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateCollection),getItemName:o=>o.name,bulkAssignToChannel:(o,n,e)=>e.map(a=>o.collection.assignCollectionsToChannel({collectionIds:n,channelId:a}).pipe((0,f.T)(i=>i.assignCollectionsToChannel)))}),Be=(0,l.YSJ)({location:"collection-list",requiresPermission:o=>o.includes(l.aXG.DeleteCatalog)||o.includes(l.aXG.DeleteCollection),getItemName:o=>o.name,bulkRemoveFromChannel:(o,n,e)=>o.collection.removeCollectionsFromChannel({channelId:e,collectionIds:n}).pipe((0,f.T)(a=>a.removeCollectionsFromChannel))}),we={location:"collection-list",label:(0,u.x)("common.duplicate"),icon:"copy",onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{o.get(l.Bg8).fromComponent(l.MPR,{locals:{entities:n,entityName:"Collection",title:(0,u.x)("catalog.duplicate-collections"),getEntityName:s=>s.name}}).subscribe(s=>{s&&(a(),e.refresh())})}};var pe=p(4195),ue=p(2124),hi=p(1693),Xe=p(8671);const fi=()=>["CreateCatalog","CreateCollection"],vi=()=>["./create"],Je=o=>["./",o],bi=o=>({contents:o}),Ci=()=>({contentsPage:1});function Ii(o,n){1&o&&(t.j41(0,"a",6),t.nrm(1,"clr-icon",7),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,vi)),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.create-new-collection")," "))}function Ti(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function Ri(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function Fi(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function Pi(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.position," ")}}function Di(o,n){if(1&o&&t.nrm(0,"clr-icon",26),2&o){const e=t.XpG().depth;t.AVh("transparent",0===e)}}function ki(o,n){1&o&&t.nrm(0,"clr-icon",30)}function Gi(o,n){1&o&&t.nrm(0,"clr-icon",31)}function Ei(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",27),t.bIt("click",function(){t.eBV(e);const i=t.XpG().item,s=t.XpG(2);return t.Njj(s.toggleExpanded(i))}),t.DNE(1,ki,1,0,"clr-icon",28)(2,Gi,1,0,"clr-icon",29),t.k0s()}if(2&o){const e=t.XpG().item,a=t.XpG(2);t.R7$(),t.Y8G("ngIf",!a.expandedIds.includes(e.id)),t.R7$(),t.Y8G("ngIf",a.expandedIds.includes(e.id))}}function Mi(o,n){if(1&o&&(t.nrm(0,"div",21),t.DNE(1,Di,1,2,"clr-icon",22)(2,Ei,3,2,"button",23),t.j41(3,"a",24)(4,"span"),t.EFF(5),t.k0s(),t.nrm(6,"clr-icon",25),t.k0s()),2&o){const e=n.item,a=n.depth;t.Y8G("ngClass","indent-"+a),t.R7$(),t.Y8G("ngIf",!(null!=e.children&&e.children.length)),t.R7$(),t.Y8G("ngIf",null==e.children?null:e.children.length),t.R7$(),t.Y8G("routerLink",t.eq3(5,Je,e.id)),t.R7$(2),t.JRh(e.name)}}function Oi(o,n){if(1&o&&(t.j41(0,"div")(1,"span",36),t.EFF(2,"/"),t.k0s(),t.EFF(3),t.k0s()),2&o){const e=n.$implicit;t.R7$(3),t.SpI("",e.name," ")}}function $i(o,n){if(1&o&&(t.qex(0),t.DNE(1,Oi,4,1,"div",35),t.bVm()),2&o){const e=t.XpG().ngIf;t.R7$(),t.Y8G("ngForOf",e)}}function yi(o,n){1&o&&(t.j41(0,"span",36),t.EFF(1,"/"),t.k0s())}function Vi(o,n){if(1&o&&(t.qex(0),t.DNE(1,$i,2,1,"ng-container",33)(2,yi,2,0,"span",34),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",e.length),t.R7$(),t.Y8G("ngIf",!e.length)}}function Si(o,n){if(1&o&&(t.j41(0,"div",32),t.DNE(1,Vi,3,2,"ng-container",33),t.nI1(2,"collectionBreadcrumb"),t.k0s()),2&o){const e=n.item;t.R7$(),t.Y8G("ngIf",t.bMT(2,1,e))}}function xi(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.slug," ")}}function Ni(o,n){1&o&&(t.j41(0,"vdr-chip",39),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.private")))}function Ai(o,n){1&o&&(t.j41(0,"vdr-chip",40),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.public")))}function ji(o,n){if(1&o&&t.DNE(0,Ni,3,3,"vdr-chip",37)(1,Ai,3,3,"vdr-chip",38),2&o){const e=n.item;t.Y8G("ngIf",e.isPrivate),t.R7$(),t.Y8G("ngIf",!e.isPrivate)}}function Yi(o,n){if(1&o&&(t.j41(0,"a",41)(1,"span"),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.nrm(4,"clr-icon",42),t.k0s()),2&o){const e=n.item;t.Y8G("routerLink",t.eq3(7,Je,t.eq3(5,bi,e.id)))("queryParams",t.lJ4(9,Ci)),t.R7$(2),t.JRh(t.bMT(3,3,"common.view-contents"))}}function Ui(o,n){if(1&o&&t.nrm(0,"vdr-dt2-custom-field-column",43),2&o){const e=n.$implicit,a=t.XpG(2);t.Y8G("customField",e)("sorts",a.sorts)}}function Li(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-collection-data-table",8),t.nI1(1,"async"),t.nI1(2,"async"),t.nI1(3,"async"),t.nI1(4,"async"),t.nI1(5,"async"),t.nI1(6,"async"),t.bIt("pageChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.setPageNumber(i))})("itemsPerPageChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.setItemsPerPage(i))})("changeOrder",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.onRearrange(i))}),t.nrm(7,"vdr-bulk-action-menu",9)(8,"vdr-dt2-search",10),t.nI1(9,"translate"),t.j41(10,"vdr-dt2-column",11),t.nI1(11,"translate"),t.DNE(12,Ti,1,1,"ng-template"),t.k0s(),t.j41(13,"vdr-dt2-column",12),t.nI1(14,"translate"),t.DNE(15,Ri,2,4,"ng-template"),t.k0s(),t.j41(16,"vdr-dt2-column",13),t.nI1(17,"translate"),t.DNE(18,Fi,2,4,"ng-template"),t.k0s(),t.j41(19,"vdr-dt2-column",14),t.nI1(20,"translate"),t.DNE(21,Pi,1,1,"ng-template"),t.k0s(),t.j41(22,"vdr-dt2-column",15),t.nI1(23,"translate"),t.DNE(24,Mi,7,7,"ng-template"),t.k0s(),t.j41(25,"vdr-dt2-column",16),t.nI1(26,"translate"),t.DNE(27,Si,3,3,"ng-template"),t.k0s(),t.j41(28,"vdr-dt2-column",17),t.nI1(29,"translate"),t.DNE(30,xi,1,1,"ng-template"),t.k0s(),t.j41(31,"vdr-dt2-column",18),t.nI1(32,"translate"),t.DNE(33,ji,2,2,"ng-template"),t.k0s(),t.j41(34,"vdr-dt2-column",19),t.nI1(35,"translate"),t.DNE(36,Yi,5,10,"ng-template"),t.k0s(),t.DNE(37,Ui,1,2,"vdr-dt2-custom-field-column",20),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("items",t.bMT(1,32,e.items$))("subCollections",t.bMT(2,34,e.subCollections$))("itemsPerPage",t.bMT(3,36,e.itemsPerPage$))("totalItems",t.bMT(4,38,e.totalItems$))("currentPage",t.bMT(5,40,e.currentPage$))("filters",e.filters)("activeIndex",t.bMT(6,42,e.activeCollectionIndex$)),t.R7$(7),t.Y8G("hostComponent",e)("selectionManager",e.selectionManager),t.R7$(),t.Y8G("searchTermControl",e.searchTermControl)("searchTermPlaceholder",t.bMT(9,44,"common.search-by-name")),t.R7$(2),t.Y8G("heading",t.bMT(11,46,"common.id"))("hiddenByDefault",!0),t.R7$(3),t.Y8G("heading",t.bMT(14,48,"common.created-at"))("hiddenByDefault",!0)("sort",e.sorts.get("createdAt")),t.R7$(3),t.Y8G("heading",t.bMT(17,50,"common.updated-at"))("hiddenByDefault",!0)("sort",e.sorts.get("updatedAt")),t.R7$(3),t.Y8G("heading",t.bMT(20,52,"common.position"))("hiddenByDefault",!0)("sort",e.sorts.get("position")),t.R7$(3),t.Y8G("heading",t.bMT(23,54,"common.name"))("optional",!1)("sort",e.sorts.get("name")),t.R7$(3),t.Y8G("heading",t.bMT(26,56,"common.breadcrumb")),t.R7$(3),t.Y8G("heading",t.bMT(29,58,"common.slug"))("sort",e.sorts.get("slug")),t.R7$(3),t.Y8G("heading",t.bMT(32,60,"common.visibility")),t.R7$(3),t.Y8G("heading",t.bMT(35,62,"common.view-contents"))("optional",!1),t.R7$(3),t.Y8G("ngForOf",e.customFields)}}function Bi(o,n){if(1&o&&(t.qex(0),t.nrm(1,"vdr-collection-contents",44),t.nI1(2,"async"),t.bVm()),2&o){const e=t.XpG(2);t.R7$(),t.Y8G("collectionId",t.bMT(2,1,e.activeCollectionId$))}}function wi(o,n){if(1&o&&(t.DNE(0,Bi,3,3,"ng-container",33),t.nI1(1,"async")),2&o){const e=t.XpG();t.Y8G("ngIf",t.bMT(1,1,e.activeCollectionId$))}}class Ot extends l.B8I{constructor(n,e){super(),this.dataService=n,this.notificationService=e,this.expandedIds=[],this.customFields=this.getCustomFieldConfig("Collection"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilter({name:"slug",label:(0,u.x)("common.slug"),type:{kind:"text"},filterField:"slug"}).addFilter({name:"visibility",type:{kind:"boolean"},label:(0,u.x)("common.visibility"),toFilterInput:a=>({isPrivate:{eq:!a}})}).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().defaultSort("position","ASC").addSort({name:"createdAt"}).addSort({name:"updatedAt"}).addSort({name:"name"}).addSort({name:"slug"}).addSort({name:"position"}).addCustomFieldSorts(this.customFields).connectToRoute(this.route),super.configure({document:l.cIG,getItems:a=>a.collections,setVariables:(a,i)=>{const s=""===this.searchTermControl.value&&0===this.filters.activeFilters.length||void 0;return{options:{skip:a,take:i,filter:{name:{contains:this.searchTermControl.value},...this.filters.createFilterInput()},topLevelOnly:s,sort:this.sorts.createSortInput()}}},refreshListOnChanges:[this.filters.valueChanges,this.sorts.valueChanges]})}ngOnInit(){super.ngOnInit(),this.activeCollectionId$=this.route.paramMap.pipe((0,f.T)(e=>e.get("contents")),(0,Y.F)());const n=this.route.queryParamMap.pipe((0,f.T)(e=>e.get("expanded")),(0,Y.F)(),(0,f.T)(e=>e?e.split(","):[]));n.pipe((0,Jt.Q)(this.destroy$)).subscribe(e=>{this.expandedIds=e}),this.subCollections$=(0,D.z)(n,this.refresh$).pipe((0,C.n)(([e])=>e.length?this.dataService.collection.getCollections({take:999,filter:{parentId:{in:e}}}).mapStream(a=>a.collections.items):(0,O.of)([]))),this.activeCollectionTitle$=(0,D.z)(this.activeCollectionId$,this.items$,this.subCollections$).pipe((0,f.T)(([e,a,i])=>{if(e){const s=[...a,...i].find(c=>c.id===e);return s?s.name:""}return""})),this.activeCollectionIndex$=(0,D.z)(this.activeCollectionId$,this.items$,this.subCollections$).pipe((0,f.T)(([e,a,i])=>{if(e){const s=[];for(const c of a){s.push(c);const m=i.filter(_=>_.parentId&&_.parentId===c.id);s.push(...m)}return s.findIndex(c=>c.id===e)}return-1}))}onRearrange(n){this.dataService.collection.moveCollection([n]).subscribe({next:()=>{this.notificationService.success((0,u.x)("common.notify-saved-changes")),this.refresh()},error:e=>{this.notificationService.error((0,u.x)("common.notify-save-changes-error"))}})}closeContents(){const n={...this.route.snapshot.params};delete n.contents,this.router.navigate(["./",n],{relativeTo:this.route,queryParamsHandling:"preserve"})}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}toggleExpanded(n){let e=this.expandedIds;e.includes(n.id)?e=e.filter(a=>a!==n.id):e.push(n.id),this.router.navigate(["./"],{queryParams:{expanded:e.filter(a=>!!a).join(",")},queryParamsHandling:"merge",relativeTo:this.route})}static{this.\u0275fac=function(e){return new(e||Ot)(t.rXU(l.uSP),t.rXU(l.JEu))}}static{this.\u0275cmp=t.VBU({type:Ot,selectors:[["vdr-collection-list"]],features:[t.Vt3],decls:15,vars:14,consts:[[3,"languageCodeChange","availableLanguageCodes","currentLanguageCode"],["locationId","collection-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"closeClicked","rightPanelOpen"],["vdrSplitViewLeft",""],["vdrSplitViewRight","",3,"splitViewTitle"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],["id","collection-list",1,"mt-2",3,"pageChange","itemsPerPageChange","changeOrder","items","subCollections","itemsPerPage","totalItems","currentPage","filters","activeIndex"],["locationId","collection-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault","sort"],["id","updated-at",3,"heading","hiddenByDefault","sort"],["id","position",3,"heading","hiddenByDefault","sort"],["id","name",3,"heading","optional","sort"],["id","breadcrumb",3,"heading"],["id","slug",3,"heading","sort"],["id","visibility",3,"heading"],["id","view-contents",3,"heading","optional"],[3,"customField","sorts",4,"ngFor","ngForOf"],[3,"ngClass"],["class","child-arrow","shape","child-arrow",3,"transparent",4,"ngIf"],["class","icon-button folder-button",3,"click",4,"ngIf"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],["shape","child-arrow",1,"child-arrow"],[1,"icon-button","folder-button",3,"click"],["shape","folder",4,"ngIf"],["shape","folder-open",4,"ngIf"],["shape","folder"],["shape","folder-open"],[1,"breadcrumb"],[4,"ngIf"],["class","separator",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"separator"],["colorType","warning",4,"ngIf"],["colorType","success",4,"ngIf"],["colorType","warning"],["colorType","success"],["queryParamsHandling","merge",1,"button-small","bg-weight-150",3,"routerLink","queryParams"],["shape","file-group"],[3,"customField","sorts"],[3,"collectionId"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left")(3,"vdr-language-selector",0),t.nI1(4,"async"),t.nI1(5,"async"),t.bIt("languageCodeChange",function(s){return a.setLanguage(s)}),t.k0s()(),t.j41(6,"vdr-ab-right"),t.nrm(7,"vdr-action-bar-items",1),t.DNE(8,Ii,4,5,"a",2),t.nrm(9,"vdr-action-bar-dropdown-menu",1),t.k0s()()(),t.j41(10,"vdr-split-view",3),t.nI1(11,"async"),t.bIt("closeClicked",function(){return a.closeContents()}),t.DNE(12,Li,38,64,"ng-template",4)(13,wi,2,3,"ng-template",5),t.nI1(14,"async"),t.k0s()),2&e&&(t.R7$(3),t.Y8G("availableLanguageCodes",t.bMT(4,5,a.availableLanguages$))("currentLanguageCode",t.bMT(5,7,a.contentLanguage$)),t.R7$(5),t.Y8G("vdrIfPermissions",t.lJ4(13,fi)),t.R7$(2),t.Y8G("rightPanelOpen",t.bMT(11,9,a.activeCollectionId$)),t.R7$(3),t.Y8G("splitViewTitle",t.bMT(14,11,a.activeCollectionTitle$)))},dependencies:[b.U4n,g.YU,g.Sq,g.bT,P.Wk,R.nG,R.wL,R.TX,nt.l,Q.w,H.t,X.p,ot.T,pe.T,z.Y,dt.E,ue.T,hi.l,Xe.w,Xe.P,A.e,_t,gt,g.Jj,T.D9,ct.P,ht],styles:["[_nghost-%COMP%]{--indent-spacing: 18px}.indent-1[_ngcontent-%COMP%]{padding-inline-start:var(--indent-spacing)}.indent-2[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 2)}.indent-3[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 3)}.indent-4[_ngcontent-%COMP%], .indent-5[_ngcontent-%COMP%], .indent-6[_ngcontent-%COMP%], .indent-7[_ngcontent-%COMP%], .indent-8[_ngcontent-%COMP%], .indent-9[_ngcontent-%COMP%]{padding-inline-start:calc(var(--indent-spacing) * 4)}.child-arrow[_ngcontent-%COMP%]{margin:1px 6px}.child-arrow.transparent[_ngcontent-%COMP%]{opacity:0}.breadcrumb[_ngcontent-%COMP%]{display:flex}.separator[_ngcontent-%COMP%]{color:var(--color-weight-500);margin:0 3px}"],changeDetection:0})}}class at{constructor(){this.allMoveListItems=[],this._rearrange$=new Tt.B,this._delete$=new Tt.B,this.rearrange$=this._rearrange$.asObservable(),this.delete$=this._delete$.asObservable()}ngOnDestroy(){this._rearrange$.complete(),this._delete$.complete()}setCollectionTree(n){this.collectionTree=n}resetMoveList(){this.allMoveListItems=[]}getMoveListItems(n){return 0===this.allMoveListItems.length&&(this.allMoveListItems=this.calculateAllMoveListItems()),this.allMoveListItems.filter(e=>e.id!==n.id&&!e.ancestorIdPath.has(n.id)&&e.id!==n.parent?.id)}onDrop(n){const e=n.item.data,i=n.container.data.id;if(null==i)throw new Error("Could not determine the ID of the root Collection");this._rearrange$.next({collectionId:e.id,parentId:i,index:n.currentIndex})}onMove(n){this._rearrange$.next(n)}onDelete(n){this._delete$.next(n)}calculateAllMoveListItems(){const n=(e,a,i,s)=>{const c=a.concat(e.name);return s.push({path:c.slice(1).join(" / ")||"root",id:e.id,ancestorIdPath:i}),e.children.forEach(m=>n(m,c,new Set([...i,e.id]),s)),s};return n(this.collectionTree,[],new Set,[])}static{this.\u0275fac=function(e){return new(e||at)}}static{this.\u0275prov=t.jDH({token:at,factory:at.\u0275fac})}}const Xi=o=>({contents:o}),Ji=o=>["./",o],Hi=o=>["/catalog/collections/",o],Wi=()=>["UpdateCatalog","UpdateCollection"],Ki=()=>["CreateCatalog","CreateCollection"],Qi=o=>({parentId:o}),Zi=o=>["./","create",o];function zi(o,n){1&o&&t.nrm(0,"clr-icon",32)}function qi(o,n){1&o&&t.nrm(0,"clr-icon",33)}function tr(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",29),t.bIt("click",function(){t.eBV(e);const i=t.XpG().$implicit,s=t.XpG();return t.Njj(s.toggleExpanded(i))}),t.DNE(1,zi,1,0,"clr-icon",30)(2,qi,1,0,"clr-icon",31),t.k0s()}if(2&o){const e=t.XpG().$implicit,a=t.XpG();t.Y8G("disabled",a.expandAll),t.R7$(),t.Y8G("ngIf",!e.expanded&&!a.expandAll),t.R7$(),t.Y8G("ngIf",e.expanded||a.expandAll)}}function er(o,n){1&o&&t.nrm(0,"div",34)}function nr(o,n){1&o&&(t.j41(0,"vdr-chip"),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.private")))}function or(o,n){1&o&&(t.j41(0,"div",35),t.nrm(1,"clr-icon",36),t.k0s())}function ar(o,n){if(1&o&&(t.j41(0,"a",37),t.nrm(1,"clr-icon",38),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o){const e=t.XpG().$implicit;t.Y8G("routerLink",t.eq3(6,Zi,t.eq3(4,Qi,e.id))),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.create-new-collection")," ")}}function ir(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",21),t.nI1(1,"async"),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG().$implicit,c=t.XpG();return t.Njj(c.move(s,i.id))}),t.j41(2,"div",39)(3,"div",40),t.nrm(4,"clr-icon",41),t.k0s(),t.j41(5,"div",42),t.EFF(6),t.k0s()()()}if(2&o){const e=n.$implicit,a=t.XpG(2);t.Y8G("disabled",!t.bMT(1,2,a.hasUpdatePermission$)),t.R7$(6),t.SpI(" ",e.path," ")}}function rr(o,n){if(1&o&&t.nrm(0,"vdr-collection-tree-node",43),2&o){const e=t.XpG().$implicit,a=t.XpG();t.Y8G("expandAll",a.expandAll)("collectionTree",e)("activeCollectionId",a.activeCollectionId)("selectionManager",a.selectionManager)}}function sr(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",4)(1,"div",5)(2,"div")(3,"input",6),t.bIt("click",function(i){const s=t.eBV(e).$implicit,c=t.XpG();return t.Njj(c.selectionManager.toggleSelection(s,i))}),t.k0s()(),t.j41(4,"div",7),t.DNE(5,tr,3,3,"button",8)(6,er,1,0,"ng-template",null,1,t.C5r),t.EFF(8),t.k0s(),t.nrm(9,"div",9),t.DNE(10,nr,3,3,"vdr-chip",10),t.j41(11,"a",11),t.nrm(12,"clr-icon",12),t.EFF(13),t.nI1(14,"translate"),t.k0s(),t.j41(15,"a",13),t.nrm(16,"clr-icon",14),t.EFF(17),t.nI1(18,"translate"),t.k0s(),t.DNE(19,or,2,0,"div",15),t.j41(20,"vdr-dropdown")(21,"button",16),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.getMoveListItems(i))}),t.nrm(22,"clr-icon",17),t.k0s(),t.j41(23,"vdr-dropdown-menu",18),t.DNE(24,ar,4,8,"a",19),t.nrm(25,"div",20),t.j41(26,"button",21),t.nI1(27,"async"),t.bIt("click",function(){const i=t.eBV(e),s=i.$implicit,c=i.index,m=t.XpG();return t.Njj(m.moveUp(s,c))}),t.nrm(28,"clr-icon",22),t.EFF(29),t.nI1(30,"translate"),t.k0s(),t.j41(31,"button",21),t.nI1(32,"async"),t.bIt("click",function(){const i=t.eBV(e),s=i.$implicit,c=i.index,m=t.XpG();return t.Njj(m.moveDown(s,c))}),t.nrm(33,"clr-icon",23),t.EFF(34),t.nI1(35,"translate"),t.k0s(),t.j41(36,"h4",24),t.EFF(37),t.nI1(38,"translate"),t.k0s(),t.DNE(39,ir,7,4,"button",25),t.nrm(40,"div",20),t.j41(41,"button",26),t.nI1(42,"async"),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.delete(i.id))}),t.nrm(43,"clr-icon",27),t.EFF(44),t.nI1(45,"translate"),t.k0s()()()(),t.DNE(46,rr,1,4,"vdr-collection-tree-node",28),t.k0s()}if(2&o){const e=n.$implicit,a=n.index,i=t.sdS(7),s=t.XpG();t.AVh("private",e.isPrivate),t.Y8G("cdkDragData",e),t.R7$(),t.AVh("active",e.id===s.activeCollectionId),t.Y8G("ngClass","depth-"+s.depth),t.R7$(2),t.Y8G("checked",s.selectionManager.isSelected(e)),t.R7$(2),t.Y8G("ngIf",null==e.children?null:e.children.length)("ngIfElse",i),t.R7$(3),t.SpI(" ",e.name," "),t.R7$(2),t.Y8G("ngIf",e.isPrivate),t.R7$(),t.Y8G("routerLink",t.eq3(46,Ji,t.eq3(44,Xi,e.id))),t.R7$(2),t.SpI(" ",t.bMT(14,26,"catalog.view-contents")," "),t.R7$(2),t.Y8G("routerLink",t.eq3(48,Hi,e.id)),t.R7$(2),t.SpI(" ",t.bMT(18,28,"common.edit")," "),t.R7$(2),t.Y8G("vdrIfPermissions",t.lJ4(50,Wi)),t.R7$(5),t.Y8G("vdrIfPermissions",t.lJ4(51,Ki)),t.R7$(2),t.Y8G("disabled",0===a||!t.bMT(27,30,s.hasUpdatePermission$)),t.R7$(3),t.SpI(" ",t.bMT(30,32,"catalog.move-up")," "),t.R7$(2),t.Y8G("disabled",a===s.collectionTree.children.length-1||!t.bMT(32,34,s.hasUpdatePermission$)),t.R7$(3),t.SpI(" ",t.bMT(35,36,"catalog.move-down")," "),t.R7$(3),t.JRh(t.bMT(38,38,"catalog.move-to")),t.R7$(2),t.Y8G("ngForOf",s.moveListItems),t.R7$(2),t.Y8G("disabled",!t.bMT(42,40,s.hasDeletePermission$)),t.R7$(3),t.SpI(" ",t.bMT(45,42,"common.delete")," "),t.R7$(2),t.Y8G("ngIf",e.expanded||s.expandAll)}}class it{constructor(n,e,a,i,s,c){this.parent=n,this.dataService=e,this.collectionTreeService=a,this.router=i,this.route=s,this.changeDetectorRef=c,this.depth=0,this.expandAll=!1,this.moveListItems=[],n&&(this.depth=n.depth+1)}ngOnInit(){this.parentName=this.collectionTree.name||"<root>";const n=this.dataService.client.userStatus().mapStream(e=>e.userStatus.permissions).pipe((0,r.t)(1));this.hasUpdatePermission$=n.pipe((0,f.T)(e=>e.includes(l.aXG.UpdateCatalog)||e.includes(l.aXG.UpdateCollection))),this.hasDeletePermission$=n.pipe((0,f.T)(e=>e.includes(l.aXG.DeleteCatalog)||e.includes(l.aXG.DeleteCollection))),this.subscription=this.selectionManager?.selectionChanges$.subscribe(()=>this.changeDetectorRef.markForCheck())}ngOnChanges(n){const e=n.expandAll;e&&!0===e.previousValue&&!1===e.currentValue&&this.collectionTree.children.forEach(a=>a.expanded=!1)}ngOnDestroy(){this.subscription?.unsubscribe()}trackByFn(n,e){return e.id}toggleExpanded(n){n.expanded=!n.expanded;let e=this.route.snapshot.queryParamMap.get("expanded")?.split(",")??[];n.expanded?e.push(n.id):e=e.filter(a=>a!==n.id),this.router.navigate(["./"],{queryParams:{expanded:e.filter(a=>!!a).join(",")},queryParamsHandling:"merge",relativeTo:this.route})}getMoveListItems(n){this.moveListItems=this.collectionTreeService.getMoveListItems(n)}move(n,e){this.collectionTreeService.onMove({index:0,parentId:e,collectionId:n.id})}moveUp(n,e){n.parent&&this.collectionTreeService.onMove({index:e-1,parentId:n.parent.id,collectionId:n.id})}moveDown(n,e){n.parent&&this.collectionTreeService.onMove({index:e+1,parentId:n.parent.id,collectionId:n.id})}drop(n){(0,B.HD)(this.collectionTree.children,n.previousIndex,n.currentIndex),this.collectionTreeService.onDrop(n)}delete(n){this.collectionTreeService.onDelete(n)}static{this.\u0275fac=function(e){return new(e||it)(t.rXU(it,12),t.rXU(l.uSP),t.rXU(at),t.rXU(P.Ix),t.rXU(P.nX),t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:it,selectors:[["vdr-collection-tree-node"]],inputs:{collectionTree:"collectionTree",activeCollectionId:"activeCollectionId",expandAll:"expandAll",selectionManager:"selectionManager"},features:[t.OA$],decls:4,vars:6,consts:[["dropList",""],["folderSpacer",""],["cdkDropList","",1,"tree-node",3,"cdkDropListDropped","cdkDropListData","cdkDropListDisabled"],["class","collection","cdkDrag","",3,"private","cdkDragData",4,"ngFor","ngForOf","ngForTrackBy"],["cdkDrag","",1,"collection",3,"cdkDragData"],[1,"collection-detail",3,"ngClass"],["type","checkbox","clrCheckbox","",3,"click","checked"],[1,"name"],["class","icon-button folder-button",3,"disabled","click",4,"ngIf","ngIfElse"],[1,"flex-spacer"],[4,"ngIf"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","edit"],["class","drag-handle","cdkDragHandle","",4,"vdrIfPermissions"],["vdrDropdownTrigger","",1,"icon-button",3,"click"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["class","dropdown-item",3,"routerLink",4,"vdrIfPermissions"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",3,"click","disabled"],["shape","caret up"],["shape","caret down"],[1,"dropdown-header"],["type","button","vdrDropdownItem","",3,"disabled","click",4,"ngFor","ngForOf"],["vdrDropdownItem","",1,"button",3,"click","disabled"],["shape","trash",1,"is-danger"],[3,"expandAll","collectionTree","activeCollectionId","selectionManager",4,"ngIf"],[1,"icon-button","folder-button",3,"click","disabled"],["shape","folder",4,"ngIf"],["shape","folder-open",4,"ngIf"],["shape","folder"],["shape","folder-open"],[1,"folder-button-spacer"],["cdkDragHandle","",1,"drag-handle"],["shape","drag-handle","size","24"],[1,"dropdown-item",3,"routerLink"],["shape","plus"],[1,"move-to-item"],[1,"move-icon"],["shape","child-arrow"],[1,"path"],[3,"expandAll","collectionTree","activeCollectionId","selectionManager"]],template:function(e,a){if(1&e){const i=t.RV6();t.j41(0,"div",2,0),t.nI1(2,"async"),t.bIt("cdkDropListDropped",function(c){return t.eBV(i),t.Njj(a.drop(c))}),t.DNE(3,sr,47,52,"div",3),t.k0s()}2&e&&(t.Y8G("cdkDropListData",a.collectionTree)("cdkDropListDisabled",!t.bMT(2,4,a.hasUpdatePermission$)),t.R7$(3),t.Y8G("ngForOf",a.collectionTree.children)("ngForTrackBy",a.trackByFn))},dependencies:[b.U4n,b.Jej,g.YU,g.Sq,g.bT,P.Wk,B.O7,B.T1,B.Fb,Q.w,$.V,ae.P,ie.q,re.j,Ht.M,X.p,it,g.Jj,T.D9],styles:["[_nghost-%COMP%]{display:block}.collection[_ngcontent-%COMP%]{background-color:var(--clr-table-bgcolor);border-radius:var(--clr-global-borderradius);font-size:.65rem;transition:transform .25s cubic-bezier(0,0,.2,1);margin-bottom:2px;border-inline-start:2px solid transparent;transition:border-left-color .2s}.collection.private[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.collection[_ngcontent-%COMP%] .collection-detail[_ngcontent-%COMP%]{padding:6px 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--color-component-border-100)}.collection[_ngcontent-%COMP%] .collection-detail.active[_ngcontent-%COMP%]{background-color:var(--clr-global-selection-color)}.collection[_ngcontent-%COMP%] .collection-detail.depth-1[_ngcontent-%COMP%]{padding-inline-start:36px}.collection[_ngcontent-%COMP%] .collection-detail.depth-2[_ngcontent-%COMP%]{padding-inline-start:60px}.collection[_ngcontent-%COMP%] .collection-detail.depth-3[_ngcontent-%COMP%]{padding-inline-start:84px}.collection[_ngcontent-%COMP%] .collection-detail.depth-4[_ngcontent-%COMP%]{padding-inline-start:108px}.collection[_ngcontent-%COMP%] .collection-detail[_ngcontent-%COMP%] .folder-button-spacer[_ngcontent-%COMP%]{display:inline-block;width:28px}.tree-node[_ngcontent-%COMP%]{display:block;background-color:var(--clr-table-bgcolor);border-radius:var(--clr-global-borderradius);overflow:hidden}.tree-node.cdk-drop-list-dragging[_ngcontent-%COMP%] > .collection[_ngcontent-%COMP%]{border-left-color:var(--color-primary-300)}.drag-placeholder[_ngcontent-%COMP%]{min-height:120px;background-color:var(--color-component-bg-300);transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview[_ngcontent-%COMP%]{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder[_ngcontent-%COMP%]{opacity:0}.cdk-drag-animating[_ngcontent-%COMP%]{transition:transform .25s cubic-bezier(0,0,.2,1)}.example-list.cdk-drop-list-dragging[_ngcontent-%COMP%] .tree-node[_ngcontent-%COMP%]:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.move-to-item[_ngcontent-%COMP%]{display:flex;white-space:normal;align-items:baseline}.move-to-item[_ngcontent-%COMP%] .move-icon[_ngcontent-%COMP%]{flex:none;margin-inline-end:3px}.move-to-item[_ngcontent-%COMP%] .path[_ngcontent-%COMP%]{line-height:18px}"],changeDetection:0})}}function He(o,n,e=[]){const a=[],i={},s=function lr(o){const n=new Map;function e(a){n.set(a.id,a),a.children.forEach(e)}return o&&e(o),n}(n);for(const m of o)i[m.id]={...m,children:[]};for(const m of o.map(_=>_.id))if(i.hasOwnProperty(m)){const _=i[m];_.expanded=s.get(m)?.expanded??e.includes(m);const h=_.parent;if(!h)continue;i[h.id]?i[h.id]?i[h.id].children.push(_):i[h.id]={children:[_]}:a.push(_)}return{id:a.length?a[0].parent.id:void 0,children:a}}function cr(o,n){if(1&o&&t.nrm(0,"vdr-collection-tree-node",1),2&o){const e=t.XpG();t.Y8G("expandAll",e.expandAll)("collectionTree",e.collectionTree)("selectionManager",e.selectionManager)("activeCollectionId",e.activeCollectionId)}}class Wt{constructor(n){this.collectionTreeService=n,this.expandAll=!1,this.expandedIds=[],this.rearrange=new t.bkB,this.deleteCollection=new t.bkB}ngOnChanges(n){"collections"in n&&this.collections&&(this.collectionTree=He(this.collections,this.collectionTree,this.expandedIds),this.collectionTreeService.setCollectionTree(this.collectionTree),this.collectionTreeService.resetMoveList())}ngOnInit(){this.collectionTreeService.rearrange$.subscribe(n=>this.rearrange.emit(n)),this.collectionTreeService.delete$.subscribe(n=>this.deleteCollection.emit(n))}static{this.\u0275fac=function(e){return new(e||Wt)(t.rXU(at))}}static{this.\u0275cmp=t.VBU({type:Wt,selectors:[["vdr-collection-tree"]],inputs:{collections:"collections",activeCollectionId:"activeCollectionId",expandAll:"expandAll",expandedIds:"expandedIds",selectionManager:"selectionManager"},outputs:{rearrange:"rearrange",deleteCollection:"deleteCollection"},features:[t.Jv_([at]),t.OA$],decls:1,vars:1,consts:[["cdkDropListGroup","",3,"expandAll","collectionTree","selectionManager","activeCollectionId",4,"ngIf"],["cdkDropListGroup","",3,"expandAll","collectionTree","selectionManager","activeCollectionId"]],template:function(e,a){1&e&&t.DNE(0,cr,1,4,"vdr-collection-tree-node",0),2&e&&t.Y8G("ngIf",a.collectionTree)},dependencies:[g.bT,B.RK,it],changeDetection:0})}}function dr(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.confirm-deletion-of-unused-variants-title"),"\n")}function pr(o,n){if(1&o&&(t.j41(0,"li"),t.EFF(1),t.k0s()),2&o){const e=n.$implicit;t.R7$(),t.Lme("",e.name," (",e.sku,")")}}function ur(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",3),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",4),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.confirm())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}2&o&&(t.R7$(),t.JRh(t.bMT(2,2,"common.cancel")),t.R7$(3),t.SpI(" ",t.bMT(5,4,"common.confirm")," "))}class Kt{constructor(){this.variants=[]}confirm(){this.resolveWith(!0)}cancel(){this.resolveWith()}static{this.\u0275fac=function(e){return new(e||Kt)}}static{this.\u0275cmp=t.VBU({type:Kt,selectors:[["vdr-confirm-variant-deletion-dialog"]],decls:6,vars:4,consts:[["vdrDialogTitle",""],[4,"ngFor","ngForOf"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click"]],template:function(e,a){1&e&&(t.DNE(0,dr,2,3,"ng-template",0),t.EFF(1),t.nI1(2,"translate"),t.j41(3,"ul"),t.DNE(4,pr,2,2,"li",1),t.k0s(),t.DNE(5,ur,6,6,"ng-template",2)),2&e&&(t.R7$(),t.SpI("\n",t.bMT(2,2,"catalog.confirm-deletion-of-unused-variants-body"),"\n"),t.R7$(3),t.Y8G("ngForOf",a.variants))},dependencies:[g.Sq,tt.b,K.M,T.D9],changeDetection:0})}}function mr(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.SpI(" ",t.bMT(1,1,"catalog.create-facet-value"),"\n")}function _r(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",7),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",8),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.confirm())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",e.form.invalid),t.R7$(),t.SpI(" ",t.bMT(5,5,"common.confirm")," ")}}class $t{constructor(n){this.formBuilder=n,this.form=this.formBuilder.group({name:["",d.k0.required],code:["",d.k0.required]})}updateCode(){const n=this.form.get("name"),e=this.form.get("code");n&&e&&e.pristine&&e.setValue((0,S.J)(`${n.value}`,"-"))}confirm(){const{name:n,code:e}=this.form.value;!n||!e||this.resolveWith({facetId:this.facetId,code:e,translations:[{languageCode:this.languageCode,name:n}]})}cancel(){this.resolveWith()}static{this.\u0275fac=function(e){return new(e||$t)(t.rXU(d.ok))}}static{this.\u0275cmp=t.VBU({type:$t,selectors:[["vdr-create-facet-value-dialog"]],decls:9,vars:7,consts:[["vdrDialogTitle",""],[1,"form-grid",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"input"],["for","code",3,"label"],["id","code","type","text","formControlName","code"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){1&e&&(t.DNE(0,mr,2,3,"ng-template",0),t.j41(1,"div",1)(2,"vdr-form-field",2),t.nI1(3,"translate"),t.j41(4,"input",3),t.bIt("input",function(){return a.updateCode()}),t.k0s()(),t.j41(5,"vdr-form-field",4),t.nI1(6,"translate"),t.nrm(7,"input",5),t.k0s()(),t.DNE(8,_r,6,7,"ng-template",6)),2&e&&(t.R7$(),t.Y8G("formGroup",a.form),t.R7$(),t.Y8G("label",t.bMT(3,3,"common.name")),t.R7$(3),t.Y8G("label",t.bMT(6,5,"common.code")))},dependencies:[d.me,d.BC,d.cb,d.j4,d.JD,L.K,$.V,tt.b,K.M,T.D9],changeDetection:0})}}var gr=p(6719);const hr=()=>["CreateCatalog","CreateFacet"],fr=(o,n,e)=>({currentPage:o,itemsPerPage:n,totalItems:e}),vr=o=>["values",o],br=o=>["values",o,"customFields"];function Cr(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",20),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.create())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",e.detailForm.invalid||e.detailForm.pristine),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.create")," ")}}function Ir(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",20),t.bIt("click",function(){t.eBV(e);const i=t.XpG(2);return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG(2);t.Y8G("disabled",e.detailForm.invalid||e.detailForm.pristine),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}function Tr(o,n){if(1&o&&t.DNE(0,Ir,3,4,"button",21),2&o){const e=t.XpG();t.Y8G("vdrIfPermissions",e.updatePermission)}}function Rr(o,n){1&o&&(t.qex(0),t.EFF(1),t.nI1(2,"translate"),t.bVm()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.public")))}function Fr(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.private"))}function Pr(o,n){if(1&o&&t.nrm(0,"vdr-page-entity-info",22),2&o){const e=n.ngIf;t.Y8G("entity",e)}}function Dr(o,n){if(1&o&&(t.j41(0,"vdr-card",23),t.nI1(1,"translate"),t.nrm(2,"vdr-tabbed-custom-fields",24),t.nI1(3,"hasPermission"),t.k0s()),2&o){const e=t.XpG();t.Y8G("title",t.bMT(1,4,"common.custom-fields")),t.R7$(2),t.Y8G("customFields",e.customFields)("customFieldsFormGroup",e.detailForm.get("facet.customFields"))("readonly",!t.bMT(3,6,e.updatePermission))}}function kr(o,n){if(1&o&&(t.nrm(0,"input",29),t.nI1(1,"translate")),2&o){const e=t.XpG(2);t.Y8G("formControl",e.filterControl)("placeholder",t.bMT(1,2,"catalog.filter-by-name"))}}function Gr(o,n){1&o&&(t.qex(0),t.j41(1,"th"),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.bVm()),2&o&&(t.R7$(2),t.JRh(t.bMT(3,1,"common.custom-fields")))}function Er(o,n){if(1&o&&(t.j41(0,"td",45),t.nrm(1,"vdr-tabbed-custom-fields",46),t.nI1(2,"hasPermission"),t.k0s()),2&o){const e=t.XpG().$implicit,a=t.XpG(3);t.R7$(),t.Y8G("customFields",a.customValueFields)("compact",!0)("customFieldsFormGroup",a.detailForm.get(t.eq3(6,br,e.id)))("readonly",!t.bMT(2,4,a.updatePermission))}}function Mr(o,n){if(1&o){const e=t.RV6();t.j41(0,"tr",35)(1,"td",36),t.nrm(2,"vdr-entity-info",22),t.k0s(),t.j41(3,"td",36)(4,"input",37),t.nI1(5,"hasPermission"),t.bIt("input",function(i){const s=t.eBV(e).$implicit,c=t.XpG(3);return t.Njj(c.updateValueCode(s.code,i.target.value,s.id))}),t.k0s()(),t.j41(6,"td",36),t.nrm(7,"input",38),t.k0s(),t.DNE(8,Er,3,8,"td",39),t.j41(9,"td",36)(10,"vdr-dropdown")(11,"button",40),t.nrm(12,"clr-icon",41),t.k0s(),t.j41(13,"vdr-dropdown-menu",42)(14,"button",43),t.nI1(15,"hasPermission"),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG(3);return t.Njj(s.deleteFacetValue(i.id))}),t.nrm(16,"clr-icon",44),t.EFF(17),t.nI1(18,"translate"),t.k0s()()()()()}if(2&o){const e=n.$implicit,a=t.XpG(3);t.Y8G("formGroup",a.detailForm.get(t.eq3(12,vr,e.id))),t.R7$(2),t.Y8G("entity",e),t.R7$(2),t.Y8G("readonly",!t.bMT(5,6,a.updatePermission)),t.R7$(4),t.Y8G("ngIf",a.customValueFields.length),t.R7$(6),t.Y8G("disabled",!t.bMT(15,8,a.updatePermission)),t.R7$(3),t.SpI(" ",t.bMT(18,10,"common.delete")," ")}}function Or(o,n){if(1&o){const e=t.RV6();t.qex(0),t.j41(1,"table",30)(2,"thead")(3,"tr"),t.nrm(4,"th"),t.j41(5,"th"),t.EFF(6),t.nI1(7,"translate"),t.k0s(),t.j41(8,"th"),t.EFF(9),t.nI1(10,"translate"),t.k0s(),t.DNE(11,Gr,4,3,"ng-container",27),t.nrm(12,"th"),t.k0s()(),t.j41(13,"tbody"),t.DNE(14,Mr,19,14,"tr",31),t.nI1(15,"paginate"),t.k0s()(),t.j41(16,"div",32)(17,"vdr-items-per-page-controls",33),t.bIt("itemsPerPageChange",function(i){t.eBV(e);const s=t.XpG(2);return t.Njj(s.setItemsPerPage(i))}),t.k0s(),t.j41(18,"vdr-pagination-controls",34),t.bIt("pageChange",function(i){t.eBV(e);const s=t.XpG(2);return t.Njj(s.setCurrentPage(i))}),t.k0s()(),t.bVm()}if(2&o){const e=n.ngIf,a=t.XpG(2);t.R7$(6),t.JRh(t.bMT(7,8,"common.name")),t.R7$(3),t.JRh(t.bMT(10,10,"common.code")),t.R7$(2),t.Y8G("ngIf",a.customValueFields.length),t.R7$(3),t.Y8G("ngForOf",t.i5U(15,12,e,t.sMw(15,fr,a.currentPage,a.itemsPerPage,a.totalItems))),t.R7$(3),t.Y8G("itemsPerPage",a.itemsPerPage),t.R7$(),t.Y8G("currentPage",a.currentPage)("itemsPerPage",a.itemsPerPage)("totalItems",a.totalItems)}}function $r(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",47),t.bIt("click",function(){t.eBV(e);const i=t.XpG(2);return t.Njj(i.addFacetValue())}),t.nrm(1,"clr-icon",48),t.EFF(2),t.nI1(3,"translate"),t.k0s()}2&o&&(t.R7$(2),t.SpI(" ",t.bMT(3,1,"catalog.add-facet-value")," "))}function yr(o,n){if(1&o&&(t.j41(0,"vdr-card",25),t.nI1(1,"translate"),t.DNE(2,kr,2,4,"ng-template",26)(3,Or,19,19,"ng-container",27),t.nI1(4,"async"),t.j41(5,"div"),t.DNE(6,$r,4,3,"button",28),t.k0s()()),2&o){const e=t.XpG();t.Y8G("title",t.bMT(1,4,"catalog.facet-values"))("paddingX",!1),t.R7$(3),t.Y8G("ngIf",t.bMT(4,6,e.values$)),t.R7$(3),t.Y8G("vdrIfPermissions",t.lJ4(8,hr))}}const We=M.J1`
|
|
83
|
+
query GetFacetDetail($id: ID!, $facetValueListOptions: FacetValueListOptions) {
|
|
84
|
+
facet(id: $id) {
|
|
85
|
+
...FacetWithValueList
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
${l.r$9}
|
|
89
|
+
`;class yt extends l.wi7{constructor(n,e,a,i,s){super(),this.changeDetector=n,this.dataService=e,this.formBuilder=a,this.notificationService=i,this.modalService=s,this.customFields=this.getCustomFieldConfig("Facet"),this.customValueFields=this.getCustomFieldConfig("FacetValue"),this.detailForm=this.formBuilder.group({facet:this.formBuilder.group({code:["",d.k0.required],name:"",visible:!0,customFields:this.formBuilder.group((0,l.HCD)(this.customFields))}),values:this.formBuilder.record({})}),this.currentPage=1,this.itemsPerPage=10,this.totalItems=0,this.filterControl=new d.MJ(""),this.values$=new j.t([]),this.updatePermission=[l.aXG.UpdateCatalog,l.aXG.UpdateFacet]}ngOnInit(){this.init(),this.filterControl.valueChanges.pipe((0,ut.B)(200),(0,Jt.Q)(this.destroy$)).subscribe(n=>{this.currentPage=1,this.fetchFacetValues(this.currentPage,this.itemsPerPage,n)})}ngOnDestroy(){this.destroy()}updateCode(n,e){if(!n){const a=this.detailForm.get(["facet","code"]);a&&a.pristine&&a.setValue((0,S.J)(e,"-"))}}updateValueCode(n,e,a){if(!n){const i=this.detailForm.get(["values",a,"code"]);i&&i.pristine&&i.setValue((0,S.J)(e,"-"))}}customValueFieldIsSet(n,e){return!!this.detailForm.get(["values",n,"customFields",e])}addFacetValue(){this.modalService.fromComponent($t,{locals:{languageCode:this.languageCode,facetId:this.id}}).pipe((0,C.n)(n=>n?this.dataService.facet.createFacetValues([n]):E.w)).subscribe(n=>{n.createFacetValues&&(this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"FacetValue"}),this.currentPage=1,this.fetchFacetValues(this.currentPage,this.itemsPerPage))})}create(){const n=this.detailForm.get("facet");if(!n||!n.dirty)return;const e=this.getUpdatedFacet({id:"",createdAt:"",updatedAt:"",isPrivate:!1,languageCode:this.languageCode,name:"",code:"",translations:[]},n,this.languageCode);this.dataService.facet.createFacet(e).subscribe(a=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"Facet"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",a.createFacet.id],{relativeTo:this.route})},a=>{this.notificationService.error((0,u.x)("common.notify-create-error"),{entity:"Facet"})})}save(){const n=this.detailForm.get("values");(0,D.z)(this.entity$,this.languageCode$).pipe((0,U.s)(1),(0,V.Z)(([e,a])=>{const i=this.detailForm.get("facet"),s=[];if(i&&i.dirty){const c=this.getUpdatedFacet(e,i,a);c&&s.push(this.dataService.facet.updateFacet(c))}if(n&&n.dirty){const c=this.getUpdatedFacetValues(n,a);c.length&&s.push(this.dataService.facet.updateFacetValues(c))}return(0,w.p)(s)})).subscribe(()=>{this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"Facet"})},e=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"Facet"})})}deleteFacetValue(n){this.showModalAndDelete(n).pipe((0,C.n)(e=>e.result===l.syg.DELETED?[!0]:this.showModalAndDelete(n,e.message||"").pipe((0,f.T)(a=>a.result===l.syg.DELETED))),(0,C.n)(e=>e?this.dataService.query(l.Ctv,{id:this.id}).single$:[])).subscribe(()=>{this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"FacetValue"}),this.fetchFacetValues(this.currentPage,this.itemsPerPage,this.filterControl.value)},e=>{this.notificationService.error((0,u.x)("common.notify-delete-error"),{entity:"FacetValue"})})}showModalAndDelete(n,e){return this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-facet-value"),body:e,buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(a=>a?this.dataService.facet.deleteFacetValues([n],!!e):E.w),(0,f.T)(a=>a.deleteFacetValues[0]))}setCurrentPage(n){this.currentPage=n,this.fetchFacetValues(this.currentPage,this.itemsPerPage,this.filterControl.value)}setItemsPerPage(n){this.itemsPerPage=n,this.fetchFacetValues(this.currentPage,this.itemsPerPage,this.filterControl.value)}fetchFacetValues(n,e,a){this.dataService.query(We,{id:this.id,facetValueListOptions:{take:e,skip:(n-1)*e,sort:{createdAt:Bt.xB.DESC},...a?{filter:{name:{contains:a}}}:{}}}).single$.subscribe(({facet:i})=>{i&&(this.values$.next([...i.valueList.items]),this.totalItems=i.valueList.totalItems,this.setFacetValueFormValues(i,this.languageCode))})}setFormValues(n,e){const a=(0,l.RMk)(n,e);this.detailForm.patchValue({facet:{code:n.code,visible:!n.isPrivate,name:a?.name??""}}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["facet","customFields"]),n,a),this.values$.next([...n.valueList.items]),this.totalItems=n.valueList.totalItems,this.setFacetValueFormValues(n,e)}setFacetValueFormValues(n,e){const a=this.detailForm.get("values");n.valueList.items.forEach(i=>{const s=(0,l.RMk)(i,e),c={id:i.id,code:i.code,name:s?s.name:""};let m=a.get(i.id);if(m?m.patchValue(c):(m=this.formBuilder.group(c),a.addControl(i.id,m)),this.customValueFields.length){let _=m.get(["customFields"]);if(_||(_=new d.J3({}),m.addControl("customFields",_)),_)for(const h of this.customValueFields){const v=h.name,F="localeString"===h.type?s?.customFields?.[v]:i.customFields[v],I=_.get(v);I?I.setValue(F):_.addControl(v,new d.hs(F))}}})}getUpdatedFacet(n,e,a){const i=(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.customFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||""}});return i.isPrivate=!e.value.visible,i}getUpdatedFacetValues(n,e){return Object.values(n.controls).filter(i=>i.dirty).map(i=>i.value).map((i,s)=>(0,l.vk6)({translatable:i,updatedFields:i,customFieldConfig:this.customValueFields,languageCode:e,defaultTranslation:{languageCode:e,name:""}})).filter(st.notNullOrUndefined)}static{this.\u0275fac=function(e){return new(e||yt)(t.rXU(t.gRc),t.rXU(l.uSP),t.rXU(d.ok),t.rXU(l.JEu),t.rXU(l.Bg8))}}static{this.\u0275cmp=t.VBU({type:yt,selectors:[["vdr-facet-detail"]],features:[t.Vt3],decls:45,vars:43,consts:[["updateButton",""],["private",""],[3,"languageCodeChange","disabled","availableLanguageCodes","currentLanguageCode"],["locationId","facet-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],[1,"form",3,"formGroup"],["formGroupName","facet"],["for","visibility",3,"label"],["type","checkbox","clrToggle","","formControlName","visible","id","visibility",3,"vdrDisabled"],[1,"visible-toggle"],[4,"ngIf","ngIfElse"],[3,"entity",4,"ngIf"],[1,"form-grid"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"input","readonly"],["for","code",3,"label"],["id","code","type","text","formControlName","code",3,"readonly"],[3,"title",4,"ngIf"],["locationId","facet-detail",3,"entity$","detailForm"],[3,"title","paddingX",4,"ngIf"],[1,"btn","btn-primary",3,"click","disabled"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"entity"],[3,"title"],["entityName","Facet",3,"customFields","customFieldsFormGroup","readonly"],[3,"title","paddingX"],["vdrCardControls",""],[4,"ngIf"],["type","button","class","button m-3",3,"click",4,"vdrIfPermissions"],["type","text",1,"mr-3",3,"formControl","placeholder"],["formArrayName","values",1,"facet-values-list","table"],["class","facet-value",3,"formGroup",4,"ngFor","ngForOf"],[1,"pagination-wrapper"],[3,"itemsPerPageChange","itemsPerPage"],[3,"pageChange","currentPage","itemsPerPage","totalItems"],[1,"facet-value",3,"formGroup"],[1,"align-middle"],["type","text","formControlName","name",3,"input","readonly"],["type","text","formControlName","code"],["class","",4,"ngIf"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"click","disabled"],["shape","trash",1,"is-danger"],[1,""],["entityName","FacetValue",3,"customFields","compact","customFieldsFormGroup","readonly"],["type","button",1,"button","m-3",3,"click"],["shape","add"]],template:function(e,a){if(1&e){const i=t.RV6();t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left")(3,"vdr-language-selector",2),t.nI1(4,"async"),t.nI1(5,"async"),t.nI1(6,"async"),t.bIt("languageCodeChange",function(c){return t.eBV(i),t.Njj(a.setLanguage(c))}),t.k0s()(),t.j41(7,"vdr-ab-right"),t.nrm(8,"vdr-action-bar-items",3),t.DNE(9,Cr,3,4,"button",4),t.nI1(10,"async"),t.DNE(11,Tr,1,1,"ng-template",null,0,t.C5r),t.nrm(13,"vdr-action-bar-dropdown-menu",3),t.k0s()()(),t.j41(14,"form",5)(15,"vdr-page-detail-layout")(16,"vdr-page-detail-sidebar",6)(17,"vdr-card")(18,"vdr-form-field",7),t.nI1(19,"translate"),t.j41(20,"clr-toggle-wrapper"),t.nrm(21,"input",8),t.nI1(22,"hasPermission"),t.j41(23,"label",9),t.DNE(24,Rr,3,3,"ng-container",10)(25,Fr,2,3,"ng-template",null,1,t.C5r),t.k0s()()()(),t.j41(27,"vdr-card"),t.DNE(28,Pr,1,1,"vdr-page-entity-info",11),t.nI1(29,"async"),t.k0s()(),t.j41(30,"vdr-page-block")(31,"vdr-card",6)(32,"div",12)(33,"vdr-form-field",13),t.nI1(34,"translate"),t.j41(35,"input",14),t.nI1(36,"hasPermission"),t.bIt("input",function(c){return t.eBV(i),t.Njj(a.updateCode(null==a.entity?null:a.entity.code,c.target.value))}),t.k0s()(),t.j41(37,"vdr-form-field",15),t.nI1(38,"translate"),t.nrm(39,"input",16),t.nI1(40,"hasPermission"),t.k0s()()(),t.DNE(41,Dr,4,8,"vdr-card",17),t.nrm(42,"vdr-custom-detail-component-host",18),t.DNE(43,yr,7,9,"vdr-card",19),t.nI1(44,"async"),t.k0s()()()}if(2&e){const i=t.sdS(12),s=t.sdS(26);t.R7$(3),t.Y8G("disabled",t.bMT(4,19,a.isNew$))("availableLanguageCodes",t.bMT(5,21,a.availableLanguages$))("currentLanguageCode",t.bMT(6,23,a.languageCode$)),t.R7$(6),t.Y8G("ngIf",t.bMT(10,25,a.isNew$))("ngIfElse",i),t.R7$(5),t.Y8G("formGroup",a.detailForm),t.R7$(4),t.Y8G("label",t.bMT(19,27,"catalog.visibility")),t.R7$(3),t.Y8G("vdrDisabled",!t.bMT(22,29,a.updatePermission)),t.R7$(3),t.Y8G("ngIf",null==a.detailForm.value.facet?null:a.detailForm.value.facet.visible)("ngIfElse",s),t.R7$(4),t.Y8G("ngIf",t.bMT(29,31,a.entity$)),t.R7$(5),t.Y8G("label",t.bMT(34,33,"common.name")),t.R7$(2),t.Y8G("readonly",!t.bMT(36,35,a.updatePermission)),t.R7$(2),t.Y8G("label",t.bMT(38,37,"common.code")),t.R7$(2),t.Y8G("readonly",!t.bMT(40,39,a.updatePermission)),t.R7$(2),t.Y8G("ngIf",a.customFields.length),t.R7$(),t.Y8G("entity$",a.entity$)("detailForm",a.detailForm),t.R7$(),t.Y8G("ngIf",!t.bMT(44,41,a.isNew$))}},dependencies:[b.U4n,b.aZZ,b.Jej,b.eAx,g.Sq,g.bT,d.qT,d.me,d.Zm,d.BC,d.cb,d.l_,d.j4,d.JD,d.$R,d.v8,R.nG,R.wL,R.TX,nt.l,_e.w,ge.e,L.K,$.V,H.t,ae.P,ie.q,re.j,Ht.M,X.p,ot.T,se.y,gr.n,bt.W,le.L,A.e,wt.E,ce.c,de.e,lt.i,lt.a,g.Jj,ne.kf,T.D9,q.E],styles:[".visible-toggle[_ngcontent-%COMP%]{margin-top:-3px!important}tr.facet-value[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle}.pagination-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:space-between;padding:var(--card-padding)}"],changeDetection:0})}}const Ke=(0,l.AfA)({location:"facet-list",requiresPermission:o=>o.includes(l.aXG.DeleteFacet)||o.includes(l.aXG.DeleteCatalog),getItemName:o=>o.name,shouldRetryItem:(o,n)=>!!o.message,bulkDelete:(o,n,e)=>o.facet.deleteFacets(n,e).pipe((0,f.T)(a=>a.deleteFacets))}),Qe=(0,l.oUe)({location:"facet-list",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateFacet),getItemName:o=>o.name,bulkAssignToChannel:(o,n,e)=>e.map(a=>o.facet.assignFacetsToChannel({facetIds:n,channelId:a}).pipe((0,f.T)(i=>i.assignFacetsToChannel)))}),Ze=(0,l.YSJ)({location:"facet-list",requiresPermission:o=>o.includes(l.aXG.DeleteCatalog)||o.includes(l.aXG.DeleteFacet),getItemName:o=>o.name,bulkRemoveFromChannel:(o,n,e,a)=>o.facet.removeFacetsFromChannel({channelId:e,facetIds:n,force:a}).pipe((0,f.T)(i=>i.removeFacetsFromChannel)),isErrorResult:o=>"FacetInUseError"===o.__typename?o.message:void 0}),Vr={location:"facet-list",label:(0,u.x)("catalog.remove-from-channel"),getTranslationVars:({injector:o})=>(0,l.w2E)(o.get(l.uSP)),icon:"layers",iconClass:"is-warning",requiresPermission:o=>o.includes(l.aXG.UpdateFacet)||o.includes(l.aXG.UpdateCatalog),isVisible:({injector:o})=>(0,l.r6Z)(o.get(l.uSP)),onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{const i=o.get(l.Bg8),s=o.get(l.uSP),c=o.get(l.JEu),m=s.client.userStatus().mapSingle(({userStatus:h})=>h.activeChannelId);function _(h,v){return i.dialog({title:(0,u.x)("catalog.remove-from-channel"),translationVars:{count:n.length},size:v?"lg":"md",body:v,buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:v?(0,u.x)("common.force-remove"):(0,u.x)("common.remove"),returnValue:!0}]}).pipe((0,C.n)(F=>F?m.pipe((0,C.n)(I=>I?s.facet.removeFacetsFromChannel({channelId:I,facetIds:h,force:!!v}):E.w),(0,f.T)(I=>I.removeFacetsFromChannel)):E.w))}_((0,x.A)(n.map(h=>h.id))).pipe((0,C.n)(h=>{let v=n.length;const F=[],I=[];let G=0;for(const k of h)"FacetInUseError"===k.__typename&&(F.push(k.message),I.push(n[G]?.id),v--),G++;return 0<I.length?_(I,F.join("\n")).pipe((0,f.T)(k=>{const y=k.filter(rt=>"FacetInUseError"===rt.__typename).length;return n.length-y})):(0,O.of)(v)}),(0,C.n)(h=>h?(0,l.w2E)(s).then(({channelCode:v})=>({channelCode:v,removedCount:h})):E.w)).subscribe(({removedCount:h,channelCode:v})=>{h&&(e.refresh(),a(),c.success((0,u.x)("catalog.notify-remove-facets-from-channel-success"),{count:h,channelCode:v}))})}},ze={location:"facet-list",label:(0,u.x)("common.duplicate"),icon:"copy",onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{o.get(l.Bg8).fromComponent(l.MPR,{locals:{entities:n,entityName:"Facet",title:(0,u.x)("catalog.duplicate-facets"),getEntityName:s=>s.name}}).subscribe(s=>{s&&(a(),e.refresh())})}},Sr=()=>["CreateCatalog","CreateFacet"],xr=()=>["./create"],Nr=o=>["./",o];function Ar(o,n){1&o&&(t.j41(0,"a",15),t.nrm(1,"clr-icon",16),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,xr)),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.create-new-facet")," "))}function jr(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function Yr(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function Ur(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function Lr(o,n){if(1&o&&(t.j41(0,"a",17)(1,"span"),t.EFF(2),t.k0s(),t.nrm(3,"clr-icon",18),t.k0s()),2&o){const e=n.item;t.Y8G("routerLink",t.eq3(2,Nr,e.id)),t.R7$(2),t.JRh(e.name)}}function Br(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.code," ")}}function wr(o,n){1&o&&(t.j41(0,"vdr-chip",21),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.private")))}function Xr(o,n){1&o&&(t.j41(0,"vdr-chip",22),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.public")))}function Jr(o,n){if(1&o&&t.DNE(0,wr,3,3,"vdr-chip",19)(1,Xr,3,3,"vdr-chip",20),2&o){const e=n.item;t.Y8G("ngIf",e.isPrivate),t.R7$(),t.Y8G("ngIf",!e.isPrivate)}}function Hr(o,n){if(1&o&&t.nrm(0,"vdr-facet-value-chip",27),2&o){const e=n.$implicit;t.Y8G("facetValue",e)("removable",!1)("displayFacetName",!1)}}function Wr(o,n){if(1&o&&(t.j41(0,"vdr-chip"),t.EFF(1),t.k0s()),2&o){const e=t.XpG().item;t.R7$(),t.SpI(" ... + ",e.valueList.totalItems-e.valueList.items.length," ")}}function Kr(o,n){if(1&o&&(t.qex(0),t.nrm(1,"clr-icon",16),t.EFF(2),t.bVm()),2&o){const e=t.XpG(2).item,a=t.XpG();t.R7$(2),t.SpI(" ",e.valueList.totalItems-a.initialLimit," ")}}function Qr(o,n){1&o&&t.nrm(0,"clr-icon",30)}function Zr(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",28),t.bIt("click",function(){t.eBV(e);const i=t.XpG().item,s=t.XpG();return t.Njj(s.toggleDisplayLimit(i))}),t.DNE(1,Kr,3,1,"ng-container",29)(2,Qr,1,0,"ng-template",null,0,t.C5r),t.k0s()}if(2&o){const e=t.sdS(3),a=t.XpG().item,i=t.XpG();t.R7$(),t.Y8G("ngIf",(i.displayLimit[a.id]||0)<a.valueList.items.length)("ngIfElse",e)}}function zr(o,n){if(1&o&&(t.j41(0,"div",23),t.DNE(1,Hr,1,3,"vdr-facet-value-chip",24),t.nI1(2,"slice"),t.DNE(3,Wr,2,1,"vdr-chip",25)(4,Zr,4,2,"button",26),t.k0s()),2&o){const e=n.item,a=t.XpG();t.R7$(),t.Y8G("ngForOf",t.brH(2,3,e.valueList.items,0,a.displayLimit[e.id]||3)),t.R7$(2),t.Y8G("ngIf",a.displayLimit[e.id]<e.valueList.totalItems&&(a.displayLimit[e.id]||0)===e.valueList.items.length),t.R7$(),t.Y8G("ngIf",e.valueList.items.length>a.initialLimit)}}function qr(o,n){if(1&o&&t.nrm(0,"vdr-dt2-custom-field-column",31),2&o){const e=n.$implicit,a=t.XpG();t.Y8G("customField",e)("sorts",a.sorts)}}const ts=M.J1`
|
|
90
|
+
query GetFacetList($options: FacetListOptions, $facetValueListOptions: FacetValueListOptions) {
|
|
91
|
+
facets(options: $options) {
|
|
92
|
+
items {
|
|
93
|
+
...FacetWithValueList
|
|
94
|
+
}
|
|
95
|
+
totalItems
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
${l.r$9}
|
|
99
|
+
`;class Vt extends l.B8I{constructor(n){super(),this.dataService=n,this.initialLimit=3,this.displayLimit={},this.customFields=this.getCustomFieldConfig("Facet"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilter({name:"visibility",type:{kind:"boolean"},label:(0,u.x)("common.visibility"),toFilterInput:e=>({isPrivate:{eq:!e}})}).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().defaultSort("createdAt","DESC").addSort({name:"id"}).addSort({name:"createdAt"}).addSort({name:"updatedAt"}).addSort({name:"name"}).addSort({name:"code"}).addCustomFieldSorts(this.customFields).connectToRoute(this.route),super.configure({document:l.xne,getItems:e=>e.facets,setVariables:(e,a)=>({options:{skip:e,take:a,filter:{name:{contains:this.searchTermControl.value},...this.filters.createFilterInput()},sort:this.sorts.createSortInput()},facetValueListOptions:{take:100}}),refreshListOnChanges:[this.filters.valueChanges,this.sorts.valueChanges]})}toggleDisplayLimit(n){this.displayLimit[n.id]===n.valueList.items.length?this.displayLimit[n.id]=this.initialLimit:this.displayLimit[n.id]=n.valueList.items.length}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}static{this.\u0275fac=function(e){return new(e||Vt)(t.rXU(l.uSP))}}static{this.\u0275cmp=t.VBU({type:Vt,selectors:[["vdr-facet-list"]],features:[t.Vt3],decls:40,vars:57,consts:[["collapse",""],[3,"languageCodeChange","availableLanguageCodes","currentLanguageCode"],["locationId","facet-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],["id","facet-list",1,"mt-2",3,"pageChange","itemsPerPageChange","items","itemsPerPage","totalItems","currentPage","filters"],["locationId","facet-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault","sort"],["id","created-at",3,"heading","hiddenByDefault","sort"],["id","updated-at",3,"heading","hiddenByDefault","sort"],["id","name",3,"heading","optional","sort"],["id","code",3,"heading"],["id","visibility",3,"heading"],["id","values",3,"heading"],[3,"customField","sorts",4,"ngFor","ngForOf"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],["colorType","warning",4,"ngIf"],["colorType","success",4,"ngIf"],["colorType","warning"],["colorType","success"],[1,"facet-values-list"],[3,"facetValue","removable","displayFacetName",4,"ngFor","ngForOf"],[4,"ngIf"],["class","button-small",3,"click",4,"ngIf"],[3,"facetValue","removable","displayFacetName"],[1,"button-small",3,"click"],[4,"ngIf","ngIfElse"],["shape","minus"],[3,"customField","sorts"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left")(3,"vdr-language-selector",1),t.nI1(4,"async"),t.nI1(5,"async"),t.bIt("languageCodeChange",function(s){return a.setLanguage(s)}),t.k0s()(),t.j41(6,"vdr-ab-right"),t.nrm(7,"vdr-action-bar-items",2),t.DNE(8,Ar,4,5,"a",3),t.nrm(9,"vdr-action-bar-dropdown-menu",2),t.k0s()()(),t.j41(10,"vdr-data-table-2",4),t.nI1(11,"async"),t.nI1(12,"async"),t.nI1(13,"async"),t.nI1(14,"async"),t.bIt("pageChange",function(s){return a.setPageNumber(s)})("itemsPerPageChange",function(s){return a.setItemsPerPage(s)}),t.nrm(15,"vdr-bulk-action-menu",5)(16,"vdr-dt2-search",6),t.nI1(17,"translate"),t.j41(18,"vdr-dt2-column",7),t.nI1(19,"translate"),t.DNE(20,jr,1,1,"ng-template"),t.k0s(),t.j41(21,"vdr-dt2-column",8),t.nI1(22,"translate"),t.DNE(23,Yr,2,4,"ng-template"),t.k0s(),t.j41(24,"vdr-dt2-column",9),t.nI1(25,"translate"),t.DNE(26,Ur,2,4,"ng-template"),t.k0s(),t.j41(27,"vdr-dt2-column",10),t.nI1(28,"translate"),t.DNE(29,Lr,4,4,"ng-template"),t.k0s(),t.j41(30,"vdr-dt2-column",11),t.nI1(31,"translate"),t.DNE(32,Br,1,1,"ng-template"),t.k0s(),t.j41(33,"vdr-dt2-column",12),t.nI1(34,"translate"),t.DNE(35,Jr,2,2,"ng-template"),t.k0s(),t.j41(36,"vdr-dt2-column",13),t.nI1(37,"translate"),t.DNE(38,zr,5,7,"ng-template"),t.k0s(),t.DNE(39,qr,1,2,"vdr-dt2-custom-field-column",14),t.k0s()),2&e&&(t.R7$(3),t.Y8G("availableLanguageCodes",t.bMT(4,28,a.availableLanguages$))("currentLanguageCode",t.bMT(5,30,a.contentLanguage$)),t.R7$(5),t.Y8G("vdrIfPermissions",t.lJ4(56,Sr)),t.R7$(2),t.Y8G("items",t.bMT(11,32,a.items$))("itemsPerPage",t.bMT(12,34,a.itemsPerPage$))("totalItems",t.bMT(13,36,a.totalItems$))("currentPage",t.bMT(14,38,a.currentPage$))("filters",a.filters),t.R7$(5),t.Y8G("hostComponent",a)("selectionManager",a.selectionManager),t.R7$(),t.Y8G("searchTermControl",a.searchTermControl)("searchTermPlaceholder",t.bMT(17,40,"catalog.filter-by-name")),t.R7$(2),t.Y8G("heading",t.bMT(19,42,"common.id"))("hiddenByDefault",!0)("sort",a.sorts.get("id")),t.R7$(3),t.Y8G("heading",t.bMT(22,44,"common.created-at"))("hiddenByDefault",!0)("sort",a.sorts.get("createdAt")),t.R7$(3),t.Y8G("heading",t.bMT(25,46,"common.updated-at"))("hiddenByDefault",!0)("sort",a.sorts.get("updatedAt")),t.R7$(3),t.Y8G("heading",t.bMT(28,48,"common.name"))("optional",!1)("sort",a.sorts.get("name")),t.R7$(3),t.Y8G("heading",t.bMT(31,50,"common.code")),t.R7$(3),t.Y8G("heading",t.bMT(34,52,"common.visibility")),t.R7$(3),t.Y8G("heading",t.bMT(37,54,"catalog.values")),t.R7$(3),t.Y8G("ngForOf",a.customFields))},dependencies:[b.U4n,g.Sq,g.bT,P.Wk,R.nG,R.wL,R.TX,nt.l,Q.w,oe.K,H.t,X.p,ot.T,pe.T,Ct.I,z.Y,dt.E,ue.T,A.e,g.Jj,g.P9,T.D9,ct.P],styles:[".facet-values-list[_ngcontent-%COMP%]{max-width:500px;display:flex;flex-wrap:wrap;align-items:center;gap:4px}"]})}}const es=["optionGroupName"];function ns(o,n){if(1&o){const e=t.RV6();t.j41(0,"div",6)(1,"div",7)(2,"label"),t.EFF(3),t.nI1(4,"translate"),t.k0s(),t.j41(5,"input",8,0),t.mxI("ngModelChange",function(i){const s=t.eBV(e).$implicit;return t.DH7(s.name,i)||(s.name=i),t.Njj(i)}),t.bIt("keydown.enter",function(i){t.eBV(e);const s=t.sdS(12),c=t.XpG();return t.Njj(c.handleEnter(i,s))}),t.k0s()(),t.j41(7,"div",9)(8,"label"),t.EFF(9),t.nI1(10,"translate"),t.k0s(),t.j41(11,"vdr-option-value-input",10,1),t.mxI("ngModelChange",function(i){const s=t.eBV(e).$implicit;return t.DH7(s.values,i)||(s.values=i),t.Njj(i)}),t.bIt("ngModelChange",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.generateVariants())})("edit",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.generateVariants())}),t.k0s()(),t.j41(13,"div",11)(14,"button",12),t.nI1(15,"translate"),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.removeOption(i.name))}),t.nrm(16,"clr-icon",13),t.k0s()()()}if(2&o){const e=n.$implicit;t.R7$(3),t.JRh(t.bMT(4,7,"catalog.option")),t.R7$(2),t.R50("ngModel",e.name),t.R7$(4),t.JRh(t.bMT(10,9,"catalog.option-values")),t.R7$(2),t.R50("ngModel",e.values),t.Y8G("groupName",e.name)("disabled",""===e.name),t.R7$(3),t.Y8G("title",t.bMT(15,11,"catalog.remove-option"))}}function os(o,n){1&o&&(t.j41(0,"clr-alert",18)(1,"clr-alert-item")(2,"span",19),t.EFF(3),t.nI1(4,"translate"),t.k0s()()()),2&o&&(t.Y8G("clrAlertClosable",!1),t.R7$(3),t.SpI(" ",t.bMT(4,2,"catalog.no-stock-locations-available-on-current-channel")," "))}function as(o,n){if(1&o&&(t.j41(0,"option",23),t.EFF(1),t.k0s()),2&o){const e=n.$implicit;t.Y8G("value",e.id),t.R7$(),t.SpI(" ",e.name," ")}}function is(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-form-field",20),t.nI1(1,"translate"),t.j41(2,"select",21),t.mxI("ngModelChange",function(i){t.eBV(e);const s=t.XpG(2);return t.DH7(s.selectedStockLocationId,i)||(s.selectedStockLocationId=i),t.Njj(i)}),t.DNE(3,as,2,2,"option",22),t.k0s()()}if(2&o){const e=t.XpG().ngIf,a=t.XpG();t.Y8G("label",t.bMT(1,3,"catalog.add-stock-to-location")),t.R7$(2),t.R50("ngModel",a.selectedStockLocationId),t.R7$(),t.Y8G("ngForOf",e)}}function rs(o,n){1&o&&(t.j41(0,"th"),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.create")))}function ss(o,n){1&o&&(t.j41(0,"th"),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"catalog.variant")))}function ls(o,n){1&o&&(t.j41(0,"td"),t.nrm(1,"input",31),t.k0s())}function cs(o,n){if(1&o&&(t.j41(0,"td"),t.EFF(1),t.k0s()),2&o){const e=t.XpG().$implicit;t.R7$(),t.SpI(" ",e.values.join(" ")," ")}}function ds(o,n){if(1&o&&(t.j41(0,"tr",27),t.DNE(1,ls,2,0,"td",5)(2,cs,2,1,"td",5),t.j41(3,"td")(4,"vdr-form-field"),t.nrm(5,"input",28),t.nI1(6,"translate"),t.k0s()(),t.j41(7,"td")(8,"vdr-form-field"),t.nrm(9,"vdr-currency-input",29),t.k0s()(),t.j41(10,"td")(11,"vdr-form-field"),t.nrm(12,"input",30),t.k0s()()()),2&o){const e=n.$implicit,a=t.XpG(3);t.AVh("disabled",!!a.variantFormValues[e.id].value.enabled),t.Y8G("formGroup",a.variantFormValues[e.id]),t.R7$(),t.Y8G("ngIf",1<a.variants.length),t.R7$(),t.Y8G("ngIf",1<a.variants.length),t.R7$(3),t.Y8G("placeholder",t.bMT(6,7,"catalog.sku")),t.R7$(4),t.Y8G("currencyCode",a.currencyCode)}}function ps(o,n){if(1&o&&(t.j41(0,"div",24)(1,"table",25)(2,"thead")(3,"tr"),t.DNE(4,rs,3,3,"th",5)(5,ss,3,3,"th",5),t.j41(6,"th"),t.EFF(7),t.nI1(8,"translate"),t.k0s(),t.j41(9,"th"),t.EFF(10),t.nI1(11,"translate"),t.k0s(),t.j41(12,"th"),t.EFF(13),t.nI1(14,"translate"),t.k0s()()(),t.DNE(15,ds,13,9,"tr",26),t.k0s()()),2&o){const e=t.XpG(2);t.R7$(4),t.Y8G("ngIf",1<e.variants.length),t.R7$(),t.Y8G("ngIf",1<e.variants.length),t.R7$(2),t.JRh(t.bMT(8,7,"catalog.sku")),t.R7$(3),t.JRh(t.bMT(11,9,"catalog.price")),t.R7$(3),t.JRh(t.bMT(14,11,"catalog.stock-on-hand")),t.R7$(2),t.Y8G("ngForOf",e.variants)("ngForTrackBy",e.trackByFn)}}function us(o,n){if(1&o&&(t.qex(0),t.DNE(1,os,5,4,"clr-alert",14),t.j41(2,"div",15),t.DNE(3,is,4,5,"vdr-form-field",16),t.k0s(),t.DNE(4,ps,16,13,"div",17),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",0===e.length),t.R7$(2),t.Y8G("ngIf",e.length),t.R7$(),t.Y8G("ngIf",0<e.length)}}const be="__DEFAULT_VARIANT__";class St{constructor(n,e){this.dataService=n,this.formBuilder=e,this.variantsChange=new t.bkB,this.optionGroups=[],this.variantFormValues={},this.selectedStockLocationId=null}ngOnInit(){this.dataService.settings.getActiveChannel().single$.subscribe(n=>{this.currencyCode=n.activeChannel.defaultCurrencyCode}),this.stockLocations$=this.dataService.query(l.jju,{options:{take:999}}).refetchOnChannelChange().mapStream(({stockLocations:n})=>n.items).pipe((0,N.M)(n=>{n.length&&(this.selectedStockLocationId=n[0].id,this.onFormChange())})),this.generateVariants()}addOption(){this.optionGroups.push({name:"",values:[]});const n=this.optionGroups.length-1;setTimeout(()=>{this.groupNameInputs.get(n)?.nativeElement?.focus()})}removeOption(n){this.optionGroups=this.optionGroups.filter(e=>e.name!==n),this.generateVariants()}generateVariants(){const e=this.optionGroups.reduce((a,i)=>a+i.values.length,0)?this.optionGroups.map(a=>a.values.map(i=>i.name)):[[be]];this.variants=(0,st.generateAllCombinations)(e).map(a=>({id:a.join("|"),values:a})),this.variants.forEach((a,i)=>{if(!this.variantFormValues[a.id]){const s=this.formBuilder.nonNullable.group({optionValues:[a.values],enabled:!0,price:this.copyFromDefault(a.id,"price",0),sku:this.copyFromDefault(a.id,"sku",""),stock:this.copyFromDefault(a.id,"stock",0)});s.valueChanges.subscribe(()=>this.onFormChange()),0===i&&(s.get("price")?.valueChanges.subscribe(c=>{this.copyValuesToPristine("price",s.get("price"))}),s.get("sku")?.valueChanges.subscribe(c=>{this.copyValuesToPristine("sku",s.get("sku"))}),s.get("stock")?.valueChanges.subscribe(c=>{this.copyValuesToPristine("stock",s.get("stock"))})),this.variantFormValues[a.id]=s}}),this.onFormChange()}trackByFn(n,e){return e.values.join("|")}handleEnter(n,e){n.preventDefault(),n.stopPropagation(),e.focus()}copyValuesToPristine(n,e){e&&Object.values(this.variantFormValues).forEach(a=>{const i=a.get(n);i&&i.pristine&&i.setValue(e.value,{emitEvent:!1})})}onFormChange(){const n=this.variants.map(e=>this.variantFormValues[e.id].value).filter(e=>e.enabled);this.variantsChange.emit({groups:this.optionGroups.map(e=>({name:e.name,values:e.values.map(a=>a.name)})),variants:n,stockLocationId:this.selectedStockLocationId})}copyFromDefault(n,e,a){return n!==be?this.variantFormValues[be].get(e)?.value:a}static{this.\u0275fac=function(e){return new(e||St)(t.rXU(l.uSP),t.rXU(d.ok))}}static{this.\u0275cmp=t.VBU({type:St,selectors:[["vdr-generate-product-variants"]],viewQuery:function(e,a){if(1&e&&t.GBs(es,5,t.aKT),2&e){let i;t.mGM(i=t.lsd())&&(a.groupNameInputs=i)}},outputs:{variantsChange:"variantsChange"},decls:7,vars:7,consts:[["optionGroupName",""],["optionValueInputComponent",""],["class","option-groups",4,"ngFor","ngForOf"],[1,"button","mb-2",3,"click"],["shape","plus"],[4,"ngIf"],[1,"option-groups"],[1,"name"],["placeholder","e.g. Size","clrInput","","name","name","required","",3,"ngModelChange","keydown.enter","ngModel"],[1,"values"],[3,"ngModelChange","edit","ngModel","groupName","disabled"],[1,"remove-group"],[1,"button-small","mt-2",3,"click","title"],["shape","trash"],["clrAlertType","warning","class","",3,"clrAlertClosable",4,"ngIf"],[1,"form-grid","mb-2"],[3,"label",4,"ngIf"],["class","variants-preview",4,"ngIf"],["clrAlertType","warning",1,"",3,"clrAlertClosable"],[1,"alert-text"],[3,"label"],[3,"ngModelChange","ngModel"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"variants-preview"],[1,"table"],[3,"disabled","formGroup",4,"ngFor","ngForOf","ngForTrackBy"],[3,"formGroup"],["type","text","formControlName","sku",3,"placeholder"],["formControlName","price",3,"currencyCode"],["type","number","formControlName","stock","min","0","step","1"],["type","checkbox","formControlName","enabled","clrCheckbox",""]],template:function(e,a){1&e&&(t.DNE(0,ns,17,13,"div",2),t.j41(1,"button",3),t.bIt("click",function(){return a.addOption()}),t.nrm(2,"clr-icon",4),t.EFF(3),t.nI1(4,"translate"),t.k0s(),t.DNE(5,us,5,3,"ng-container",5),t.nI1(6,"async")),2&e&&(t.Y8G("ngForOf",a.optionGroups),t.R7$(3),t.SpI(" ",t.bMT(4,3,"catalog.add-option"),"\n"),t.R7$(2),t.Y8G("ngIf",t.bMT(6,5,a.stockLocations$)))},dependencies:[b.k8k,b.Bw1,b.tQl,b.U4n,b.aZZ,b.Jej,b.icl,g.Sq,g.bT,d.xH,d.y7,d.me,d.Q0,d.Zm,d.wz,d.BC,d.cb,d.YS,d.VZ,d.vS,d.j4,d.JD,ee.J,L.K,$.V,et,g.Jj,T.D9],styles:["[_nghost-%COMP%]{display:block;margin-bottom:120px}.option-groups[_ngcontent-%COMP%]{display:flex}.values[_ngcontent-%COMP%]{flex:1;margin:0 6px}.remove-group[_ngcontent-%COMP%]{padding-top:18px}.variants-preview[_ngcontent-%COMP%] tr.disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100);color:var(--color-grey-400)}"]})}}var ms=p(7605),qe=p(5655),Ce=p(3992),_s=p(1198),gs=p(3239),hs=p(1062),Ie=p(229);const fs=(o,n)=>["/catalog/products",o,"variants",n];function vs(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-page-block")(1,"vdr-language-selector",16),t.nI1(2,"async"),t.nI1(3,"async"),t.bIt("languageCodeChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.setLanguage(i))}),t.k0s()()}if(2&o){const e=t.XpG();t.R7$(),t.Y8G("availableLanguageCodes",t.bMT(2,2,e.availableLanguages$))("currentLanguageCode",t.bMT(3,4,e.contentLanguage$))}}function bs(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function Cs(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function Is(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function Ts(o,n){if(1&o&&(t.nrm(0,"img",19),t.nI1(1,"assetPreview")),2&o){const e=n.ngIf;t.Y8G("src",t.i5U(1,1,e,"tiny"),t.B4B)}}function Rs(o,n){1&o&&(t.j41(0,"div",20),t.nrm(1,"clr-icon",21),t.k0s())}function Fs(o,n){if(1&o&&(t.j41(0,"div",17),t.DNE(1,Ts,2,4,"img",18)(2,Rs,2,0,"ng-template",null,0,t.C5r),t.k0s()),2&o){const e=n.item,a=t.sdS(3);t.R7$(),t.Y8G("ngIf",e.featuredAsset)("ngIfElse",a)}}function Ps(o,n){if(1&o&&(t.j41(0,"a",22)(1,"span"),t.EFF(2),t.k0s(),t.nrm(3,"clr-icon",23),t.k0s()),2&o){const e=n.item;t.Y8G("routerLink",t.l_i(2,fs,e.productId,e.id)),t.R7$(2),t.JRh(e.name)}}function Ds(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.sku," ")}}function ks(o,n){1&o&&(t.j41(0,"vdr-chip",26),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.enabled")))}function Gs(o,n){1&o&&(t.j41(0,"vdr-chip",27),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.disabled")))}function Es(o,n){if(1&o&&t.DNE(0,ks,3,3,"vdr-chip",24)(1,Gs,3,3,"vdr-chip",25),2&o){const e=n.item;t.Y8G("ngIf",e.enabled),t.R7$(),t.Y8G("ngIf",!e.enabled)}}function Ms(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeCurrency")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.price,e.currencyCode)," ")}}function Os(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeCurrency")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.priceWithTax,e.currencyCode)," ")}}function $s(o,n){if(1&o&&(t.j41(0,"span",32),t.EFF(1),t.k0s()),2&o){const e=t.XpG().$implicit;t.R7$(),t.SpI("(",e.stockAllocated," allocated)")}}function ys(o,n){if(1&o&&(t.j41(0,"vdr-chip",29)(1,"div",30)(2,"div"),t.EFF(3),t.DNE(4,$s,2,1,"span",31),t.k0s()()()),2&o){const e=n.$implicit;t.Y8G("title",null==e.stockLocation?null:e.stockLocation.name),t.R7$(3),t.SpI(" ",e.stockOnHand,""),t.R7$(),t.Y8G("ngIf",e.stockAllocated)}}function Vs(o,n){if(1&o&&t.DNE(0,ys,5,3,"vdr-chip",28),2&o){const e=n.item;t.Y8G("ngForOf",e.stockLevels)}}function Ss(o,n){if(1&o&&t.nrm(0,"vdr-dt2-custom-field-column",33),2&o){const e=n.$implicit,a=t.XpG();t.Y8G("customField",e)("sorts",a.sorts)}}class ft extends l.B8I{constructor(){super(),this.hideLanguageSelect=!1,this.customFields=this.getCustomFieldConfig("ProductVariant"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilters([{name:"name",type:{kind:"text"},label:(0,u.x)("common.name"),filterField:"name"},{name:"enabled",type:{kind:"boolean"},label:(0,u.x)("common.enabled"),filterField:"enabled"},{name:"sku",type:{kind:"text"},label:(0,u.x)("catalog.sku"),filterField:"sku"},{name:"price",type:{kind:"number",inputType:"currency"},label:(0,u.x)("common.price"),filterField:"price"},{name:"priceWithTax",type:{kind:"number",inputType:"currency"},label:(0,u.x)("common.price-with-tax"),filterField:"priceWithTax"}]).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().addSorts([{name:"id"},{name:"createdAt"},{name:"updatedAt"},{name:"name"},{name:"sku"},{name:"price"},{name:"priceWithTax"}]).addCustomFieldSorts(this.customFields).connectToRoute(this.route),this.configure({document:l.kw5,getItems:n=>n.productVariants,setVariables:(n,e)=>{const a=this.searchTermControl.value,i={_and:[]},s=this.filters.createFilterInput();return Object.keys(s).length&&i._and?.push(s),a&&i._and?.push({_or:[{name:{contains:a}},{sku:{contains:a}}]}),this.productId&&i._and?.push({productId:{eq:this.productId}}),{options:{skip:n,take:e,filter:i,sort:this.sorts.createSortInput()}}},refreshListOnChanges:[this.sorts.valueChanges,this.filters.valueChanges]})}static{this.\u0275fac=function(e){return new(e||ft)}}static{this.\u0275cmp=t.VBU({type:ft,selectors:[["vdr-product-variant-list"]],inputs:{productId:"productId",hideLanguageSelect:"hideLanguageSelect",dataTableId:"dataTableId"},features:[t.Vt3],decls:40,vars:65,consts:[["imagePlaceholder",""],[4,"ngIf"],[1,"mt-2",3,"pageChange","itemsPerPageChange","id","items","itemsPerPage","totalItems","currentPage","filters"],["locationId","product-variant-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault","sort"],["id","created-at",3,"heading","hiddenByDefault","sort"],["id","updated-at",3,"heading","hiddenByDefault","sort"],["id","image",3,"heading"],["id","name",3,"heading","optional","sort"],["id","sku",3,"heading","sort"],["id","enabled",3,"heading"],["id","price",3,"heading","hiddenByDefault","sort"],["id","price-with-tax",3,"heading","sort"],["id","stock-on-hand",3,"heading","hiddenByDefault"],[3,"customField","sorts",4,"ngFor","ngForOf"],[3,"languageCodeChange","availableLanguageCodes","currentLanguageCode"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],["colorType","success",4,"ngIf"],["colorType","warning",4,"ngIf"],["colorType","success"],["colorType","warning"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],[1,"flex","center"],["class","ml-1",4,"ngIf"],[1,"ml-1"],[3,"customField","sorts"]],template:function(e,a){1&e&&(t.DNE(0,vs,4,6,"vdr-page-block",1),t.j41(1,"vdr-data-table-2",2),t.nI1(2,"async"),t.nI1(3,"async"),t.nI1(4,"async"),t.nI1(5,"async"),t.bIt("pageChange",function(s){return a.setPageNumber(s)})("itemsPerPageChange",function(s){return a.setItemsPerPage(s)}),t.nrm(6,"vdr-bulk-action-menu",3)(7,"vdr-dt2-search",4),t.nI1(8,"translate"),t.j41(9,"vdr-dt2-column",5),t.nI1(10,"translate"),t.DNE(11,bs,1,1,"ng-template"),t.k0s(),t.j41(12,"vdr-dt2-column",6),t.nI1(13,"translate"),t.DNE(14,Cs,2,4,"ng-template"),t.k0s(),t.j41(15,"vdr-dt2-column",7),t.nI1(16,"translate"),t.DNE(17,Is,2,4,"ng-template"),t.k0s(),t.j41(18,"vdr-dt2-column",8),t.nI1(19,"translate"),t.DNE(20,Fs,4,2,"ng-template"),t.k0s(),t.j41(21,"vdr-dt2-column",9),t.nI1(22,"translate"),t.DNE(23,Ps,4,5,"ng-template"),t.k0s(),t.j41(24,"vdr-dt2-column",10),t.nI1(25,"translate"),t.DNE(26,Ds,1,1,"ng-template"),t.k0s(),t.j41(27,"vdr-dt2-column",11),t.nI1(28,"translate"),t.DNE(29,Es,2,2,"ng-template"),t.k0s(),t.j41(30,"vdr-dt2-column",12),t.nI1(31,"translate"),t.DNE(32,Ms,2,4,"ng-template"),t.k0s(),t.j41(33,"vdr-dt2-column",13),t.nI1(34,"translate"),t.DNE(35,Os,2,4,"ng-template"),t.k0s(),t.j41(36,"vdr-dt2-column",14),t.nI1(37,"translate"),t.DNE(38,Vs,1,1,"ng-template"),t.k0s(),t.DNE(39,Ss,1,2,"vdr-dt2-custom-field-column",15),t.k0s()),2&e&&(t.Y8G("ngIf",!a.hideLanguageSelect),t.R7$(),t.Y8G("id",a.dataTableId||"product-variant-list")("items",t.bMT(2,35,a.items$))("itemsPerPage",t.bMT(3,37,a.itemsPerPage$))("totalItems",t.bMT(4,39,a.totalItems$))("currentPage",t.bMT(5,41,a.currentPage$))("filters",a.filters),t.R7$(5),t.Y8G("hostComponent",a)("selectionManager",a.selectionManager),t.R7$(),t.Y8G("searchTermControl",a.searchTermControl)("searchTermPlaceholder",t.bMT(8,43,"settings.search-by-product-name-or-sku")),t.R7$(2),t.Y8G("heading",t.bMT(10,45,"common.id"))("hiddenByDefault",!0)("sort",a.sorts.get("id")),t.R7$(3),t.Y8G("heading",t.bMT(13,47,"common.created-at"))("hiddenByDefault",!0)("sort",a.sorts.get("createdAt")),t.R7$(3),t.Y8G("heading",t.bMT(16,49,"common.updated-at"))("hiddenByDefault",!0)("sort",a.sorts.get("updatedAt")),t.R7$(3),t.Y8G("heading",t.bMT(19,51,"common.image")),t.R7$(3),t.Y8G("heading",t.bMT(22,53,"catalog.name"))("optional",!1)("sort",a.sorts.get("name")),t.R7$(3),t.Y8G("heading",t.bMT(25,55,"catalog.sku"))("sort",a.sorts.get("sku")),t.R7$(3),t.Y8G("heading",t.bMT(28,57,"common.enabled")),t.R7$(3),t.Y8G("heading",t.bMT(31,59,"common.price"))("hiddenByDefault",!0)("sort",a.sorts.get("price")),t.R7$(3),t.Y8G("heading",t.bMT(34,61,"common.price-with-tax"))("sort",a.sorts.get("priceWithTax")),t.R7$(3),t.Y8G("heading",t.bMT(37,63,"catalog.stock-on-hand"))("hiddenByDefault",!1),t.R7$(3),t.Y8G("ngForOf",a.customFields))},dependencies:[b.U4n,g.Sq,g.bT,P.Wk,Q.w,H.t,pe.T,Ct.I,z.Y,dt.E,ue.T,A.e,g.Jj,T.D9,Ie.H,ct.P,Xt.u],styles:[".image-col[_ngcontent-%COMP%]{width:70px}.image-placeholder[_ngcontent-%COMP%]{width:50px;height:50px;margin-top:calc(var(--space-unit) * -1);margin-bottom:calc(var(--space-unit) * -1);background-color:var(--color-component-bg-200)}.image-placeholder[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}.image-placeholder[_ngcontent-%COMP%] .placeholder[_ngcontent-%COMP%]{text-align:center;color:var(--color-grey-300)}.search-form[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%}vdr-product-search-input[_ngcontent-%COMP%]{min-width:300px}@media screen and (max-width: 768px){vdr-product-search-input[_ngcontent-%COMP%]{min-width:100px}}.search-settings-menu[_ngcontent-%COMP%]{margin:0 12px}td.disabled[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.search-index-button[_ngcontent-%COMP%]{position:relative}.search-index-button[_ngcontent-%COMP%] vdr-status-badge[_ngcontent-%COMP%]{right:0;top:0}.run-updates-button[_ngcontent-%COMP%]{position:relative}.run-updates-button[_ngcontent-%COMP%] vdr-status-badge[_ngcontent-%COMP%]{left:10px;top:10px}.edit-button[_ngcontent-%COMP%]{margin-inline-end:24px}.sku[_ngcontent-%COMP%]{color:var(--color-text-300)}"]})}}var Te=p(8624);const xs=()=>["name"],tn=o=>({pattern:o}),Ns=()=>["enabled"],As=()=>["options"],js=()=>["manage-variants"];function Ys(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",28),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.create())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",e.detailForm.invalid||e.detailForm.pristine||0===e.createVariantsConfig.variants.length),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.create")," ")}}function Us(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",28),t.bIt("click",function(){t.eBV(e);const i=t.XpG(2);return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG(2);t.Y8G("disabled",(e.detailForm.invalid||e.detailForm.pristine)&&!e.assetsChanged()),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}function Ls(o,n){if(1&o&&t.DNE(0,Us,3,4,"button",29),2&o){const e=t.XpG();t.Y8G("vdrIfPermissions",e.updatePermissions)}}function Bs(o,n){if(1&o&&(t.j41(0,"clr-toggle-wrapper"),t.nrm(1,"input",30),t.j41(2,"label"),t.EFF(3),t.nI1(4,"translate"),t.k0s()()),2&o){const e=t.XpG();t.R7$(),t.Y8G("formControl",e.detailForm.get(t.lJ4(4,Ns))),t.R7$(2),t.JRh(t.bMT(4,2,"common.enabled"))}}function ws(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-chip",39),t.bIt("iconClick",function(){t.eBV(e);const i=t.XpG().$implicit,s=t.XpG(4);return t.Njj(s.removeFromChannel(i.id))}),t.nrm(1,"vdr-channel-badge",40),t.EFF(2),t.nI1(3,"channelCodeToLabel"),t.k0s()}if(2&o){const e=t.XpG().$implicit;t.R7$(),t.Y8G("channelCode",e.code),t.R7$(),t.SpI(" ",t.bMT(3,2,e.code)," ")}}function Xs(o,n){if(1&o&&(t.qex(0),t.DNE(1,ws,4,4,"vdr-chip",38),t.bVm()),2&o){const e=n.$implicit,a=t.XpG(4);t.R7$(),t.Y8G("ngIf",!a.isDefaultChannel(e.code))}}function Js(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-form-item")(1,"div",33)(2,"div",34),t.DNE(3,Xs,2,1,"ng-container",35),t.nI1(4,"async"),t.k0s(),t.j41(5,"button",36),t.bIt("click",function(){t.eBV(e);const i=t.XpG(3);return t.Njj(i.assignToChannel())}),t.nrm(6,"clr-icon",37),t.EFF(7),t.nI1(8,"translate"),t.k0s()()()}if(2&o){const e=t.XpG(3);t.R7$(3),t.Y8G("ngForOf",t.bMT(4,2,e.productChannels$)),t.R7$(4),t.SpI(" ",t.bMT(8,4,"common.assign-to-channel")," ")}}function Hs(o,n){1&o&&(t.j41(0,"vdr-card",11),t.nI1(1,"translate"),t.DNE(2,Js,9,6,"vdr-form-item",32),t.k0s()),2&o&&t.Y8G("title",t.bMT(1,1,"common.channels"))}function Ws(o,n){1&o&&(t.qex(0),t.DNE(1,Hs,3,3,"vdr-card",31),t.bVm())}function Ks(o,n){if(1&o&&(t.j41(0,"vdr-chip",44),t.EFF(1),t.k0s()),2&o){const e=n.$implicit;t.Y8G("colorFrom",e.code)("invert",!0),t.R7$(),t.SpI(" ",e.name," ")}}function Qs(o,n){1&o&&(t.j41(0,"a",45),t.nrm(1,"clr-icon",46),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,As)),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.edit-options")," "))}function Zs(o,n){if(1&o&&(t.j41(0,"vdr-card",11),t.nI1(1,"translate"),t.j41(2,"div",41),t.DNE(3,Ks,2,3,"vdr-chip",42),t.nI1(4,"sort"),t.k0s(),t.j41(5,"div"),t.DNE(6,Qs,4,5,"a",43),t.k0s()()),2&o){const e=t.XpG();t.Y8G("title",t.bMT(1,3,"catalog.product-options")),t.R7$(3),t.Y8G("ngForOf",t.i5U(4,5,null==e.entity?null:e.entity.optionGroups,"id")),t.R7$(3),t.Y8G("vdrIfPermissions",e.updatePermissions)}}function zs(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-facet-value-chip",47),t.nI1(1,"hasPermission"),t.bIt("remove",function(){const i=t.eBV(e).$implicit,s=t.XpG();return t.Njj(s.removeProductFacetValue(i.id))}),t.k0s()}if(2&o){const e=n.$implicit,a=t.XpG();t.Y8G("facetValue",e)("removable",t.bMT(1,2,a.updatePermissions))}}function qs(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",48),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.selectProductFacetValue())}),t.nrm(1,"clr-icon",49),t.EFF(2),t.nI1(3,"translate"),t.k0s()}2&o&&(t.R7$(2),t.SpI(" ",t.bMT(3,1,"catalog.add-facets")," "))}function tl(o,n){if(1&o&&(t.j41(0,"vdr-card"),t.nrm(1,"vdr-page-entity-info",50),t.k0s()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("entity",e)}}function el(o,n){1&o&&(t.j41(0,"div")(1,"clr-checkbox-wrapper"),t.nrm(2,"input",51),t.j41(3,"label"),t.EFF(4),t.nI1(5,"translate"),t.k0s()()()),2&o&&(t.R7$(4),t.JRh(t.bMT(5,1,"catalog.auto-update-product-variant-name")))}function nl(o,n){if(1&o&&(t.j41(0,"vdr-card",11),t.nI1(1,"translate"),t.nrm(2,"vdr-tabbed-custom-fields",52),t.nI1(3,"hasPermission"),t.k0s()),2&o){const e=t.XpG();t.Y8G("title",t.bMT(1,4,"common.custom-fields")),t.R7$(2),t.Y8G("customFields",e.customFields)("customFieldsFormGroup",e.detailForm.get("customFields"))("readonly",!t.bMT(3,6,e.updatePermissions))}}function ol(o,n){if(1&o){const e=t.RV6();t.j41(0,"div")(1,"vdr-generate-product-variants",53),t.bIt("variantsChange",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.createVariantsConfig=i)}),t.k0s()()}}function al(o,n){if(1&o&&t.nrm(0,"vdr-product-variant-list",54),2&o){const e=t.XpG();t.Y8G("productId",e.id)("hideLanguageSelect",!0)}}function il(o,n){1&o&&(t.j41(0,"div",55)(1,"a",56),t.nrm(2,"clr-icon",57),t.EFF(3),t.nI1(4,"translate"),t.k0s()()),2&o&&(t.R7$(),t.Y8G("routerLink",t.lJ4(4,js)),t.R7$(2),t.SpI(" ",t.bMT(4,2,"catalog.manage-variants"),""))}const rl=M.J1`
|
|
100
|
+
query GetProductDetail($id: ID!) {
|
|
101
|
+
product(id: $id) {
|
|
102
|
+
...ProductDetail
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
${l.NOX}
|
|
106
|
+
`;class vt extends l.wi7{constructor(n,e,a,i,s,c){super(),this.productDetailService=n,this.formBuilder=e,this.modalService=a,this.notificationService=i,this.dataService=s,this.changeDetector=c,this.customFields=this.getCustomFieldConfig("Product"),this.detailForm=this.formBuilder.group({enabled:!0,name:["",d.k0.required],autoUpdateVariantNames:!0,slug:["",(0,l.ySm)(/^[\p{Letter}0-9._-]+$/)],description:"",facetValueIds:[[]],customFields:this.formBuilder.group((0,l.HCD)(this.customFields))}),this.assetChanges={},this.createVariantsConfig={groups:[],variants:[],stockLocationId:""},this.updatePermissions=[l.aXG.UpdateCatalog,l.aXG.UpdateProduct]}ngOnInit(){this.init();const n=this.isNew$.pipe((0,C.n)(i=>i?(0,O.of)([]):this.entity$.pipe((0,f.T)(s=>s.facetValues)))),a=this.detailForm.get("facetValueIds").valueChanges.pipe((0,Y.F)(),(0,C.n)(i=>this.dataService.facet.getFacetValues({filter:{id:{in:i}}}).mapSingle(({facetValues:s})=>s.items)),(0,r.t)(1));this.facetValues$=(0,qe.x)(n.pipe((0,U.s)(1)),n.pipe((0,C.n)(()=>a))),this.productChannels$=this.entity$.pipe((0,f.T)(i=>i.channels))}ngOnDestroy(){this.destroy()}isDefaultChannel(n){return n===ms.ky}assignToChannel(){this.productChannels$.pipe((0,U.s)(1),(0,C.n)(n=>this.modalService.fromComponent(Z,{size:"lg",locals:{productIds:[this.id],currentChannelIds:n.map(e=>e.id)}}))).subscribe()}removeFromChannel(n){(0,he.H)((0,l.w2E)(this.dataService,n)).pipe((0,C.n)(({channelCode:e})=>this.modalService.dialog({title:(0,u.x)("catalog.remove-product-from-channel"),buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("catalog.remove-from-channel"),translationVars:{channelCode:e},returnValue:!0}]})),(0,C.n)(e=>e?this.dataService.product.removeProductsFromChannel({channelId:n,productIds:[this.id]}):E.w)).subscribe(()=>{this.notificationService.success((0,u.x)("catalog.notify-remove-product-from-channel-success"))},e=>{this.notificationService.error((0,u.x)("catalog.notify-remove-product-from-channel-error"))})}assignVariantToChannel(n){return this.modalService.fromComponent(Z,{size:"lg",locals:{productIds:[this.id],productVariantIds:[n.id],currentChannelIds:n.channels.map(e=>e.id)}}).subscribe()}removeVariantFromChannel({channelId:n,variant:e}){(0,he.H)((0,l.w2E)(this.dataService,n)).pipe((0,C.n)(({channelCode:a})=>this.modalService.dialog({title:(0,u.x)("catalog.remove-product-variant-from-channel"),buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("catalog.remove-from-channel"),translationVars:{channelCode:a},returnValue:!0}]})),(0,C.n)(a=>a?this.dataService.product.removeVariantsFromChannel({channelId:n,productVariantIds:[e.id]}):E.w)).subscribe(()=>{this.notificationService.success((0,u.x)("catalog.notify-remove-variant-from-channel-success"))},a=>{this.notificationService.error((0,u.x)("catalog.notify-remove-variant-from-channel-error"))})}assetsChanged(){return!!Object.values(this.assetChanges).length}updateSlug(n){const e=this.detailForm.get("slug"),a=this.entity?(0,l.RMk)(this.entity,this.languageCode):void 0,i=!a||!a.slug;e&&e.pristine&&i&&e.setValue((0,S.J)(`${n}`,"-"))}selectProductFacetValue(){this.displayFacetValueModal().subscribe(n=>{if(n){const e=this.detailForm,a=e.value.facetValueIds??[];e.patchValue({facetValueIds:(0,x.A)([...a,...n])}),e.markAsDirty(),this.changeDetector.markForCheck()}})}removeProductFacetValue(n){const e=this.detailForm,a=e.value.facetValueIds??[];e.patchValue({facetValueIds:a.filter(i=>i!==n)}),e.markAsDirty()}displayFacetValueModal(){return this.modalService.fromComponent(pt,{size:"md",closable:!0}).pipe((0,f.T)(n=>n&&n.map(e=>e.id)))}create(){const n=this.detailForm;if(!n.dirty)return;const e=this.getUpdatedProduct({id:"",createdAt:"",updatedAt:"",enabled:!0,languageCode:this.languageCode,name:"",slug:"",featuredAsset:null,assets:[],description:"",translations:[],optionGroups:[],facetValues:[],channels:[]},n,this.languageCode);this.productDetailService.createProductWithVariants(e,this.createVariantsConfig,this.languageCode).subscribe(({createProductVariants:a,productId:i})=>{this.notificationService.success((0,u.x)("common.notify-create-success"),{entity:"Product"}),this.assetChanges={},this.detailForm.markAsPristine(),this.router.navigate(["../",i],{relativeTo:this.route})},a=>{console.error(a),this.notificationService.error((0,u.x)("common.notify-create-error"),{entity:"Product"})})}save(){(0,D.z)(this.entity$,this.languageCode$).pipe((0,U.s)(1),(0,V.Z)(([n,e])=>{const a=this.detailForm;let i;return(a.dirty||this.assetsChanged())&&(i=this.getUpdatedProduct(n,a,e)),this.productDetailService.updateProduct({product:n,languageCode:e,autoUpdate:this.detailForm.get(["autoUpdateVariantNames"])?.value??!1,productInput:i,variantsInput:undefined})})).subscribe(n=>{this.updateSlugAfterSave(n),this.detailForm.markAsPristine(),this.assetChanges={},this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"Product"}),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"Product"})})}canDeactivate(){return super.canDeactivate()&&!this.assetChanges.assets&&!this.assetChanges.featuredAsset}setFormValues(n,e){const a=(0,l.RMk)(n,e);this.detailForm.patchValue({enabled:n.enabled,name:a?a.name:"",slug:a?a.slug:"",description:a?a.description:"",facetValueIds:n.facetValues.map(i=>i.id)}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,a)}getUpdatedProduct(n,e,a){return{...(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.customFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||"",slug:n.slug||"",description:n.description||""}}),assetIds:this.assetChanges.assets?.map(s=>s.id),featuredAssetId:this.assetChanges.featuredAsset?.id,facetValueIds:e.value.facetValueIds}}updateSlugAfterSave(n){const e=n[0],a=this.detailForm.get(["product","slug"]);a&&function i(s){return s.hasOwnProperty("updateProduct")}(e)&&a.setValue(e.updateProduct.slug,{emitEvent:!1})}static{this.\u0275fac=function(e){return new(e||vt)(t.rXU(J),t.rXU(d.ok),t.rXU(l.Bg8),t.rXU(l.JEu),t.rXU(l.uSP),t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:vt,selectors:[["vdr-product-detail2"]],features:[t.Vt3],decls:69,vars:86,consts:[["updateButton",""],["variantList",""],[1,"flex","clr-flex-row"],[3,"languageCodeChange","disabled","availableLanguageCodes","currentLanguageCode"],["locationId","product-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],[1,"form",3,"formGroup"],["for","visibility",3,"label"],[4,"vdrIfPermissions"],[4,"ngIf"],[3,"title",4,"ngIf"],[3,"title"],[1,"facets"],[3,"facetValue","removable","remove",4,"ngFor","ngForOf"],["class","button-small mt-2",3,"click",4,"vdrIfPermissions"],["type","submit","hidden","","x-data","prevents enter key from triggering other buttons"],[1,"form-grid"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"input","readonly"],["for","slug",3,"label","errors"],["id","slug","type","text","formControlName","slug",3,"readonly"],["for","slug",1,"form-grid-span",3,"label","errors"],["formControlName","description",3,"readonly"],["locationId","product-detail",3,"entity$","detailForm"],[3,"change","assets","featuredAsset","updatePermissions"],[3,"title","paddingX"],[4,"ngIf","ngIfElse"],["class","mx-3",4,"ngIf"],[1,"btn","btn-primary",3,"click","disabled"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["type","checkbox","clrToggle","","name","enabled",3,"formControl"],[3,"title",4,"vdrIfMultichannel"],[4,"vdrIfDefaultChannelActive"],[1,"flex","channel-assignment"],[1,"mb-2"],[4,"ngFor","ngForOf"],[1,"button-small",3,"click"],["shape","layers"],["icon","times-circle",3,"iconClick",4,"ngIf"],["icon","times-circle",3,"iconClick"],[3,"channelCode"],[1,"options"],[3,"colorFrom","invert",4,"ngFor","ngForOf"],["class","button-small mt-2",3,"routerLink",4,"vdrIfPermissions"],[3,"colorFrom","invert"],[1,"button-small","mt-2",3,"routerLink"],["shape","pencil"],[3,"remove","facetValue","removable"],[1,"button-small","mt-2",3,"click"],["shape","plus"],[3,"entity"],["clrCheckbox","","type","checkbox","id","auto-update","formControlName","autoUpdateVariantNames"],["entityName","Product",3,"customFields","customFieldsFormGroup","readonly"],[3,"variantsChange"],["dataTableId","product-detail-variants-list",3,"productId","hideLanguageSelect"],[1,"mx-3"],[1,"button",3,"routerLink"],["shape","add-text"]],template:function(e,a){if(1&e){const i=t.RV6();t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left"),t.nrm(3,"div",2),t.j41(4,"vdr-language-selector",3),t.nI1(5,"async"),t.nI1(6,"async"),t.nI1(7,"async"),t.bIt("languageCodeChange",function(c){return t.eBV(i),t.Njj(a.setLanguage(c))}),t.k0s()(),t.j41(8,"vdr-ab-right"),t.nrm(9,"vdr-action-bar-items",4),t.DNE(10,Ys,3,4,"button",5),t.nI1(11,"async"),t.DNE(12,Ls,1,1,"ng-template",null,0,t.C5r),t.nrm(14,"vdr-action-bar-dropdown-menu",4),t.k0s()()(),t.j41(15,"form",6)(16,"vdr-page-detail-layout")(17,"vdr-page-detail-sidebar")(18,"vdr-card")(19,"vdr-form-field",7),t.nI1(20,"translate"),t.DNE(21,Bs,5,5,"clr-toggle-wrapper",8),t.k0s()(),t.DNE(22,Ws,2,0,"ng-container",9),t.nI1(23,"async"),t.DNE(24,Zs,7,8,"vdr-card",10),t.j41(25,"vdr-card",11),t.nI1(26,"translate"),t.j41(27,"div",12),t.DNE(28,zs,2,4,"vdr-facet-value-chip",13),t.nI1(29,"async"),t.k0s(),t.j41(30,"div"),t.DNE(31,qs,4,3,"button",14),t.k0s()(),t.DNE(32,tl,2,1,"vdr-card",9),t.nI1(33,"async"),t.k0s(),t.j41(34,"vdr-page-block"),t.nrm(35,"button",15),t.j41(36,"vdr-card")(37,"div",16)(38,"div")(39,"vdr-form-field",17),t.nI1(40,"translate"),t.j41(41,"input",18),t.nI1(42,"hasPermission"),t.bIt("input",function(c){return t.eBV(i),t.Njj(a.updateSlug(c.target.value))}),t.k0s()(),t.DNE(43,el,6,3,"div",9),t.nI1(44,"async"),t.k0s(),t.j41(45,"vdr-form-field",19),t.nI1(46,"translate"),t.nI1(47,"translate"),t.nrm(48,"input",20),t.nI1(49,"hasPermission"),t.k0s(),t.j41(50,"vdr-form-field",21),t.nI1(51,"translate"),t.nI1(52,"translate"),t.nrm(53,"vdr-rich-text-editor",22),t.nI1(54,"hasPermission"),t.k0s()()(),t.DNE(55,nl,4,8,"vdr-card",10),t.nrm(56,"vdr-custom-detail-component-host",23),t.j41(57,"vdr-card",11),t.nI1(58,"translate"),t.j41(59,"vdr-assets",24),t.bIt("change",function(c){return t.eBV(i),t.Njj(a.assetChanges=c)}),t.k0s()(),t.j41(60,"vdr-card",25),t.nI1(61,"translate"),t.nI1(62,"async"),t.DNE(63,ol,2,0,"div",26),t.nI1(64,"async"),t.DNE(65,al,1,2,"ng-template",null,1,t.C5r)(67,il,5,5,"div",27),t.nI1(68,"async"),t.k0s()()()()}if(2&e){let i;const s=t.sdS(13),c=t.sdS(66);t.R7$(4),t.Y8G("disabled",t.bMT(5,35,a.isNew$))("availableLanguageCodes",t.bMT(6,37,a.availableLanguages$))("currentLanguageCode",t.bMT(7,39,a.languageCode$)),t.R7$(6),t.Y8G("ngIf",t.bMT(11,41,a.isNew$))("ngIfElse",s),t.R7$(5),t.Y8G("formGroup",a.detailForm),t.R7$(4),t.Y8G("label",t.bMT(20,43,"catalog.visibility")),t.R7$(2),t.Y8G("vdrIfPermissions",a.updatePermissions),t.R7$(),t.Y8G("ngIf",!t.bMT(23,45,a.isNew$)),t.R7$(2),t.Y8G("ngIf",null==a.entity?null:a.entity.optionGroups.length),t.R7$(),t.Y8G("title",t.bMT(26,47,"catalog.facets")),t.R7$(3),t.Y8G("ngForOf",t.bMT(29,49,a.facetValues$)),t.R7$(3),t.Y8G("vdrIfPermissions",a.updatePermissions),t.R7$(),t.Y8G("ngIf",t.bMT(33,51,a.entity$)),t.R7$(7),t.Y8G("label",t.bMT(40,53,"catalog.product-name")),t.R7$(2),t.Y8G("readonly",!t.bMT(42,55,a.updatePermissions)),t.R7$(2),t.Y8G("ngIf",!1===t.bMT(44,57,a.isNew$)&&(null==(i=a.detailForm.get(t.lJ4(81,xs)))?null:i.dirty)),t.R7$(2),t.Y8G("label",t.bMT(46,59,"catalog.slug"))("errors",t.eq3(82,tn,t.bMT(47,61,"catalog.slug-pattern-error"))),t.R7$(3),t.Y8G("readonly",!t.bMT(49,63,a.updatePermissions)),t.R7$(2),t.Y8G("label",t.bMT(51,65,"common.description"))("errors",t.eq3(84,tn,t.bMT(52,67,"catalog.slug-pattern-error"))),t.R7$(3),t.Y8G("readonly",!t.bMT(54,69,a.updatePermissions)),t.R7$(2),t.Y8G("ngIf",a.customFields.length),t.R7$(),t.Y8G("entity$",a.entity$)("detailForm",a.detailForm),t.R7$(),t.Y8G("title",t.bMT(58,71,"catalog.assets")),t.R7$(2),t.Y8G("assets",a.assetChanges.assets||(null==a.entity?null:a.entity.assets))("featuredAsset",a.assetChanges.featuredAsset||(null==a.entity?null:a.entity.featuredAsset))("updatePermissions",a.updatePermissions),t.R7$(),t.Y8G("title",t.bMT(61,73,"catalog.product-variants"))("paddingX",t.bMT(62,75,a.isNew$)),t.R7$(3),t.Y8G("ngIf",t.bMT(64,77,a.isNew$))("ngIfElse",c),t.R7$(4),t.Y8G("ngIf",!1===t.bMT(68,79,a.isNew$))}},dependencies:[b.U4n,b.aZZ,b.Jej,b.eAx,g.Sq,g.bT,d.qT,d.me,d.Zm,d.BC,d.cb,d.l_,d.j4,d.JD,P.Wk,R.nG,R.wL,R.TX,nt.l,ve.P,Q.w,oe.K,L.K,$.V,Ce.N,H.t,je.q,X.p,_s.l,ot.T,gs.a,hs.$,bt.W,le.L,A.e,wt.E,ce.c,de.e,lt.i,St,ft,g.Jj,T.D9,Te.F,q.E,$e.i],styles:["[_nghost-%COMP%] trix-toolbar{top:24px}.facets[_ngcontent-%COMP%], .options[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:3px}vdr-action-bar[_ngcontent-%COMP%] clr-toggle-wrapper[_ngcontent-%COMP%]{margin-top:12px}.variant-filter[_ngcontent-%COMP%]{flex:1;display:flex}.variant-filter[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;max-width:initial;border-radius:3px 0 0 3px!important}.variant-filter[_ngcontent-%COMP%] .icon-button[_ngcontent-%COMP%]{border:1px solid var(--color-component-border-300);background-color:var(--color-component-bg-100);border-radius:0 3px 3px 0;border-inline-start:none}.group-name[_ngcontent-%COMP%]{padding-inline-end:6px}.view-mode[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-between}@media screen and (min-width: 768px){.view-mode[_ngcontent-%COMP%]{flex-direction:row}}.edit-variants-btn[_ngcontent-%COMP%]{margin-top:0}.channel-assignment[_ngcontent-%COMP%]{flex-wrap:wrap;max-height:144px}.pagination-row[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between}"],changeDetection:0})}}const en={location:"product-list",label:(0,u.x)("common.delete"),icon:"trash",iconClass:"is-danger",requiresPermission:o=>o.includes(l.aXG.DeleteProduct)||o.includes(l.aXG.DeleteCatalog),onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{const i=o.get(l.Bg8),s=o.get(l.uSP),c=o.get(l.JEu);i.dialog({title:(0,u.x)("catalog.confirm-bulk-delete-products"),translationVars:{count:n.length},buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(m=>m?s.product.deleteProducts((0,x.A)(n.map(_=>_.id))):E.w)).subscribe(m=>{let _=0;const h=[];for(const v of m.deleteProducts)v.result===l.syg.DELETED?_++:v.message&&h.push(v.message);0<_&&c.success((0,u.x)("catalog.notify-bulk-delete-products-success"),{count:_}),0<h.length&&c.error(h.join("\n")),e.refresh(),a()})}},nn={location:"product-list",label:(0,u.x)("common.assign-to-channel"),icon:"layers",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),isVisible:({injector:o})=>(0,l.$xL)(o.get(l.uSP)),onClick:({injector:o,selection:n,clearSelection:e})=>{o.get(l.Bg8).fromComponent(Z,{size:"lg",locals:{productIds:(0,x.A)(n.map(i=>i.id)),currentChannelIds:[]}}).subscribe(i=>{i&&e()})}},on=(0,l.YSJ)({location:"product-list",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),getItemName:o=>o.name,bulkRemoveFromChannel:(o,n,e)=>o.product.removeProductsFromChannel({channelId:e,productIds:n}).pipe((0,f.T)(a=>a.removeProductsFromChannel))}),an={location:"product-list",label:(0,u.x)("catalog.edit-facet-values"),icon:"tag",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{const i=o.get(l.Bg8),s=o.get(l.JEu),c="product",m=(0,x.A)(n.map(_=>_.id));return i.fromComponent(mt,{size:"xl",locals:{mode:c,ids:m}}).subscribe(_=>{_&&(s.success((0,u.x)("common.notify-bulk-update-success"),{count:n.length,entity:"Products"}),a())})}},rn={location:"product-list",label:(0,u.x)("common.duplicate"),icon:"copy",onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{o.get(l.Bg8).fromComponent(l.MPR,{locals:{entities:n,entityName:"Product",title:(0,u.x)("catalog.duplicate-products"),getEntityName:s=>s.name}}).subscribe(s=>{s&&(a(),e.refresh())})}};var sl=p(5591);const ll=()=>["CreateCatalog","CreateProduct"],cl=()=>["./create"],dl=o=>["./",o],pl=o=>({count:o});function ul(o,n){1&o&&(t.j41(0,"a",19),t.nrm(1,"clr-icon",20),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,cl)),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.create-new-product")," "))}function ml(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.id," ")}}function _l(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.createdAt,"short")," ")}}function gl(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"localeDate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,e.updatedAt,"short")," ")}}function hl(o,n){if(1&o&&(t.nrm(0,"img",23),t.nI1(1,"assetPreview")),2&o){const e=n.ngIf;t.Y8G("src",t.i5U(1,1,e,"tiny"),t.B4B)}}function fl(o,n){1&o&&(t.j41(0,"div",24),t.nrm(1,"clr-icon",25),t.k0s())}function vl(o,n){if(1&o&&(t.j41(0,"div",21),t.DNE(1,hl,2,4,"img",22)(2,fl,2,0,"ng-template",null,0,t.C5r),t.k0s()),2&o){const e=n.item,a=t.sdS(3);t.R7$(),t.Y8G("ngIf",e.featuredAsset)("ngIfElse",a)}}function bl(o,n){if(1&o&&(t.j41(0,"a",26)(1,"span"),t.EFF(2),t.k0s(),t.nrm(3,"clr-icon",27),t.k0s()),2&o){const e=n.item;t.Y8G("routerLink",t.eq3(2,dl,e.id)),t.R7$(2),t.JRh(e.name)}}function Cl(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.SpI(" ",e.slug," ")}}function Il(o,n){1&o&&(t.j41(0,"vdr-chip",30),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.enabled")))}function Tl(o,n){1&o&&(t.j41(0,"vdr-chip",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&o&&(t.R7$(),t.JRh(t.bMT(2,1,"common.disabled")))}function Rl(o,n){if(1&o&&t.DNE(0,Il,3,3,"vdr-chip",28)(1,Tl,3,3,"vdr-chip",29),2&o){const e=n.item;t.Y8G("ngIf",e.enabled),t.R7$(),t.Y8G("ngIf",!e.enabled)}}function Fl(o,n){if(1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o){const e=n.item;t.SpI(" ",t.i5U(1,1,"catalog.variant-count",t.eq3(4,pl,null==e.variantList?null:e.variantList.totalItems))," ")}}function Pl(o,n){if(1&o&&t.nrm(0,"vdr-dt2-custom-field-column",32),2&o){const e=n.$implicit,a=t.XpG();t.Y8G("customField",e)("sorts",a.sorts)}}class xt extends l.B8I{constructor(n,e,a,i){super(),this.dataService=n,this.modalService=e,this.notificationService=a,this.jobQueueService=i,this.pendingSearchIndexUpdates=0,this.customFields=this.getCustomFieldConfig("Product"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilters([{name:"enabled",type:{kind:"boolean"},label:(0,u.x)("common.enabled"),filterField:"enabled"},{name:"slug",type:{kind:"text"},label:(0,u.x)("common.slug"),filterField:"slug"}]).addFilter({name:"facetValues",type:{kind:"custom",component:l.Axz,serializeValue:s=>s.map(c=>c.id).join(","),deserializeValue:s=>s.split(",").map(c=>({id:c})),getLabel:s=>0===s.length?"":s[0].name?s.map(c=>c.name).join(", "):(0,Oe.s)(this.dataService.facet.getFacetValues({filter:{id:{in:s.map(c=>c.id)}}}).mapSingle(({facetValues:c})=>c.items.map(m=>m.name).join(", ")))},label:(0,u.x)("catalog.facet-values"),toFilterInput:s=>({facetValueId:{in:s.map(c=>c.id)}})}).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().defaultSort("createdAt","DESC").addSorts([{name:"id"},{name:"createdAt"},{name:"updatedAt"},{name:"name"},{name:"slug"}]).addCustomFieldSorts(this.customFields).connectToRoute(this.route),this.configure({document:l.TT4,getItems:s=>s.products,setVariables:(s,c)=>{const m=this.searchTermControl.value;let _=this.filters.createFilterInput();return m&&(_={name:{contains:m},sku:{contains:m}}),{options:{skip:s,take:c,filter:{..._??{}},filterOperator:m?l.umn.OR:l.umn.AND,sort:this.sorts.createSortInput()}}},refreshListOnChanges:[this.sorts.valueChanges,this.filters.valueChanges]})}rebuildSearchIndex(){this.dataService.product.reindex().subscribe(({reindex:n})=>{this.notificationService.info((0,u.x)("catalog.reindexing")),this.jobQueueService.addJob(n.id,e=>{if(e.state===l.dqH.COMPLETED){const a=(new Intl.NumberFormat).format(e.duration||0);this.notificationService.success((0,u.x)("catalog.reindex-successful"),{count:e.result.indexedItemCount,time:a}),this.refresh()}else this.notificationService.error((0,u.x)("catalog.reindex-error"))})})}deleteProduct(n){this.modalService.dialog({title:(0,u.x)("catalog.confirm-delete-product"),buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(e=>e?this.dataService.product.deleteProduct(n):E.w),(0,sl.c)(500)).subscribe(()=>{this.notificationService.success((0,u.x)("common.notify-delete-success"),{entity:"Product"}),this.refresh()},e=>{this.notificationService.error((0,u.x)("common.notify-delete-error"),{entity:"Product"})})}static{this.\u0275fac=function(e){return new(e||xt)(t.rXU(l.uSP),t.rXU(l.Bg8),t.rXU(l.JEu),t.rXU(l.gYg))}}static{this.\u0275cmp=t.VBU({type:xt,selectors:[["vdr-products-list"]],features:[t.Vt3],decls:47,vars:65,consts:[["imagePlaceholder",""],[3,"languageCodeChange","availableLanguageCodes","currentLanguageCode"],["locationId","product-list"],["class","button primary mr-1",3,"routerLink",4,"vdrIfPermissions"],["locationId","product-list",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click"],["shape","refresh",1,""],["id","product-list",1,"mt-2",3,"pageChange","itemsPerPageChange","items","itemsPerPage","totalItems","currentPage","filters"],["locationId","product-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault","sort"],["id","created-at",3,"heading","hiddenByDefault","sort"],["id","updated-at",3,"heading","hiddenByDefault","sort"],["id","image",3,"heading"],["id","name",3,"heading","optional","sort"],["id","slug",3,"heading","sort"],["id","enabled",3,"heading"],["id","number-of-variants",3,"heading"],[3,"customField","sorts",4,"ngFor","ngForOf"],[1,"button","primary","mr-1",3,"routerLink"],["shape","plus"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],["colorType","success",4,"ngIf"],["colorType","warning",4,"ngIf"],["colorType","success"],["colorType","warning"],[3,"customField","sorts"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left")(3,"vdr-language-selector",1),t.nI1(4,"async"),t.nI1(5,"async"),t.bIt("languageCodeChange",function(s){return a.setLanguage(s)}),t.k0s()(),t.j41(6,"vdr-ab-right"),t.nrm(7,"vdr-action-bar-items",2),t.DNE(8,ul,4,5,"a",3),t.j41(9,"vdr-action-bar-dropdown-menu",4)(10,"button",5),t.bIt("click",function(){return a.rebuildSearchIndex()}),t.nrm(11,"clr-icon",6),t.EFF(12),t.nI1(13,"translate"),t.k0s()()()()(),t.j41(14,"vdr-data-table-2",7),t.nI1(15,"async"),t.nI1(16,"async"),t.nI1(17,"async"),t.nI1(18,"async"),t.bIt("pageChange",function(s){return a.setPageNumber(s)})("itemsPerPageChange",function(s){return a.setItemsPerPage(s)}),t.nrm(19,"vdr-bulk-action-menu",8)(20,"vdr-dt2-search",9),t.nI1(21,"translate"),t.j41(22,"vdr-dt2-column",10),t.nI1(23,"translate"),t.DNE(24,ml,1,1,"ng-template"),t.k0s(),t.j41(25,"vdr-dt2-column",11),t.nI1(26,"translate"),t.DNE(27,_l,2,4,"ng-template"),t.k0s(),t.j41(28,"vdr-dt2-column",12),t.nI1(29,"translate"),t.DNE(30,gl,2,4,"ng-template"),t.k0s(),t.j41(31,"vdr-dt2-column",13),t.nI1(32,"translate"),t.DNE(33,vl,4,2,"ng-template"),t.k0s(),t.j41(34,"vdr-dt2-column",14),t.nI1(35,"translate"),t.DNE(36,bl,4,4,"ng-template"),t.k0s(),t.j41(37,"vdr-dt2-column",15),t.nI1(38,"translate"),t.DNE(39,Cl,1,1,"ng-template"),t.k0s(),t.j41(40,"vdr-dt2-column",16),t.nI1(41,"translate"),t.DNE(42,Rl,2,2,"ng-template"),t.k0s(),t.j41(43,"vdr-dt2-column",17),t.nI1(44,"translate"),t.DNE(45,Fl,2,6,"ng-template"),t.k0s(),t.DNE(46,Pl,1,2,"vdr-dt2-custom-field-column",18),t.k0s()),2&e&&(t.R7$(3),t.Y8G("availableLanguageCodes",t.bMT(4,32,a.availableLanguages$))("currentLanguageCode",t.bMT(5,34,a.contentLanguage$)),t.R7$(5),t.Y8G("vdrIfPermissions",t.lJ4(64,ll)),t.R7$(),t.Y8G("alwaysShow",!0),t.R7$(3),t.SpI(" ",t.bMT(13,36,"catalog.rebuild-search-index")," "),t.R7$(2),t.Y8G("items",t.bMT(15,38,a.items$))("itemsPerPage",t.bMT(16,40,a.itemsPerPage$))("totalItems",t.bMT(17,42,a.totalItems$))("currentPage",t.bMT(18,44,a.currentPage$))("filters",a.filters),t.R7$(5),t.Y8G("hostComponent",a)("selectionManager",a.selectionManager),t.R7$(),t.Y8G("searchTermControl",a.searchTermControl)("searchTermPlaceholder",t.bMT(21,46,"settings.search-by-product-name-or-sku")),t.R7$(2),t.Y8G("heading",t.bMT(23,48,"common.id"))("hiddenByDefault",!0)("sort",a.sorts.get("id")),t.R7$(3),t.Y8G("heading",t.bMT(26,50,"common.created-at"))("hiddenByDefault",!0)("sort",a.sorts.get("createdAt")),t.R7$(3),t.Y8G("heading",t.bMT(29,52,"common.updated-at"))("hiddenByDefault",!0)("sort",a.sorts.get("updatedAt")),t.R7$(3),t.Y8G("heading",t.bMT(32,54,"common.image")),t.R7$(3),t.Y8G("heading",t.bMT(35,56,"catalog.name"))("optional",!1)("sort",a.sorts.get("name")),t.R7$(3),t.Y8G("heading",t.bMT(38,58,"common.slug"))("sort",a.sorts.get("slug")),t.R7$(3),t.Y8G("heading",t.bMT(41,60,"common.enabled")),t.R7$(3),t.Y8G("heading",t.bMT(44,62,"catalog.number-of-variants")),t.R7$(3),t.Y8G("ngForOf",a.customFields))},dependencies:[b.U4n,g.Sq,g.bT,P.Wk,R.nG,R.wL,R.TX,nt.l,Q.w,H.t,Ht.M,X.p,ot.T,pe.T,Ct.I,z.Y,dt.E,ue.T,A.e,g.Jj,T.D9,Ie.H,ct.P],styles:[".image-col[_ngcontent-%COMP%]{width:70px}.image-placeholder[_ngcontent-%COMP%]{width:50px;height:50px;margin-top:calc(var(--space-unit) * -1);margin-bottom:calc(var(--space-unit) * -1);background-color:var(--color-component-bg-200)}.image-placeholder[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}.image-placeholder[_ngcontent-%COMP%] .placeholder[_ngcontent-%COMP%]{text-align:center;color:var(--color-grey-300)}.search-form[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%}vdr-product-search-input[_ngcontent-%COMP%]{min-width:300px}@media screen and (max-width: 768px){vdr-product-search-input[_ngcontent-%COMP%]{min-width:100px}}.search-settings-menu[_ngcontent-%COMP%]{margin:0 12px}td.disabled[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.search-index-button[_ngcontent-%COMP%]{position:relative}.search-index-button[_ngcontent-%COMP%] vdr-status-badge[_ngcontent-%COMP%]{right:0;top:0}.run-updates-button[_ngcontent-%COMP%]{position:relative}.run-updates-button[_ngcontent-%COMP%] vdr-status-badge[_ngcontent-%COMP%]{left:10px;top:10px}.edit-button[_ngcontent-%COMP%]{margin-inline-end:24px}.sku[_ngcontent-%COMP%]{color:var(--color-text-300)}"]})}}var Dl=p(897),kl=p(3973),Gl=p(3711);const Ml=o=>({rate:o}),Ol=(o,n)=>({price:o,rate:n});function $l(o,n){if(1&o&&(t.j41(0,"div",2),t.EFF(1),t.nI1(2,"async"),t.nI1(3,"translate"),t.k0s()),2&o){const e=t.XpG();t.R7$(),t.SpI(" ",t.i5U(3,3,"catalog.price-includes-tax-at",t.eq3(6,Ml,t.bMT(2,1,e.taxRate$))),"\n")}}function yl(o,n){if(1&o&&(t.j41(0,"div",2),t.EFF(1),t.nI1(2,"async"),t.nI1(3,"localeCurrency"),t.nI1(4,"async"),t.nI1(5,"translate"),t.k0s()),2&o){const e=t.XpG();t.R7$(),t.SpI(" ",t.i5U(5,8,"catalog.price-with-tax-in-default-zone",t.l_i(11,Ol,t.i5U(3,3,t.bMT(2,1,e.grossPrice$),e.currencyCode),t.bMT(4,6,e.taxRate$))),"\n")}}class Nt{constructor(n){this.dataService=n,this.priceChange$=new j.t(0),this.taxCategoryIdChange$=new j.t("")}ngOnInit(){const n=this.dataService.settings.getTaxRatesSimple(999,0,"cache-first").mapStream(a=>a.taxRates.items),e=this.dataService.settings.getActiveChannel("cache-first").refetchOnChannelChange().mapStream(a=>a.activeChannel);this.taxRate$=(0,D.z)(e,n,this.taxCategoryIdChange$).pipe((0,f.T)(([a,i,s])=>{const c=a.defaultTaxZone;if(!c)return 0;const m=i.find(_=>_.zone.id===c.id&&_.category.id===s);return m?m.value:0})),this.grossPrice$=(0,D.z)(this.taxRate$,this.priceChange$).pipe((0,f.T)(([a,i])=>Math.round(i*((100+a)/100))))}ngOnChanges(n){"price"in n&&this.priceChange$.next(n.price.currentValue),"taxCategoryId"in n&&this.taxCategoryIdChange$.next(n.taxCategoryId.currentValue)}static{this.\u0275fac=function(e){return new(e||Nt)(t.rXU(l.uSP))}}static{this.\u0275cmp=t.VBU({type:Nt,selectors:[["vdr-variant-price-detail"]],inputs:{priceIncludesTax:"priceIncludesTax",price:"price",currencyCode:"currencyCode",taxCategoryId:"taxCategoryId"},features:[t.OA$],decls:5,vars:5,consts:[[1,"clr-control-label"],["class","value",4,"ngIf"],[1,"value"]],template:function(e,a){1&e&&(t.j41(0,"label",0),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.DNE(3,$l,4,8,"div",1)(4,yl,6,14,"div",1)),2&e&&(t.R7$(),t.JRh(t.bMT(2,3,"catalog.taxes")),t.R7$(2),t.Y8G("ngIf",a.priceIncludesTax),t.R7$(),t.Y8G("ngIf",!a.priceIncludesTax))},dependencies:[b.aZZ,g.bT,g.Jj,T.D9,Xt.u],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column}.value[_ngcontent-%COMP%]{margin-top:3px}"],changeDetection:0})}}function Vl(o,n){if(1&o&&(t.j41(0,"div",1),t.nrm(1,"vdr-form-item",2),t.nI1(2,"translate"),t.nI1(3,"translate"),t.j41(4,"div",3)(5,"vdr-form-item",4),t.nI1(6,"translate"),t.EFF(7),t.nI1(8,"localeCurrency"),t.k0s(),t.j41(9,"vdr-form-item",4),t.nI1(10,"translate"),t.EFF(11),t.nI1(12,"localeCurrency"),t.k0s()()()),2&o){const e=t.XpG();t.R7$(),t.Y8G("label",t.bMT(2,6,"catalog.calculated-price"))("tooltip",t.bMT(3,8,"catalog.calculated-price-tooltip")),t.R7$(4),t.Y8G("label",t.bMT(6,10,"common.price")),t.R7$(2),t.SpI(" ",t.i5U(8,12,e.variant.price,e.variant.currencyCode)," "),t.R7$(2),t.Y8G("label",t.bMT(10,15,"common.price-with-tax")),t.R7$(2),t.SpI(" ",t.i5U(12,17,e.variant.priceWithTax,e.variant.currencyCode)," ")}}class At{calculatedPriceDiffersFromInputPrice(){const n=this.variant.prices.find(e=>e.currencyCode===this.channelDefaultCurrencyCode)??this.variant.prices[0];return!!n&&(this.channelPriceIncludesTax?this.variant.priceWithTax!==n.price:this.variant.price!==n.price)}static{this.\u0275fac=function(e){return new(e||At)}}static{this.\u0275cmp=t.VBU({type:At,selectors:[["vdr-variant-price-strategy-detail"]],inputs:{channelPriceIncludesTax:"channelPriceIncludesTax",variant:"variant",channelDefaultCurrencyCode:"channelDefaultCurrencyCode"},decls:1,vars:1,consts:[["class","price-strategy-detail",4,"ngIf"],[1,"price-strategy-detail"],["for","price",3,"label","tooltip"],[1,"form-grid","mt-2"],[3,"label"]],template:function(e,a){1&e&&t.DNE(0,Vl,13,20,"div",0),2&e&&t.Y8G("ngIf",a.calculatedPriceDiffersFromInputPrice())},dependencies:[g.bT,Ce.N,T.D9,Xt.u],styles:["[_nghost-%COMP%]{display:block}.price-strategy-detail[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 2);border-top:1px solid var(--color-weight-150)}"],changeDetection:0})}}function Sl(o,n){if(1&o&&t.EFF(0),2&o){const e=n.item;t.Lme(" ",e.name," (",e.sku,") ")}}function xl(o,n){if(1&o){const e=t.RV6();t.j41(0,"ng-select",1),t.nI1(1,"async"),t.nI1(2,"translate"),t.mxI("ngModelChange",function(i){t.eBV(e);const s=t.XpG();return t.DH7(s.selectedVariantId,i)||(s.selectedVariantId=i),t.Njj(i)}),t.bIt("change",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.onSelect(i))}),t.DNE(3,Sl,1,2,"ng-template",2),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("items",t.bMT(1,5,e.variants$)),t.R50("ngModel",e.selectedVariantId),t.Y8G("searchFn",e.searchFn)("clearable",!1)("placeholder",t.bMT(2,7,"catalog.quick-jump-placeholder"))}}M.J1`
|
|
107
|
+
query GetProductVariantsQuickJump($id: ID!) {
|
|
108
|
+
product(id: $id) {
|
|
109
|
+
id
|
|
110
|
+
variants {
|
|
111
|
+
id
|
|
112
|
+
name
|
|
113
|
+
sku
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`;class jt{constructor(n,e){this.dataService=n,this.router=e,this.searchFn=(a,i)=>i.name.toLowerCase().includes(a.toLowerCase())||i.sku.toLowerCase().includes(a.toLowerCase())}ngOnInit(){this.variants$=this.dataService.query(l.A2y,{id:this.productId}).mapSingle(n=>n.product?.variants??[])}onSelect(n){n&&this.router.navigate(["catalog","products",this.productId,"variants",n.id]).then(()=>this.selectedVariantId=void 0)}static{this.\u0275fac=function(e){return new(e||jt)(t.rXU(l.uSP),t.rXU(P.Ix))}}static{this.\u0275cmp=t.VBU({type:jt,selectors:[["vdr-product-variant-quick-jump"]],inputs:{productId:"productId"},decls:2,vars:3,consts:[["appendTo","body","bindValue","id",3,"items","ngModel","searchFn","clearable","placeholder","ngModelChange","change",4,"ngIf"],["appendTo","body","bindValue","id",3,"ngModelChange","change","items","ngModel","searchFn","clearable","placeholder"],["ng-option-tmp",""]],template:function(e,a){if(1&e&&(t.DNE(0,xl,4,9,"ng-select",0),t.nI1(1,"async")),2&e){let i;t.Y8G("ngIf",(null==(i=t.bMT(1,1,a.variants$))?null:i.length)>1)}},dependencies:[g.bT,d.BC,d.vS,te.vr,te.Uq,g.Jj,T.D9],changeDetection:0})}}var Nl=p(3298);const Re=()=>["UpdateCatalog","UpdateProduct"],Al=()=>["enabled"],jl=()=>["../../","options"];function Yl(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-language-selector",8),t.nI1(1,"async"),t.nI1(2,"async"),t.bIt("languageCodeChange",function(i){t.eBV(e);const s=t.XpG(2);return t.Njj(s.setLanguage(i))}),t.k0s()}if(2&o){const e=t.XpG().ngIf,a=t.XpG();t.Y8G("disabled",t.bMT(1,3,a.isNew$))("availableLanguageCodes",e)("currentLanguageCode",t.bMT(2,5,a.languageCode$))}}function Ul(o,n){if(1&o&&(t.qex(0),t.DNE(1,Yl,3,7,"vdr-language-selector",7),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",e.length>1)}}function Ll(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",9),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.save())}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&o){const e=t.XpG();t.Y8G("disabled",(e.detailForm.invalid||e.stockLevelsForm.invalid||e.pricesForm.invalid||e.detailForm.pristine&&e.stockLevelsForm.pristine&&e.pricesForm.pristine)&&!e.assetsChanged()),t.R7$(),t.SpI(" ",t.bMT(2,2,"common.update")," ")}}function Bl(o,n){if(1&o&&(t.j41(0,"clr-toggle-wrapper"),t.nrm(1,"input",39),t.j41(2,"label"),t.EFF(3),t.nI1(4,"translate"),t.k0s()()),2&o){const e=t.XpG(2);t.R7$(),t.Y8G("formControl",e.detailForm.get(t.lJ4(4,Al))),t.R7$(2),t.JRh(t.bMT(4,2,"common.enabled"))}}function wl(o,n){if(1&o&&(t.j41(0,"vdr-chip",43)(1,"span"),t.EFF(2),t.k0s(),t.EFF(3),t.k0s()),2&o){const e=n.$implicit,a=t.XpG(3);t.Y8G("colorFrom",a.optionGroupCode(e.groupId))("invert",!0),t.R7$(2),t.SpI("",a.optionGroupCode(e.groupId),":"),t.R7$(),t.SpI(" ",a.optionName(e)," ")}}function Xl(o,n){1&o&&(t.j41(0,"a",44),t.nrm(1,"clr-icon",45),t.EFF(2),t.nI1(3,"translate"),t.k0s()),2&o&&(t.Y8G("routerLink",t.lJ4(4,jl)),t.R7$(2),t.SpI(" ",t.bMT(3,2,"catalog.edit-options")," "))}function Jl(o,n){if(1&o&&(t.j41(0,"vdr-card",14),t.nI1(1,"translate"),t.j41(2,"div",40),t.DNE(3,wl,4,4,"vdr-chip",41),t.nI1(4,"sort"),t.k0s(),t.j41(5,"div"),t.DNE(6,Xl,4,5,"a",42),t.k0s()()),2&o){const e=t.XpG().ngIf,a=t.XpG();t.Y8G("title",t.bMT(1,3,"catalog.product-options")),t.R7$(3),t.Y8G("ngForOf",t.i5U(4,5,e.options,"groupId")),t.R7$(3),t.Y8G("vdrIfPermissions",a.updatePermissions)}}function Hl(o,n){if(1&o){const e=t.RV6();t.j41(0,"vdr-facet-value-chip",46),t.nI1(1,"hasPermission"),t.bIt("remove",function(){const i=t.eBV(e).$implicit,s=t.XpG(2);return t.Njj(s.removeFacetValue(i.id))}),t.k0s()}if(2&o){const e=n.$implicit,a=t.XpG(2);t.Y8G("facetValue",e)("removable",t.bMT(1,2,a.updatePermissions))}}function Wl(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",47),t.bIt("click",function(){t.eBV(e);const i=t.XpG(2);return t.Njj(i.selectFacetValue())}),t.nrm(1,"clr-icon",48),t.EFF(2),t.nI1(3,"translate"),t.k0s()}2&o&&(t.R7$(2),t.SpI(" ",t.bMT(3,1,"catalog.add-facets")," "))}function Kl(o,n){if(1&o&&t.nrm(0,"vdr-page-entity-info",49),2&o){const e=n.ngIf;t.Y8G("entity",e)}}function Ql(o,n){if(1&o&&(t.j41(0,"vdr-card",14),t.nI1(1,"translate"),t.nrm(2,"vdr-tabbed-custom-fields",50),t.nI1(3,"hasPermission"),t.k0s()),2&o){const e=t.XpG(2);t.Y8G("title",t.bMT(1,4,"common.custom-fields")),t.R7$(2),t.Y8G("customFields",e.customFields)("customFieldsFormGroup",e.detailForm.get("customFields"))("readonly",!t.bMT(3,6,e.updatePermissions))}}function Zl(o,n){if(1&o&&(t.j41(0,"option",34),t.EFF(1),t.k0s()),2&o){const e=n.$implicit;t.Y8G("value",e.id),t.R7$(),t.SpI(" ",e.name," ")}}function zl(o,n){if(1&o){const e=t.RV6();t.j41(0,"div")(1,"button",56),t.bIt("click",function(){t.eBV(e);const i=t.XpG().$implicit,s=t.XpG(2);return t.Njj(s.toggleDeletePrice(i.get("delete")))}),t.nrm(2,"clr-icon",57),t.k0s()()}if(2&o){const e=t.XpG().$implicit,a=t.XpG(2);t.R7$(),t.Y8G("disabled",e.value.currencyCode===a.channelDefaultCurrencyCode)}}function ql(o,n){if(1&o&&(t.j41(0,"div",51)(1,"vdr-form-field",52),t.nI1(2,"translate"),t.nI1(3,"translate"),t.j41(4,"div",53),t.nrm(5,"vdr-currency-input",54),t.nI1(6,"hasPermission"),t.DNE(7,zl,3,1,"div",2),t.k0s()(),t.nrm(8,"vdr-variant-price-detail",55),t.nI1(9,"async"),t.k0s()),2&o){const e=n.$implicit,a=t.XpG(2);t.Y8G("formGroup",e),t.R7$(),t.Y8G("label",t.bMT(2,12,"catalog.price")+(1<a.pricesForm.length?" ("+e.value.currencyCode+")":""))("tooltip",1<a.pricesForm.length&&e.value.currencyCode===a.channelDefaultCurrencyCode?t.bMT(3,14,"catalog.default-currency"):void 0),t.R7$(3),t.AVh("pending-deletion",!0===e.value.delete),t.R7$(),t.Y8G("currencyCode",e.value.currencyCode)("readonly",!t.bMT(6,16,a.updatePermissions)||!0===e.value.delete),t.R7$(2),t.Y8G("ngIf",1<a.pricesForm.controls.length),t.R7$(),t.Y8G("price",e.value.price)("currencyCode",e.value.currencyCode)("priceIncludesTax",t.bMT(9,18,a.channelPriceIncludesTax$))("taxCategoryId",a.detailForm.get("taxCategoryId").value)}}function tc(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",61),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG(4);return t.Njj(s.addPriceInCurrency(i))}),t.EFF(1),t.nI1(2,"localeCurrencyName"),t.k0s()}if(2&o){const e=n.$implicit;t.R7$(),t.SpI(" ",t.bMT(2,1,e)," ")}}function ec(o,n){if(1&o&&(t.j41(0,"div")(1,"vdr-dropdown")(2,"button",58),t.nrm(3,"clr-icon",48),t.EFF(4),t.nI1(5,"translate"),t.nrm(6,"clr-icon",59),t.k0s(),t.j41(7,"vdr-dropdown-menu"),t.DNE(8,tc,3,3,"button",60),t.k0s()()()),2&o){const e=t.XpG().ngIf;t.R7$(4),t.SpI(" ",t.bMT(5,2,"catalog.add-price-in-another-currency")," "),t.R7$(4),t.Y8G("ngForOf",e)}}function nc(o,n){if(1&o&&(t.qex(0),t.DNE(1,ec,9,4,"div",2),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",e.length)}}function oc(o,n){if(1&o&&(t.j41(0,"div",62)(1,"vdr-form-field",63),t.nI1(2,"translate"),t.nrm(3,"input",64),t.nI1(4,"hasPermission"),t.k0s(),t.j41(5,"vdr-form-item",65),t.nI1(6,"translate"),t.EFF(7),t.k0s()()),2&o){let e,a,i,s,c;const m=n.$implicit,_=t.XpG(2);t.Y8G("formGroup",m),t.R7$(),t.Y8G("label",(null==(e=m.get("stockLocationName"))?null:e.value)+": "+t.bMT(2,7,"catalog.stock-on-hand"))("for","stockOnHand_"+(null==(a=m.get("stockLocationId"))?null:a.value)),t.R7$(2),t.Y8G("id","stockOnHand_"+(null==(i=m.get("stockLocationId"))?null:i.value))("readonly",!t.bMT(4,9,_.updatePermissions)),t.R7$(2),t.Y8G("label",(null==(s=m.get("stockLocationName"))?null:s.value)+": "+t.bMT(6,11,"catalog.stock-allocated")),t.R7$(2),t.SpI(" ",null==(c=m.get("stockAllocated"))?null:c.value," ")}}function ac(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",61),t.bIt("click",function(){const i=t.eBV(e).$implicit,s=t.XpG(4);return t.Njj(s.addStockLocation(i))}),t.nrm(1,"clr-icon",66),t.EFF(2),t.k0s()}if(2&o){const e=n.$implicit;t.R7$(2),t.SpI(" ",e.name," ")}}function ic(o,n){if(1&o&&(t.j41(0,"div")(1,"vdr-dropdown")(2,"button",58),t.nrm(3,"clr-icon",48),t.EFF(4),t.nI1(5,"translate"),t.nrm(6,"clr-icon",59),t.k0s(),t.j41(7,"vdr-dropdown-menu"),t.DNE(8,ac,3,1,"button",60),t.k0s()()()),2&o){const e=t.XpG().ngIf;t.R7$(4),t.SpI(" ",t.bMT(5,2,"catalog.add-stock-location")," "),t.R7$(4),t.Y8G("ngForOf",e)}}function rc(o,n){if(1&o&&(t.qex(0),t.DNE(1,ic,9,4,"div",2),t.bVm()),2&o){const e=n.ngIf;t.R7$(),t.Y8G("ngIf",e.length)}}function sc(o,n){if(1&o){const e=t.RV6();t.j41(0,"form",10)(1,"vdr-page-detail-layout")(2,"vdr-page-detail-sidebar")(3,"vdr-card")(4,"vdr-form-field",11),t.nI1(5,"translate"),t.DNE(6,Bl,5,5,"clr-toggle-wrapper",12),t.k0s()(),t.DNE(7,Jl,7,8,"vdr-card",13),t.j41(8,"vdr-card",14),t.nI1(9,"translate"),t.j41(10,"div",15),t.DNE(11,Hl,2,4,"vdr-facet-value-chip",16),t.nI1(12,"async"),t.k0s(),t.j41(13,"div"),t.DNE(14,Wl,4,3,"button",17),t.k0s()(),t.j41(15,"vdr-card"),t.DNE(16,Kl,1,1,"vdr-page-entity-info",18),t.nI1(17,"async"),t.k0s()(),t.j41(18,"vdr-page-block"),t.nrm(19,"button",19),t.j41(20,"vdr-card")(21,"div",20)(22,"vdr-form-field",21),t.nI1(23,"translate"),t.nrm(24,"input",22),t.nI1(25,"hasPermission"),t.k0s(),t.j41(26,"vdr-form-field",23),t.nI1(27,"translate"),t.nrm(28,"input",24),t.nI1(29,"hasPermission"),t.k0s()()(),t.DNE(30,Ql,4,8,"vdr-card",13),t.nrm(31,"vdr-custom-detail-component-host",25),t.j41(32,"vdr-card",14),t.nI1(33,"translate"),t.j41(34,"vdr-assets",26),t.bIt("change",function(i){t.eBV(e);const s=t.XpG();return t.Njj(s.assetChanges=i)}),t.k0s()(),t.j41(35,"vdr-card",14),t.nI1(36,"translate"),t.j41(37,"div",20)(38,"vdr-form-field",27),t.nI1(39,"translate"),t.j41(40,"select",28),t.DNE(41,Zl,2,2,"option",29),t.nI1(42,"async"),t.k0s()()(),t.DNE(43,ql,10,20,"div",30),t.nrm(44,"vdr-variant-price-strategy-detail",31),t.nI1(45,"async"),t.DNE(46,nc,2,1,"ng-container",2),t.nI1(47,"async"),t.k0s(),t.j41(48,"vdr-card",14),t.nI1(49,"translate"),t.j41(50,"div",20)(51,"vdr-form-field",32),t.nI1(52,"translate"),t.nI1(53,"translate"),t.j41(54,"select",33),t.nI1(55,"hasPermission"),t.j41(56,"option",34),t.EFF(57),t.nI1(58,"translate"),t.k0s(),t.j41(59,"option",34),t.EFF(60),t.nI1(61,"translate"),t.k0s(),t.j41(62,"option",34),t.EFF(63),t.nI1(64,"translate"),t.k0s()()(),t.j41(65,"vdr-form-item",35),t.nI1(66,"translate"),t.nI1(67,"translate"),t.nrm(68,"input",36),t.nI1(69,"hasPermission"),t.j41(70,"clr-toggle-wrapper"),t.nrm(71,"input",37),t.nI1(72,"hasPermission"),t.j41(73,"label"),t.EFF(74),t.nI1(75,"translate"),t.k0s()()()(),t.DNE(76,oc,8,13,"div",38)(77,rc,2,1,"ng-container",2),t.nI1(78,"async"),t.k0s()()()()}if(2&o){let e;const a=n.ngIf,i=t.XpG();t.Y8G("formGroup",i.detailForm),t.R7$(4),t.Y8G("label",t.bMT(5,46,"catalog.visibility")),t.R7$(2),t.Y8G("vdrIfPermissions",t.lJ4(100,Re)),t.R7$(),t.Y8G("ngIf",a.options.length),t.R7$(),t.Y8G("title",t.bMT(9,48,"catalog.facets")),t.R7$(3),t.Y8G("ngForOf",t.bMT(12,50,i.facetValues$)),t.R7$(3),t.Y8G("vdrIfPermissions",i.updatePermissions),t.R7$(2),t.Y8G("ngIf",t.bMT(17,52,i.entity$)),t.R7$(6),t.Y8G("label",t.bMT(23,54,"common.name")),t.R7$(2),t.Y8G("readonly",!t.bMT(25,56,t.lJ4(101,Re))),t.R7$(2),t.Y8G("label",t.bMT(27,58,"catalog.sku")),t.R7$(2),t.Y8G("readonly",!t.bMT(29,60,i.updatePermissions)),t.R7$(2),t.Y8G("ngIf",i.customFields.length),t.R7$(),t.Y8G("entity$",i.entity$)("detailForm",i.detailForm),t.R7$(),t.Y8G("title",t.bMT(33,62,"catalog.assets")),t.R7$(2),t.Y8G("assets",i.assetChanges.assets||a.assets)("featuredAsset",i.assetChanges.featuredAsset||a.featuredAsset)("updatePermissions",i.updatePermissions),t.R7$(),t.Y8G("title",t.bMT(36,64,"catalog.price-and-tax")),t.R7$(3),t.Y8G("label",t.bMT(39,66,"catalog.tax-category")),t.R7$(3),t.Y8G("ngForOf",t.bMT(42,68,i.taxCategories$)),t.R7$(2),t.Y8G("ngForOf",i.pricesForm.controls),t.R7$(),t.Y8G("channelPriceIncludesTax",t.bMT(45,70,i.channelPriceIncludesTax$))("channelDefaultCurrencyCode",i.channelDefaultCurrencyCode)("variant",a),t.R7$(2),t.Y8G("ngIf",t.bMT(47,72,i.unusedCurrencyCodes$)),t.R7$(2),t.Y8G("title",t.bMT(49,74,"catalog.stock-levels")),t.R7$(3),t.Y8G("label",t.bMT(52,76,"catalog.track-inventory"))("tooltip",t.bMT(53,78,"catalog.track-inventory-tooltip")),t.R7$(3),t.Y8G("disabled",!t.bMT(55,80,i.updatePermissions)),t.R7$(2),t.Y8G("value",i.GlobalFlag.TRUE),t.R7$(),t.SpI(" ",t.bMT(58,82,"catalog.track-inventory-true")," "),t.R7$(2),t.Y8G("value",i.GlobalFlag.FALSE),t.R7$(),t.SpI(" ",t.bMT(61,84,"catalog.track-inventory-false")," "),t.R7$(2),t.Y8G("value",i.GlobalFlag.INHERIT),t.R7$(),t.SpI(" ",t.bMT(64,86,"catalog.track-inventory-inherit")," "),t.R7$(2),t.Y8G("label",t.bMT(66,88,"catalog.out-of-stock-threshold"))("tooltip",t.bMT(67,90,"catalog.out-of-stock-threshold-tooltip")),t.R7$(3),t.Y8G("readonly",!t.bMT(69,92,i.updatePermissions))("vdrDisabled",!1!==(null==(e=i.detailForm.get("useGlobalOutOfStockThreshold"))?null:e.value)||i.inventoryIsNotTracked(i.detailForm)),t.R7$(3),t.Y8G("vdrDisabled",!t.bMT(72,94,i.updatePermissions)||i.inventoryIsNotTracked(i.detailForm)),t.R7$(3),t.Lme("",t.bMT(75,96,"catalog.use-global-value")," (",i.globalOutOfStockThreshold,")"),t.R7$(2),t.Y8G("ngForOf",i.stockLevelsForm.controls),t.R7$(),t.Y8G("ngIf",t.bMT(78,98,i.unusedStockLocation$))}}class Yt extends l.wi7{constructor(n,e,a,i,s,c){super(),this.productDetailService=n,this.formBuilder=e,this.modalService=a,this.notificationService=i,this.dataService=s,this.changeDetector=c,this.updatePermissions=[l.aXG.UpdateCatalog,l.aXG.UpdateProduct],this.customFields=this.getCustomFieldConfig("ProductVariant"),this.customOptionFields=this.getCustomFieldConfig("ProductOption"),this.detailForm=this.formBuilder.group({id:"",enabled:!1,sku:"",name:"",taxCategoryId:"",stockOnHand:0,useGlobalOutOfStockThreshold:!0,outOfStockThreshold:0,trackInventory:l.uQg.TRUE,facetValueIds:[],customFields:this.formBuilder.group((0,l.HCD)(this.customFields))}),this.stockLevelsForm=this.formBuilder.array([]),this.pricesForm=this.formBuilder.array([]),this.assetChanges={},this.GlobalFlag=l.uQg}ngOnInit(){this.init(),this.dataService.settings.getGlobalSettings("cache-first").single$.subscribe(({globalSettings:s})=>{this.globalTrackInventory=s.trackInventory,this.globalOutOfStockThreshold=s.outOfStockThreshold,this.changeDetector.markForCheck()}),this.taxCategories$=this.result$.pipe((0,f.T)(s=>s.taxCategories.items));const n=this.result$.pipe((0,N.M)(s=>this.channelDefaultCurrencyCode=s.activeChannel.defaultCurrencyCode),(0,f.T)(s=>s.activeChannel.availableCurrencyCodes));this.unusedCurrencyCodes$=(0,D.z)(this.pricesForm.valueChanges,n).pipe((0,f.T)(([s,c])=>c.filter(m=>!s.map(_=>_.currencyCode).includes(m))));const e=this.result$.pipe((0,f.T)(s=>s.stockLocations.items));this.unusedStockLocation$=(0,D.z)(this.entity$,e).pipe((0,f.T)(([s,c])=>{const m=s.stockLevels.map(_=>_.stockLocation.id);return c.filter(_=>!m.includes(_.id))})),this.channelPriceIncludesTax$=this.dataService.settings.getActiveChannel("cache-first").refetchOnChannelChange().mapStream(s=>s.activeChannel.pricesIncludeTax).pipe((0,r.t)(1)),this.stockLevels$=this.entity$.pipe((0,f.T)(s=>s?.stockLevels??[]));const a=this.entity$.pipe((0,f.T)(s=>s.facetValues??[])),i=this.detailForm.get("facetValueIds").valueChanges.pipe((0,kl.i)(1),(0,Y.F)(),(0,C.n)(s=>this.dataService.facet.getFacetValues({filter:{id:{in:s}}}).mapSingle(({facetValues:c})=>c.items)),(0,r.t)(1));this.facetValues$=(0,qe.x)(a.pipe((0,U.s)(1)),a.pipe(function El(o,n){return(0,Gl.T)(n)?(0,C.n)(()=>o,n):(0,C.n)(()=>o)}(i)))}ngOnDestroy(){this.destroy()}addPriceInCurrency(n){this.pricesForm.push(this.formBuilder.group({currencyCode:n,price:0,delete:!1}))}toggleDeletePrice(n){n.setValue(!n.value),n.markAsDirty()}addStockLocation(n){this.stockLevelsForm.push(this.formBuilder.group({stockLocationId:n.id,stockLocationName:n.name,stockOnHand:0,stockAllocated:0}))}save(){(0,D.z)(this.entity$,this.languageCode$).pipe((0,U.s)(1),(0,V.Z)(([n,e])=>{const a=(0,Dl.U)(this.getUpdatedVariant(n,this.detailForm,e),["id","enabled","translations","sku","taxCategoryId","facetValueIds","featuredAssetId","assetIds","trackInventory","outOfStockThreshold","useGlobalOutOfStockThreshold","customFields"]);return this.stockLevelsForm.dirty&&(a.stockLevels=this.stockLevelsForm.controls.filter(i=>i.dirty).map(i=>({stockLocationId:i.value.stockLocationId,stockOnHand:i.value.stockOnHand}))),this.pricesForm.dirty&&(a.prices=this.pricesForm.controls.filter(i=>i.dirty).map(i=>({price:i.value.price,currencyCode:i.value.currencyCode,delete:!0===i.value.delete}))),this.dataService.mutate(l.Cjo,{input:[a]})})).subscribe(n=>{this.detailForm.markAsPristine(),this.stockLevelsForm.markAsPristine(),this.pricesForm.markAsPristine(),this.assetChanges={},this.notificationService.success((0,u.x)("common.notify-update-success"),{entity:"ProductVariant"}),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,u.x)("common.notify-update-error"),{entity:"ProductVariant"})})}assetsChanged(){return!!Object.values(this.assetChanges).length}inventoryIsNotTracked(n){const e=n.get("trackInventory")?.value;return e===l.uQg.FALSE||e===l.uQg.INHERIT&&!1===this.globalTrackInventory}optionGroupCode(n){return this.entity?.product.optionGroups.find(a=>a.id===n)?.code}optionName(n){return(n.translations.find(a=>a.languageCode===this.languageCode)??n.translations[0]).name}removeFacetValue(n){const e=this.detailForm,a=e.value.facetValueIds??[];e.patchValue({facetValueIds:a.filter(i=>i!==n)}),e.markAsDirty()}selectFacetValue(){this.displayFacetValueModal().subscribe(n=>{if(n){const e=this.detailForm.value.facetValueIds??[];this.detailForm.patchValue({facetValueIds:(0,x.A)([...e,...n])}),this.detailForm.markAsDirty()}})}displayFacetValueModal(){return this.modalService.fromComponent(pt,{size:"md",closable:!0}).pipe((0,f.T)(n=>n&&n.map(e=>e.id)))}setFormValues(n,e){const a=(0,l.RMk)(n,e),i=n.facetValues.map(s=>s.id);this.detailForm.patchValue({id:n.id,enabled:n.enabled,sku:n.sku,name:a?a.name:"",taxCategoryId:n.taxCategory.id,stockOnHand:n.stockLevels[0]?.stockOnHand??0,useGlobalOutOfStockThreshold:n.useGlobalOutOfStockThreshold,outOfStockThreshold:n.outOfStockThreshold,trackInventory:n.trackInventory,facetValueIds:i}),this.stockLevelsForm.clear();for(const s of n.stockLevels)this.stockLevelsForm.push(this.formBuilder.group({stockLocationId:s.stockLocation.id,stockLocationName:s.stockLocation.name,stockOnHand:s.stockOnHand,stockAllocated:s.stockAllocated}));this.pricesForm.clear();for(const s of n.prices)this.pricesForm.push(this.formBuilder.group({price:s.price,currencyCode:s.currencyCode,delete:!1}));this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n,a)}getUpdatedVariant(n,e,a){return{...(0,l.vk6)({translatable:n,updatedFields:e.value,customFieldConfig:this.customFields,languageCode:a,defaultTranslation:{languageCode:a,name:n.name||""}}),assetIds:this.assetChanges.assets?.map(s=>s.id),featuredAssetId:this.assetChanges.featuredAsset?.id,facetValueIds:e.value.facetValueIds,taxCategoryId:e.value.taxCategoryId}}static{this.\u0275fac=function(e){return new(e||Yt)(t.rXU(J),t.rXU(d.ok),t.rXU(l.Bg8),t.rXU(l.JEu),t.rXU(l.uSP),t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:Yt,selectors:[["vdr-product-variant-detail"]],features:[t.Vt3],decls:13,vars:10,consts:[[3,"grow"],[1,"flex","center"],[4,"ngIf"],[3,"productId"],["locationId","product-variant-detail"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["class","form",3,"formGroup",4,"ngIf"],["class","mr-2",3,"disabled","availableLanguageCodes","currentLanguageCode","languageCodeChange",4,"ngIf"],[1,"mr-2",3,"languageCodeChange","disabled","availableLanguageCodes","currentLanguageCode"],[1,"btn","btn-primary",3,"click","disabled"],[1,"form",3,"formGroup"],["for","visibility",3,"label"],[4,"vdrIfPermissions"],[3,"title",4,"ngIf"],[3,"title"],[1,"facets"],[3,"facetValue","removable","remove",4,"ngFor","ngForOf"],["class","button-small mt-2",3,"click",4,"vdrIfPermissions"],[3,"entity",4,"ngIf"],["type","submit","hidden","","x-data","prevents enter key from triggering other buttons"],[1,"form-grid"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","sku",3,"label"],["id","sku","type","text","formControlName","sku",3,"readonly"],["locationId","product-variant-detail",3,"entity$","detailForm"],[3,"change","assets","featuredAsset","updatePermissions"],["for","taxCategory",3,"label"],["name","taxCategory","formControlName","taxCategoryId"],[3,"value",4,"ngFor","ngForOf"],["class","form-grid prices",3,"formGroup",4,"ngFor","ngForOf"],[3,"channelPriceIncludesTax","channelDefaultCurrencyCode","variant"],["for","track-inventory",3,"label","tooltip"],["name","track-inventory","formControlName","trackInventory",3,"disabled"],[3,"value"],[3,"label","tooltip"],["type","number","formControlName","outOfStockThreshold",3,"readonly","vdrDisabled"],["type","checkbox","clrToggle","","name","useGlobalOutOfStockThreshold","formControlName","useGlobalOutOfStockThreshold",3,"vdrDisabled"],["class","form-grid stock-levels",3,"formGroup",4,"ngFor","ngForOf"],["type","checkbox","clrToggle","","name","enabled",3,"formControl"],[1,"options"],[3,"colorFrom","invert",4,"ngFor","ngForOf"],["class","button-small mt-2",3,"routerLink",4,"vdrIfPermissions"],[3,"colorFrom","invert"],[1,"button-small","mt-2",3,"routerLink"],["shape","pencil"],[3,"remove","facetValue","removable"],[1,"button-small","mt-2",3,"click"],["shape","plus"],[3,"entity"],["entityName","ProductVariant",3,"customFields","customFieldsFormGroup","readonly"],[1,"form-grid","prices",3,"formGroup"],["for","price",3,"label","tooltip"],[1,"price-wrapper"],["name","price","formControlName","price",3,"currencyCode","readonly"],[3,"price","currencyCode","priceIncludesTax","taxCategoryId"],[1,"button-small","delete-button",3,"click","disabled"],["shape","trash"],["vdrDropdownTrigger","",1,"button","mt-2"],["shape","ellipsis-vertical"],["vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["vdrDropdownItem","",3,"click"],[1,"form-grid","stock-levels",3,"formGroup"],[3,"label","for"],["type","number","formControlName","stockOnHand",3,"id","readonly"],[3,"label"],["shape","map-marker"]],template:function(e,a){1&e&&(t.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-left",0)(3,"div",1),t.DNE(4,Ul,2,1,"ng-container",2),t.nI1(5,"async"),t.nrm(6,"vdr-product-variant-quick-jump",3),t.k0s()(),t.j41(7,"vdr-ab-right"),t.nrm(8,"vdr-action-bar-items",4),t.DNE(9,Ll,3,4,"button",5),t.nrm(10,"vdr-action-bar-dropdown-menu",4),t.k0s()()(),t.DNE(11,sc,79,102,"form",6),t.nI1(12,"async")),2&e&&(t.R7$(2),t.Y8G("grow",!0),t.R7$(2),t.Y8G("ngIf",t.bMT(5,5,a.availableLanguages$)),t.R7$(2),t.Y8G("productId",null==a.entity?null:a.entity.product.id),t.R7$(3),t.Y8G("vdrIfPermissions",t.lJ4(9,Re)),t.R7$(2),t.Y8G("ngIf",t.bMT(12,7,a.entity$)))},dependencies:[b.U4n,b.aZZ,b.Jej,b.eAx,g.Sq,g.bT,d.qT,d.xH,d.y7,d.me,d.Q0,d.Zm,d.wz,d.BC,d.cb,d.l_,d.j4,d.JD,P.Wk,R.nG,R.wL,R.TX,nt.l,ve.P,Q.w,ee.J,oe.K,L.K,$.V,Ce.N,H.t,ae.P,ie.q,re.j,Ht.M,X.p,ot.T,se.y,bt.W,le.L,A.e,wt.E,ce.c,de.e,lt.i,Nt,At,jt,g.Jj,T.D9,Nl.$,Te.F,q.E],styles:[".facets[_ngcontent-%COMP%], .options[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:3px}vdr-product-variant-quick-jump[_ngcontent-%COMP%]{flex:1;margin-inline-end:calc(var(--space-unit) * 2)}.stock-levels[_ngcontent-%COMP%], .prices[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 2);border-top:1px solid var(--color-weight-150)}.price-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--space-unit);width:100%}.price-wrapper.pending-deletion[_ngcontent-%COMP%] vdr-currency-input[_ngcontent-%COMP%]{opacity:.7}.price-wrapper.pending-deletion[_ngcontent-%COMP%] .delete-button[_ngcontent-%COMP%]{background-color:var(--color-error-700);color:var(--color-error-100)}"],changeDetection:0})}}const sn={location:"product-variant-list",label:(0,u.x)("common.assign-to-channel"),icon:"layers",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),isVisible:({injector:o})=>(0,l.$xL)(o.get(l.uSP)),onClick:({injector:o,selection:n,clearSelection:e})=>{o.get(l.Bg8).fromComponent(Z,{size:"lg",locals:{productVariantIds:(0,x.A)(n.map(i=>i.id)),currentChannelIds:[]}}).subscribe(i=>{i&&e()})}},ln=(0,l.YSJ)({location:"product-variant-list",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),getItemName:o=>o,bulkRemoveFromChannel:(o,n,e)=>o.product.removeVariantsFromChannel({channelId:e,productVariantIds:n}).pipe((0,f.T)(a=>a.removeProductVariantsFromChannel))}),cn={location:"product-variant-list",label:(0,u.x)("common.delete"),icon:"trash",iconClass:"is-danger",requiresPermission:o=>o.includes(l.aXG.DeleteProduct)||o.includes(l.aXG.DeleteCatalog),onClick:({injector:o,selection:n,hostComponent:e,clearSelection:a})=>{const i=o.get(l.Bg8),s=o.get(l.uSP),c=o.get(l.JEu);i.dialog({title:(0,u.x)("common.confirm-bulk-delete"),translationVars:{count:n.length},buttons:[{type:"secondary",label:(0,u.x)("common.cancel")},{type:"danger",label:(0,u.x)("common.delete"),returnValue:!0}]}).pipe((0,C.n)(m=>m?s.product.deleteProductVariants((0,x.A)(n.map(_=>_.id))):E.w)).subscribe(m=>{let _=0;const h=[];for(const v of m.deleteProductVariants)v.result===l.syg.DELETED?_++:v.message&&h.push(v.message);0<_&&c.success((0,u.x)("catalog.notify-bulk-delete-products-success"),{count:_}),0<h.length&&c.error(h.join("\n")),e.refresh(),a()})}},dn={location:"product-variant-list",label:(0,u.x)("catalog.edit-facet-values"),icon:"tag",requiresPermission:o=>o.includes(l.aXG.UpdateCatalog)||o.includes(l.aXG.UpdateProduct),onClick:({injector:o,selection:n,clearSelection:e})=>{const a=o.get(l.Bg8),i=o.get(l.JEu),s="variant",c=(0,x.A)(n.map(m=>m.id));return a.fromComponent(mt,{size:"xl",locals:{mode:s,ids:c}}).subscribe(m=>{m&&(i.success((0,u.x)("common.notify-bulk-update-success"),{count:n.length,entity:"Products"}),e())})}};var lc=p(6897);function cc(o,n){if(1&o&&(t.qex(0),t.j41(1,"th"),t.EFF(2),t.k0s(),t.bVm()),2&o){const e=n.$implicit;t.R7$(2),t.JRh(e.name)}}function dc(o,n){if(1&o&&(t.nrm(0,"img",18),t.nI1(1,"assetPreview")),2&o){const e=n.ngIf;t.Y8G("src",t.i5U(1,1,e,"tiny"),t.B4B)}}function pc(o,n){1&o&&(t.j41(0,"div",19),t.nrm(1,"clr-icon",20),t.k0s())}function uc(o,n){if(1&o&&(t.qex(0),t.j41(1,"td",6),t.nI1(2,"stringToColor"),t.EFF(3),t.k0s(),t.bVm()),2&o){const e=n.$implicit,a=t.XpG().ngIf,i=t.XpG(2);t.R7$(),t.xc7("color",t.bMT(2,5,i.optionGroupName(e.groupId))),t.AVh("disabled",!a.get("enabled").value),t.R7$(2),t.SpI(" ",e.name," ")}}function mc(o,n){if(1&o&&(t.nrm(0,"vdr-currency-input",21),t.nI1(1,"hasPermission")),2&o){const e=t.XpG(2).$implicit,a=t.XpG();t.Y8G("currencyCode",e.currencyCode)("readonly",!t.bMT(1,2,a.updatePermission))}}function _c(o,n){if(1&o&&(t.nrm(0,"vdr-currency-input",22),t.nI1(1,"hasPermission")),2&o){const e=t.XpG(2).$implicit,a=t.XpG();t.Y8G("currencyCode",e.currencyCode)("readonly",!t.bMT(1,2,a.updatePermission))}}function gc(o,n){if(1&o&&(t.qex(0,5),t.j41(1,"td",6)(2,"div",7)(3,"div",8),t.DNE(4,dc,2,4,"img",9)(5,pc,2,0,"ng-template",null,0,t.C5r),t.k0s()()(),t.j41(7,"td",6)(8,"clr-input-container"),t.nrm(9,"input",10),t.nI1(10,"hasPermission"),t.nI1(11,"translate"),t.k0s()(),t.j41(12,"td",6)(13,"clr-input-container"),t.nrm(14,"input",11),t.nI1(15,"hasPermission"),t.nI1(16,"translate"),t.k0s()(),t.DNE(17,uc,4,7,"ng-container",2),t.nI1(18,"sort"),t.j41(19,"td",12)(20,"clr-input-container"),t.DNE(21,mc,2,4,"vdr-currency-input",13)(22,_c,2,4,"vdr-currency-input",14),t.k0s()(),t.j41(23,"td",15)(24,"clr-input-container"),t.nrm(25,"input",16),t.nI1(26,"hasPermission"),t.k0s()(),t.j41(27,"td",15)(28,"clr-toggle-wrapper"),t.nrm(29,"input",17),t.nI1(30,"hasPermission"),t.k0s()(),t.bVm()),2&o){const e=n.ngIf,a=t.sdS(6),i=t.XpG().$implicit,s=t.XpG();t.Y8G("formGroup",e),t.R7$(),t.AVh("disabled",!e.get("enabled").value),t.R7$(3),t.Y8G("ngIf",s.getFeaturedAsset(i))("ngIfElse",a),t.R7$(3),t.AVh("disabled",!e.get("enabled").value),t.R7$(2),t.Y8G("readonly",!t.bMT(10,24,s.updatePermission))("placeholder",t.bMT(11,26,"common.name")),t.R7$(3),t.AVh("disabled",!e.get("enabled").value),t.R7$(2),t.Y8G("readonly",!t.bMT(15,28,s.updatePermission))("placeholder",t.bMT(16,30,"catalog.sku")),t.R7$(3),t.Y8G("ngForOf",t.i5U(18,32,i.options,"groupId")),t.R7$(2),t.AVh("disabled",!e.get("enabled").value),t.R7$(2),t.Y8G("ngIf",!s.channelPriceIncludesTax),t.R7$(),t.Y8G("ngIf",s.channelPriceIncludesTax),t.R7$(),t.AVh("disabled",!e.get("enabled").value),t.R7$(2),t.Y8G("readonly",!t.bMT(26,35,s.updatePermission)),t.R7$(2),t.AVh("disabled",!e.get("enabled").value),t.R7$(2),t.Y8G("vdrDisabled",!t.bMT(30,37,s.updatePermission))}}function hc(o,n){if(1&o&&(t.j41(0,"tr"),t.DNE(1,gc,31,39,"ng-container",4),t.k0s()),2&o){const e=n.$implicit,a=t.XpG();t.R7$(),t.Y8G("ngIf",a.formGroupMap.get(e.id))}}class Qt{constructor(n){this.changeDetector=n,this.formGroupMap=new Map,this.updatePermission=[l.aXG.UpdateCatalog,l.aXG.UpdateProduct]}ngOnInit(){this.subscription=this.formArray.valueChanges.pipe((0,f.T)(n=>n.length),(0,ut.B)(1),(0,Y.F)()).subscribe(()=>{this.buildFormGroupMap()}),this.buildFormGroupMap()}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}trackByFn(n,e){return null!=e.id?e.id:n}getFeaturedAsset(n){return this.pendingAssetChanges[n.id]?.featuredAsset||n.featuredAsset}optionGroupName(n){const e=this.optionGroups.find(a=>a.id===n);return e&&e.name}buildFormGroupMap(){this.formGroupMap.clear();for(const n of this.formArray.controls)this.formGroupMap.set(n.value.id,n);this.changeDetector.markForCheck()}static{this.\u0275fac=function(e){return new(e||Qt)(t.rXU(t.gRc))}}static{this.\u0275cmp=t.VBU({type:Qt,selectors:[["vdr-product-variants-table"]],inputs:{formArray:[t.Mj6.None,"productVariantsFormArray","formArray"],variants:"variants",paginationConfig:"paginationConfig",channelPriceIncludesTax:"channelPriceIncludesTax",optionGroups:"optionGroups",pendingAssetChanges:"pendingAssetChanges"},decls:24,vars:24,consts:[["placeholder",""],[1,"table"],[4,"ngFor","ngForOf"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],[1,"left","align-middle"],[1,"card-img"],[1,"featured-asset"],[3,"src",4,"ngIf","ngIfElse"],["clrInput","","type","text","formControlName","name",3,"readonly","placeholder"],["clrInput","","type","text","formControlName","sku",3,"readonly","placeholder"],[1,"left","align-middle","price"],["clrInput","","formControlName","price",3,"currencyCode","readonly",4,"ngIf"],["clrInput","","formControlName","priceWithTax",3,"currencyCode","readonly",4,"ngIf"],[1,"left","align-middle","stock"],["clrInput","","type","number","min","0","step","1","formControlName","stockOnHand",3,"readonly"],["type","checkbox","clrToggle","","name","enabled","formControlName","enabled",3,"vdrDisabled"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],["clrInput","","formControlName","price",3,"currencyCode","readonly"],["clrInput","","formControlName","priceWithTax",3,"currencyCode","readonly"]],template:function(e,a){1&e&&(t.j41(0,"table",1)(1,"thead")(2,"tr"),t.nrm(3,"th"),t.j41(4,"th"),t.EFF(5),t.nI1(6,"translate"),t.k0s(),t.j41(7,"th"),t.EFF(8),t.nI1(9,"translate"),t.k0s(),t.DNE(10,cc,3,1,"ng-container",2),t.nI1(11,"sort"),t.j41(12,"th"),t.EFF(13),t.nI1(14,"translate"),t.k0s(),t.j41(15,"th"),t.EFF(16),t.nI1(17,"translate"),t.k0s(),t.j41(18,"th"),t.EFF(19),t.nI1(20,"translate"),t.k0s()()(),t.j41(21,"tbody"),t.DNE(22,hc,2,1,"tr",3),t.nI1(23,"paginate"),t.k0s()()),2&e&&(t.R7$(5),t.JRh(t.bMT(6,8,"common.name")),t.R7$(3),t.JRh(t.bMT(9,10,"catalog.sku")),t.R7$(2),t.Y8G("ngForOf",t.i5U(11,12,a.optionGroups,"id")),t.R7$(3),t.JRh(t.bMT(14,15,"catalog.price")),t.R7$(3),t.JRh(t.bMT(17,17,"catalog.stock-on-hand")),t.R7$(3),t.JRh(t.bMT(20,19,"common.enabled")),t.R7$(3),t.Y8G("ngForOf",t.i5U(23,21,a.variants,a.paginationConfig))("ngForTrackBy",a.trackByFn))},dependencies:[b.U4n,b.Jej,b.eAx,b.icl,b.Xu5,g.Sq,g.bT,d.me,d.Q0,d.Zm,d.BC,d.cb,d.VZ,d.j4,d.JD,ee.J,$.V,se.y,ne.kf,T.D9,Te.F,lc.s,q.E,Ie.H],styles:[".placeholder[_ngcontent-%COMP%]{color:var(--color-grey-300)}.stock[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .price[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{max-width:96px}td[_ngcontent-%COMP%]{transition:background-color .2s}td.disabled[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}"],changeDetection:0})}}const fc=()=>["UpdateCatalog","UpdateProduct"];function vc(o,n){1&o&&(t.EFF(0),t.nI1(1,"translate")),2&o&&t.JRh(t.bMT(1,1,"catalog.update-product-option"))}function bc(o,n){if(1&o&&(t.j41(0,"section")(1,"label"),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.nrm(4,"vdr-tabbed-custom-fields",10),t.nI1(5,"hasPermission"),t.k0s()),2&o){const e=t.XpG();t.R7$(2),t.JRh(t.bMT(3,4,"common.custom-fields")),t.R7$(2),t.Y8G("customFields",e.customFields)("customFieldsFormGroup",e.customFieldsForm)("readonly",!t.bMT(5,6,t.lJ4(8,fc)))}}function Cc(o,n){if(1&o){const e=t.RV6();t.j41(0,"button",11),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.cancel())}),t.EFF(1),t.nI1(2,"translate"),t.k0s(),t.j41(3,"button",12),t.bIt("click",function(){t.eBV(e);const i=t.XpG();return t.Njj(i.update())}),t.EFF(4),t.nI1(5,"translate"),t.k0s()}if(2&o){const e=t.XpG(),a=t.sdS(4),i=t.sdS(8);t.R7$(),t.JRh(t.bMT(2,3,"common.cancel")),t.R7$(2),t.Y8G("disabled",a.invalid||i.invalid||a.pristine&&i.pristine&&e.customFieldsForm.pristine),t.R7$(),t.SpI(" ",t.bMT(5,5,"catalog.update-product-option")," ")}}class Zt{constructor(){this.updateVariantName=!0,this.codeInputTouched=!1}ngOnInit(){const n=this.productOption.translations.find(e=>e.languageCode===this.activeLanguage);if(this.name=n?.name??"",this.code=this.productOption.code,this.customFieldsForm=new d.J3({}),this.customFields){const e=n&&n.customFields||{};for(const a of this.customFields){const i=a.name,s="localeString"===a.type?e[i]:this.productOption.customFields[i];this.customFieldsForm.addControl(a.name,new d.hs(s))}}}update(){const n=(0,l.vk6)({translatable:this.productOption,languageCode:this.activeLanguage,updatedFields:{code:this.code,name:this.name,customFields:this.customFieldsForm.value},customFieldConfig:this.customFields,defaultTranslation:{languageCode:this.activeLanguage,name:""}});this.resolveWith({...n,autoUpdate:this.updateVariantName})}cancel(){this.resolveWith()}updateCode(n){!this.codeInputTouched&&!this.productOption.code&&(this.code=(0,S.J)(n,"-"))}static{this.\u0275fac=function(e){return new(e||Zt)}}static{this.\u0275cmp=t.VBU({type:Zt,selectors:[["vdr-update-product-option-dialog"]],decls:16,vars:13,consts:[["nameInput","ngModel"],["codeInput","ngModel"],["vdrDialogTitle",""],["for","name",3,"label"],["id","name","type","text","required","",3,"ngModelChange","input","ngModel"],["for","code",3,"label"],["id","code","type","text","required","","pattern","[a-z0-9_-]+",3,"ngModelChange","ngModel"],["type","checkbox","clrCheckbox","",3,"ngModelChange","ngModel"],[4,"ngIf"],["vdrDialogButtons",""],["entityName","ProductOption",3,"customFields","customFieldsFormGroup","readonly"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,a){if(1&e){const i=t.RV6();t.DNE(0,vc,2,3,"ng-template",2),t.j41(1,"vdr-form-field",3),t.nI1(2,"translate"),t.j41(3,"input",4,0),t.mxI("ngModelChange",function(c){return t.eBV(i),t.DH7(a.name,c)||(a.name=c),t.Njj(c)}),t.bIt("input",function(c){return t.eBV(i),t.Njj(a.updateCode(c.target.value))}),t.k0s()(),t.j41(5,"vdr-form-field",5),t.nI1(6,"translate"),t.j41(7,"input",6,1),t.mxI("ngModelChange",function(c){return t.eBV(i),t.DH7(a.code,c)||(a.code=c),t.Njj(c)}),t.k0s()(),t.j41(9,"clr-checkbox-wrapper")(10,"input",7),t.mxI("ngModelChange",function(c){return t.eBV(i),t.DH7(a.updateVariantName,c)||(a.updateVariantName=c),t.Njj(c)}),t.k0s(),t.j41(11,"label"),t.EFF(12),t.nI1(13,"translate"),t.k0s()(),t.DNE(14,bc,6,9,"section",8)(15,Cc,6,7,"ng-template",9)}2&e&&(t.R7$(),t.Y8G("label",t.bMT(2,7,"catalog.option-name")),t.R7$(2),t.R50("ngModel",a.name),t.R7$(2),t.Y8G("label",t.bMT(6,9,"common.code")),t.R7$(2),t.R50("ngModel",a.code),t.R7$(3),t.R50("ngModel",a.updateVariantName),t.R7$(2),t.JRh(t.bMT(13,11,"catalog.auto-update-option-variant-name")),t.R7$(2),t.Y8G("ngIf",a.customFields.length))},dependencies:[b.aZZ,b.Jej,b.eAx,g.bT,d.me,d.Zm,d.BC,d.YS,d.R_,d.vS,L.K,$.V,tt.b,K.M,bt.W,T.D9,q.E],changeDetection:0})}}class Ut{static{this.hasRegisteredTabsAndBulkActions=!1}constructor(n,e){Ut.hasRegisteredTabsAndBulkActions||(n.registerBulkAction(an),n.registerBulkAction(nn),n.registerBulkAction(rn),n.registerBulkAction(on),n.registerBulkAction(en),n.registerBulkAction(dn),n.registerBulkAction(sn),n.registerBulkAction(ln),n.registerBulkAction(cn),n.registerBulkAction(Qe),n.registerBulkAction(ze),n.registerBulkAction(Ze),n.registerBulkAction(Ke),n.registerBulkAction(Ue),n.registerBulkAction(Le),n.registerBulkAction(we),n.registerBulkAction(Be),n.registerBulkAction(Ye),e.registerPageTab({priority:0,location:"product-list",tab:(0,u.x)("catalog.products"),route:"",component:xt}),e.registerPageTab({priority:0,location:"product-detail",tab:(0,u.x)("catalog.product"),route:"",component:(0,l.HL6)({component:vt,query:l.A69,entityKey:"product",getBreadcrumbs:a=>[{label:a?a.name:(0,u.x)("catalog.create-new-product"),link:[a?.id]}]})}),e.registerPageTab({priority:0,location:"product-list",tab:(0,u.x)("catalog.product-variants"),route:"variants",component:ft}),e.registerPageTab({priority:0,location:"product-variant-detail",tab:(0,u.x)("catalog.product-variants"),route:"",component:(0,l.HL6)({component:Yt,query:l.vsw,entityKey:"productVariant",getBreadcrumbs:a=>[{label:`${a?.product.name}`,link:["/catalog","products",a?.product.id]},{label:`${a?.name} (${a?.sku})`,link:["variants",a?.id]}]})}),e.registerPageTab({priority:0,location:"facet-list",tab:(0,u.x)("catalog.facets"),route:"",component:Vt}),e.registerPageTab({priority:0,location:"facet-detail",tab:(0,u.x)("catalog.facet"),route:"",component:(0,l.HL6)({component:yt,query:l.Ctv,variables:{facetValueListOptions:{take:10,skip:0,sort:{createdAt:Bt.xB.DESC}}},entityKey:"facet",getBreadcrumbs:a=>[{label:a?a.name:(0,u.x)("catalog.create-new-facet"),link:[a?.id]}]})}),e.registerPageTab({priority:0,location:"collection-list",tab:(0,u.x)("catalog.collections"),route:"",component:Ot}),e.registerPageTab({priority:0,location:"collection-detail",tab:(0,u.x)("catalog.collection"),route:"",component:(0,l.HL6)({component:Et,query:l.RMd,entityKey:"collection",getBreadcrumbs:a=>[{label:a?a.name:(0,u.x)("catalog.create-new-collection"),link:[a?.id]}]})}),e.registerPageTab({priority:0,location:"asset-list",tab:(0,u.x)("catalog.assets"),route:"",component:Gt}),e.registerPageTab({priority:0,location:"asset-detail",tab:(0,u.x)("catalog.asset"),route:"",component:(0,l.HL6)({component:kt,query:l.xFh,entityKey:"asset",getBreadcrumbs:a=>[{label:`${a?.name}`,link:[a?.id]}]})}),Ut.hasRegisteredTabsAndBulkActions=!0)}static{this.\u0275fac=function(e){return new(e||Ut)(t.KVO(l.HCh),t.KVO(l.bPm))}}static{this.\u0275mod=t.$C({type:Ut})}static{this.\u0275inj=t.G2t({providers:[{provide:P.bw,useFactory:n=>ke(n),multi:!0,deps:[l.bPm]}],imports:[l.GgS,P.iI.forChild([])]})}}const Ic=M.J1`
|
|
118
|
+
fragment ProductListQueryProductFragment on Product {
|
|
119
|
+
id
|
|
120
|
+
createdAt
|
|
121
|
+
updatedAt
|
|
122
|
+
enabled
|
|
123
|
+
languageCode
|
|
124
|
+
name
|
|
125
|
+
slug
|
|
126
|
+
featuredAsset {
|
|
127
|
+
id
|
|
128
|
+
createdAt
|
|
129
|
+
updatedAt
|
|
130
|
+
preview
|
|
131
|
+
focalPoint {
|
|
132
|
+
x
|
|
133
|
+
y
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
variantList {
|
|
137
|
+
totalItems
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`,Tc=M.J1`
|
|
141
|
+
query ProductListQuery($options: ProductListOptions) {
|
|
142
|
+
products(options: $options) {
|
|
143
|
+
items {
|
|
144
|
+
...ProductListQueryProductFragment
|
|
145
|
+
}
|
|
146
|
+
totalItems
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
${Ic}
|
|
150
|
+
`,Fe=M.J1`
|
|
151
|
+
fragment ProductVariantDetailQueryProductVariantFragment on ProductVariant {
|
|
152
|
+
id
|
|
153
|
+
createdAt
|
|
154
|
+
updatedAt
|
|
155
|
+
enabled
|
|
156
|
+
languageCode
|
|
157
|
+
name
|
|
158
|
+
price
|
|
159
|
+
currencyCode
|
|
160
|
+
prices {
|
|
161
|
+
price
|
|
162
|
+
currencyCode
|
|
163
|
+
}
|
|
164
|
+
priceWithTax
|
|
165
|
+
stockOnHand
|
|
166
|
+
stockAllocated
|
|
167
|
+
trackInventory
|
|
168
|
+
outOfStockThreshold
|
|
169
|
+
useGlobalOutOfStockThreshold
|
|
170
|
+
taxRateApplied {
|
|
171
|
+
id
|
|
172
|
+
name
|
|
173
|
+
value
|
|
174
|
+
}
|
|
175
|
+
taxCategory {
|
|
176
|
+
id
|
|
177
|
+
name
|
|
178
|
+
}
|
|
179
|
+
sku
|
|
180
|
+
options {
|
|
181
|
+
...ProductOption
|
|
182
|
+
}
|
|
183
|
+
stockLevels {
|
|
184
|
+
id
|
|
185
|
+
createdAt
|
|
186
|
+
updatedAt
|
|
187
|
+
stockOnHand
|
|
188
|
+
stockAllocated
|
|
189
|
+
stockLocationId
|
|
190
|
+
stockLocation {
|
|
191
|
+
id
|
|
192
|
+
createdAt
|
|
193
|
+
updatedAt
|
|
194
|
+
name
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
facetValues {
|
|
198
|
+
id
|
|
199
|
+
code
|
|
200
|
+
name
|
|
201
|
+
facet {
|
|
202
|
+
id
|
|
203
|
+
name
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
featuredAsset {
|
|
207
|
+
...Asset
|
|
208
|
+
}
|
|
209
|
+
assets {
|
|
210
|
+
...Asset
|
|
211
|
+
}
|
|
212
|
+
translations {
|
|
213
|
+
id
|
|
214
|
+
languageCode
|
|
215
|
+
name
|
|
216
|
+
}
|
|
217
|
+
channels {
|
|
218
|
+
id
|
|
219
|
+
code
|
|
220
|
+
}
|
|
221
|
+
product {
|
|
222
|
+
id
|
|
223
|
+
name
|
|
224
|
+
optionGroups {
|
|
225
|
+
id
|
|
226
|
+
name
|
|
227
|
+
code
|
|
228
|
+
translations {
|
|
229
|
+
id
|
|
230
|
+
languageCode
|
|
231
|
+
name
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
`,Rc=M.J1`
|
|
237
|
+
query GetProductVariantDetail($id: ID!) {
|
|
238
|
+
productVariant(id: $id) {
|
|
239
|
+
...ProductVariantDetailQueryProductVariantFragment
|
|
240
|
+
}
|
|
241
|
+
stockLocations(options: { take: 100 }) {
|
|
242
|
+
items {
|
|
243
|
+
id
|
|
244
|
+
createdAt
|
|
245
|
+
updatedAt
|
|
246
|
+
name
|
|
247
|
+
description
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
taxCategories(options: { take: 100 }) {
|
|
251
|
+
items {
|
|
252
|
+
id
|
|
253
|
+
createdAt
|
|
254
|
+
updatedAt
|
|
255
|
+
name
|
|
256
|
+
isDefault
|
|
257
|
+
}
|
|
258
|
+
totalItems
|
|
259
|
+
}
|
|
260
|
+
activeChannel {
|
|
261
|
+
id
|
|
262
|
+
availableCurrencyCodes
|
|
263
|
+
defaultCurrencyCode
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
${Fe}
|
|
267
|
+
`,Fc=M.J1`
|
|
268
|
+
mutation ProductVariantUpdateMutation($input: [UpdateProductVariantInput!]!) {
|
|
269
|
+
updateProductVariants(input: $input) {
|
|
270
|
+
...ProductVariantDetailQueryProductVariantFragment
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
${Fe}
|
|
274
|
+
`,Pc=M.J1`
|
|
275
|
+
fragment ProductVariantListQueryProductVariantFragment on ProductVariant {
|
|
276
|
+
id
|
|
277
|
+
createdAt
|
|
278
|
+
updatedAt
|
|
279
|
+
productId
|
|
280
|
+
enabled
|
|
281
|
+
languageCode
|
|
282
|
+
name
|
|
283
|
+
price
|
|
284
|
+
currencyCode
|
|
285
|
+
priceWithTax
|
|
286
|
+
trackInventory
|
|
287
|
+
outOfStockThreshold
|
|
288
|
+
stockLevels {
|
|
289
|
+
id
|
|
290
|
+
createdAt
|
|
291
|
+
updatedAt
|
|
292
|
+
stockLocationId
|
|
293
|
+
stockOnHand
|
|
294
|
+
stockAllocated
|
|
295
|
+
stockLocation {
|
|
296
|
+
id
|
|
297
|
+
createdAt
|
|
298
|
+
updatedAt
|
|
299
|
+
name
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
useGlobalOutOfStockThreshold
|
|
303
|
+
sku
|
|
304
|
+
featuredAsset {
|
|
305
|
+
...Asset
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
${l.eqi}
|
|
310
|
+
`,Dc=M.J1`
|
|
311
|
+
query ProductVariantListQuery($options: ProductVariantListOptions!) {
|
|
312
|
+
productVariants(options: $options) {
|
|
313
|
+
items {
|
|
314
|
+
...ProductVariantListQueryProductVariantFragment
|
|
315
|
+
}
|
|
316
|
+
totalItems
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
${Pc}
|
|
320
|
+
`},6587:(pn,Lt)=>{var P,r,u,l,Bt,t,f,d,D,w,N,U,V,S,st,O,qt;Lt.xB=void 0,(r=P||(P={})).DISTRIBUTED_ORDER_PROMOTION="DISTRIBUTED_ORDER_PROMOTION",r.OTHER="OTHER",r.PROMOTION="PROMOTION",function(r){r.BINARY="BINARY",r.IMAGE="IMAGE",r.VIDEO="VIDEO"}(u||(u={})),function(r){r.AED="AED",r.AFN="AFN",r.ALL="ALL",r.AMD="AMD",r.ANG="ANG",r.AOA="AOA",r.ARS="ARS",r.AUD="AUD",r.AWG="AWG",r.AZN="AZN",r.BAM="BAM",r.BBD="BBD",r.BDT="BDT",r.BGN="BGN",r.BHD="BHD",r.BIF="BIF",r.BMD="BMD",r.BND="BND",r.BOB="BOB",r.BRL="BRL",r.BSD="BSD",r.BTN="BTN",r.BWP="BWP",r.BYN="BYN",r.BZD="BZD",r.CAD="CAD",r.CDF="CDF",r.CHF="CHF",r.CLP="CLP",r.CNY="CNY",r.COP="COP",r.CRC="CRC",r.CUC="CUC",r.CUP="CUP",r.CVE="CVE",r.CZK="CZK",r.DJF="DJF",r.DKK="DKK",r.DOP="DOP",r.DZD="DZD",r.EGP="EGP",r.ERN="ERN",r.ETB="ETB",r.EUR="EUR",r.FJD="FJD",r.FKP="FKP",r.GBP="GBP",r.GEL="GEL",r.GHS="GHS",r.GIP="GIP",r.GMD="GMD",r.GNF="GNF",r.GTQ="GTQ",r.GYD="GYD",r.HKD="HKD",r.HNL="HNL",r.HRK="HRK",r.HTG="HTG",r.HUF="HUF",r.IDR="IDR",r.ILS="ILS",r.INR="INR",r.IQD="IQD",r.IRR="IRR",r.ISK="ISK",r.JMD="JMD",r.JOD="JOD",r.JPY="JPY",r.KES="KES",r.KGS="KGS",r.KHR="KHR",r.KMF="KMF",r.KPW="KPW",r.KRW="KRW",r.KWD="KWD",r.KYD="KYD",r.KZT="KZT",r.LAK="LAK",r.LBP="LBP",r.LKR="LKR",r.LRD="LRD",r.LSL="LSL",r.LYD="LYD",r.MAD="MAD",r.MDL="MDL",r.MGA="MGA",r.MKD="MKD",r.MMK="MMK",r.MNT="MNT",r.MOP="MOP",r.MRU="MRU",r.MUR="MUR",r.MVR="MVR",r.MWK="MWK",r.MXN="MXN",r.MYR="MYR",r.MZN="MZN",r.NAD="NAD",r.NGN="NGN",r.NIO="NIO",r.NOK="NOK",r.NPR="NPR",r.NZD="NZD",r.OMR="OMR",r.PAB="PAB",r.PEN="PEN",r.PGK="PGK",r.PHP="PHP",r.PKR="PKR",r.PLN="PLN",r.PYG="PYG",r.QAR="QAR",r.RON="RON",r.RSD="RSD",r.RUB="RUB",r.RWF="RWF",r.SAR="SAR",r.SBD="SBD",r.SCR="SCR",r.SDG="SDG",r.SEK="SEK",r.SGD="SGD",r.SHP="SHP",r.SLL="SLL",r.SOS="SOS",r.SRD="SRD",r.SSP="SSP",r.STN="STN",r.SVC="SVC",r.SYP="SYP",r.SZL="SZL",r.THB="THB",r.TJS="TJS",r.TMT="TMT",r.TND="TND",r.TOP="TOP",r.TRY="TRY",r.TTD="TTD",r.TWD="TWD",r.TZS="TZS",r.UAH="UAH",r.UGX="UGX",r.USD="USD",r.UYU="UYU",r.UZS="UZS",r.VES="VES",r.VND="VND",r.VUV="VUV",r.WST="WST",r.XAF="XAF",r.XCD="XCD",r.XOF="XOF",r.XPF="XPF",r.YER="YER",r.ZAR="ZAR",r.ZMW="ZMW",r.ZWL="ZWL"}(l||(l={})),function(r){r.DELETED="DELETED",r.NOT_DELETED="NOT_DELETED"}(Bt||(Bt={})),function(r){r.ALREADY_REFUNDED_ERROR="ALREADY_REFUNDED_ERROR",r.CANCEL_ACTIVE_ORDER_ERROR="CANCEL_ACTIVE_ORDER_ERROR",r.CANCEL_PAYMENT_ERROR="CANCEL_PAYMENT_ERROR",r.CHANNEL_DEFAULT_LANGUAGE_ERROR="CHANNEL_DEFAULT_LANGUAGE_ERROR",r.COUPON_CODE_EXPIRED_ERROR="COUPON_CODE_EXPIRED_ERROR",r.COUPON_CODE_INVALID_ERROR="COUPON_CODE_INVALID_ERROR",r.COUPON_CODE_LIMIT_ERROR="COUPON_CODE_LIMIT_ERROR",r.CREATE_FULFILLMENT_ERROR="CREATE_FULFILLMENT_ERROR",r.DUPLICATE_ENTITY_ERROR="DUPLICATE_ENTITY_ERROR",r.EMAIL_ADDRESS_CONFLICT_ERROR="EMAIL_ADDRESS_CONFLICT_ERROR",r.EMPTY_ORDER_LINE_SELECTION_ERROR="EMPTY_ORDER_LINE_SELECTION_ERROR",r.FACET_IN_USE_ERROR="FACET_IN_USE_ERROR",r.FULFILLMENT_STATE_TRANSITION_ERROR="FULFILLMENT_STATE_TRANSITION_ERROR",r.GUEST_CHECKOUT_ERROR="GUEST_CHECKOUT_ERROR",r.INELIGIBLE_SHIPPING_METHOD_ERROR="INELIGIBLE_SHIPPING_METHOD_ERROR",r.INSUFFICIENT_STOCK_ERROR="INSUFFICIENT_STOCK_ERROR",r.INSUFFICIENT_STOCK_ON_HAND_ERROR="INSUFFICIENT_STOCK_ON_HAND_ERROR",r.INVALID_CREDENTIALS_ERROR="INVALID_CREDENTIALS_ERROR",r.INVALID_FULFILLMENT_HANDLER_ERROR="INVALID_FULFILLMENT_HANDLER_ERROR",r.ITEMS_ALREADY_FULFILLED_ERROR="ITEMS_ALREADY_FULFILLED_ERROR",r.LANGUAGE_NOT_AVAILABLE_ERROR="LANGUAGE_NOT_AVAILABLE_ERROR",r.MANUAL_PAYMENT_STATE_ERROR="MANUAL_PAYMENT_STATE_ERROR",r.MIME_TYPE_ERROR="MIME_TYPE_ERROR",r.MISSING_CONDITIONS_ERROR="MISSING_CONDITIONS_ERROR",r.MULTIPLE_ORDER_ERROR="MULTIPLE_ORDER_ERROR",r.NATIVE_AUTH_STRATEGY_ERROR="NATIVE_AUTH_STRATEGY_ERROR",r.NEGATIVE_QUANTITY_ERROR="NEGATIVE_QUANTITY_ERROR",r.NOTHING_TO_REFUND_ERROR="NOTHING_TO_REFUND_ERROR",r.NO_ACTIVE_ORDER_ERROR="NO_ACTIVE_ORDER_ERROR",r.NO_CHANGES_SPECIFIED_ERROR="NO_CHANGES_SPECIFIED_ERROR",r.ORDER_LIMIT_ERROR="ORDER_LIMIT_ERROR",r.ORDER_MIDDLEWARE_ERROR="ORDER_MIDDLEWARE_ERROR",r.ORDER_MODIFICATION_ERROR="ORDER_MODIFICATION_ERROR",r.ORDER_MODIFICATION_STATE_ERROR="ORDER_MODIFICATION_STATE_ERROR",r.ORDER_STATE_TRANSITION_ERROR="ORDER_STATE_TRANSITION_ERROR",r.PAYMENT_METHOD_MISSING_ERROR="PAYMENT_METHOD_MISSING_ERROR",r.PAYMENT_ORDER_MISMATCH_ERROR="PAYMENT_ORDER_MISMATCH_ERROR",r.PAYMENT_STATE_TRANSITION_ERROR="PAYMENT_STATE_TRANSITION_ERROR",r.PRODUCT_OPTION_IN_USE_ERROR="PRODUCT_OPTION_IN_USE_ERROR",r.QUANTITY_TOO_GREAT_ERROR="QUANTITY_TOO_GREAT_ERROR",r.REFUND_AMOUNT_ERROR="REFUND_AMOUNT_ERROR",r.REFUND_ORDER_STATE_ERROR="REFUND_ORDER_STATE_ERROR",r.REFUND_PAYMENT_ID_MISSING_ERROR="REFUND_PAYMENT_ID_MISSING_ERROR",r.REFUND_STATE_TRANSITION_ERROR="REFUND_STATE_TRANSITION_ERROR",r.SETTLE_PAYMENT_ERROR="SETTLE_PAYMENT_ERROR",r.UNKNOWN_ERROR="UNKNOWN_ERROR"}(t||(t={})),function(r){r.FALSE="FALSE",r.INHERIT="INHERIT",r.TRUE="TRUE"}(f||(f={})),function(r){r.CUSTOMER_ADDED_TO_GROUP="CUSTOMER_ADDED_TO_GROUP",r.CUSTOMER_ADDRESS_CREATED="CUSTOMER_ADDRESS_CREATED",r.CUSTOMER_ADDRESS_DELETED="CUSTOMER_ADDRESS_DELETED",r.CUSTOMER_ADDRESS_UPDATED="CUSTOMER_ADDRESS_UPDATED",r.CUSTOMER_DETAIL_UPDATED="CUSTOMER_DETAIL_UPDATED",r.CUSTOMER_EMAIL_UPDATE_REQUESTED="CUSTOMER_EMAIL_UPDATE_REQUESTED",r.CUSTOMER_EMAIL_UPDATE_VERIFIED="CUSTOMER_EMAIL_UPDATE_VERIFIED",r.CUSTOMER_NOTE="CUSTOMER_NOTE",r.CUSTOMER_PASSWORD_RESET_REQUESTED="CUSTOMER_PASSWORD_RESET_REQUESTED",r.CUSTOMER_PASSWORD_RESET_VERIFIED="CUSTOMER_PASSWORD_RESET_VERIFIED",r.CUSTOMER_PASSWORD_UPDATED="CUSTOMER_PASSWORD_UPDATED",r.CUSTOMER_REGISTERED="CUSTOMER_REGISTERED",r.CUSTOMER_REMOVED_FROM_GROUP="CUSTOMER_REMOVED_FROM_GROUP",r.CUSTOMER_VERIFIED="CUSTOMER_VERIFIED",r.ORDER_CANCELLATION="ORDER_CANCELLATION",r.ORDER_COUPON_APPLIED="ORDER_COUPON_APPLIED",r.ORDER_COUPON_REMOVED="ORDER_COUPON_REMOVED",r.ORDER_CUSTOMER_UPDATED="ORDER_CUSTOMER_UPDATED",r.ORDER_FULFILLMENT="ORDER_FULFILLMENT",r.ORDER_FULFILLMENT_TRANSITION="ORDER_FULFILLMENT_TRANSITION",r.ORDER_MODIFIED="ORDER_MODIFIED",r.ORDER_NOTE="ORDER_NOTE",r.ORDER_PAYMENT_TRANSITION="ORDER_PAYMENT_TRANSITION",r.ORDER_REFUND_TRANSITION="ORDER_REFUND_TRANSITION",r.ORDER_STATE_TRANSITION="ORDER_STATE_TRANSITION"}(d||(d={})),function(r){r.CANCELLED="CANCELLED",r.COMPLETED="COMPLETED",r.FAILED="FAILED",r.PENDING="PENDING",r.RETRYING="RETRYING",r.RUNNING="RUNNING"}(D||(D={})),function(r){r.af="af",r.ak="ak",r.am="am",r.ar="ar",r.as="as",r.az="az",r.be="be",r.bg="bg",r.bm="bm",r.bn="bn",r.bo="bo",r.br="br",r.bs="bs",r.ca="ca",r.ce="ce",r.co="co",r.cs="cs",r.cu="cu",r.cy="cy",r.da="da",r.de="de",r.de_AT="de_AT",r.de_CH="de_CH",r.dz="dz",r.ee="ee",r.el="el",r.en="en",r.en_AU="en_AU",r.en_CA="en_CA",r.en_GB="en_GB",r.en_US="en_US",r.eo="eo",r.es="es",r.es_ES="es_ES",r.es_MX="es_MX",r.et="et",r.eu="eu",r.fa="fa",r.fa_AF="fa_AF",r.ff="ff",r.fi="fi",r.fo="fo",r.fr="fr",r.fr_CA="fr_CA",r.fr_CH="fr_CH",r.fy="fy",r.ga="ga",r.gd="gd",r.gl="gl",r.gu="gu",r.gv="gv",r.ha="ha",r.he="he",r.hi="hi",r.hr="hr",r.ht="ht",r.hu="hu",r.hy="hy",r.ia="ia",r.id="id",r.ig="ig",r.ii="ii",r.is="is",r.it="it",r.ja="ja",r.jv="jv",r.ka="ka",r.ki="ki",r.kk="kk",r.kl="kl",r.km="km",r.kn="kn",r.ko="ko",r.ks="ks",r.ku="ku",r.kw="kw",r.ky="ky",r.la="la",r.lb="lb",r.lg="lg",r.ln="ln",r.lo="lo",r.lt="lt",r.lu="lu",r.lv="lv",r.mg="mg",r.mi="mi",r.mk="mk",r.ml="ml",r.mn="mn",r.mr="mr",r.ms="ms",r.mt="mt",r.my="my",r.nb="nb",r.nd="nd",r.ne="ne",r.nl="nl",r.nl_BE="nl_BE",r.nn="nn",r.ny="ny",r.om="om",r.or="or",r.os="os",r.pa="pa",r.pl="pl",r.ps="ps",r.pt="pt",r.pt_BR="pt_BR",r.pt_PT="pt_PT",r.qu="qu",r.rm="rm",r.rn="rn",r.ro="ro",r.ro_MD="ro_MD",r.ru="ru",r.rw="rw",r.sa="sa",r.sd="sd",r.se="se",r.sg="sg",r.si="si",r.sk="sk",r.sl="sl",r.sm="sm",r.sn="sn",r.so="so",r.sq="sq",r.sr="sr",r.st="st",r.su="su",r.sv="sv",r.sw="sw",r.sw_CD="sw_CD",r.ta="ta",r.te="te",r.tg="tg",r.th="th",r.ti="ti",r.tk="tk",r.to="to",r.tr="tr",r.tt="tt",r.ug="ug",r.uk="uk",r.ur="ur",r.uz="uz",r.vi="vi",r.vo="vo",r.wo="wo",r.xh="xh",r.yi="yi",r.yo="yo",r.zh="zh",r.zh_Hans="zh_Hans",r.zh_Hant="zh_Hant",r.zu="zu"}(w||(w={})),function(r){r.AND="AND",r.OR="OR"}(N||(N={})),function(r){r.Daily="Daily"}(U||(U={})),function(r){r.AverageOrderValue="AverageOrderValue",r.OrderCount="OrderCount",r.OrderTotal="OrderTotal"}(V||(V={})),function(r){r.Aggregate="Aggregate",r.Regular="Regular",r.Seller="Seller"}(S||(S={})),function(r){r.Authenticated="Authenticated",r.CreateAdministrator="CreateAdministrator",r.CreateAsset="CreateAsset",r.CreateCatalog="CreateCatalog",r.CreateChannel="CreateChannel",r.CreateCollection="CreateCollection",r.CreateCountry="CreateCountry",r.CreateCustomer="CreateCustomer",r.CreateCustomerGroup="CreateCustomerGroup",r.CreateFacet="CreateFacet",r.CreateOrder="CreateOrder",r.CreatePaymentMethod="CreatePaymentMethod",r.CreateProduct="CreateProduct",r.CreatePromotion="CreatePromotion",r.CreateSeller="CreateSeller",r.CreateSettings="CreateSettings",r.CreateShippingMethod="CreateShippingMethod",r.CreateStockLocation="CreateStockLocation",r.CreateSystem="CreateSystem",r.CreateTag="CreateTag",r.CreateTaxCategory="CreateTaxCategory",r.CreateTaxRate="CreateTaxRate",r.CreateZone="CreateZone",r.DeleteAdministrator="DeleteAdministrator",r.DeleteAsset="DeleteAsset",r.DeleteCatalog="DeleteCatalog",r.DeleteChannel="DeleteChannel",r.DeleteCollection="DeleteCollection",r.DeleteCountry="DeleteCountry",r.DeleteCustomer="DeleteCustomer",r.DeleteCustomerGroup="DeleteCustomerGroup",r.DeleteFacet="DeleteFacet",r.DeleteOrder="DeleteOrder",r.DeletePaymentMethod="DeletePaymentMethod",r.DeleteProduct="DeleteProduct",r.DeletePromotion="DeletePromotion",r.DeleteSeller="DeleteSeller",r.DeleteSettings="DeleteSettings",r.DeleteShippingMethod="DeleteShippingMethod",r.DeleteStockLocation="DeleteStockLocation",r.DeleteSystem="DeleteSystem",r.DeleteTag="DeleteTag",r.DeleteTaxCategory="DeleteTaxCategory",r.DeleteTaxRate="DeleteTaxRate",r.DeleteZone="DeleteZone",r.Owner="Owner",r.Public="Public",r.ReadAdministrator="ReadAdministrator",r.ReadAsset="ReadAsset",r.ReadCatalog="ReadCatalog",r.ReadChannel="ReadChannel",r.ReadCollection="ReadCollection",r.ReadCountry="ReadCountry",r.ReadCustomer="ReadCustomer",r.ReadCustomerGroup="ReadCustomerGroup",r.ReadFacet="ReadFacet",r.ReadOrder="ReadOrder",r.ReadPaymentMethod="ReadPaymentMethod",r.ReadProduct="ReadProduct",r.ReadPromotion="ReadPromotion",r.ReadSeller="ReadSeller",r.ReadSettings="ReadSettings",r.ReadShippingMethod="ReadShippingMethod",r.ReadStockLocation="ReadStockLocation",r.ReadSystem="ReadSystem",r.ReadTag="ReadTag",r.ReadTaxCategory="ReadTaxCategory",r.ReadTaxRate="ReadTaxRate",r.ReadZone="ReadZone",r.SuperAdmin="SuperAdmin",r.UpdateAdministrator="UpdateAdministrator",r.UpdateAsset="UpdateAsset",r.UpdateCatalog="UpdateCatalog",r.UpdateChannel="UpdateChannel",r.UpdateCollection="UpdateCollection",r.UpdateCountry="UpdateCountry",r.UpdateCustomer="UpdateCustomer",r.UpdateCustomerGroup="UpdateCustomerGroup",r.UpdateFacet="UpdateFacet",r.UpdateGlobalSettings="UpdateGlobalSettings",r.UpdateOrder="UpdateOrder",r.UpdatePaymentMethod="UpdatePaymentMethod",r.UpdateProduct="UpdateProduct",r.UpdatePromotion="UpdatePromotion",r.UpdateSeller="UpdateSeller",r.UpdateSettings="UpdateSettings",r.UpdateShippingMethod="UpdateShippingMethod",r.UpdateStockLocation="UpdateStockLocation",r.UpdateSystem="UpdateSystem",r.UpdateTag="UpdateTag",r.UpdateTaxCategory="UpdateTaxCategory",r.UpdateTaxRate="UpdateTaxRate",r.UpdateZone="UpdateZone"}(st||(st={})),function(r){r.ASC="ASC",r.DESC="DESC"}(O||(Lt.xB=O={})),function(r){r.ADJUSTMENT="ADJUSTMENT",r.ALLOCATION="ALLOCATION",r.CANCELLATION="CANCELLATION",r.RELEASE="RELEASE",r.RETURN="RETURN",r.SALE="SALE"}(qt||(qt={}))}}]);
|
|
321
|
+
//# sourceMappingURL=153.7eec6efd3edd54b4.js.map
|