@vendure/admin-ui-plugin 2.0.0-next.20 → 2.0.0-next.21
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/lib/admin-ui/{26.d4121b2f19189eb7.js → 26.5cc3bfffe8943e16.js} +2 -2
- package/lib/admin-ui/26.5cc3bfffe8943e16.js.map +1 -0
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/main.65109179713dd228.js +2944 -0
- package/lib/admin-ui/main.65109179713dd228.js.map +1 -0
- package/lib/admin-ui/{runtime.03c9d901339d6844.js → runtime.28bd5da02a9b1f7b.js} +2 -2
- package/lib/admin-ui/{runtime.03c9d901339d6844.js.map → runtime.28bd5da02a9b1f7b.js.map} +1 -1
- package/package.json +4 -4
- package/lib/admin-ui/26.d4121b2f19189eb7.js.map +0 -1
- package/lib/admin-ui/main.b70cff0822881967.js +0 -2944
- package/lib/admin-ui/main.b70cff0822881967.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[26],{9026:(Li,Me,m)=>{m.r(Me),m.d(Me,{AddCountryToZoneDialogComponent:()=>re,AdminDetailComponent:()=>ae,AdministratorListComponent:()=>le,AdministratorResolver:()=>V,ChannelDetailComponent:()=>ce,ChannelListComponent:()=>de,ChannelResolver:()=>B,CountryDetailComponent:()=>me,CountryListComponent:()=>ue,CountryResolver:()=>K,GlobalSettingsComponent:()=>pe,GlobalSettingsResolver:()=>W,PaymentMethodDetailComponent:()=>ge,PaymentMethodListComponent:()=>_e,PaymentMethodResolver:()=>X,PermissionGridComponent:()=>z,ProfileComponent:()=>he,ProfileResolver:()=>ee,RoleDetailComponent:()=>fe,RoleListComponent:()=>be,RoleResolver:()=>te,SettingsModule:()=>Je,ShippingEligibilityTestResultComponent:()=>ve,ShippingMethodDetailComponent:()=>Ce,ShippingMethodListComponent:()=>ye,ShippingMethodResolver:()=>ne,ShippingMethodTestResultComponent:()=>Ze,TaxCategoryDetailComponent:()=>xe,TaxCategoryListComponent:()=>Te,TaxCategoryResolver:()=>oe,TaxRateDetailComponent:()=>Ae,TaxRateListComponent:()=>Le,TaxRateResolver:()=>ie,TestAddressFormComponent:()=>H,TestOrderBuilderComponent:()=>E,ZoneDetailDialogComponent:()=>G,ZoneListComponent:()=>Fe,ZoneMemberControlsDirective:()=>Y,ZoneMemberListComponent:()=>j,ZoneMemberListHeaderDirective:()=>$,administratorBreadcrumb:()=>We,channelBreadcrumb:()=>Xe,countryBreadcrumb:()=>ot,paymentMethodBreadcrumb:()=>rt,roleBreadcrumb:()=>et,settingsRoutes:()=>Ke,shippingMethodBreadcrumb:()=>it,taxCategoryBreadcrumb:()=>tt,taxRateBreadcrumb:()=>nt});var L=m(635),e=m(3184),s=m(8098),Oe=m(309);class Y{constructor(n){this.templateRef=n}}Y.\u0275fac=function(n){return new(n||Y)(e.Y36(e.Rgc))},Y.\u0275dir=e.lG2({type:Y,selectors:[["","vdrZoneMemberControls",""]]});class ${constructor(n){this.templateRef=n}}$.\u0275fac=function(n){return new(n||$)(e.Y36(e.Rgc))},$.\u0275dir=e.lG2({type:$,selectors:[["","vdrZoneMemberListHeader",""]]});var p=m(6362),A=m(7890),a=m(587),N=m(365),M=m(901),u=m(2748),b=m(7514),Z=m(7388);function st(o,n){1&o&&e.GkF(0)}function at(o,n){if(1&o&&(e.ynx(0),e.YNc(1,st,1,0,"ng-container",4),e.BQk()),2&o){const t=e.oxw();e.xp6(1),e.Q6J("ngTemplateOutlet",t.headerTemplate.templateRef)}}function lt(o,n){1&o&&e.GkF(0)}const ct=function(o){return{member:o}};function dt(o,n){if(1&o&&(e.ynx(0),e.YNc(1,lt,1,0,"ng-container",7),e.BQk()),2&o){const t=e.oxw().item,i=e.oxw();e.xp6(1),e.Q6J("ngTemplateOutlet",i.controlsTemplate.templateRef)("ngTemplateOutletContext",e.VKq(2,ct,t))}}function mt(o,n){if(1&o&&(e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._UZ(5,"clr-icon"),e.qZA(),e.TgZ(6,"td",6),e.YNc(7,dt,2,4,"ng-container",1),e.qZA()),2&o){const t=n.item,i=e.oxw();e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.ekj("is-success",t.enabled),e.uIk("shape",t.enabled?"check":"times"),e.xp6(2),e.Q6J("ngIf",i.controlsTemplate)}}const ut=function(){return["UpdateSettings","UpdateZone"]};class j{constructor(){this.members=[],this.selectedMemberIds=[],this.selectionChange=new e.vpe,this.filterTerm="",this.isMemberSelected=n=>-1<this.selectedMemberIds.indexOf(n.id)}filteredMembers(){if(""!==this.filterTerm){const n=this.filterTerm.toLocaleLowerCase();return this.members.filter(t=>t.name.toLocaleLowerCase().includes(n)||t.code.toLocaleLowerCase().includes(n))}return this.members}areAllSelected(){return!!this.members&&this.selectedMemberIds.length===this.members.length}toggleSelectAll(){this.areAllSelected()?this.selectionChange.emit([]):this.selectionChange.emit(this.members.map(n=>n.id))}toggleSelectMember({item:n}){this.selectedMemberIds.includes(n.id)?this.selectionChange.emit(this.selectedMemberIds.filter(t=>t!==n.id)):this.selectionChange.emit([...this.selectedMemberIds,n.id])}}j.\u0275fac=function(n){return new(n||j)},j.\u0275cmp=e.Xpm({type:j,selectors:[["vdr-zone-member-list"]],contentQueries:function(n,t,i){if(1&n&&(e.Suo(i,$,5),e.Suo(i,Y,5)),2&n){let r;e.iGM(r=e.CRH())&&(t.headerTemplate=r.first),e.iGM(r=e.CRH())&&(t.controlsTemplate=r.first)}},inputs:{members:"members",selectedMemberIds:"selectedMemberIds"},outputs:{selectionChange:"selectionChange"},decls:17,vars:20,consts:[[1,"members-header"],[4,"ngIf"],["type","text",3,"placeholder","ngModel","ngModelChange"],[3,"items","allSelected","isRowSelectedFn","rowSelectChange","allSelectChange"],[4,"ngTemplateOutlet"],[1,"left","align-middle"],[1,"right","align-middle"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.YNc(1,at,2,1,"ng-container",1),e.TgZ(2,"input",2),e.NdJ("ngModelChange",function(r){return t.filterTerm=r}),e.ALo(3,"translate"),e.qZA()(),e.TgZ(4,"vdr-data-table",3),e.NdJ("rowSelectChange",function(r){return t.toggleSelectMember(r)})("allSelectChange",function(){return t.toggleSelectAll()}),e.ALo(5,"hasPermission"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"vdr-dt-column"),e.YNc(16,mt,8,6,"ng-template"),e.qZA()),2&n&&(e.xp6(1),e.Q6J("ngIf",t.headerTemplate),e.xp6(1),e.Q6J("placeholder",e.lcZ(3,9,"settings.filter-by-member-name"))("ngModel",t.filterTerm),e.xp6(2),e.Q6J("items",t.filteredMembers())("allSelected",t.areAllSelected())("isRowSelectedFn",e.lcZ(5,11,e.DdM(19,ut))&&t.isMemberSelected),e.xp6(3),e.Oqu(e.lcZ(8,13,"common.code")),e.xp6(3),e.Oqu(e.lcZ(11,15,"common.name")),e.xp6(3),e.Oqu(e.lcZ(14,17,"common.enabled")))},directives:[p.O5,p.tP,A.y,a.Fj,a.JJ,a.On,N.Q,M.E,u.qvL],pipes:[b.X$,Z.j],styles:[".members-header[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100);position:sticky;top:0;padding:6px;z-index:5;border-bottom:1px solid var(--color-component-border-200)}.members-header[_ngcontent-%COMP%] .header-title-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.members-header[_ngcontent-%COMP%] .clr-input[_ngcontent-%COMP%]{width:100%}"],changeDetection:0});var we=m(8318);const Qe=function(o){return{zoneName:o}};function pt(o,n){if(1&o&&(e._uU(0),e.ALo(1,"translate")),2&o){const t=e.oxw();e.Oqu(e.xi3(1,1,"settings.add-countries-to-zone",e.VKq(4,Qe,t.zoneName)))}}function gt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",3),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedMemberIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"settings.add-countries-to-zone",e.VKq(8,Qe,t.zoneName))," ")}}class re{constructor(n){this.dataService=n,this.currentMembers=[],this.selectedMemberIds=[]}ngOnInit(){const n=this.currentMembers.map(t=>t.id);this.availableCountries$=this.dataService.settings.getCountries(999).mapStream(t=>t.countries.items).pipe((0,L.U)(t=>t.filter(i=>!n.includes(i.id))))}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedMemberIds)}}re.\u0275fac=function(n){return new(n||re)(e.Y36(s.DoR))},re.\u0275cmp=e.Xpm({type:re,selectors:[["vdr-add-country-to-zone-dialog"]],decls:4,vars:4,consts:[["vdrDialogTitle",""],[3,"members","selectedMemberIds","selectionChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,pt,2,6,"ng-template",0),e.TgZ(1,"vdr-zone-member-list",1),e.NdJ("selectionChange",function(r){return t.selectedMemberIds=r}),e.ALo(2,"async"),e.qZA(),e.YNc(3,gt,6,10,"ng-template",2)),2&n&&(e.xp6(1),e.Q6J("members",e.lcZ(2,2,t.availableCountries$))("selectedMemberIds",t.selectedMemberIds))},directives:[Oe.q,j,we.n],pipes:[b.X$,p.Ov],styles:[""],changeDetection:0});var c=m(8270),se=m(5454),F=m(9295),T=m(9525),g=m(9720),_=m(7346),U=m(3146),C=m(8276),x=m(9416),q=m(4652),I=m(837),O=m(2505),ke=m(8660),_t=m(1213);function ht(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().$implicit;return e.oxw().toggleAll(r.permissions)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&o&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"common.toggle-all")," "))}function ft(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td")(1,"vdr-select-toggle",5),e.NdJ("selectedChange",function(r){const d=e.CHM(t).$implicit;return e.oxw(2).setPermission(d.name,r)}),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw().$implicit,r=e.oxw();e.uIk("colspan",1===i.permissions.length?4:1),e.xp6(1),e.Q6J("title",t.description)("label",t.name)("disabled",r.readonly)("selected",null==r.activePermissions?null:r.activePermissions.includes(t.name))}}function bt(o,n){if(1&o&&(e.TgZ(0,"tr")(1,"td",2)(2,"div")(3,"strong"),e._uU(4),e.ALo(5,"translate"),e.qZA()(),e.TgZ(6,"small"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"br"),e.YNc(10,ht,3,3,"button",3),e.qZA(),e.YNc(11,ft,2,5,"td",1),e.qZA()),2&o){const t=n.$implicit,i=e.oxw();e.xp6(4),e.Oqu(e.lcZ(5,4,t.label)),e.xp6(3),e.Oqu(e.lcZ(8,6,t.description)),e.xp6(3),e.Q6J("ngIf",1<t.permissions.length&&!i.readonly),e.xp6(1),e.Q6J("ngForOf",t.permissions)}}class z{constructor(){this.readonly=!1,this.permissionChange=new e.vpe}ngOnInit(){this.buildGrid()}setPermission(n,t){this.readonly||this.permissionChange.emit({permission:n,value:t})}toggleAll(n){const t=n.some(i=>!this.activePermissions.includes(i.name));for(const i of n)this.permissionChange.emit({permission:i.name,value:t})}buildGrid(){var n;const t=new Map,i=[],r=/^(Create|Read|Update|Delete)([a-zA-Z]+)$/;for(const l of this.permissionDefinitions)if(r.test(l.name)){const h=null===(n=l.name.match(r))||void 0===n?void 0:n[2];if(h){const f=t.get(h);f?f.push(l):t.set(h,[l])}}else l.assignable&&i.push(l);this.gridData=[...i.map(l=>({label:l.name,description:l.description,permissions:[l]})),...Array.from(t.entries()).map(([l,d])=>({label:l,description:this.extractCrudDescription(d[0]),permissions:d}))]}extractCrudDescription(n){return n.description.replace(/Grants permission to [\w]+/,"Grants permissions on")}}z.\u0275fac=function(n){return new(n||z)},z.\u0275cmp=e.Xpm({type:z,selectors:[["vdr-permission-grid"]],inputs:{permissionDefinitions:"permissionDefinitions",activePermissions:"activePermissions",readonly:"readonly"},outputs:{permissionChange:"permissionChange"},decls:3,vars:1,consts:[[1,"table"],[4,"ngFor","ngForOf"],[1,"permission-group","left"],["class","btn btn-sm btn-link",3,"click",4,"ngIf"],[1,"btn","btn-sm","btn-link",3,"click"],["size","small",3,"title","label","disabled","selected","selectedChange"]],template:function(n,t){1&n&&(e.TgZ(0,"table",0)(1,"tbody"),e.YNc(2,bt,12,8,"tr",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.gridData))},directives:[p.sg,p.O5,_t.a],pipes:[b.X$],styles:["td.permission-group[_ngcontent-%COMP%]{max-width:300px;background-color:var(--color-component-bg-200)}"],changeDetection:0});var Ue=m(8766);function vt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Zt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Ct(o,n){1&o&&e.YNc(0,Zt,3,4,"button",21),2&o&&e.Q6J("vdrIfPermissions","UpdateAdministrator")}function yt(o,n){1&o&&(e.TgZ(0,"vdr-form-field",22),e.ALo(1,"translate"),e._UZ(2,"input",23),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,1,"settings.password"))}function xt(o,n){1&o&&(e.TgZ(0,"vdr-form-field",24),e.ALo(1,"translate"),e._UZ(2,"input",23),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,2,"settings.password"))("readOnlyToggle",!0)}function Tt(o,n){if(1&o&&(e.TgZ(0,"section",25)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",26),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,"UpdateAdministrator"))}}function At(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"li",27)(1,"button",28),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().selectedChannelId=l.channelId}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw();e.xp6(1),e.ekj("active",i.selectedChannelId===t.channelId),e.Q6J("id",t.channelId),e.uIk("aria-selected",i.selectedChannelId===t.channelId),e.xp6(1),e.hij(" ",e.lcZ(3,5,e.lcZ(4,7,t.channelCode))," ")}}class ae extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.selectedRoles=[],this.selectedRolePermissions={},this.selectedChannelId=null,this.customFields=this.getCustomFieldConfig("Administrator"),this.detailForm=this.formBuilder.group({emailAddress:["",a.kI.required],firstName:["",a.kI.required],lastName:["",a.kI.required],password:[""],roles:[[]],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}getAvailableChannels(){return Object.values(this.selectedRolePermissions)}ngOnInit(){this.init(),this.administrator$=this.entity$,this.allRoles$=this.dataService.administrator.getRoles(999).mapStream(n=>n.roles.items.filter(t=>t.code!==se.RO)),this.dataService.client.userStatus().single$.subscribe(({userStatus:n})=>{if(!n.permissions.includes(s.y3$.UpdateAdministrator)){const t=this.detailForm.get("roles");t&&t.disable()}}),this.permissionDefinitions=this.serverConfigService.getPermissionDefinitions()}ngOnDestroy(){this.destroy()}rolesChanged(n){this.buildPermissionsMap()}getPermissionsForSelectedChannel(){function n(i){return Object.entries(i).filter(([r,l])=>l).map(([r,l])=>r)}if(this.selectedChannelId&&this.selectedRolePermissions[this.selectedChannelId]){return n(this.selectedRolePermissions[this.selectedChannelId].permissions)}const t=Object.values(this.selectedRolePermissions);return 0<t.length?(this.selectedChannelId=t[0].channelId,n(t[0].permissions)):[]}create(){const n=this.detailForm.value,t={emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName,password:n.password,customFields:n.customFields,roleIds:n.roles.map(i=>i.id)};this.dataService.administrator.createAdministrator(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createAdministrator.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Administrator"})})}save(){this.administrator$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i={id:n,emailAddress:t.emailAddress,firstName:t.firstName,lastName:t.lastName,password:t.password,customFields:t.customFields,roleIds:t.roles.map(r=>r.id)};return this.dataService.administrator.updateAdministrator(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Administrator"})})}setFormValues(n,t){this.detailForm.patchValue({emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName,roles:n.user.roles}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n);const i=this.detailForm.get("password");i&&(n.id?i.setValidators([]):i.setValidators([a.kI.required])),this.buildPermissionsMap()}buildPermissionsMap(){const n=this.detailForm.get("roles");if(n){const t=n.value,i=new Map,r=new Map;for(const l of t)for(const d of l.channels){const f=i.get(d.id)||new Set;l.permissions.forEach(y=>f.add(y)),i.set(d.id,f),r.set(d.id,d.code)}this.selectedRolePermissions={};for(const l of Array.from(i.keys())){const d=i.get(l),h={};for(const f of this.serverConfigService.getPermissionDefinitions())h[f.name]=d.has(f.name);this.selectedRolePermissions[l]={channelId:l,channelCode:r.get(l),permissions:h}}}}}ae.\u0275fac=function(n){return new(n||ae)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ae.\u0275cmp=e.Xpm({type:ae,selectors:[["vdr-admin-detail"]],features:[e.qOj],decls:38,vars:49,consts:[[3,"entity"],["locationId","administrator-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress",3,"readonly"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName",3,"readonly"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName",3,"readonly"],["for","password",3,"label",4,"ngIf"],["for","password",3,"label","readOnlyToggle",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","administrator-detail",3,"entity$","detailForm"],[1,"clr-control-label"],["formControlName","roles","bindLabel","description",3,"items","multiple","hideSelected","change"],["role","tablist",1,"nav"],["role","presentation","class","nav-item",4,"ngFor","ngForOf"],[3,"activePermissions","permissionDefinitions","readonly"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["for","password",3,"label"],["id","password","type","password","formControlName","password"],["for","password",3,"label","readOnlyToggle"],["formGroupName","customFields"],["entityName","Administrator",3,"customFields","customFieldsFormGroup","readonly"],["role","presentation",1,"nav-item"],["type","button",1,"btn","btn-link","nav-link",3,"id","click"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,vt,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Ct,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e._UZ(17,"input",8),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",9),e.ALo(20,"translate"),e._UZ(21,"input",10),e.ALo(22,"hasPermission"),e.qZA(),e.YNc(23,yt,3,3,"vdr-form-field",11),e.ALo(24,"async"),e.YNc(25,xt,3,4,"vdr-form-field",12),e.ALo(26,"async"),e.ALo(27,"hasPermission"),e.YNc(28,Tt,6,8,"section",13),e._UZ(29,"vdr-custom-detail-component-host",14),e.TgZ(30,"label",15),e._uU(31),e.ALo(32,"translate"),e.qZA(),e.TgZ(33,"ng-select",16),e.NdJ("change",function(r){return t.rolesChanged(r)}),e.ALo(34,"async"),e.qZA(),e.TgZ(35,"ul",17),e.YNc(36,At,5,9,"li",18),e.qZA(),e._UZ(37,"vdr-permission-grid",19),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,23,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,25,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,27,"settings.email-address")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,29,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(16,31,"settings.first-name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,33,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(20,35,"settings.last-name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(22,37,"UpdateAdministrator")),e.xp6(2),e.Q6J("ngIf",e.lcZ(24,39,t.isNew$)),e.xp6(2),e.Q6J("ngIf",!e.lcZ(26,41,t.isNew$)&&e.lcZ(27,43,"UpdateAdministrator")),e.xp6(3),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(2),e.Oqu(e.lcZ(32,45,"settings.roles")),e.xp6(2),e.Q6J("items",e.lcZ(34,47,t.allRoles$))("multiple",!0)("hideSelected",!0),e.xp6(3),e.Q6J("ngForOf",t.getAvailableChannels()),e.xp6(1),e.Q6J("activePermissions",t.getPermissionsForSelectedChannel())("permissionDefinitions",t.permissionDefinitions)("readonly",!0)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,a.x0,u.MgK,I.y,O.C,ke.w9,p.sg,z],pipes:[p.Ov,b.X$,Z.j,Ue.E],styles:[""],changeDetection:0});var J=m(591),v=m(2673),Q=m(8899),D=m(735),S=m(1519),k=m(8854),P=m(5111);const Lt=function(){return["./create"]};function Ft(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Lt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"admin.create-new-administrator")," "))}const Jt=function(o){return["./",o]};function qt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._uU(5),e.qZA(),e.TgZ(6,"td",6),e._UZ(7,"vdr-table-row-action",7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"td")(10,"vdr-dropdown")(11,"button",8),e._uU(12),e.ALo(13,"translate"),e._UZ(14,"clr-icon",9),e.qZA(),e.TgZ(15,"vdr-dropdown-menu",10)(16,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteAdministrator(l)}),e.ALo(17,"hasPermission"),e._UZ(18,"clr-icon",12),e._uU(19),e.ALo(20,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.firstName),e.xp6(2),e.Oqu(t.lastName),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("label",e.lcZ(8,8,"common.edit"))("linkTo",e.VKq(16,Jt,t.id)),e.xp6(5),e.hij(" ",e.lcZ(13,10,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(17,12,"DeleteAdministrator")),e.xp6(3),e.hij(" ",e.lcZ(20,14,"common.delete")," ")}}class le extends s.t7C{constructor(n,t,i,r,l){super(t,i),this.dataService=n,this.modalService=r,this.notificationService=l,super.setQueryFn((...d)=>this.dataService.administrator.getAdministrators(...d),d=>d.administrators)}deleteAdministrator(n){return this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-administrator"),body:`${n.firstName} ${n.lastName}`,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.administrator.deleteAdministrator(n.id):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Administrator"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Administrator"})})}}le.\u0275fac=function(n){return new(n||le)(e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.Z7U),e.Y36(s.gqp))},le.\u0275cmp=e.Xpm({type:le,selectors:[["vdr-administrator-list"]],features:[e.qOj],decls:21,vars:22,consts:[["locationId","administrator-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,Ft,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e._UZ(18,"vdr-dt-column")(19,"vdr-dt-column"),e.YNc(20,qt,21,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions","CreateAdministrator"),e.xp6(1),e.Q6J("items",e.lcZ(5,8,t.items$))("itemsPerPage",e.lcZ(6,10,t.itemsPerPage$))("totalItems",e.lcZ(7,12,t.totalItems$))("currentPage",e.lcZ(8,14,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,16,"settings.first-name")),e.xp6(3),e.Oqu(e.lcZ(14,18,"settings.last-name")),e.xp6(3),e.Oqu(e.lcZ(17,20,"settings.email-address")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""]});var R=m(3516),Dt=m(7808),Re=m(4990);function St(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function kt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}const Pt=function(){return["SuperAdmin","UpdateChannel"]};function Ut(o,n){1&o&&e.YNc(0,kt,3,4,"button",25),2&o&&e.Q6J("vdrIfPermissions",e.DdM(1,Pt))}function It(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.ALo(2,"localeCurrencyName"),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(e.lcZ(2,2,t))}}function Nt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.ALo(2,"localeLanguageName"),e.ALo(3,"uppercase"),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.AsE(" ",e.lcZ(2,3,t)," (",e.lcZ(3,5,t),") ")}}function Mt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Ot(o,n){1&o&&(e.TgZ(0,"clr-alert",27)(1,"clr-alert-item")(2,"span",28),e._uU(3),e.ALo(4,"translate"),e.qZA()()()),2&o&&(e.Q6J("clrAlertClosable",!1),e.xp6(3),e.hij(" ",e.lcZ(4,2,"error.no-default-tax-zone-set")," "))}function wt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Qt(o,n){1&o&&(e.TgZ(0,"clr-alert",29)(1,"clr-alert-item")(2,"span",28),e._uU(3),e.ALo(4,"translate"),e.qZA()()()),2&o&&(e.Q6J("clrAlertClosable",!1),e.xp6(3),e.hij(" ",e.lcZ(4,2,"error.no-default-shipping-zone-set")," "))}function Rt(o,n){if(1&o&&(e.TgZ(0,"section",30)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",31),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class ce extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.serverConfigService=i,this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.currencyCodes=Object.values(s.NEm),this.updatePermission=[s.y3$.SuperAdmin,s.y3$.UpdateChannel,s.y3$.CreateChannel],this.customFields=this.getCustomFieldConfig("Channel"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],token:["",a.kI.required],pricesIncludeTax:[!1],currencyCode:[""],defaultShippingZoneId:["",a.kI.required],defaultLanguageCode:[],defaultTaxZoneId:["",a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.zones$=this.dataService.settings.getZones().mapSingle(n=>n.zones),this.availableLanguageCodes$=this.serverConfigService.getAvailableLanguages()}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={code:n.code,token:n.token,defaultLanguageCode:n.defaultLanguageCode,pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZoneId,defaultTaxZoneId:n.defaultTaxZoneId,customFields:n.customFields};this.dataService.settings.createChannel(t).pipe((0,T.z)(({createChannel:i})=>this.dataService.auth.currentUser().single$.pipe((0,L.U)(({me:r})=>({me:r,createChannel:i})))),(0,T.z)(({me:i,createChannel:r})=>this.dataService.client.updateUserChannels(i.channels).pipe((0,L.U)(()=>r)))).subscribe(i=>{switch(i.__typename){case"Channel":this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Channel"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.id],{relativeTo:this.route});break;case"LanguageNotAvailableError":this.notificationService.error(i.message)}})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.entity$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,code:n.code,token:n.token,pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZoneId,defaultLanguageCode:n.defaultLanguageCode,defaultTaxZoneId:n.defaultTaxZoneId,customFields:n.customFields};return this.dataService.settings.updateChannel(i)})).subscribe(({updateChannel:t})=>{switch(t.__typename){case"Channel":this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Channel"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck();break;case"LanguageNotAvailableError":this.notificationService.error(t.message)}})}setFormValues(n,t){if(this.detailForm.patchValue({code:n.code,token:n.token||this.generateToken(),pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZone?n.defaultShippingZone.id:"",defaultLanguageCode:n.defaultLanguageCode,defaultTaxZoneId:n.defaultTaxZone?n.defaultTaxZone.id:""}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n),n.code===se.z$){const i=this.detailForm.get("code");i&&i.disable()}}generateToken(){const n=()=>Math.random().toString(36).substr(3,10);return`${n()}${n()}`}}ce.\u0275fac=function(n){return new(n||ce)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ce.\u0275cmp=e.Xpm({type:ce,selectors:[["vdr-channel-detail"]],features:[e.qOj],decls:53,vars:65,consts:[[3,"entity"],["locationId","channel-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","code",3,"label"],["id","code","type","text","formControlName","code",3,"readonly"],["for","token",3,"label"],["id","token","type","text","formControlName","token",3,"readonly"],["for","defaultTaxZoneId",3,"label"],["clrSelect","","name","currencyCode","formControlName","currencyCode",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["for","defaultLanguage",3,"label"],["clrSelect","","name","defaultLanguageCode","formControlName","defaultLanguageCode",3,"vdrDisabled"],["for","pricesIncludeTax",3,"label"],["type","checkbox","clrToggle","","id","pricesIncludeTax","formControlName","pricesIncludeTax",3,"vdrDisabled"],["clrSelect","","name","defaultTaxZoneId","formControlName","defaultTaxZoneId",3,"vdrDisabled"],["selected","","value","",2,"display","none"],["clrAlertType","danger",3,"clrAlertClosable",4,"ngIf"],["for","defaultShippingZoneId",3,"label"],["clrSelect","","name","defaultShippingZoneId","formControlName","defaultShippingZoneId",3,"vdrDisabled"],["clrAlertType","warning",3,"clrAlertClosable",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","channel-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"value"],["clrAlertType","danger",3,"clrAlertClosable"],[1,"alert-text"],["clrAlertType","warning",3,"clrAlertClosable"],["formGroupName","customFields"],["entityName","Channel",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,St,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Ut,1,2,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e._UZ(17,"input",8),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",9),e.ALo(20,"translate"),e.TgZ(21,"select",10),e.ALo(22,"hasPermission"),e.YNc(23,It,3,4,"option",11),e.qZA()(),e.TgZ(24,"vdr-form-field",12),e.ALo(25,"translate"),e.TgZ(26,"select",13),e.ALo(27,"hasPermission"),e.YNc(28,Nt,4,7,"option",11),e.ALo(29,"async"),e.qZA()(),e.TgZ(30,"vdr-form-field",14),e.ALo(31,"translate"),e.TgZ(32,"clr-toggle-wrapper"),e._UZ(33,"input",15),e.ALo(34,"hasPermission"),e.qZA()(),e.TgZ(35,"vdr-form-field",9),e.ALo(36,"translate"),e.TgZ(37,"select",16),e.ALo(38,"hasPermission"),e._UZ(39,"option",17),e.YNc(40,Mt,2,2,"option",11),e.ALo(41,"async"),e.qZA()(),e.YNc(42,Ot,5,4,"clr-alert",18),e.TgZ(43,"vdr-form-field",19),e.ALo(44,"translate"),e.TgZ(45,"select",20),e.ALo(46,"hasPermission"),e._UZ(47,"option",17),e.YNc(48,wt,2,2,"option",11),e.ALo(49,"async"),e.qZA()(),e.YNc(50,Qt,5,4,"clr-alert",21),e.YNc(51,Rt,6,8,"section",22),e._UZ(52,"vdr-custom-detail-component-host",23),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,27,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,29,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,31,"common.code")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,33,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,35,"settings.channel-token")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,37,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(20,39,"settings.currency")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(22,41,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",t.currencyCodes),e.xp6(1),e.Q6J("label",e.lcZ(25,43,"common.default-language")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(27,45,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(29,47,t.availableLanguageCodes$)),e.xp6(2),e.Q6J("label",e.lcZ(31,49,"settings.prices-include-tax")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(34,51,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(36,53,"settings.default-tax-zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(38,55,t.updatePermission)),e.xp6(3),e.Q6J("ngForOf",e.lcZ(41,57,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.detailForm.value.code&&!t.detailForm.value.defaultTaxZoneId),e.xp6(1),e.Q6J("label",e.lcZ(44,59,"settings.default-shipping-zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(46,61,t.updatePermission)),e.xp6(3),e.Q6J("ngForOf",e.lcZ(49,63,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.detailForm.value.code&&!t.detailForm.value.defaultShippingZoneId),e.xp6(1),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,a.EJ,u.otW,R.x,p.sg,a.YN,a.Kr,u.PEh,a.Wl,u.KKC,u.TIm,u.CyW,u.I9z,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j,Dt.u,Re.B,p.gd],styles:["clr-alert[_ngcontent-%COMP%]{max-width:30rem;margin-bottom:12px}"],changeDetection:0});var qe=m(253),Ye=m(4874),$e=m(1185);const Yt=function(){return["./create"]};function $t(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Yt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-channel")," "))}const jt=function(o){return["./",o]},zt=function(){return["SuperAdmin","DeleteChannel"]};function Et(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._UZ(1,"vdr-channel-badge",6),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA(),e.TgZ(5,"td",7),e._UZ(6,"vdr-table-row-action",8),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"td",7)(9,"vdr-dropdown")(10,"button",9),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",10),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",11)(15,"button",12),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteChannel(l.id)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",13),e._uU(18),e.ALo(19,"translate"),e.qZA()()()()}if(2&o){const t=n.item,i=e.oxw();e.xp6(1),e.Q6J("channelCode",t.code),e.xp6(1),e.hij(" ",e.lcZ(3,8,e.lcZ(4,10,t.code))," "),e.xp6(4),e.Q6J("label",e.lcZ(7,12,"common.edit"))("linkTo",e.VKq(20,jt,t.id)),e.xp6(4),e.Q6J("disabled",i.isDefaultChannel(t.code)),e.xp6(1),e.hij(" ",e.lcZ(12,14,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,16,e.DdM(22,zt))),e.xp6(3),e.hij(" ",e.lcZ(19,18,"common.delete")," ")}}const Ht=function(){return["SuperAdmin","CreateChannel"]};class de{constructor(n,t,i){this.dataService=n,this.modalService=t,this.notificationService=i,this.refresh$=new qe.x,this.channels$=this.refresh$.pipe((0,Ye.O)(1),(0,v.w)(()=>this.dataService.settings.getChannels().mapStream(r=>r.channels)))}isDefaultChannel(n){return n===se.z$}deleteChannel(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-channel"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteChannel(n):J.E),(0,T.z)(()=>this.dataService.auth.currentUser().single$),(0,T.z)(t=>this.dataService.client.updateUserChannels(t.me.channels))).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Channel"}),this.refresh$.next(1)},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Channel"})})}}de.\u0275fac=function(n){return new(n||de)(e.Y36(s.DoR),e.Y36(s.Z7U),e.Y36(s.gqp))},de.\u0275cmp=e.Xpm({type:de,selectors:[["vdr-channel-list"]],decls:12,vars:8,consts:[["locationId","channel-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"channelCode"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm",3,"disabled"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,$t,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.ALo(5,"async"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"vdr-dt-column")(10,"vdr-dt-column"),e.YNc(11,Et,20,23,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(7,Ht)),e.xp6(1),e.Q6J("items",e.lcZ(5,3,t.channels$)),e.xp6(3),e.Oqu(e.lcZ(8,5,"common.code")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,$e.n,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Ue.E,Z.j],styles:[""],changeDetection:0});var w=m(6562),De=m(7425);function Gt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Vt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Bt(o,n){if(1&o&&e.YNc(0,Vt,3,4,"button",15),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function Kt(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class me extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateCountry],this.customFields=this.getCustomFieldConfig("Country"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],enabled:[!0],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.country$=this.entity$}ngOnDestroy(){this.destroy()}create(){!this.detailForm.dirty||(0,w.a)(this.country$,this.languageCode$).pipe((0,F.q)(1),(0,T.z)(([n,t])=>{const i=this.detailForm.value,r=(0,s.iSy)({translatable:n,updatedFields:i,customFieldConfig:this.customFields,languageCode:t,defaultTranslation:{name:i.name,languageCode:t}});return this.dataService.settings.createCountry(r)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Country"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",n.createCountry.id],{relativeTo:this.route})},n=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Country"})})}save(){(0,w.a)(this.country$,this.languageCode$).pipe((0,F.q)(1),(0,T.z)(([n,t])=>{const i=this.detailForm.value,r=(0,s.iSy)({translatable:n,updatedFields:i,customFieldConfig:this.customFields,languageCode:t,defaultTranslation:{name:i.name,languageCode:t}});return this.dataService.settings.updateCountry(r)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Country"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Country"})})}setFormValues(n,t){const i=(0,s.ZIM)(n,t);this.detailForm.patchValue({code:n.code,name:i?i.name:"",enabled:n.enabled}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,i)}}me.\u0275fac=function(n){return new(n||me)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},me.\u0275cmp=e.Xpm({type:me,selectors:[["vdr-country-detail"]],features:[e.qOj],decls:30,vars:38,consts:[[3,"entity"],[3,"disabled","availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","country-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","code",3,"label"],["id","code","type","text","formControlName","code",3,"readonly"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","enabled",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","country-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["formGroupName","customFields"],["entityName","Country",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.TgZ(4,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,Gt,3,4,"button",3),e.ALo(11,"async"),e.YNc(12,Bt,1,1,"ng-template",null,4,e.W1O),e.qZA()(),e.TgZ(14,"form",5)(15,"vdr-form-field",6),e.ALo(16,"translate"),e._UZ(17,"input",7),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",8),e.ALo(20,"translate"),e._UZ(21,"input",9),e.ALo(22,"hasPermission"),e.qZA(),e.TgZ(23,"vdr-form-field",10),e.ALo(24,"translate"),e.TgZ(25,"clr-toggle-wrapper"),e._UZ(26,"input",11),e.ALo(27,"hasPermission"),e.qZA()(),e.YNc(28,Kt,6,8,"section",12),e._UZ(29,"vdr-custom-detail-component-host",13),e.qZA()),2&n){const i=e.MAs(13);e.xp6(2),e.Q6J("entity",e.lcZ(3,16,t.entity$)),e.xp6(2),e.Q6J("disabled",e.lcZ(5,18,t.isNew$))("availableLanguageCodes",e.lcZ(6,20,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,22,t.languageCode$)),e.xp6(6),e.Q6J("ngIf",e.lcZ(11,24,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(16,26,"common.code")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,28,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(20,30,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(22,32,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(24,34,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(27,36,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,De.S,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});var Se=m(9337),Pe=m(4447);const Wt=function(){return["./create"]};function Xt(o,n){1&o&&(e.TgZ(0,"a",6),e._UZ(1,"clr-icon",7),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Wt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-country")," "))}const en=function(o){return{contents:o}},tn=function(o){return["/settings","zones",o]};function nn(o,n){if(1&o&&(e.TgZ(0,"a",17)(1,"vdr-chip",18),e._uU(2),e.qZA()()),2&o){const t=n.$implicit;e.Q6J("routerLink",e.VKq(5,tn,e.VKq(3,en,t.id))),e.xp6(1),e.Q6J("colorFrom",t.name),e.xp6(1),e.Oqu(t.name)}}const on=function(o){return["./",o]},rn=function(){return["DeleteSettings","DeleteCountry"]};function sn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",8),e._uU(1),e.qZA(),e.TgZ(2,"td",8),e._uU(3),e.qZA(),e.TgZ(4,"td",8),e.YNc(5,nn,3,7,"a",9),e.qZA(),e.TgZ(6,"td",8),e._UZ(7,"clr-icon"),e.qZA(),e.TgZ(8,"td",10),e._UZ(9,"vdr-table-row-action",11),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"td",10)(12,"vdr-dropdown")(13,"button",12),e._uU(14),e.ALo(15,"translate"),e._UZ(16,"clr-icon",13),e.qZA(),e.TgZ(17,"vdr-dropdown-menu",14)(18,"button",15),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteCountry(l.id)}),e.ALo(19,"hasPermission"),e._UZ(20,"clr-icon",16),e._uU(21),e.ALo(22,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngForOf",t.zones),e.xp6(2),e.ekj("is-success",t.enabled),e.uIk("shape",t.enabled?"check":"times"),e.xp6(2),e.Q6J("label",e.lcZ(10,11,"common.edit"))("linkTo",e.VKq(19,on,t.id)),e.xp6(5),e.hij(" ",e.lcZ(15,13,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(19,15,e.DdM(21,rn))),e.xp6(3),e.hij(" ",e.lcZ(22,17,"common.delete")," ")}}const an=function(){return["CreateSettings","CreateCountry"]};class ue{constructor(n,t,i,r){this.dataService=n,this.notificationService=t,this.modalService=i,this.serverConfigService=r,this.searchTerm=new a.NI(""),this.countries=[],this.destroy$=new qe.x,this.refresh$=new qe.x}ngOnInit(){this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:t})=>t.contentLanguage);const n=(0,w.a)(this.contentLanguage$,this.searchTerm.valueChanges.pipe((0,Ye.O)(null))).pipe((0,L.U)(([t,i])=>i),(0,v.w)(t=>this.dataService.settings.getCountries(999,0,t).single$),(0,Se.b)(t=>{this.countries=t.countries.items}),(0,L.U)(t=>t.countries.items));this.zones$=this.dataService.settings.getZones().mapStream(t=>t.zones),this.countriesWithZones$=(0,w.a)(n,this.zones$).pipe((0,L.U)(([t,i])=>t.map(r=>Object.assign(Object.assign({},r),{zones:i.filter(l=>!!l.members.find(d=>d.id===r.id))})))),this.availableLanguages$=this.serverConfigService.getAvailableLanguages()}ngOnDestroy(){this.destroy$.next(void 0),this.destroy$.complete()}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}deleteCountry(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-country"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteCountry(n):J.E)).subscribe(t=>{t.deleteCountry.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Country"}),this.dataService.settings.getCountries(999,0).single$.subscribe()):this.notificationService.error(t.deleteCountry.message||"")},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Country"})})}isZone(n){return n.hasOwnProperty("id")}}ue.\u0275fac=function(n){return new(n||ue)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U),e.Y36(s.iHG))},ue.\u0275cmp=e.Xpm({type:ue,selectors:[["vdr-country-list"]],decls:28,vars:28,consts:[["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","country-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[3,"expand"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"routerLink",4,"ngFor","ngForOf"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[3,"routerLink"],[3,"colorFrom"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.TgZ(4,"div")(5,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,Xt,4,5,"a",3),e.qZA()(),e.TgZ(11,"vdr-data-table",4),e.ALo(12,"async"),e.TgZ(13,"vdr-dt-column"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dt-column",5),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"vdr-dt-column"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.TgZ(22,"vdr-dt-column"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e._UZ(25,"vdr-dt-column")(26,"vdr-dt-column"),e.YNc(27,sn,23,22,"ng-template"),e.qZA()),2&n&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,11,"settings.search-country-by-name")),e.xp6(3),e.Q6J("availableLanguageCodes",e.lcZ(6,13,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,15,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(27,an)),e.xp6(1),e.Q6J("items",e.lcZ(12,17,t.countriesWithZones$)),e.xp6(3),e.Oqu(e.lcZ(15,19,"common.code")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(18,21,"common.name")),e.xp6(3),e.Oqu(e.lcZ(21,23,"settings.zone")),e.xp6(3),e.Oqu(e.lcZ(24,25,"common.enabled")))},directives:[_.Kk,_.BN,A.y,a.Fj,a.JJ,a.oH,De.S,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.sg,Pe.Y,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[".search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"],changeDetection:0});var ln=m(538);function cn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",13),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function dn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"span",14),e.NdJ("click",function(){const r=e.CHM(t),l=r.item;return r.clear.call(null,l)}),e._uU(1," \xd7 "),e.qZA(),e.TgZ(2,"span",15),e._uU(3),e.ALo(4,"localeLanguageName"),e.qZA()}if(2&o){const t=n.item;e.xp6(3),e.AsE("",e.lcZ(4,2,t)," (",t,")")}}function mn(o,n){if(1&o&&(e._uU(0),e.ALo(1,"localeLanguageName")),2&o){const t=n.item;e.AsE(" ",e.lcZ(1,2,t)," (",t,") ")}}function un(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class pe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.languageCodes=Object.values(s.spR),this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateGlobalSettings],this.customFields=this.getCustomFieldConfig("GlobalSettings"),this.detailForm=this.formBuilder.group({availableLanguages:[""],trackInventory:!1,outOfStockThreshold:[0,a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.dataService.client.userStatus().single$.subscribe(({userStatus:n})=>{if(!n.permissions.includes(s.y3$.UpdateSettings)){const t=this.detailForm.get("availableLanguages");t&&t.disable()}})}save(){!this.detailForm.dirty||this.dataService.settings.updateGlobalSettings(this.detailForm.value).pipe((0,Se.b)(({updateGlobalSettings:n})=>{switch(n.__typename){case"GlobalSettings":this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Settings"});break;case"ChannelDefaultLanguageError":this.notificationService.error(n.message)}}),(0,v.w)(()=>this.serverConfigService.refreshGlobalSettings()),(0,ln.M)(this.dataService.client.uiState().single$)).subscribe(([{globalSettings:n},{uiState:t}])=>{const i=n.availableLanguages;i.length&&!i.includes(t.contentLanguage)&&this.dataService.client.setContentLanguage(i[0]).subscribe()})}setFormValues(n,t){this.detailForm.patchValue({availableLanguages:n.availableLanguages,trackInventory:n.trackInventory,outOfStockThreshold:n.outOfStockThreshold}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}pe.\u0275fac=function(n){return new(n||pe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},pe.\u0275cmp=e.Xpm({type:pe,selectors:[["vdr-global-settings"]],features:[e.qOj],decls:23,vars:29,consts:[["locationId","global-settings-detail"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","availableLanguages",3,"label"],["multiple","true","appendTo","body","formControlName","availableLanguages",3,"items","addTag","hideSelected"],["ng-label-tmp",""],["ng-option-tmp",""],["for","outOfStockThreshold",3,"label","tooltip"],["id","outOfStockThreshold","type","number","formControlName","outOfStockThreshold",3,"readonly"],["for","enabled",3,"label","tooltip"],["type","checkbox","clrToggle","","name","enabled","formControlName","trackInventory",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","global-settings-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["aria-hidden","true",1,"ng-value-icon","left",3,"click"],[1,"ng-value-label"],["formGroupName","customFields"],["entityName","GlobalSettings",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,cn,3,4,"button",1),e.qZA()(),e.TgZ(4,"form",2)(5,"vdr-form-field",3),e.ALo(6,"translate"),e.TgZ(7,"ng-select",4),e.YNc(8,dn,5,4,"ng-template",5),e.YNc(9,mn,2,4,"ng-template",6),e.qZA()(),e.TgZ(10,"vdr-form-field",7),e.ALo(11,"translate"),e.ALo(12,"translate"),e._UZ(13,"input",8),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",9),e.ALo(16,"translate"),e.ALo(17,"translate"),e.TgZ(18,"clr-toggle-wrapper"),e._UZ(19,"input",10),e.ALo(20,"hasPermission"),e.qZA()(),e.YNc(21,un,6,8,"section",11),e._UZ(22,"vdr-custom-detail-component-host",12),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",t.updatePermission),e.xp6(1),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(6,15,"common.available-languages")),e.xp6(2),e.Q6J("items",t.languageCodes)("addTag",!1)("hideSelected",!0),e.xp6(3),e.Q6J("label",e.lcZ(11,17,"settings.global-out-of-stock-threshold"))("tooltip",e.lcZ(12,19,"settings.global-out-of-stock-threshold-tooltip")),e.xp6(3),e.Q6J("readonly",!e.lcZ(14,21,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,23,"settings.track-inventory-default"))("tooltip",e.lcZ(17,25,"catalog.track-inventory-tooltip")),e.xp6(4),e.Q6J("vdrDisabled",!e.lcZ(20,27,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm))},directives:[_.Kk,_.mz,C.W,x.H,a._Y,a.JL,a.sg,q.h,ke.w9,a.JJ,a.u,ke.mR,ke.ir,A.y,a.wV,a.Fj,u.PEh,a.Wl,u.KKC,R.x,p.O5,a.x0,u.MgK,I.y,O.C],pipes:[b.X$,Re.B,Z.j],styles:["ng-select .ng-value>span{margin:0!important} ng-select .ng-arrow-wrapper .ng-arrow{margin:0!important} ng-select .ng-select-container>span{margin:0!important}"],changeDetection:0});var Ie=m(2604),je=m(3628),ze=m(8931);function pn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function gn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedHandler),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function _n(o,n){if(1&o&&e.YNc(0,gn,3,4,"button",6),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function hn(o,n){if(1&o&&(e.TgZ(0,"section",23)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",24),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}function fn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",25),e.NdJ("remove",function(){return e.CHM(t),e.oxw(2).removeChecker()}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedChecker)("operationDefinition",t.selectedCheckerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function bn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectChecker(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function vn(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",26),e._UZ(3,"clr-icon",27),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",28),e.YNc(7,bn,2,1,"button",29),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.checkers)}}function Zn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",31),e.NdJ("remove",function(){return e.CHM(t),e.oxw(2).removeHandler()}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedHandler)("operationDefinition",t.selectedHandlerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function Cn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectHandler(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function yn(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",26),e._UZ(3,"clr-icon",27),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",28),e.YNc(7,Cn,2,1,"button",29),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.handlers)}}function xn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"form",7)(1,"vdr-form-field",8),e.ALo(2,"translate"),e.TgZ(3,"input",9),e.NdJ("input",function(r){const d=e.CHM(t).ngIf;return e.oxw().updateCode(d.code,r.target.value)}),e.ALo(4,"hasPermission"),e.qZA()(),e.TgZ(5,"vdr-form-field",10),e.ALo(6,"translate"),e.ALo(7,"hasPermission"),e._UZ(8,"input",11),e.ALo(9,"hasPermission"),e.qZA(),e._UZ(10,"vdr-rich-text-editor",12),e.ALo(11,"hasPermission"),e.ALo(12,"translate"),e.TgZ(13,"vdr-form-field",13),e.ALo(14,"translate"),e.TgZ(15,"clr-toggle-wrapper"),e._UZ(16,"input",14),e.ALo(17,"hasPermission"),e.qZA()(),e.YNc(18,hn,6,8,"section",15),e._UZ(19,"vdr-custom-detail-component-host",16),e.TgZ(20,"div",17)(21,"div",18)(22,"label",19),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.YNc(25,fn,2,5,"vdr-configurable-input",20),e.YNc(26,vn,8,4,"div",21),e.qZA(),e.TgZ(27,"div",18)(28,"label",19),e._uU(29),e.ALo(30,"translate"),e.qZA(),e.YNc(31,Zn,2,5,"vdr-configurable-input",22),e.YNc(32,yn,8,4,"div",21),e.qZA()()()}if(2&o){const t=e.oxw();e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(2,19,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(4,21,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(6,23,"common.code"))("readOnlyToggle",e.lcZ(7,25,t.updatePermission)),e.xp6(3),e.Q6J("readonly",!e.lcZ(9,27,t.updatePermission)),e.xp6(2),e.Q6J("readonly",!e.lcZ(11,29,t.updatePermission))("label",e.lcZ(12,31,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(14,33,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(17,35,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(4),e.Oqu(e.lcZ(24,37,"settings.payment-eligibility-checker")),e.xp6(2),e.Q6J("ngIf",t.selectedChecker&&t.selectedCheckerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedChecker||!t.selectedCheckerDefinition),e.xp6(3),e.Oqu(e.lcZ(30,39,"settings.payment-handler")),e.xp6(2),e.Q6J("ngIf",t.selectedHandler&&t.selectedHandlerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedHandler||!t.selectedHandlerDefinition)}}class ge extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.checkers=[],this.handlers=[],this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdatePaymentMethod],this.customFields=this.getCustomFieldConfig("PaymentMethod"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],description:"",enabled:[!0,a.kI.required],checker:{},handler:{},customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),(0,w.a)([this.dataService.settings.getPaymentMethodOperations().single$,this.entity$.pipe((0,F.q)(1))]).subscribe(([n,t])=>{this.checkers=n.paymentMethodEligibilityCheckers,this.handlers=n.paymentMethodHandlers,this.changeDetector.markForCheck(),this.selectedCheckerDefinition=n.paymentMethodEligibilityCheckers.find(i=>i.code===(t.checker&&t.checker.code)),this.selectedHandlerDefinition=n.paymentMethodHandlers.find(i=>i.code===(t.handler&&t.handler.code))})}ngOnDestroy(){this.destroy()}updateCode(n,t){if(!n){const i=this.detailForm.get(["code"]);i&&i.pristine&&i.setValue((0,Ie.U)(t,"-"))}}configArgsIsPopulated(){const n=this.detailForm.get("configArgs");return!!n&&0<Object.keys(n.controls).length}selectChecker(n){this.selectedCheckerDefinition=n,this.selectedChecker=(0,s.miO)(n);const t=this.detailForm.get("checker");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedChecker)),this.detailForm.markAsDirty()}selectHandler(n){this.selectedHandlerDefinition=n,this.selectedHandler=(0,s.miO)(n);const t=this.detailForm.get("handler");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedHandler)),this.detailForm.markAsDirty()}removeChecker(){this.selectedChecker=null,this.detailForm.markAsDirty()}removeHandler(){this.selectedHandler=null,this.detailForm.markAsDirty()}create(){const n=this.selectedChecker,t=this.selectedHandler;!t||this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:i})=>{const r=this.detailForm.value,l={name:r.name,code:r.code,description:r.description,enabled:r.enabled,checker:n?(0,s.RnJ)(n,r.checker):null,handler:(0,s.RnJ)(t,r.handler),customFields:r.customFields};return this.dataService.settings.createPaymentMethod(l)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"PaymentMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createPaymentMethod.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"PaymentMethod"})})}save(){const n=this.selectedChecker,t=this.selectedHandler;!t||this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:i})=>{const r=this.detailForm.value,l={id:i,name:r.name,code:r.code,description:r.description,enabled:r.enabled,checker:n?(0,s.RnJ)(n,r.checker):null,handler:(0,s.RnJ)(t,r.handler),customFields:r.customFields};return this.dataService.settings.updatePaymentMethod(l)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"PaymentMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},i=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"PaymentMethod"})})}setFormValues(n){this.detailForm.patchValue({name:n.name,code:n.code,description:n.description,enabled:n.enabled,checker:n.checker||{},handler:n.handler||{}}),this.selectedChecker||(this.selectedChecker=n.checker&&{code:n.checker.code,args:n.checker.args.map(t=>Object.assign(Object.assign({},t),{value:(0,s.sux)(t.value)}))}),this.selectedHandler||(this.selectedHandler=n.handler&&{code:n.handler.code,args:n.handler.args.map(t=>Object.assign(Object.assign({},t),{value:(0,s.sux)(t.value)}))}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}ge.\u0275fac=function(n){return new(n||ge)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ge.\u0275cmp=e.Xpm({type:ge,selectors:[["vdr-payment-method-detail"]],features:[e.qOj],decls:12,vars:10,consts:[[3,"entity"],["locationId","payment-method-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],["class","form",3,"formGroup",4,"ngIf"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],["formControlName","description",3,"readonly","label"],["for","description",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","payment-method-detail",3,"entity$","detailForm"],[1,"clr-row","mt4"],[1,"clr-col"],[1,"clr-control-label"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[4,"ngIf"],["formControlName","handler",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],["formGroupName","customFields"],["entityName","PaymentMethod",3,"customFields","customFieldsFormGroup","readonly"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],["formControlName","handler",3,"operation","operationDefinition","readonly","remove"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,pn,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,_n,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.YNc(10,xn,33,41,"form",4),e.ALo(11,"async")),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,4,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,6,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",e.lcZ(11,8,t.entity$))}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,je.Y,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C,ze.q,D.J,S.U,u.qvL,k.N,p.sg,P.H],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Tn=function(){return["./create"]};function An(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Tn)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-payment-method")," "))}const Ln=function(o){return["./",o]},Fn=function(){return["DeleteSettings","DeletePaymentMethod"]};function Jn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",6),e._UZ(5,"vdr-table-row-action",7),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",6)(8,"vdr-dropdown")(9,"button",8),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",9),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",10)(14,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deletePaymentMethod(l.id)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",12),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.enabled),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,Ln,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,Fn))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}const qn=function(){return["CreateSettings","CreatePaymentMethod"]};class _e extends s.t7C{constructor(n,t,i,r,l){super(t,i),this.dataService=n,this.modalService=r,this.notificationService=l,super.setQueryFn((...d)=>this.dataService.settings.getPaymentMethods(...d).refetchOnChannelChange(),d=>d.paymentMethods)}deletePaymentMethod(n){this.showModalAndDelete(n).pipe((0,v.w)(t=>t.result===s.PcR.DELETED?[!0]:this.showModalAndDelete(n,t.message||"").pipe((0,L.U)(i=>i.result===s.PcR.DELETED))),(0,v.w)(()=>this.dataService.settings.getPaymentMethods(100).single$)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"PaymentMethod"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"PaymentMethod"})})}showModalAndDelete(n,t){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-payment-method"),body:t,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(i=>i?this.dataService.settings.deletePaymentMethod(n,!!t):J.E),(0,L.U)(i=>i.deletePaymentMethod))}}function Dn(o,n){1&o&&(e.TgZ(0,"vdr-form-field",15),e.ALo(1,"translate"),e._UZ(2,"input",12),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,1,"settings.password"))}function Sn(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,3,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))}}_e.\u0275fac=function(n){return new(n||_e)(e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.Z7U),e.Y36(s.gqp))},_e.\u0275cmp=e.Xpm({type:_e,selectors:[["vdr-payment-method-list"]],features:[e.qOj],decls:18,vars:20,consts:[["locationId","payment-method-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,An,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"vdr-dt-column")(16,"vdr-dt-column"),e.YNc(17,Jn,19,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(19,qn)),e.xp6(1),e.Q6J("items",e.lcZ(5,7,t.items$))("itemsPerPage",e.lcZ(6,9,t.itemsPerPage$))("totalItems",e.lcZ(7,11,t.totalItems$))("currentPage",e.lcZ(8,13,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,15,"common.code")),e.xp6(3),e.Oqu(e.lcZ(14,17,"common.enabled")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});class he extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.customFields=this.getCustomFieldConfig("Administrator"),this.detailForm=this.formBuilder.group({emailAddress:["",a.kI.required],firstName:["",a.kI.required],lastName:["",a.kI.required],password:[""],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init()}ngOnDestroy(){this.destroy()}save(){this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i={emailAddress:t.emailAddress,firstName:t.firstName,lastName:t.lastName,password:t.password,customFields:t.customFields};return this.dataService.administrator.updateActiveAdministrator(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Administrator"})})}setFormValues(n,t){this.detailForm.patchValue({emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}he.\u0275fac=function(n){return new(n||he)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},he.\u0275cmp=e.Xpm({type:he,selectors:[["vdr-profile"]],features:[e.qOj],decls:26,vars:27,consts:[[3,"entity"],["locationId","administrator-detail"],[1,"btn","btn-primary",3,"disabled","click"],[1,"form",3,"formGroup"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","password",3,"label",4,"ngIf"],["for","password",3,"label","readOnlyToggle"],["id","password","type","password","formControlName","password"],["formGroupName","customFields",4,"ngIf"],["locationId","administrator-profile",3,"entity$","detailForm"],["for","password",3,"label"],["formGroupName","customFields"],["entityName","Administrator",3,"customFields","customFieldsFormGroup"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.TgZ(6,"button",2),e.NdJ("click",function(){return t.save()}),e._uU(7),e.ALo(8,"translate"),e.qZA()()(),e.TgZ(9,"form",3)(10,"vdr-form-field",4),e.ALo(11,"translate"),e._UZ(12,"input",5),e.qZA(),e.TgZ(13,"vdr-form-field",6),e.ALo(14,"translate"),e._UZ(15,"input",7),e.qZA(),e.TgZ(16,"vdr-form-field",8),e.ALo(17,"translate"),e._UZ(18,"input",9),e.qZA(),e.YNc(19,Dn,3,3,"vdr-form-field",10),e.ALo(20,"async"),e.TgZ(21,"vdr-form-field",11),e.ALo(22,"translate"),e._UZ(23,"input",12),e.qZA(),e.YNc(24,Sn,5,5,"section",13),e._UZ(25,"vdr-custom-detail-component-host",14),e.qZA()),2&n&&(e.xp6(2),e.Q6J("entity",e.lcZ(3,13,t.entity$)),e.xp6(4),e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(8,15,"common.update")," "),e.xp6(2),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(11,17,"settings.email-address")),e.xp6(3),e.Q6J("label",e.lcZ(14,19,"settings.first-name")),e.xp6(3),e.Q6J("label",e.lcZ(17,21,"settings.last-name")),e.xp6(3),e.Q6J("ngIf",e.lcZ(20,23,t.isNew$)),e.xp6(2),e.Q6J("label",e.lcZ(22,25,"settings.password"))("readOnlyToggle",!0),e.xp6(3),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm))},directives:[_.Kk,_.BN,U.V,_.mz,C.W,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,p.O5,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$],styles:[""],changeDetection:0});var kn=m(9493),Pn=m(5646);function Un(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",12),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function In(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",12),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Nn(o,n){1&o&&e.YNc(0,In,3,4,"button",13),2&o&&e.Q6J("vdrIfPermissions","UpdateAdministrator")}class fe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.detailForm=this.formBuilder.group({code:["",a.kI.required],description:["",a.kI.required],channelIds:[],permissions:[]})}ngOnInit(){this.init(),this.role$=this.entity$,this.permissionDefinitions=this.serverConfigService.getPermissionDefinitions()}ngOnDestroy(){this.destroy()}updateCode(n){const t=this.detailForm.get(["code"]);t&&t.pristine&&t.setValue((0,Ie.U)(n,"-"))}setPermission(n){const t=this.detailForm.get("permissions");if(t){const i=t.value,r=!0===n.value?(0,kn.T)([...i,n.permission]):i.filter(l=>l!==n.permission);t.setValue(r),t.markAsDirty()}}create(){const t=this.detailForm.value;this.dataService.administrator.createRole(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Role"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createRole.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Role"})})}save(){this.role$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i=Object.assign({id:n},t);return this.dataService.administrator.updateRole(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Role"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Role"})})}setFormValues(n,t){this.detailForm.patchValue({description:n.description,code:n.code,channelIds:n.channels.map(i=>i.id),permissions:n.permissions}),this.changeDetector.detectChanges()}}fe.\u0275fac=function(n){return new(n||fe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},fe.\u0275cmp=e.Xpm({type:fe,selectors:[["vdr-role-detail"]],features:[e.qOj],decls:29,vars:37,consts:[[3,"entity"],["locationId","role-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","description",3,"label"],["id","description","type","text","formControlName","description",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],[3,"label"],["formControlName","channelIds",3,"vdrDisabled"],[3,"permissionDefinitions","activePermissions","readonly","permissionChange"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,Un,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Nn,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e.TgZ(13,"input",6),e.NdJ("input",function(r){return t.updateCode(r.target.value)}),e.ALo(14,"hasPermission"),e.qZA()(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.ALo(17,"hasPermission"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA(),e.TgZ(20,"vdr-form-field",9),e.ALo(21,"translate"),e._UZ(22,"vdr-channel-assignment-control",10),e.ALo(23,"hasPermission"),e.qZA(),e.TgZ(24,"label"),e._uU(25),e.ALo(26,"translate"),e.qZA(),e.TgZ(27,"vdr-permission-grid",11),e.NdJ("permissionChange",function(r){return t.setPermission(r)}),e.ALo(28,"hasPermission"),e.qZA()()),2&n){const i=e.MAs(9);let r;e.xp6(2),e.Q6J("entity",e.lcZ(3,15,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,17,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,19,"common.description")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,21,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(16,23,"common.code"))("readOnlyToggle",e.lcZ(17,25,"UpdateAdministrator")),e.xp6(3),e.Q6J("readonly",!e.lcZ(19,27,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(21,29,"settings.channel")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(23,31,"UpdateAdministrator")),e.xp6(3),e.Oqu(e.lcZ(26,33,"settings.permissions")),e.xp6(2),e.Q6J("permissionDefinitions",t.permissionDefinitions)("activePermissions",null==(r=t.detailForm.get("permissions"))?null:r.value)("readonly",!e.lcZ(28,35,"UpdateAdministrator"))}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,Pn.S,R.x,u.MgK,z],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Mn=function(){return["./create"]};function On(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Mn)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-role")," "))}function wn(o,n){if(1&o&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&o){const t=e.oxw().item;e.xp6(1),e.Oqu(t.code)}}function Qn(o,n){if(1&o&&(e.TgZ(0,"vdr-chip"),e._UZ(1,"vdr-channel-badge",17),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA()),2&o){const t=n.$implicit;e.xp6(1),e.Q6J("channelCode",t.code),e.xp6(1),e.hij(" ",e.lcZ(3,2,e.lcZ(4,4,t.code))," ")}}function Rn(o,n){if(1&o&&(e.ynx(0),e.YNc(1,Qn,5,6,"vdr-chip",16),e.BQk()),2&o){const t=e.oxw().item;e.xp6(1),e.Q6J("ngForOf",t.channels)}}function Yn(o,n){if(1&o&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.xp6(1),e.Oqu(t)}}function $n(o,n){if(1&o&&(e.ynx(0),e._UZ(1,"clr-icon",4),e._uU(2),e.BQk()),2&o){const t=e.oxw(3).item,i=e.oxw();e.xp6(2),e.hij(" ",t.permissions.length-i.initialLimit," ")}}function jn(o,n){1&o&&e._UZ(0,"clr-icon",21)}function zn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2).item;return e.oxw().toggleDisplayLimit(r)}),e.YNc(1,$n,3,1,"ng-container",7),e.YNc(2,jn,1,0,"ng-template",null,20,e.W1O),e.qZA()}if(2&o){const t=e.MAs(3),i=e.oxw(2).item,r=e.oxw();e.xp6(1),e.Q6J("ngIf",(r.displayLimit[i.id]||0)<i.permissions.length)("ngIfElse",t)}}function En(o,n){if(1&o&&(e.ynx(0),e.YNc(1,Yn,2,1,"vdr-chip",16),e.ALo(2,"slice"),e.YNc(3,zn,4,2,"button",18),e.BQk()),2&o){const t=e.oxw().item,i=e.oxw();e.xp6(1),e.Q6J("ngForOf",e.Dn7(2,2,t.permissions,0,i.displayLimit[t.id]||3)),e.xp6(2),e.Q6J("ngIf",t.permissions.length>i.initialLimit)}}function Hn(o,n){1&o&&(e.TgZ(0,"span",22),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.default-role-label")))}const Gn=function(o){return["./",o]};function Vn(o,n){if(1&o&&(e._UZ(0,"vdr-table-row-action",23),e.ALo(1,"translate")),2&o){const t=e.oxw().item;e.Q6J("label",e.lcZ(1,2,"common.edit"))("linkTo",e.VKq(4,Gn,t.id))}}function Bn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e.YNc(3,wn,2,1,"span",6),e.qZA(),e.TgZ(4,"td",5),e.YNc(5,Rn,2,1,"ng-container",6),e.qZA(),e.TgZ(6,"td",5),e.YNc(7,En,4,6,"ng-container",7),e.YNc(8,Hn,3,3,"ng-template",null,8,e.W1O),e.qZA(),e.TgZ(10,"td",9),e.YNc(11,Vn,2,6,"vdr-table-row-action",10),e.qZA(),e.TgZ(12,"td",9)(13,"vdr-dropdown")(14,"button",11),e._uU(15),e.ALo(16,"translate"),e._UZ(17,"clr-icon",12),e.qZA(),e.TgZ(18,"vdr-dropdown-menu",13)(19,"button",14),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteRole(l.id)}),e.ALo(20,"hasPermission"),e._UZ(21,"clr-icon",15),e._uU(22),e.ALo(23,"translate"),e.qZA()()()()}if(2&o){const t=n.item,i=e.MAs(9),r=e.oxw();e.xp6(1),e.Oqu(t.description),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(3),e.Q6J("disabled",r.isDefaultRole(t)),e.xp6(1),e.hij(" ",e.lcZ(16,10,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(20,12,"SuperAdmin")),e.xp6(3),e.hij(" ",e.lcZ(23,14,"common.delete")," ")}}class be extends s.t7C{constructor(n,t,i,r,l){super(r,l),this.modalService=n,this.notificationService=t,this.dataService=i,this.initialLimit=3,this.displayLimit={},super.setQueryFn((...d)=>this.dataService.administrator.getRoles(...d),d=>d.roles)}ngOnInit(){super.ngOnInit(),this.visibleRoles$=this.items$.pipe((0,L.U)(n=>n.filter(t=>t.code!==se.RO)))}toggleDisplayLimit(n){this.displayLimit[n.id]===n.permissions.length?this.displayLimit[n.id]=this.initialLimit:this.displayLimit[n.id]=n.permissions.length}isDefaultRole(n){return n.code===se.Wi||n.code===se.RO}deleteRole(n){this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-role"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.administrator.deleteRole(n):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Role"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Role"})})}}be.\u0275fac=function(n){return new(n||be)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz))},be.\u0275cmp=e.Xpm({type:be,selectors:[["vdr-role-list"]],features:[e.qOj],decls:24,vars:25,consts:[["locationId","role-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[4,"ngIf"],[4,"ngIf","ngIfElse"],["defaultRole",""],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo",4,"ngIf"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm",3,"disabled"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[4,"ngFor","ngForOf"],[3,"channelCode"],["class","btn btn-sm btn-secondary btn-icon",3,"click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary","btn-icon",3,"click"],["collapse",""],["shape","minus"],[1,"default-role-label"],["iconShape","edit",3,"label","linkTo"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,On,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e._UZ(21,"vdr-dt-column")(22,"vdr-dt-column"),e.YNc(23,Bn,24,16,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions","CreateAdministrator"),e.xp6(1),e.Q6J("items",e.lcZ(5,9,t.visibleRoles$))("itemsPerPage",e.lcZ(6,11,t.itemsPerPage$))("totalItems",e.lcZ(7,13,t.totalItems$))("currentPage",e.lcZ(8,15,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,17,"common.description")),e.xp6(3),e.Oqu(e.lcZ(14,19,"common.code")),e.xp6(3),e.Oqu(e.lcZ(17,21,"settings.channel")),e.xp6(3),e.Oqu(e.lcZ(20,23,"settings.permissions")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.O5,p.sg,Pe.Y,$e.n,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Ue.E,p.OU,Z.j],styles:[".default-role-label[_ngcontent-%COMP%]{color:var(--color-grey-400)}"],changeDetection:0});var Ee=m(7368),He=m(2702),Ne=m(4187);function Kn(o,n){if(1&o&&e._UZ(0,"vdr-object-tree",11),2&o){const t=e.oxw().$implicit;e.Q6J("value",t.metadata)}}function Wn(o,n){if(1&o&&(e.TgZ(0,"div",6)(1,"div",7)(2,"vdr-labeled-data",8),e.ALo(3,"translate"),e._uU(4),e.qZA(),e.TgZ(5,"div",9)(6,"vdr-labeled-data",8),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA(),e.TgZ(10,"vdr-labeled-data",8),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.YNc(14,Kn,1,1,"vdr-object-tree",10),e.qZA()()),2&o){const t=n.$implicit,i=e.oxw();e.xp6(1),e.ekj("stale",i.testDataUpdated),e.xp6(1),e.Q6J("label",e.lcZ(3,9,"settings.shipping-method")),e.xp6(2),e.hij(" ",t.name," "),e.xp6(2),e.Q6J("label",e.lcZ(7,11,"common.price")),e.xp6(2),e.hij(" ",e.xi3(9,13,t.price,i.currencyCode)," "),e.xp6(2),e.Q6J("label",e.lcZ(11,16,"common.price-with-tax")),e.xp6(2),e.hij(" ",e.xi3(13,18,t.priceWithTax,i.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.metadata)}}function Xn(o,n){1&o&&(e.TgZ(0,"div",6),e._UZ(1,"clr-icon",12),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"settings.no-eligible-shipping-methods")," "))}class ve{constructor(){this.okToRun=!1,this.testDataUpdated=!1,this.runTest=new e.vpe}}ve.\u0275fac=function(n){return new(n||ve)},ve.\u0275cmp=e.Xpm({type:ve,selectors:[["vdr-shipping-eligibility-test-result"]],inputs:{testResult:"testResult",okToRun:"okToRun",testDataUpdated:"testDataUpdated",currencyCode:"currencyCode"},outputs:{runTest:"runTest"},decls:10,vars:9,consts:[[1,"test-result","card"],[1,"card-header"],["class","card-block",4,"ngFor","ngForOf"],["class","card-block",4,"ngIf"],[1,"card-footer"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"card-block"],[1,"result-details"],[3,"label"],[1,"price-row"],[3,"value",4,"ngIf"],[3,"value"],["shape","ban",1,"is-solid","error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Wn,15,21,"div",2),e.YNc(5,Xn,4,3,"div",3),e.TgZ(6,"div",4)(7,"button",5),e.NdJ("click",function(){return t.runTest.emit()}),e._uU(8),e.ALo(9,"translate"),e.qZA()()()),2&n&&(e.xp6(2),e.hij(" ",e.lcZ(3,5,"settings.test-result")," "),e.xp6(2),e.Q6J("ngForOf",t.testResult),e.xp6(1),e.Q6J("ngIf",0===(null==t.testResult?null:t.testResult.length)),e.xp6(2),e.Q6J("disabled",!t.okToRun),e.xp6(1),e.hij(" ",e.lcZ(9,7,"settings.test-shipping-methods")," "))},directives:[p.sg,Ee.W,p.O5,He._,u.qvL],pipes:[b.X$,Ne.k],styles:[".result-details[_ngcontent-%COMP%]{transition:opacity .2s}.result-details.stale[_ngcontent-%COMP%]{opacity:.5}.price-row[_ngcontent-%COMP%]{display:flex}.price-row[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(:first-child){margin-left:24px}clr-icon.error[_ngcontent-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});var Ge=m(745),eo=m(6646),to=m(8951),no=m(1588),oo=m(5983);function io(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"tr",10)(1,"td",11),e._UZ(2,"img",12),e.qZA(),e.TgZ(3,"td",13),e._uU(4),e.qZA(),e.TgZ(5,"td",14),e._uU(6),e.qZA(),e.TgZ(7,"td",15),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA(),e.TgZ(10,"td",16)(11,"input",17),e.NdJ("ngModelChange",function(r){return e.CHM(t).$implicit.quantity=r})("change",function(){return e.CHM(t),e.oxw(2).updateQuantity()}),e.qZA(),e.TgZ(12,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).removeLine(l)}),e._UZ(13,"clr-icon",19),e.qZA()(),e.TgZ(14,"td",20),e._uU(15),e.ALo(16,"localeCurrency"),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw(2);e.xp6(2),e.Q6J("src",t.preview+"?preset=tiny",e.LSH),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.sku),e.xp6(2),e.hij(" ",e.xi3(9,6,t.unitPriceWithTax,i.currencyCode)," "),e.xp6(3),e.Q6J("ngModel",t.quantity),e.xp6(4),e.hij(" ",e.xi3(16,9,t.unitPriceWithTax*t.quantity,i.currencyCode)," ")}}function ro(o,n){if(1&o&&(e.TgZ(0,"table",6)(1,"thead")(2,"tr"),e._UZ(3,"th"),e.TgZ(4,"th"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.YNc(19,io,17,12,"tr",7),e.TgZ(20,"tr",8)(21,"td",9),e._uU(22),e.ALo(23,"translate"),e.qZA(),e._UZ(24,"td")(25,"td")(26,"td")(27,"td"),e.TgZ(28,"td"),e._uU(29),e.ALo(30,"localeCurrency"),e.qZA()()()),2&o){const t=e.oxw();e.xp6(5),e.Oqu(e.lcZ(6,8,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(9,10,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(12,12,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(15,14,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,16,"order.total")),e.xp6(2),e.Q6J("ngForOf",t.lines),e.xp6(3),e.Oqu(e.lcZ(23,18,"order.sub-total")),e.xp6(7),e.Oqu(e.xi3(30,20,t.subTotal,t.currencyCode))}}function so(o,n){1&o&&(e.TgZ(0,"div",21)(1,"div",22),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"clr-icon",23),e.qZA()),2&o&&(e.xp6(2),e.Oqu(e.lcZ(3,1,"settings.add-products-to-test-order")))}class E{constructor(n,t){this.dataService=n,this.localStorageService=t,this.orderLinesChange=new e.vpe,this.lines=[]}get subTotal(){return this.lines.reduce((n,t)=>n+t.unitPriceWithTax*t.quantity,0)}ngOnInit(){this.lines=this.loadFromLocalStorage(),this.lines&&this.orderLinesChange.emit(this.lines),this.dataService.settings.getActiveChannel("cache-first").single$.subscribe(n=>{this.currencyCode=n.activeChannel.currencyCode})}selectResult(n){n&&this.addToLines(n)}addToLines(n){var t,i;this.lines.find(r=>r.id===n.productVariantId)||(this.lines.push({id:n.productVariantId,name:n.productVariantName,preview:null!==(i=null===(t=n.productAsset)||void 0===t?void 0:t.preview)&&void 0!==i?i:"",quantity:1,sku:n.sku,unitPriceWithTax:"SinglePrice"===n.priceWithTax.__typename&&n.priceWithTax.value||0}),this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines))}updateQuantity(){this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines)}removeLine(n){this.lines=this.lines.filter(t=>t.id!==n.id),this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines)}persistToLocalStorage(){this.localStorageService.setForCurrentLocation("shippingTestOrder",this.lines)}loadFromLocalStorage(){return this.localStorageService.getForCurrentLocation("shippingTestOrder")||[]}}function ao(o,n){if(1&o&&(e.TgZ(0,"option",9),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.code),e.xp6(1),e.hij(" ",t.name," ")}}E.\u0275fac=function(n){return new(n||E)(e.Y36(s.DoR),e.Y36(s.n2A))},E.\u0275cmp=e.Xpm({type:E,selectors:[["vdr-test-order-builder"]],outputs:{orderLinesChange:"orderLinesChange"},decls:9,vars:5,consts:[[1,"card"],[1,"card-header"],["class","order-table table",4,"ngIf","ngIfElse"],["emptyPlaceholder",""],[1,"card-block"],[3,"productSelected"],[1,"order-table","table"],["class","order-line",4,"ngFor","ngForOf"],[1,"sub-total"],[1,"left"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],["type","number","max","9999","min","1",3,"ngModel","ngModelChange","change"],[1,"icon-button",3,"click"],["shape","trash"],[1,"align-middle","total"],[1,"card-block","empty-placeholder"],[1,"empty-text"],["shape","arrow","dir","down","size","96"]],template:function(n,t){if(1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ro,31,23,"table",2),e.YNc(5,so,5,3,"ng-template",null,3,e.W1O),e.TgZ(7,"div",4)(8,"vdr-product-variant-selector",5),e.NdJ("productSelected",function(r){return t.selectResult(r)}),e.qZA()()()),2&n){const i=e.MAs(6);e.xp6(2),e.hij(" ",e.lcZ(3,3,"settings.test-order")," "),e.xp6(2),e.Q6J("ngIf",t.lines.length)("ngIfElse",i)}},directives:[p.O5,p.sg,A.y,a.Fd,a.qQ,a.wV,a.Fj,a.JJ,a.On,u.qvL,no.Lv,oo.e],pipes:[b.X$,Ne.k],styles:[".empty-placeholder[_ngcontent-%COMP%]{color:var(--color-grey-400);text-align:center}.empty-text[_ngcontent-%COMP%]{font-size:22px}"],changeDetection:0});class H{constructor(n,t,i){this.formBuilder=n,this.dataService=t,this.localStorageService=i,this.addressChange=new e.vpe}ngOnInit(){this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(i=>i.countries.items);const t=this.localStorageService.getForCurrentLocation("shippingTestAddress")||{city:"",countryCode:"",postalCode:"",province:""};this.addressChange.emit(t),this.form=this.formBuilder.group(t),this.subscription=this.form.valueChanges.subscribe(i=>{this.localStorageService.setForCurrentLocation("shippingTestAddress",i),this.addressChange.emit(i)})}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}}function lo(o,n){1&o&&e._UZ(0,"clr-icon",14)}function co(o,n){1&o&&e._UZ(0,"clr-icon",15)}function mo(o,n){1&o&&e._UZ(0,"clr-icon",16)}function uo(o,n){if(1&o&&(e.TgZ(0,"vdr-labeled-data",4),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&o){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"common.price")),e.xp6(2),e.hij(" ",e.xi3(3,4,null==t.testResult.quote?null:t.testResult.quote.price,t.currencyCode)," ")}}function po(o,n){if(1&o&&(e.TgZ(0,"vdr-labeled-data",4),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&o){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"common.price-with-tax")),e.xp6(2),e.hij(" ",e.xi3(3,4,null==t.testResult.quote?null:t.testResult.quote.priceWithTax,t.currencyCode)," ")}}function go(o,n){if(1&o&&e._UZ(0,"vdr-object-tree",17),2&o){const t=e.oxw();e.Q6J("value",null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.metadata)}}H.\u0275fac=function(n){return new(n||H)(e.Y36(a.qu),e.Y36(s.DoR),e.Y36(s.n2A))},H.\u0275cmp=e.Xpm({type:H,selectors:[["vdr-test-address-form"]],outputs:{addressChange:"addressChange"},decls:28,vars:19,consts:[[1,"card"],[1,"card-header"],[1,"card-block"],[3,"formGroup"],["formControlName","city","type","text","clrInput",""],["formControlName","province","type","text","clrInput",""],["formControlName","postalCode","type","text","clrInput",""],["name","countryCode","formControlName","countryCode","clrInput","","clrSelect",""],[3,"value",4,"ngFor","ngForOf"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",2)(5,"form",3)(6,"clr-input-container")(7,"label"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e._UZ(10,"input",4),e.qZA(),e.TgZ(11,"clr-input-container")(12,"label"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"input",5),e.qZA(),e.TgZ(16,"clr-input-container")(17,"label"),e._uU(18),e.ALo(19,"translate"),e.qZA(),e._UZ(20,"input",6),e.qZA(),e.TgZ(21,"clr-input-container")(22,"label"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.TgZ(25,"select",7),e.YNc(26,ao,2,2,"option",8),e.ALo(27,"async"),e.qZA()()()()()),2&n&&(e.xp6(2),e.hij(" ",e.lcZ(3,7,"settings.test-address")," "),e.xp6(3),e.Q6J("formGroup",t.form),e.xp6(3),e.Oqu(e.lcZ(9,9,"customer.city")),e.xp6(5),e.Oqu(e.lcZ(14,11,"customer.province")),e.xp6(5),e.Oqu(e.lcZ(19,13,"customer.postal-code")),e.xp6(5),e.Oqu(e.lcZ(24,15,"customer.country")),e.xp6(3),e.Q6J("ngForOf",e.lcZ(27,17,t.availableCountries$)))},directives:[a._Y,a.JL,a.sg,u.G55,u.MgK,A.y,a.Fj,a.JJ,a.u,u.xRP,a.EJ,u.otW,p.sg,a.YN,a.Kr],pipes:[b.X$,p.Ov],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});const _o=function(o,n,t){return{success:o,error:n,unknown:t}};class Ze{constructor(){this.okToRun=!1,this.testDataUpdated=!1,this.runTest=new e.vpe}}function ho(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedChecker||!t.selectedCalculator),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function fo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedChecker||!t.selectedCalculator),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function bo(o,n){if(1&o&&e.YNc(0,fo,3,4,"button",9),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function vo(o,n){if(1&o&&(e.TgZ(0,"option",27),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.code),e.xp6(1),e.AsE(" ",t.code,": ",t.description," ")}}function Zo(o,n){if(1&o&&(e.TgZ(0,"section",28)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",29),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}function Co(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",30),e.NdJ("remove",function(){e.CHM(t);return e.oxw(2).selectedChecker=null}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedChecker)("operationDefinition",t.selectedCheckerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function yo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",35),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectChecker(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function xo(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",31),e._UZ(3,"clr-icon",32),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",33),e.YNc(7,yo,2,1,"button",34),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.checkers)}}function To(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",36),e.NdJ("remove",function(){e.CHM(t);return e.oxw(2).selectedCalculator=null}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedCalculator)("operationDefinition",t.selectedCalculatorDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function Ao(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",35),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectCalculator(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function Lo(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",31),e._UZ(3,"clr-icon",32),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",33),e.YNc(7,Ao,2,1,"button",34),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.calculators)}}function Fo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"form",10)(1,"vdr-form-field",11),e.ALo(2,"translate"),e.TgZ(3,"input",12),e.NdJ("input",function(r){const d=e.CHM(t).ngIf;return e.oxw().updateCode(d.code,r.target.value)}),e.ALo(4,"hasPermission"),e.qZA()(),e.TgZ(5,"vdr-form-field",13),e.ALo(6,"translate"),e.ALo(7,"hasPermission"),e._UZ(8,"input",14),e.ALo(9,"hasPermission"),e.qZA(),e._UZ(10,"vdr-rich-text-editor",15),e.ALo(11,"hasPermission"),e.ALo(12,"translate"),e.TgZ(13,"vdr-form-field",16),e.ALo(14,"translate"),e.TgZ(15,"select",17),e.ALo(16,"hasPermission"),e.YNc(17,vo,2,3,"option",18),e.qZA()(),e.YNc(18,Zo,6,8,"section",19),e._UZ(19,"vdr-custom-detail-component-host",20),e.TgZ(20,"div",21)(21,"div",22)(22,"label",23),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.YNc(25,Co,2,5,"vdr-configurable-input",24),e.YNc(26,xo,8,4,"div",25),e.qZA(),e.TgZ(27,"div",22)(28,"label",23),e._uU(29),e.ALo(30,"translate"),e.qZA(),e.YNc(31,To,2,5,"vdr-configurable-input",26),e.YNc(32,Lo,8,4,"div",25),e.qZA()()()}if(2&o){const t=e.oxw();e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(2,20,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(4,22,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(6,24,"common.code"))("readOnlyToggle",e.lcZ(7,26,t.updatePermission)),e.xp6(3),e.Q6J("readonly",!e.lcZ(9,28,t.updatePermission)),e.xp6(2),e.Q6J("readonly",!e.lcZ(11,30,t.updatePermission))("label",e.lcZ(12,32,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(14,34,"settings.fulfillment-handler")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(16,36,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",t.fulfillmentHandlers),e.xp6(1),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(4),e.Oqu(e.lcZ(24,38,"settings.shipping-eligibility-checker")),e.xp6(2),e.Q6J("ngIf",t.selectedChecker&&t.selectedCheckerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedChecker||!t.selectedCheckerDefinition),e.xp6(3),e.Oqu(e.lcZ(30,40,"settings.shipping-calculator")),e.xp6(2),e.Q6J("ngIf",t.selectedCalculator&&t.selectedCalculatorDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedCalculator||!t.selectedCalculatorDefinition)}}function Jo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"div",37)(2,"div",22)(3,"vdr-test-order-builder",38),e.NdJ("orderLinesChange",function(r){return e.CHM(t),e.oxw().setTestOrderLines(r)}),e.qZA()(),e.TgZ(4,"div",22)(5,"vdr-test-address-form",39),e.NdJ("addressChange",function(r){return e.CHM(t),e.oxw().setTestAddress(r)}),e.qZA(),e.TgZ(6,"vdr-shipping-method-test-result",40),e.NdJ("runTest",function(){return e.CHM(t),e.oxw().runTest()}),e.ALo(7,"async"),e.ALo(8,"async"),e.qZA()()()()}if(2&o){const t=e.oxw();let i;e.xp6(6),e.Q6J("currencyCode",null==(i=e.lcZ(7,4,t.activeChannel$))?null:i.currencyCode)("okToRun",t.allTestDataPresent()&&t.testDataUpdated&&t.detailForm.valid)("testDataUpdated",t.testDataUpdated)("testResult",e.lcZ(8,6,t.testResult$))}}Ze.\u0275fac=function(n){return new(n||Ze)},Ze.\u0275cmp=e.Xpm({type:Ze,selectors:[["vdr-shipping-method-test-result"]],inputs:{testResult:"testResult",okToRun:"okToRun",testDataUpdated:"testDataUpdated",currencyCode:"currencyCode"},outputs:{runTest:"runTest"},decls:21,vars:24,consts:[[1,"test-result","card",3,"ngClass"],[1,"card-header"],[1,"card-block"],[1,"result-details"],[3,"label"],[1,"eligible-icon"],["shape","success-standard","class","is-solid success",4,"ngIf"],["shape","ban","class","is-solid error",4,"ngIf"],["shape","unknown-status",4,"ngIf"],[1,"price-row"],[3,"label",4,"ngIf"],[3,"value",4,"ngIf"],[1,"card-footer"],[1,"btn","btn-secondary",3,"disabled","click"],["shape","success-standard",1,"is-solid","success"],["shape","ban",1,"is-solid","error"],["shape","unknown-status"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",2)(5,"div",3)(6,"vdr-labeled-data",4),e.ALo(7,"translate"),e.TgZ(8,"div",5),e.YNc(9,lo,1,0,"clr-icon",6),e.YNc(10,co,1,0,"clr-icon",7),e.YNc(11,mo,1,0,"clr-icon",8),e.qZA(),e._uU(12),e.qZA(),e.TgZ(13,"div",9),e.YNc(14,uo,4,7,"vdr-labeled-data",10),e.YNc(15,po,4,7,"vdr-labeled-data",10),e.qZA(),e.YNc(16,go,1,1,"vdr-object-tree",11),e.qZA()(),e.TgZ(17,"div",12)(18,"button",13),e.NdJ("click",function(){return t.runTest.emit()}),e._uU(19),e.ALo(20,"translate"),e.qZA()()()),2&n&&(e.Q6J("ngClass",e.kEZ(20,_o,!0===(null==t.testResult?null:t.testResult.eligible),!1===(null==t.testResult?null:t.testResult.eligible),!t.testResult)),e.xp6(2),e.hij(" ",e.lcZ(3,14,"settings.test-result")," "),e.xp6(3),e.ekj("stale",t.testDataUpdated),e.xp6(1),e.Q6J("label",e.lcZ(7,16,"settings.eligible")),e.xp6(3),e.Q6J("ngIf",null==t.testResult?null:t.testResult.eligible),e.xp6(1),e.Q6J("ngIf",!1===(null==t.testResult?null:t.testResult.eligible)),e.xp6(1),e.Q6J("ngIf",!t.testResult),e.xp6(1),e.hij(" ",null==t.testResult?null:t.testResult.eligible," "),e.xp6(2),e.Q6J("ngIf",null!=(null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.price)),e.xp6(1),e.Q6J("ngIf",null!=(null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.priceWithTax)),e.xp6(1),e.Q6J("ngIf",null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.metadata),e.xp6(2),e.Q6J("disabled",!t.okToRun),e.xp6(1),e.hij(" ",e.lcZ(20,18,"settings.test-shipping-method")," "))},directives:[p.mk,Ee.W,p.O5,u.qvL,He._],pipes:[b.X$,Ne.k],styles:[".test-result.success[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-success-100)}.test-result.error[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-error-100)}.test-result.unknown[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.result-details[_ngcontent-%COMP%]{transition:opacity .2s}.result-details.stale[_ngcontent-%COMP%]{opacity:.5}.eligible-icon[_ngcontent-%COMP%]{display:inline-block}.eligible-icon[_ngcontent-%COMP%] .success[_ngcontent-%COMP%]{color:var(--color-success-500)}.eligible-icon[_ngcontent-%COMP%] .error[_ngcontent-%COMP%]{color:var(--color-error-500)}.price-row[_ngcontent-%COMP%]{display:flex}.price-row[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(:first-child){margin-left:24px}"],changeDetection:0});class Ce extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.checkers=[],this.calculators=[],this.fulfillmentHandlers=[],this.testDataUpdated=!1,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateShippingMethod],this.fetchTestResult$=new qe.x,this.customFields=this.getCustomFieldConfig("ShippingMethod"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],description:"",fulfillmentHandler:["",a.kI.required],checker:{},calculator:{},customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),(0,w.a)([this.dataService.shippingMethod.getShippingMethodOperations().single$,this.entity$.pipe((0,F.q)(1))]).subscribe(([n,t])=>{this.checkers=n.shippingEligibilityCheckers,this.calculators=n.shippingCalculators,this.fulfillmentHandlers=n.fulfillmentHandlers,this.changeDetector.markForCheck(),this.selectedCheckerDefinition=n.shippingEligibilityCheckers.find(i=>i.code===(t.checker&&t.checker.code)),this.selectedCalculatorDefinition=n.shippingCalculators.find(i=>i.code===(t.calculator&&t.calculator.code))}),this.activeChannel$=this.dataService.settings.getActiveChannel().mapStream(n=>n.activeChannel),this.testResult$=this.fetchTestResult$.pipe((0,v.w)(([n,t])=>{if(!this.selectedChecker||!this.selectedCalculator)return(0,Ge.of)(void 0);const i=this.detailForm.value,r={shippingAddress:Object.assign(Object.assign({},n),{streetLine1:"test"}),lines:t.map(l=>({productVariantId:l.id,quantity:l.quantity})),checker:(0,s.RnJ)(this.selectedChecker,i.checker),calculator:(0,s.RnJ)(this.selectedCalculator,i.calculator)};return this.dataService.shippingMethod.testShippingMethod(r).mapSingle(l=>l.testShippingMethod)})),(0,eo.T)(this.detailForm.get(["checker"]).valueChanges,this.detailForm.get(["calculator"]).valueChanges).pipe((0,to.R)(this.destroy$)).subscribe(()=>this.testDataUpdated=!0)}ngOnDestroy(){this.destroy()}updateCode(n,t){if(!n){const i=this.detailForm.get(["code"]);i&&i.pristine&&i.setValue((0,Ie.U)(t,"-"))}}selectChecker(n){this.selectedCheckerDefinition=n,this.selectedChecker=(0,s.miO)(n);const t=this.detailForm.get("checker");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedChecker)),this.detailForm.markAsDirty()}selectCalculator(n){this.selectedCalculatorDefinition=n,this.selectedCalculator=(0,s.miO)(n);const t=this.detailForm.get("calculator");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedCalculator)),this.detailForm.markAsDirty()}create(){const n=this.selectedChecker,t=this.selectedCalculator;!n||!t||(0,w.a)([this.entity$,this.languageCode$]).pipe((0,F.q)(1),(0,T.z)(([i,r])=>{const l=this.detailForm.value,d=Object.assign(Object.assign({},this.getUpdatedShippingMethod(i,this.detailForm,r)),{checker:(0,s.RnJ)(n,l.checker),calculator:(0,s.RnJ)(t,l.calculator)});return this.dataService.shippingMethod.createShippingMethod(d)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"ShippingMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createShippingMethod.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"ShippingMethod"})})}save(){const n=this.selectedChecker,t=this.selectedCalculator;!n||!t||(0,w.a)([this.entity$,this.languageCode$]).pipe((0,F.q)(1),(0,T.z)(([i,r])=>{const l=this.detailForm.value,d=Object.assign(Object.assign({},this.getUpdatedShippingMethod(i,this.detailForm,r)),{checker:(0,s.RnJ)(n,l.checker),calculator:(0,s.RnJ)(t,l.calculator)});return this.dataService.shippingMethod.updateShippingMethod(d)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"ShippingMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},i=>{console.error(i),this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"ShippingMethod"})})}setTestOrderLines(n){this.testOrderLines=n,this.testDataUpdated=!0}setTestAddress(n){this.testAddress=n,this.testDataUpdated=!0}allTestDataPresent(){return!!(this.testAddress&&this.testOrderLines&&this.testOrderLines.length&&this.selectedChecker&&this.selectedCalculator)}runTest(){this.fetchTestResult$.next([this.testAddress,this.testOrderLines]),this.testDataUpdated=!1}getUpdatedShippingMethod(n,t,i){const r=t.value,l=(0,s.iSy)({translatable:n,updatedFields:r,customFieldConfig:this.customFields,languageCode:i,defaultTranslation:{languageCode:i,name:n.name||"",description:n.description||""}});return Object.assign(Object.assign({},l),{fulfillmentHandler:r.fulfillmentHandler})}setFormValues(n,t){var i,r,l,d;const h=(0,s.ZIM)(n,t);this.detailForm.patchValue({name:null!==(i=null==h?void 0:h.name)&&void 0!==i?i:"",description:null!==(r=null==h?void 0:h.description)&&void 0!==r?r:"",code:n.code,fulfillmentHandler:n.fulfillmentHandlerCode,checker:n.checker||{},calculator:n.calculator||{}}),this.selectedChecker||(this.selectedChecker=n.checker&&{code:n.checker.code,args:n.checker.args.map(f=>Object.assign(Object.assign({},f),{value:(0,s.sux)(f.value)}))}),this.selectedCalculator||(this.selectedCalculator=n.calculator&&{code:null===(l=n.calculator)||void 0===l?void 0:l.code,args:null===(d=n.calculator)||void 0===d?void 0:d.args.map(f=>Object.assign(Object.assign({},f),{value:(0,s.sux)(f.value)}))}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,h)}}Ce.\u0275fac=function(n){return new(n||Ce)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},Ce.\u0275cmp=e.Xpm({type:Ce,selectors:[["vdr-shipping-method-detail"]],features:[e.qOj],decls:23,vars:22,consts:[[3,"entity"],[3,"disabled","availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","shipping-method-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],["class","form",3,"formGroup",4,"ngIf"],[1,"testing-tool"],[4,"clrIfExpanded"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],["formControlName","description",3,"readonly","label"],["for","fulfillmentHandler",1,"mb2",3,"label"],["name","fulfillmentHandler","formControlName","fulfillmentHandler",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","customFields",4,"ngIf"],["locationId","shipping-method-detail",3,"entity$","detailForm"],[1,"clr-row","mt4"],[1,"clr-col"],[1,"clr-control-label"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[4,"ngIf"],["formControlName","calculator",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[3,"value"],["formGroupName","customFields"],["entityName","ShippingMethod",3,"customFields","customFieldsFormGroup","readonly"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],["formControlName","calculator",3,"operation","operationDefinition","readonly","remove"],[1,"clr-row"],[3,"orderLinesChange"],[3,"addressChange"],[3,"currencyCode","okToRun","testDataUpdated","testResult","runTest"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.TgZ(4,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,ho,3,4,"button",3),e.ALo(11,"async"),e.YNc(12,bo,1,1,"ng-template",null,4,e.W1O),e.qZA()(),e.YNc(14,Fo,33,42,"form",5),e.ALo(15,"async"),e.TgZ(16,"div",6)(17,"clr-accordion")(18,"clr-accordion-panel")(19,"clr-accordion-title"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.YNc(22,Jo,9,8,"clr-accordion-content",7),e.qZA()()()),2&n){const i=e.MAs(13);e.xp6(2),e.Q6J("entity",e.lcZ(3,8,t.entity$)),e.xp6(2),e.Q6J("disabled",e.lcZ(5,10,t.isNew$))("availableLanguageCodes",e.lcZ(6,12,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,14,t.languageCode$)),e.xp6(6),e.Q6J("ngIf",e.lcZ(11,16,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",e.lcZ(15,18,t.entity$)),e.xp6(6),e.Oqu(e.lcZ(21,20,"settings.test-shipping-method"))}},directives:[_.Kk,_.BN,U.V,De.S,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,je.Y,a.EJ,R.x,p.sg,a.YN,a.Kr,a.x0,u.MgK,I.y,O.C,ze.q,D.J,S.U,u.qvL,k.N,P.H,u.bZL,u.twP,u.GmI,u.dxz,u.UJ5,u.Nz$,u.DbV,u.r6y,E,H,Ze],pipes:[p.Ov,b.X$,Z.j],styles:[".testing-tool[_ngcontent-%COMP%]{margin-top:48px;margin-bottom:128px}.testing-tool[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});const qo=function(){return["./create"]};function Do(o,n){1&o&&(e.TgZ(0,"a",6),e._UZ(1,"clr-icon",7),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,qo)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-shipping-method")," "))}const So=function(o){return["./",o]},ko=function(){return["DeleteSettings","DeleteShippingMethod"]};function Po(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",8),e._uU(1),e.qZA(),e.TgZ(2,"td",8),e._uU(3),e.qZA(),e.TgZ(4,"td",9),e._UZ(5,"vdr-table-row-action",10),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",9)(8,"vdr-dropdown")(9,"button",11),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",12),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",13)(14,"button",14),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteShippingMethod(l.id)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",15),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,So,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,ko))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}function Uo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"div",16)(2,"div",17)(3,"vdr-test-order-builder",18),e.NdJ("orderLinesChange",function(r){return e.CHM(t),e.oxw().setTestOrderLines(r)}),e.qZA()(),e.TgZ(4,"div",17)(5,"vdr-test-address-form",19),e.NdJ("addressChange",function(r){return e.CHM(t),e.oxw().setTestAddress(r)}),e.qZA(),e.TgZ(6,"vdr-shipping-eligibility-test-result",20),e.NdJ("runTest",function(){return e.CHM(t),e.oxw().runTest()}),e.ALo(7,"async"),e.ALo(8,"async"),e.qZA()()()()}if(2&o){const t=e.oxw();let i;e.xp6(6),e.Q6J("currencyCode",null==(i=e.lcZ(7,4,t.activeChannel$))?null:i.currencyCode)("okToRun",t.allTestDataPresent())("testDataUpdated",t.testDataUpdated)("testResult",e.lcZ(8,6,t.testResult$))}}const Io=function(){return["CreateSettings","CreateShippingMethod"]};class ye extends s.t7C{constructor(n,t,i,r,l,d){super(l,d),this.modalService=n,this.notificationService=t,this.dataService=i,this.serverConfigService=r,this.testDataUpdated=!1,this.fetchTestResult$=new qe.x,super.setQueryFn((...h)=>this.dataService.shippingMethod.getShippingMethods(...h).refetchOnChannelChange(),h=>h.shippingMethods)}ngOnInit(){super.ngOnInit(),this.testResult$=this.fetchTestResult$.pipe((0,v.w)(([n,t])=>{const i={shippingAddress:Object.assign(Object.assign({},n),{streetLine1:"test"}),lines:t.map(r=>({productVariantId:r.id,quantity:r.quantity}))};return this.dataService.shippingMethod.testEligibleShippingMethods(i).mapSingle(r=>r.testEligibleShippingMethods)})),this.activeChannel$=this.dataService.settings.getActiveChannel().mapStream(n=>n.activeChannel),this.availableLanguages$=this.serverConfigService.getAvailableLanguages(),this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:n})=>n.contentLanguage).pipe((0,Se.b)(()=>this.refresh()))}deleteShippingMethod(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-shipping-method"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.shippingMethod.deleteShippingMethod(n):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"ShippingMethod"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"ShippingMethod"})})}setTestOrderLines(n){this.testOrderLines=n,this.testDataUpdated=!0}setTestAddress(n){this.testAddress=n,this.testDataUpdated=!0}allTestDataPresent(){return!!(this.testAddress&&this.testOrderLines&&this.testOrderLines.length)}runTest(){this.fetchTestResult$.next([this.testAddress,this.testOrderLines]),this.testDataUpdated=!1}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}}function No(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Mo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Oo(o,n){if(1&o&&e.YNc(0,Mo,3,4,"button",12),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function wo(o,n){if(1&o&&(e.TgZ(0,"section",13)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",14),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}ye.\u0275fac=function(n){return new(n||ye)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(s.iHG),e.Y36(g.F0),e.Y36(g.gz))},ye.\u0275cmp=e.Xpm({type:ye,selectors:[["vdr-shipping-method-list"]],features:[e.qOj],decls:29,vars:29,consts:[[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","shipping-method-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"testing-tool"],[4,"clrIfExpanded"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[1,"clr-row"],[1,"clr-col"],[3,"orderLinesChange"],[3,"addressChange"],[3,"currencyCode","okToRun","testDataUpdated","testResult","runTest"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"vdr-language-selector",0),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()(),e.TgZ(5,"vdr-ab-right"),e._UZ(6,"vdr-action-bar-items",1),e.YNc(7,Do,4,5,"a",2),e.qZA()(),e.TgZ(8,"vdr-data-table",3),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(9,"async"),e.ALo(10,"async"),e.ALo(11,"async"),e.ALo(12,"async"),e.TgZ(13,"vdr-dt-column"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dt-column"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e._UZ(19,"vdr-dt-column")(20,"vdr-dt-column"),e.YNc(21,Po,19,18,"ng-template"),e.qZA(),e.TgZ(22,"div",4)(23,"clr-accordion")(24,"clr-accordion-panel")(25,"clr-accordion-title"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.YNc(28,Uo,9,8,"clr-accordion-content",5),e.qZA()()()),2&n&&(e.xp6(2),e.Q6J("availableLanguageCodes",e.lcZ(3,10,t.availableLanguages$))("currentLanguageCode",e.lcZ(4,12,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(28,Io)),e.xp6(1),e.Q6J("items",e.lcZ(9,14,t.items$))("itemsPerPage",e.lcZ(10,16,t.itemsPerPage$))("totalItems",e.lcZ(11,18,t.totalItems$))("currentPage",e.lcZ(12,20,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(15,22,"common.code")),e.xp6(3),e.Oqu(e.lcZ(18,24,"common.name")),e.xp6(9),e.Oqu(e.lcZ(27,26,"settings.test-shipping-methods")))},directives:[_.Kk,_.BN,De.S,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H,u.bZL,u.twP,u.GmI,u.dxz,u.UJ5,u.Nz$,u.DbV,u.r6y,E,H,ve],pipes:[p.Ov,b.X$,Z.j],styles:[".testing-tool[_ngcontent-%COMP%]{margin-top:48px}"],changeDetection:0});class xe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateTaxCategory],this.customFields=this.getCustomFieldConfig("TaxCategory"),this.detailForm=this.formBuilder.group({name:["",a.kI.required],isDefault:!1,customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.taxCategory$=this.entity$}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={name:n.name,isDefault:n.isDefault,customFields:n.customFields};this.dataService.settings.createTaxCategory(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"TaxCategory"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createTaxCategory.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"TaxCategory"})})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.taxCategory$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,name:n.name,isDefault:n.isDefault,customFields:n.customFields};return this.dataService.settings.updateTaxCategory(i)})).subscribe(t=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"TaxCategory"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"TaxCategory"})})}setFormValues(n,t){this.detailForm.patchValue({name:n.name,isDefault:n.isDefault}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}xe.\u0275fac=function(n){return new(n||xe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},xe.\u0275cmp=e.Xpm({type:xe,selectors:[["vdr-tax-detail"]],features:[e.qOj],decls:22,vars:23,consts:[[3,"entity"],["locationId","tax-category-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","isDefault",3,"label"],["type","checkbox","clrToggle","","id","isDefault","formControlName","isDefault",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","tax-category-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["formGroupName","customFields"],["entityName","TaxCategory",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,No,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Oo,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.TgZ(17,"clr-toggle-wrapper"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA()(),e.YNc(20,wo,6,8,"section",9),e._UZ(21,"vdr-custom-detail-component-host",10),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,11,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,13,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,15,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,17,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,19,"common.default-tax-category")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(19,21,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Qo=function(){return["./create"]};function Ro(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Qo)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-tax-category")," "))}function Yo(o,n){1&o&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.default-tax-category")))}const $o=function(o){return["./",o]},jo=function(){return["DeleteSettings","DeleteTaxCategory"]};function zo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e.YNc(3,Yo,3,3,"vdr-chip",6),e.qZA(),e.TgZ(4,"td",7),e._UZ(5,"vdr-table-row-action",8),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",7)(8,"vdr-dropdown")(9,"button",9),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",10),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",11)(14,"button",12),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteTaxCategory(l)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",13),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",t.isDefault),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,$o,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,jo))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}const Eo=function(){return["CreateSettings","CreateTaxCategory"]};class Te{constructor(n,t,i){this.dataService=n,this.notificationService=t,this.modalService=i,this.queryResult=this.dataService.settings.getTaxCategories(),this.taxCategories$=this.queryResult.mapStream(r=>r.taxCategories)}deleteTaxCategory(n){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-tax-category"),body:n.name,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteTaxCategory(n.id):J.E),(0,L.U)(t=>t.deleteTaxCategory)).subscribe(t=>{t.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"TaxRate"}),this.queryResult.ref.refetch()):this.notificationService.error(t.message||(0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})})}}Te.\u0275fac=function(n){return new(n||Te)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U))},Te.\u0275cmp=e.Xpm({type:Te,selectors:[["vdr-tax-list"]],decls:13,vars:8,consts:[["locationId","tax-category-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[4,"ngIf"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,Ro,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.ALo(5,"async"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"vdr-dt-column")(10,"vdr-dt-column")(11,"vdr-dt-column"),e.YNc(12,zo,19,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(7,Eo)),e.xp6(1),e.Q6J("items",e.lcZ(5,3,t.taxCategories$)),e.xp6(3),e.Oqu(e.lcZ(8,5,"common.name")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.O5,Pe.Y,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});var Ho=m(7122);function Go(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Vo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Bo(o,n){if(1&o&&e.YNc(0,Vo,3,4,"button",20),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function Ko(o,n){if(1&o&&(e.TgZ(0,"option",21),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.hij(" ",t.name," ")}}function Wo(o,n){if(1&o&&(e.TgZ(0,"option",21),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Xo(o,n){if(1&o&&(e.TgZ(0,"section",22)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",23),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class Ae extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateTaxRate],this.customFields=this.getCustomFieldConfig("TaxRate"),this.detailForm=this.formBuilder.group({name:["",a.kI.required],enabled:[!0],value:[0,a.kI.required],taxCategoryId:[""],zoneId:[""],customerGroupId:[""],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.taxCategories$=this.dataService.settings.getTaxCategories().mapSingle(n=>n.taxCategories),this.zones$=this.dataService.settings.getZones().mapSingle(n=>n.zones)}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={name:n.name,enabled:n.enabled,value:n.value,categoryId:n.taxCategoryId,zoneId:n.zoneId,customerGroupId:n.customerGroupId,customFields:n.customFields};this.dataService.settings.createTaxRate(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"TaxRate"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createTaxRate.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"TaxRate"})})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.entity$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,name:n.name,enabled:n.enabled,value:n.value,categoryId:n.taxCategoryId,zoneId:n.zoneId,customerGroupId:n.customerGroupId,customFields:n.customFields};return this.dataService.settings.updateTaxRate(i)})).subscribe(t=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"TaxRate"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"TaxRate"})})}setFormValues(n,t){this.detailForm.patchValue({name:n.name,enabled:n.enabled,value:n.value,taxCategoryId:n.category?n.category.id:"",zoneId:n.zone?n.zone.id:"",customerGroupId:n.customerGroup?n.customerGroup.id:""}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}Ae.\u0275fac=function(n){return new(n||Ae)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},Ae.\u0275cmp=e.Xpm({type:Ae,selectors:[["vdr-tax-rate-detail"]],features:[e.qOj],decls:39,vars:47,consts:[[3,"entity"],["locationId","tax-rate-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","enabled",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["for","value",3,"label"],["suffix","%"],["id","value","type","number","step","0.1","formControlName","value",3,"readonly"],["for","taxCategoryId",3,"label"],["clrSelect","","name","taxCategoryId","formControlName","taxCategoryId",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["for","zoneId",3,"label"],["clrSelect","","name","zoneId","formControlName","zoneId",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","tax-rate-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"value"],["formGroupName","customFields"],["entityName","TaxRate",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,Go,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Bo,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.TgZ(17,"clr-toggle-wrapper"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA()(),e.TgZ(20,"vdr-form-field",9),e.ALo(21,"translate"),e.TgZ(22,"vdr-affixed-input",10),e._UZ(23,"input",11),e.ALo(24,"hasPermission"),e.qZA()(),e.TgZ(25,"vdr-form-field",12),e.ALo(26,"translate"),e.TgZ(27,"select",13),e.ALo(28,"hasPermission"),e.YNc(29,Ko,2,2,"option",14),e.ALo(30,"async"),e.qZA()(),e.TgZ(31,"vdr-form-field",15),e.ALo(32,"translate"),e.TgZ(33,"select",16),e.ALo(34,"hasPermission"),e.YNc(35,Wo,2,2,"option",14),e.ALo(36,"async"),e.qZA()(),e.YNc(37,Xo,6,8,"section",17),e._UZ(38,"vdr-custom-detail-component-host",18),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,19,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,21,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,23,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,25,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,27,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(19,29,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(21,31,"settings.rate")),e.xp6(3),e.Q6J("readonly",!e.lcZ(24,33,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(26,35,"settings.tax-category")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(28,37,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(30,39,t.taxCategories$)),e.xp6(2),e.Q6J("label",e.lcZ(32,41,"settings.zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(34,43,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(36,45,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,Ho.K,a.wV,a.EJ,u.otW,p.sg,a.YN,a.Kr,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const ei=function(){return["./create"]};function ti(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,ei)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-tax-rate")," "))}const ni=function(o){return["./",o]},oi=function(){return["DeleteSettings","DeleteTaxRate"]};function ii(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._uU(5),e.qZA(),e.TgZ(6,"td",5),e._uU(7),e.qZA(),e.TgZ(8,"td",6),e._UZ(9,"vdr-table-row-action",7),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"td",6)(12,"vdr-dropdown")(13,"button",8),e._uU(14),e.ALo(15,"translate"),e._UZ(16,"clr-icon",9),e.qZA(),e.TgZ(17,"vdr-dropdown-menu",10)(18,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteTaxRate(l)}),e.ALo(19,"hasPermission"),e._UZ(20,"clr-icon",12),e._uU(21),e.ALo(22,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Oqu(t.category.name),e.xp6(2),e.Oqu(t.zone.name),e.xp6(2),e.hij("",t.value,"%"),e.xp6(2),e.Q6J("label",e.lcZ(10,9,"common.edit"))("linkTo",e.VKq(17,ni,t.id)),e.xp6(5),e.hij(" ",e.lcZ(15,11,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(19,13,e.DdM(19,oi))),e.xp6(3),e.hij(" ",e.lcZ(22,15,"common.delete")," ")}}const ri=function(){return["CreateSettings","CreateTaxRate"]};class Le extends s.t7C{constructor(n,t,i,r,l){super(r,l),this.modalService=n,this.notificationService=t,this.dataService=i,super.setQueryFn((...d)=>this.dataService.settings.getTaxRates(...d),d=>d.taxRates)}deleteTaxRate(n){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-tax-rate"),body:n.name,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteTaxRate(n.id):J.E),(0,L.U)(t=>t.deleteTaxRate)).subscribe(t=>{t.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"TaxRate"}),this.refresh()):this.notificationService.error(t.message||(0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})})}}function si(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.update-zone")))}function ai(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.create-zone")))}function li(o,n){if(1&o&&(e.YNc(0,si,3,3,"span",6),e.YNc(1,ai,3,3,"span",6)),2&o){const t=e.oxw();e.Q6J("ngIf",t.zone.id),e.xp6(1),e.Q6J("ngIf",!t.zone.id)}}function ci(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.update-zone")))}function di(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.create-zone")))}function mi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e.YNc(4,ci,3,3,"span",6),e.YNc(5,di,3,3,"span",6),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.form.invalid),e.xp6(1),e.Q6J("ngIf",t.zone.id),e.xp6(1),e.Q6J("ngIf",!t.zone.id)}}Le.\u0275fac=function(n){return new(n||Le)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz))},Le.\u0275cmp=e.Xpm({type:Le,selectors:[["vdr-tax-rate-list"]],features:[e.qOj],decls:24,vars:26,consts:[["locationId","tax-rate-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,ti,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e._UZ(21,"vdr-dt-column")(22,"vdr-dt-column"),e.YNc(23,ii,23,20,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(25,ri)),e.xp6(1),e.Q6J("items",e.lcZ(5,9,t.items$))("itemsPerPage",e.lcZ(6,11,t.itemsPerPage$))("totalItems",e.lcZ(7,13,t.totalItems$))("currentPage",e.lcZ(8,15,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,17,"common.name")),e.xp6(3),e.Oqu(e.lcZ(14,19,"settings.tax-category")),e.xp6(3),e.Oqu(e.lcZ(17,21,"settings.zone")),e.xp6(3),e.Oqu(e.lcZ(20,23,"settings.tax-rate")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});const Ve=function(){return["UpdateSettings","UpdateZone"]};class G{constructor(n,t){this.serverConfigService=n,this.formBuilder=t,this.customFields=this.serverConfigService.getCustomFieldsFor("CustomerGroup")}ngOnInit(){var n;if(this.form=this.formBuilder.group({name:[this.zone.name,a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,i)=>Object.assign(Object.assign({},t),{[i.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const i of this.customFields){const r=i.name,l=null===(n=this.zone.customFields)||void 0===n?void 0:n[r],d=t.get(r);d&&d.patchValue(l)}}}cancel(){this.resolveWith()}save(){this.resolveWith(this.form.value)}}G.\u0275fac=function(n){return new(n||G)(e.Y36(s.iHG),e.Y36(a.qu))},G.\u0275cmp=e.Xpm({type:G,selectors:[["vdr-zone-detail-dialog"]],decls:9,vars:14,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["entityName","Zone",3,"customFields","customFieldsFormGroup","readonly"],["vdrDialogButtons",""],[4,"ngIf"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,li,2,2,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"input",3),e.ALo(5,"hasPermission"),e.qZA(),e._UZ(6,"vdr-tabbed-custom-fields",4),e.ALo(7,"hasPermission"),e.qZA(),e.YNc(8,mi,6,6,"ng-template",5)),2&n&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,6,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(5,8,e.DdM(12,Ve))),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.form.get("customFields"))("readonly",!e.lcZ(7,10,e.DdM(13,Ve))))},directives:[Oe.q,p.O5,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,I.y,we.n],pipes:[b.X$,Z.j],styles:[""],changeDetection:0});var ui=m(8977),pi=m(73);function gi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&o&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"settings.create-new-zone")," "))}const _i=function(o){return{contents:o}},hi=function(o){return["./",o]},fi=function(){return["DeleteSettings","DeleteZone"]};function bi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"tr"),e.ALo(1,"async"),e.TgZ(2,"td",11),e._UZ(3,"vdr-entity-info",12),e.qZA(),e.TgZ(4,"td",11)(5,"vdr-chip",13),e._uU(6),e.qZA()(),e.TgZ(7,"td",14)(8,"a",15),e._UZ(9,"clr-icon",16),e._uU(10),e.ALo(11,"translate"),e.qZA()(),e.TgZ(12,"td",17)(13,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().update(l)}),e._UZ(14,"clr-icon",19),e._uU(15),e.ALo(16,"translate"),e.qZA()(),e.TgZ(17,"td",17)(18,"vdr-dropdown")(19,"button",20),e._uU(20),e.ALo(21,"translate"),e._UZ(22,"clr-icon",21),e.qZA(),e.TgZ(23,"vdr-dropdown-menu",22)(24,"button",23),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().delete(l.id)}),e.ALo(25,"hasPermission"),e._UZ(26,"clr-icon",24),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&o){const t=n.$implicit,i=e.oxw();let r;e.ekj("active",t.id===(null==(r=e.lcZ(1,11,i.activeZone$))?null:r.id)),e.xp6(3),e.Q6J("entity",t),e.xp6(2),e.Q6J("colorFrom",t.name),e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Q6J("routerLink",e.VKq(25,hi,e.VKq(23,_i,t.id))),e.xp6(2),e.hij(" ",e.lcZ(11,13,"settings.view-zone-members")," "),e.xp6(5),e.hij(" ",e.lcZ(16,15,"common.edit")," "),e.xp6(5),e.hij(" ",e.lcZ(21,17,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(25,19,e.DdM(27,fi))),e.xp6(3),e.hij(" ",e.lcZ(28,21,"common.delete")," ")}}const vi=function(o){return{count:o}},Be=function(){return["UpdateSettings","UpdateZone"]},Zi=function(o){return{zoneName:o}};function Ci(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"div")(1,"div",28)(2,"div",29),e._uU(3),e.qZA(),e._UZ(4,"div",30),e.TgZ(5,"button",31),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).closeMembers()}),e._UZ(6,"clr-icon",32),e.qZA()(),e.TgZ(7,"div",33)(8,"vdr-dropdown")(9,"button",34),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",21),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",22)(14,"button",35),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().ngIf,l=e.oxw();return l.removeFromZone(r,l.selectedMemberIds)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",24),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"button",36),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().ngIf;return e.oxw().addToZone(r)}),e._uU(20),e.ALo(21,"translate"),e.qZA()()()}if(2&o){const t=e.oxw().ngIf,i=e.oxw();e.xp6(3),e.AsE(" ",t.name," (",t.members.length,") "),e.xp6(6),e.Q6J("disabled",0===i.selectedMemberIds.length),e.xp6(1),e.hij(" ",e.xi3(11,7,"common.with-selected",e.VKq(17,vi,i.selectedMemberIds.length))," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,10,e.DdM(19,Be))),e.xp6(3),e.hij(" ",e.lcZ(18,12,"settings.remove-from-zone")," "),e.xp6(3),e.hij(" ",e.xi3(21,14,"settings.add-countries-to-zone",e.VKq(20,Zi,t.name))," ")}}const yi=function(o){return["/settings","countries",o]};function xi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",20),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"clr-icon",21),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",22)(7,"a",37),e._UZ(8,"clr-icon",19),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"button",35),e.NdJ("click",function(){const l=e.CHM(t).member,d=e.oxw().ngIf;return e.oxw().removeFromZone(d,[l.id])}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",24),e._uU(14),e.ALo(15,"translate"),e.qZA()()()()}if(2&o){const t=n.member;e.xp6(3),e.hij(" ",e.lcZ(4,5,"common.actions")," "),e.xp6(4),e.Q6J("routerLink",e.VKq(13,yi,t.id)),e.xp6(2),e.hij(" ",e.lcZ(10,7,"common.edit")," "),e.xp6(2),e.Q6J("disabled",!e.lcZ(12,9,e.DdM(15,Be))),e.xp6(3),e.hij(" ",e.lcZ(15,11,"settings.remove-from-zone")," ")}}function Ti(o,n){if(1&o){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-zone-member-list",25),e.NdJ("selectionChange",function(r){e.CHM(t);return e.oxw().selectedMemberIds=r}),e.YNc(2,Ci,22,22,"div",26),e.YNc(3,xi,16,16,"div",27),e.qZA(),e.BQk()}if(2&o){const t=n.ngIf,i=e.oxw();e.xp6(1),e.Q6J("members",t.members)("selectedMemberIds",i.selectedMemberIds)}}const Ai=function(){return["CreateSettings","CreateZone"]};class Fe{constructor(n,t,i,r,l,d){this.dataService=n,this.notificationService=t,this.modalService=i,this.route=r,this.router=l,this.serverConfigService=d,this.selectedMemberIds=[]}ngOnInit(){const n=this.dataService.settings.getZones().ref;this.zones$=n.valueChanges.pipe((0,L.U)(i=>i.data.zones));const t=this.route.paramMap.pipe((0,L.U)(i=>i.get("contents")),(0,ui.x)(),(0,Se.b)(()=>this.selectedMemberIds=[]));this.activeZone$=(0,w.a)(this.zones$,t).pipe((0,L.U)(([i,r])=>{if(r)return i.find(l=>l.id===r)})),this.availableLanguages$=this.serverConfigService.getAvailableLanguages(),this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:i})=>i.contentLanguage).pipe((0,Se.b)(()=>n.refetch()))}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}create(){this.modalService.fromComponent(G,{locals:{zone:{name:""}}}).pipe((0,v.w)(n=>n?this.dataService.settings.createZone(Object.assign(Object.assign({},n),{memberIds:[]})):J.E),(0,v.w)(()=>this.dataService.settings.getZones().single$)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Zone"})},n=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Zone"})})}delete(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-zone"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteZone(n):J.E),(0,v.w)(t=>t.deleteZone.result===s.PcR.DELETED?this.dataService.settings.getZones().mapSingle(()=>({errorMessage:!1})):(0,Ge.of)({errorMessage:t.deleteZone.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Zone"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Zone"})})}update(n){this.modalService.fromComponent(G,{locals:{zone:n}}).pipe((0,v.w)(t=>t?this.dataService.settings.updateZone(Object.assign({id:n.id},t)):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Zone"})},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Zone"})})}closeMembers(){const n=Object.assign({},this.route.snapshot.params);delete n.contents,this.router.navigate(["./",n],{relativeTo:this.route,queryParamsHandling:"preserve"})}addToZone(n){this.modalService.fromComponent(re,{locals:{zoneName:n.name,currentMembers:n.members},size:"md"}).pipe((0,v.w)(t=>t?this.dataService.settings.addMembersToZone(n.id,t).pipe((0,pi.h)(t)):J.E)).subscribe({next:t=>{this.notificationService.success((0,c.J)("settings.add-countries-to-zone-success"),{countryCount:t.length,zoneName:n.name})},error:t=>{this.notificationService.error(t)}})}removeFromZone(n,t){this.dataService.settings.removeMembersFromZone(n.id,t).subscribe({complete:()=>{this.notificationService.success((0,c.J)("settings.remove-countries-from-zone-success"),{countryCount:t.length,zoneName:n.name})}})}}Fe.\u0275fac=function(n){return new(n||Fe)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U),e.Y36(g.gz),e.Y36(g.F0),e.Y36(s.iHG))},Fe.\u0275cmp=e.Xpm({type:Fe,selectors:[["vdr-zone-list"]],decls:18,vars:18,consts:[[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","zone-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"zone-wrapper"],[1,"zone-list"],[1,"table","mt0"],[3,"active",4,"ngFor","ngForOf"],[1,"zone-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],[1,"text-right","align-middle"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","trash",1,"is-danger"],[3,"members","selectedMemberIds","selectionChange"],[4,"vdrZoneMemberListHeader"],[4,"vdrZoneMemberControls"],[1,"flex"],[1,"header-title-row"],[1,"flex-spacer"],["type","button",1,"close-button",3,"click"],["shape","close"],[1,"controls"],["type","button","vdrDropdownTrigger","",1,"btn","btn-secondary","btn-sm",3,"disabled"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],[1,"btn","btn-secondary","btn-sm",3,"click"],["type","button","vdrDropdownItem","",3,"routerLink"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"vdr-language-selector",0),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()(),e.TgZ(5,"vdr-ab-right"),e._UZ(6,"vdr-action-bar-items",1),e.YNc(7,gi,4,3,"button",2),e.qZA()(),e.TgZ(8,"div",3)(9,"div",4)(10,"table",5)(11,"tbody"),e.YNc(12,bi,29,28,"tr",6),e.ALo(13,"async"),e.qZA()()(),e.TgZ(14,"div",7),e.ALo(15,"async"),e.YNc(16,Ti,4,2,"ng-container",8),e.ALo(17,"async"),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("availableLanguageCodes",e.lcZ(3,7,t.availableLanguages$))("currentLanguageCode",e.lcZ(4,9,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(17,Ai)),e.xp6(5),e.Q6J("ngForOf",e.lcZ(13,11,t.zones$)),e.xp6(2),e.ekj("expanded",e.lcZ(15,13,t.activeZone$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(17,15,t.activeZone$)))},directives:[_.Kk,_.BN,De.S,_.mz,C.W,x.H,u.qvL,p.sg,U.V,Pe.Y,g.yS,D.J,S.U,k.N,P.H,p.O5,j,$,Y],pipes:[p.Ov,b.X$,Z.j],styles:[".zone-wrapper[_ngcontent-%COMP%]{display:flex;height:calc(100% - 50px)}.zone-wrapper[_ngcontent-%COMP%] .zone-list[_ngcontent-%COMP%]{flex:1;overflow:auto;margin-top:0}.zone-wrapper[_ngcontent-%COMP%] .zone-list[_ngcontent-%COMP%] tr.active[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.zone-members[_ngcontent-%COMP%]{height:100%;width:0;opacity:0;visibility:hidden;overflow:auto;transition:width .3s,opacity .2s .3s,visibility 0s .3s}.zone-members.expanded[_ngcontent-%COMP%]{width:40vw;visibility:visible;opacity:1;padding-left:12px}.zone-members[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin:0;background:none;border:none;cursor:pointer}.zone-members[_ngcontent-%COMP%] table.table{margin-top:0}.zone-members[_ngcontent-%COMP%] table.table th{top:0}.zone-members[_ngcontent-%COMP%] .controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0});class V extends s.p_9{constructor(n,t){super(n,{__typename:"Administrator",id:"",createdAt:"",updatedAt:"",emailAddress:"",firstName:"",lastName:"",user:{roles:[]}},i=>t.administrator.getAdministrator(i).mapStream(r=>r.administrator))}}V.\u0275fac=function(n){return new(n||V)(e.LFG(g.F0),e.LFG(s.DoR))},V.\u0275prov=e.Yz7({token:V,factory:V.\u0275fac,providedIn:"root"});class B extends s.p_9{constructor(n,t){super(n,{__typename:"Channel",id:"",createdAt:"",updatedAt:"",code:"",token:"",pricesIncludeTax:!1,currencyCode:s.NEm.USD,defaultLanguageCode:(0,s.kAh)(),defaultShippingZone:{},defaultTaxZone:{}},i=>t.settings.getChannel(i).mapStream(r=>r.channel))}}B.\u0275fac=function(n){return new(n||B)(e.LFG(g.F0),e.LFG(s.DoR))},B.\u0275prov=e.Yz7({token:B,factory:B.\u0275fac,providedIn:"root"});class K extends s.p_9{constructor(n,t){super(n,{__typename:"Country",id:"",createdAt:"",updatedAt:"",code:"",name:"",enabled:!1,translations:[]},i=>t.settings.getCountry(i).mapStream(r=>r.country))}}K.\u0275fac=function(n){return new(n||K)(e.LFG(g.F0),e.LFG(s.DoR))},K.\u0275prov=e.Yz7({token:K,factory:K.\u0275fac,providedIn:"root"});class W extends s.p_9{constructor(n,t){super(n,{},()=>t.settings.getGlobalSettings().mapStream(i=>i.globalSettings))}}W.\u0275fac=function(n){return new(n||W)(e.LFG(g.F0),e.LFG(s.DoR))},W.\u0275prov=e.Yz7({token:W,factory:W.\u0275fac,providedIn:"root"});class X extends s.p_9{constructor(n,t){super(n,{__typename:"PaymentMethod",id:"",createdAt:"",updatedAt:"",name:"",code:"",description:"",enabled:!0,checker:void 0,handler:void 0},i=>t.settings.getPaymentMethod(i).mapStream(r=>r.paymentMethod))}}X.\u0275fac=function(n){return new(n||X)(e.LFG(g.F0),e.LFG(s.DoR))},X.\u0275prov=e.Yz7({token:X,factory:X.\u0275fac,providedIn:"root"});class ee extends s.p_9{constructor(n,t){super(n,{__typename:"Administrator",id:"",createdAt:"",updatedAt:"",emailAddress:"",firstName:"",lastName:"",user:{roles:[]}},i=>t.administrator.getActiveAdministrator().mapStream(r=>r.activeAdministrator))}}ee.\u0275fac=function(n){return new(n||ee)(e.LFG(g.F0),e.LFG(s.DoR))},ee.\u0275prov=e.Yz7({token:ee,factory:ee.\u0275fac,providedIn:"root"});class te extends s.p_9{constructor(n,t){super(n,{__typename:"Role",id:"",createdAt:"",updatedAt:"",code:"",description:"",permissions:[],channels:[]},i=>t.administrator.getRole(i).mapStream(r=>r.role))}}te.\u0275fac=function(n){return new(n||te)(e.LFG(g.F0),e.LFG(s.DoR))},te.\u0275prov=e.Yz7({token:te,factory:te.\u0275fac,providedIn:"root"});class ne extends s.p_9{constructor(n,t){super(n,{__typename:"ShippingMethod",createdAt:"",updatedAt:"",id:"",code:"",name:"",description:"",fulfillmentHandlerCode:void 0,checker:void 0,calculator:void 0,translations:[]},i=>t.shippingMethod.getShippingMethod(i).mapStream(r=>r.shippingMethod))}}ne.\u0275fac=function(n){return new(n||ne)(e.LFG(g.F0),e.LFG(s.DoR))},ne.\u0275prov=e.Yz7({token:ne,factory:ne.\u0275fac,providedIn:"root"});class oe extends s.p_9{constructor(n,t){super(n,{__typename:"TaxCategory",id:"",createdAt:"",updatedAt:"",name:"",isDefault:!1},i=>t.settings.getTaxCategory(i).mapStream(r=>r.taxCategory))}}oe.\u0275fac=function(n){return new(n||oe)(e.LFG(g.F0),e.LFG(s.DoR))},oe.\u0275prov=e.Yz7({token:oe,factory:oe.\u0275fac,providedIn:"root"});class ie extends s.p_9{constructor(n,t){super(n,{__typename:"TaxRate",id:"",createdAt:"",updatedAt:"",name:"",value:0,enabled:!0,category:{},zone:{},customerGroup:null},i=>t.settings.getTaxRate(i).mapStream(r=>r.taxRate))}}ie.\u0275fac=function(n){return new(n||ie)(e.LFG(g.F0),e.LFG(s.DoR))},ie.\u0275prov=e.Yz7({token:ie,factory:ie.\u0275fac,providedIn:"root"});const Ke=[{path:"profile",component:he,resolve:(0,s.Po4)(ee),canDeactivate:[s.TSp],data:{breadcrumb:(0,c.J)("breadcrumb.profile")}},{path:"administrators",component:le,data:{breadcrumb:(0,c.J)("breadcrumb.administrators")}},{path:"administrators/:id",component:ae,resolve:(0,s.Po4)(V),canDeactivate:[s.TSp],data:{breadcrumb:We}},{path:"channels",component:de,data:{breadcrumb:(0,c.J)("breadcrumb.channels")}},{path:"channels/:id",component:ce,resolve:(0,s.Po4)(B),canDeactivate:[s.TSp],data:{breadcrumb:Xe}},{path:"roles",component:be,data:{breadcrumb:(0,c.J)("breadcrumb.roles")}},{path:"roles/:id",component:fe,resolve:(0,s.Po4)(te),canDeactivate:[s.TSp],data:{breadcrumb:et}},{path:"tax-categories",component:Te,data:{breadcrumb:(0,c.J)("breadcrumb.tax-categories")}},{path:"tax-categories/:id",component:xe,resolve:(0,s.Po4)(oe),canDeactivate:[s.TSp],data:{breadcrumb:tt}},{path:"tax-rates",component:Le,data:{breadcrumb:(0,c.J)("breadcrumb.tax-rates")}},{path:"tax-rates/:id",component:Ae,resolve:(0,s.Po4)(ie),canDeactivate:[s.TSp],data:{breadcrumb:nt}},{path:"countries",component:ue,data:{breadcrumb:(0,c.J)("breadcrumb.countries")}},{path:"countries/:id",component:me,resolve:(0,s.Po4)(K),canDeactivate:[s.TSp],data:{breadcrumb:ot}},{path:"zones",component:Fe,data:{breadcrumb:(0,c.J)("breadcrumb.zones")}},{path:"shipping-methods",component:ye,data:{breadcrumb:(0,c.J)("breadcrumb.shipping-methods")}},{path:"shipping-methods/:id",component:Ce,resolve:(0,s.Po4)(ne),canDeactivate:[s.TSp],data:{breadcrumb:it}},{path:"payment-methods",component:_e,data:{breadcrumb:(0,c.J)("breadcrumb.payment-methods")}},{path:"payment-methods/:id",component:ge,resolve:(0,s.Po4)(X),canDeactivate:[s.TSp],data:{breadcrumb:rt}},{path:"global-settings",component:pe,resolve:(0,s.Po4)(W),canDeactivate:[s.TSp],data:{breadcrumb:(0,c.J)("breadcrumb.global-settings")}}];function We(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.administrators",getName:t=>`${t.firstName} ${t.lastName}`,route:"administrators"})}function Xe(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.channels",getName:t=>t.code,route:"channels"})}function et(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.roles",getName:t=>t.description,route:"roles"})}function tt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.tax-categories",getName:t=>t.name,route:"tax-categories"})}function nt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.tax-rates",getName:t=>t.name,route:"tax-rates"})}function ot(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.countries",getName:t=>t.name,route:"countries"})}function it(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.shipping-methods",getName:t=>t.name,route:"shipping-methods"})}function rt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.payment-methods",getName:t=>t.code,route:"payment-methods"})}class Je{}Je.\u0275fac=function(n){return new(n||Je)},Je.\u0275mod=e.oAB({type:Je}),Je.\u0275inj=e.cJS({imports:[[s.m81,g.Bz.forChild(Ke)]]})}}]);
|
|
2
|
-
//# sourceMappingURL=26.
|
|
1
|
+
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[26],{9026:(Li,Me,m)=>{m.r(Me),m.d(Me,{AddCountryToZoneDialogComponent:()=>re,AdminDetailComponent:()=>ae,AdministratorListComponent:()=>le,AdministratorResolver:()=>V,ChannelDetailComponent:()=>ce,ChannelListComponent:()=>de,ChannelResolver:()=>B,CountryDetailComponent:()=>me,CountryListComponent:()=>ue,CountryResolver:()=>K,GlobalSettingsComponent:()=>pe,GlobalSettingsResolver:()=>W,PaymentMethodDetailComponent:()=>ge,PaymentMethodListComponent:()=>_e,PaymentMethodResolver:()=>X,PermissionGridComponent:()=>z,ProfileComponent:()=>he,ProfileResolver:()=>ee,RoleDetailComponent:()=>fe,RoleListComponent:()=>be,RoleResolver:()=>te,SettingsModule:()=>Je,ShippingEligibilityTestResultComponent:()=>ve,ShippingMethodDetailComponent:()=>Ce,ShippingMethodListComponent:()=>ye,ShippingMethodResolver:()=>ne,ShippingMethodTestResultComponent:()=>Ze,TaxCategoryDetailComponent:()=>xe,TaxCategoryListComponent:()=>Te,TaxCategoryResolver:()=>oe,TaxRateDetailComponent:()=>Ae,TaxRateListComponent:()=>Le,TaxRateResolver:()=>ie,TestAddressFormComponent:()=>H,TestOrderBuilderComponent:()=>E,ZoneDetailDialogComponent:()=>G,ZoneListComponent:()=>Fe,ZoneMemberControlsDirective:()=>Y,ZoneMemberListComponent:()=>j,ZoneMemberListHeaderDirective:()=>$,administratorBreadcrumb:()=>We,channelBreadcrumb:()=>Xe,countryBreadcrumb:()=>ot,paymentMethodBreadcrumb:()=>rt,roleBreadcrumb:()=>et,settingsRoutes:()=>Ke,shippingMethodBreadcrumb:()=>it,taxCategoryBreadcrumb:()=>tt,taxRateBreadcrumb:()=>nt});var L=m(635),e=m(3184),s=m(8098),Oe=m(309);class Y{constructor(n){this.templateRef=n}}Y.\u0275fac=function(n){return new(n||Y)(e.Y36(e.Rgc))},Y.\u0275dir=e.lG2({type:Y,selectors:[["","vdrZoneMemberControls",""]]});class ${constructor(n){this.templateRef=n}}$.\u0275fac=function(n){return new(n||$)(e.Y36(e.Rgc))},$.\u0275dir=e.lG2({type:$,selectors:[["","vdrZoneMemberListHeader",""]]});var p=m(6362),A=m(7890),a=m(587),N=m(365),M=m(901),u=m(2748),b=m(7514),Z=m(7388);function st(o,n){1&o&&e.GkF(0)}function at(o,n){if(1&o&&(e.ynx(0),e.YNc(1,st,1,0,"ng-container",4),e.BQk()),2&o){const t=e.oxw();e.xp6(1),e.Q6J("ngTemplateOutlet",t.headerTemplate.templateRef)}}function lt(o,n){1&o&&e.GkF(0)}const ct=function(o){return{member:o}};function dt(o,n){if(1&o&&(e.ynx(0),e.YNc(1,lt,1,0,"ng-container",7),e.BQk()),2&o){const t=e.oxw().item,i=e.oxw();e.xp6(1),e.Q6J("ngTemplateOutlet",i.controlsTemplate.templateRef)("ngTemplateOutletContext",e.VKq(2,ct,t))}}function mt(o,n){if(1&o&&(e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._UZ(5,"clr-icon"),e.qZA(),e.TgZ(6,"td",6),e.YNc(7,dt,2,4,"ng-container",1),e.qZA()),2&o){const t=n.item,i=e.oxw();e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.ekj("is-success",t.enabled),e.uIk("shape",t.enabled?"check":"times"),e.xp6(2),e.Q6J("ngIf",i.controlsTemplate)}}const ut=function(){return["UpdateSettings","UpdateZone"]};class j{constructor(){this.members=[],this.selectedMemberIds=[],this.selectionChange=new e.vpe,this.filterTerm="",this.isMemberSelected=n=>-1<this.selectedMemberIds.indexOf(n.id)}filteredMembers(){if(""!==this.filterTerm){const n=this.filterTerm.toLocaleLowerCase();return this.members.filter(t=>t.name.toLocaleLowerCase().includes(n)||t.code.toLocaleLowerCase().includes(n))}return this.members}areAllSelected(){return!!this.members&&this.selectedMemberIds.length===this.members.length}toggleSelectAll(){this.areAllSelected()?this.selectionChange.emit([]):this.selectionChange.emit(this.members.map(n=>n.id))}toggleSelectMember({item:n}){this.selectedMemberIds.includes(n.id)?this.selectionChange.emit(this.selectedMemberIds.filter(t=>t!==n.id)):this.selectionChange.emit([...this.selectedMemberIds,n.id])}}j.\u0275fac=function(n){return new(n||j)},j.\u0275cmp=e.Xpm({type:j,selectors:[["vdr-zone-member-list"]],contentQueries:function(n,t,i){if(1&n&&(e.Suo(i,$,5),e.Suo(i,Y,5)),2&n){let r;e.iGM(r=e.CRH())&&(t.headerTemplate=r.first),e.iGM(r=e.CRH())&&(t.controlsTemplate=r.first)}},inputs:{members:"members",selectedMemberIds:"selectedMemberIds"},outputs:{selectionChange:"selectionChange"},decls:17,vars:20,consts:[[1,"members-header"],[4,"ngIf"],["type","text",3,"placeholder","ngModel","ngModelChange"],[3,"items","allSelected","isRowSelectedFn","rowSelectChange","allSelectChange"],[4,"ngTemplateOutlet"],[1,"left","align-middle"],[1,"right","align-middle"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.YNc(1,at,2,1,"ng-container",1),e.TgZ(2,"input",2),e.NdJ("ngModelChange",function(r){return t.filterTerm=r}),e.ALo(3,"translate"),e.qZA()(),e.TgZ(4,"vdr-data-table",3),e.NdJ("rowSelectChange",function(r){return t.toggleSelectMember(r)})("allSelectChange",function(){return t.toggleSelectAll()}),e.ALo(5,"hasPermission"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"vdr-dt-column"),e.YNc(16,mt,8,6,"ng-template"),e.qZA()),2&n&&(e.xp6(1),e.Q6J("ngIf",t.headerTemplate),e.xp6(1),e.Q6J("placeholder",e.lcZ(3,9,"settings.filter-by-member-name"))("ngModel",t.filterTerm),e.xp6(2),e.Q6J("items",t.filteredMembers())("allSelected",t.areAllSelected())("isRowSelectedFn",e.lcZ(5,11,e.DdM(19,ut))&&t.isMemberSelected),e.xp6(3),e.Oqu(e.lcZ(8,13,"common.code")),e.xp6(3),e.Oqu(e.lcZ(11,15,"common.name")),e.xp6(3),e.Oqu(e.lcZ(14,17,"common.enabled")))},directives:[p.O5,p.tP,A.y,a.Fj,a.JJ,a.On,N.Q,M.E,u.qvL],pipes:[b.X$,Z.j],styles:[".members-header[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100);position:sticky;top:0;padding:6px;z-index:5;border-bottom:1px solid var(--color-component-border-200)}.members-header[_ngcontent-%COMP%] .header-title-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.members-header[_ngcontent-%COMP%] .clr-input[_ngcontent-%COMP%]{width:100%}"],changeDetection:0});var we=m(8318);const Qe=function(o){return{zoneName:o}};function pt(o,n){if(1&o&&(e._uU(0),e.ALo(1,"translate")),2&o){const t=e.oxw();e.Oqu(e.xi3(1,1,"settings.add-countries-to-zone",e.VKq(4,Qe,t.zoneName)))}}function gt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",3),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedMemberIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"settings.add-countries-to-zone",e.VKq(8,Qe,t.zoneName))," ")}}class re{constructor(n){this.dataService=n,this.currentMembers=[],this.selectedMemberIds=[]}ngOnInit(){const n=this.currentMembers.map(t=>t.id);this.availableCountries$=this.dataService.settings.getCountries(999).mapStream(t=>t.countries.items).pipe((0,L.U)(t=>t.filter(i=>!n.includes(i.id))))}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedMemberIds)}}re.\u0275fac=function(n){return new(n||re)(e.Y36(s.DoR))},re.\u0275cmp=e.Xpm({type:re,selectors:[["vdr-add-country-to-zone-dialog"]],decls:4,vars:4,consts:[["vdrDialogTitle",""],[3,"members","selectedMemberIds","selectionChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,pt,2,6,"ng-template",0),e.TgZ(1,"vdr-zone-member-list",1),e.NdJ("selectionChange",function(r){return t.selectedMemberIds=r}),e.ALo(2,"async"),e.qZA(),e.YNc(3,gt,6,10,"ng-template",2)),2&n&&(e.xp6(1),e.Q6J("members",e.lcZ(2,2,t.availableCountries$))("selectedMemberIds",t.selectedMemberIds))},directives:[Oe.q,j,we.n],pipes:[b.X$,p.Ov],styles:[""],changeDetection:0});var c=m(8270),se=m(5454),F=m(9295),T=m(9525),g=m(9720),_=m(7346),U=m(3146),C=m(8276),x=m(9416),q=m(4652),I=m(837),O=m(2505),ke=m(8660),_t=m(1213);function ht(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().$implicit;return e.oxw().toggleAll(r.permissions)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&o&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"common.toggle-all")," "))}function ft(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td")(1,"vdr-select-toggle",5),e.NdJ("selectedChange",function(r){const d=e.CHM(t).$implicit;return e.oxw(2).setPermission(d.name,r)}),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw().$implicit,r=e.oxw();e.uIk("colspan",1===i.permissions.length?4:1),e.xp6(1),e.Q6J("title",t.description)("label",t.name)("disabled",r.readonly)("selected",null==r.activePermissions?null:r.activePermissions.includes(t.name))}}function bt(o,n){if(1&o&&(e.TgZ(0,"tr")(1,"td",2)(2,"div")(3,"strong"),e._uU(4),e.ALo(5,"translate"),e.qZA()(),e.TgZ(6,"small"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"br"),e.YNc(10,ht,3,3,"button",3),e.qZA(),e.YNc(11,ft,2,5,"td",1),e.qZA()),2&o){const t=n.$implicit,i=e.oxw();e.xp6(4),e.Oqu(e.lcZ(5,4,t.label)),e.xp6(3),e.Oqu(e.lcZ(8,6,t.description)),e.xp6(3),e.Q6J("ngIf",1<t.permissions.length&&!i.readonly),e.xp6(1),e.Q6J("ngForOf",t.permissions)}}class z{constructor(){this.readonly=!1,this.permissionChange=new e.vpe}ngOnInit(){this.buildGrid()}setPermission(n,t){this.readonly||this.permissionChange.emit({permission:n,value:t})}toggleAll(n){const t=n.some(i=>!this.activePermissions.includes(i.name));for(const i of n)this.permissionChange.emit({permission:i.name,value:t})}buildGrid(){var n;const t=new Map,i=[],r=/^(Create|Read|Update|Delete)([a-zA-Z]+)$/;for(const l of this.permissionDefinitions)if(r.test(l.name)){const h=null===(n=l.name.match(r))||void 0===n?void 0:n[2];if(h){const f=t.get(h);f?f.push(l):t.set(h,[l])}}else l.assignable&&i.push(l);this.gridData=[...i.map(l=>({label:l.name,description:l.description,permissions:[l]})),...Array.from(t.entries()).map(([l,d])=>({label:l,description:this.extractCrudDescription(d[0]),permissions:d}))]}extractCrudDescription(n){return n.description.replace(/Grants permission to [\w]+/,"Grants permissions on")}}z.\u0275fac=function(n){return new(n||z)},z.\u0275cmp=e.Xpm({type:z,selectors:[["vdr-permission-grid"]],inputs:{permissionDefinitions:"permissionDefinitions",activePermissions:"activePermissions",readonly:"readonly"},outputs:{permissionChange:"permissionChange"},decls:3,vars:1,consts:[[1,"table"],[4,"ngFor","ngForOf"],[1,"permission-group","left"],["class","btn btn-sm btn-link",3,"click",4,"ngIf"],[1,"btn","btn-sm","btn-link",3,"click"],["size","small",3,"title","label","disabled","selected","selectedChange"]],template:function(n,t){1&n&&(e.TgZ(0,"table",0)(1,"tbody"),e.YNc(2,bt,12,8,"tr",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.gridData))},directives:[p.sg,p.O5,_t.a],pipes:[b.X$],styles:["td.permission-group[_ngcontent-%COMP%]{max-width:300px;background-color:var(--color-component-bg-200)}"],changeDetection:0});var Ue=m(8766);function vt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Zt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Ct(o,n){1&o&&e.YNc(0,Zt,3,4,"button",21),2&o&&e.Q6J("vdrIfPermissions","UpdateAdministrator")}function yt(o,n){1&o&&(e.TgZ(0,"vdr-form-field",22),e.ALo(1,"translate"),e._UZ(2,"input",23),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,1,"settings.password"))}function xt(o,n){1&o&&(e.TgZ(0,"vdr-form-field",24),e.ALo(1,"translate"),e._UZ(2,"input",23),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,2,"settings.password"))("readOnlyToggle",!0)}function Tt(o,n){if(1&o&&(e.TgZ(0,"section",25)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",26),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,"UpdateAdministrator"))}}function At(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"li",27)(1,"button",28),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().selectedChannelId=l.channelId}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw();e.xp6(1),e.ekj("active",i.selectedChannelId===t.channelId),e.Q6J("id",t.channelId),e.uIk("aria-selected",i.selectedChannelId===t.channelId),e.xp6(1),e.hij(" ",e.lcZ(3,5,e.lcZ(4,7,t.channelCode))," ")}}class ae extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.selectedRoles=[],this.selectedRolePermissions={},this.selectedChannelId=null,this.customFields=this.getCustomFieldConfig("Administrator"),this.detailForm=this.formBuilder.group({emailAddress:["",a.kI.required],firstName:["",a.kI.required],lastName:["",a.kI.required],password:[""],roles:[[]],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}getAvailableChannels(){return Object.values(this.selectedRolePermissions)}ngOnInit(){this.init(),this.administrator$=this.entity$,this.allRoles$=this.dataService.administrator.getRoles(999).mapStream(n=>n.roles.items.filter(t=>t.code!==se.RO)),this.dataService.client.userStatus().single$.subscribe(({userStatus:n})=>{if(!n.permissions.includes(s.y3$.UpdateAdministrator)){const t=this.detailForm.get("roles");t&&t.disable()}}),this.permissionDefinitions=this.serverConfigService.getPermissionDefinitions()}ngOnDestroy(){this.destroy()}rolesChanged(n){this.buildPermissionsMap()}getPermissionsForSelectedChannel(){function n(i){return Object.entries(i).filter(([r,l])=>l).map(([r,l])=>r)}if(this.selectedChannelId&&this.selectedRolePermissions[this.selectedChannelId]){return n(this.selectedRolePermissions[this.selectedChannelId].permissions)}const t=Object.values(this.selectedRolePermissions);return 0<t.length?(this.selectedChannelId=t[0].channelId,n(t[0].permissions)):[]}create(){const n=this.detailForm.value,t={emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName,password:n.password,customFields:n.customFields,roleIds:n.roles.map(i=>i.id)};this.dataService.administrator.createAdministrator(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createAdministrator.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Administrator"})})}save(){this.administrator$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i={id:n,emailAddress:t.emailAddress,firstName:t.firstName,lastName:t.lastName,password:t.password,customFields:t.customFields,roleIds:t.roles.map(r=>r.id)};return this.dataService.administrator.updateAdministrator(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Administrator"})})}setFormValues(n,t){this.detailForm.patchValue({emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName,roles:n.user.roles}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n);const i=this.detailForm.get("password");i&&(n.id?i.setValidators([]):i.setValidators([a.kI.required])),this.buildPermissionsMap()}buildPermissionsMap(){const n=this.detailForm.get("roles");if(n){const t=n.value,i=new Map,r=new Map;for(const l of t)for(const d of l.channels){const f=i.get(d.id)||new Set;l.permissions.forEach(y=>f.add(y)),i.set(d.id,f),r.set(d.id,d.code)}this.selectedRolePermissions={};for(const l of Array.from(i.keys())){const d=i.get(l),h={};for(const f of this.serverConfigService.getPermissionDefinitions())h[f.name]=d.has(f.name);this.selectedRolePermissions[l]={channelId:l,channelCode:r.get(l),permissions:h}}}}}ae.\u0275fac=function(n){return new(n||ae)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ae.\u0275cmp=e.Xpm({type:ae,selectors:[["vdr-admin-detail"]],features:[e.qOj],decls:38,vars:49,consts:[[3,"entity"],["locationId","administrator-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress",3,"readonly"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName",3,"readonly"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName",3,"readonly"],["for","password",3,"label",4,"ngIf"],["for","password",3,"label","readOnlyToggle",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","administrator-detail",3,"entity$","detailForm"],[1,"clr-control-label"],["formControlName","roles","bindLabel","description",3,"items","multiple","hideSelected","change"],["role","tablist",1,"nav"],["role","presentation","class","nav-item",4,"ngFor","ngForOf"],[3,"activePermissions","permissionDefinitions","readonly"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["for","password",3,"label"],["id","password","type","password","formControlName","password"],["for","password",3,"label","readOnlyToggle"],["formGroupName","customFields"],["entityName","Administrator",3,"customFields","customFieldsFormGroup","readonly"],["role","presentation",1,"nav-item"],["type","button",1,"btn","btn-link","nav-link",3,"id","click"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,vt,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Ct,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e._UZ(17,"input",8),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",9),e.ALo(20,"translate"),e._UZ(21,"input",10),e.ALo(22,"hasPermission"),e.qZA(),e.YNc(23,yt,3,3,"vdr-form-field",11),e.ALo(24,"async"),e.YNc(25,xt,3,4,"vdr-form-field",12),e.ALo(26,"async"),e.ALo(27,"hasPermission"),e.YNc(28,Tt,6,8,"section",13),e._UZ(29,"vdr-custom-detail-component-host",14),e.TgZ(30,"label",15),e._uU(31),e.ALo(32,"translate"),e.qZA(),e.TgZ(33,"ng-select",16),e.NdJ("change",function(r){return t.rolesChanged(r)}),e.ALo(34,"async"),e.qZA(),e.TgZ(35,"ul",17),e.YNc(36,At,5,9,"li",18),e.qZA(),e._UZ(37,"vdr-permission-grid",19),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,23,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,25,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,27,"settings.email-address")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,29,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(16,31,"settings.first-name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,33,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(20,35,"settings.last-name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(22,37,"UpdateAdministrator")),e.xp6(2),e.Q6J("ngIf",e.lcZ(24,39,t.isNew$)),e.xp6(2),e.Q6J("ngIf",!e.lcZ(26,41,t.isNew$)&&e.lcZ(27,43,"UpdateAdministrator")),e.xp6(3),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(2),e.Oqu(e.lcZ(32,45,"settings.roles")),e.xp6(2),e.Q6J("items",e.lcZ(34,47,t.allRoles$))("multiple",!0)("hideSelected",!0),e.xp6(3),e.Q6J("ngForOf",t.getAvailableChannels()),e.xp6(1),e.Q6J("activePermissions",t.getPermissionsForSelectedChannel())("permissionDefinitions",t.permissionDefinitions)("readonly",!0)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,a.x0,u.MgK,I.y,O.C,ke.w9,p.sg,z],pipes:[p.Ov,b.X$,Z.j,Ue.E],styles:[""],changeDetection:0});var J=m(591),v=m(2673),Q=m(8899),D=m(735),S=m(1519),k=m(8854),P=m(5111);const Lt=function(){return["./create"]};function Ft(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Lt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"admin.create-new-administrator")," "))}const Jt=function(o){return["./",o]};function qt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._uU(5),e.qZA(),e.TgZ(6,"td",6),e._UZ(7,"vdr-table-row-action",7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"td")(10,"vdr-dropdown")(11,"button",8),e._uU(12),e.ALo(13,"translate"),e._UZ(14,"clr-icon",9),e.qZA(),e.TgZ(15,"vdr-dropdown-menu",10)(16,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteAdministrator(l)}),e.ALo(17,"hasPermission"),e._UZ(18,"clr-icon",12),e._uU(19),e.ALo(20,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.firstName),e.xp6(2),e.Oqu(t.lastName),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("label",e.lcZ(8,8,"common.edit"))("linkTo",e.VKq(16,Jt,t.id)),e.xp6(5),e.hij(" ",e.lcZ(13,10,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(17,12,"DeleteAdministrator")),e.xp6(3),e.hij(" ",e.lcZ(20,14,"common.delete")," ")}}class le extends s.t7C{constructor(n,t,i,r,l){super(t,i),this.dataService=n,this.modalService=r,this.notificationService=l,super.setQueryFn((...d)=>this.dataService.administrator.getAdministrators(...d),d=>d.administrators)}deleteAdministrator(n){return this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-administrator"),body:`${n.firstName} ${n.lastName}`,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.administrator.deleteAdministrator(n.id):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Administrator"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Administrator"})})}}le.\u0275fac=function(n){return new(n||le)(e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.Z7U),e.Y36(s.gqp))},le.\u0275cmp=e.Xpm({type:le,selectors:[["vdr-administrator-list"]],features:[e.qOj],decls:21,vars:22,consts:[["locationId","administrator-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,Ft,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e._UZ(18,"vdr-dt-column")(19,"vdr-dt-column"),e.YNc(20,qt,21,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions","CreateAdministrator"),e.xp6(1),e.Q6J("items",e.lcZ(5,8,t.items$))("itemsPerPage",e.lcZ(6,10,t.itemsPerPage$))("totalItems",e.lcZ(7,12,t.totalItems$))("currentPage",e.lcZ(8,14,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,16,"settings.first-name")),e.xp6(3),e.Oqu(e.lcZ(14,18,"settings.last-name")),e.xp6(3),e.Oqu(e.lcZ(17,20,"settings.email-address")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""]});var R=m(3516),Dt=m(7808),Re=m(4990);function St(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function kt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}const Pt=function(){return["SuperAdmin","UpdateChannel"]};function Ut(o,n){1&o&&e.YNc(0,kt,3,4,"button",25),2&o&&e.Q6J("vdrIfPermissions",e.DdM(1,Pt))}function It(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.ALo(2,"localeCurrencyName"),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(e.lcZ(2,2,t))}}function Nt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.ALo(2,"localeLanguageName"),e.ALo(3,"uppercase"),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.AsE(" ",e.lcZ(2,3,t)," (",e.lcZ(3,5,t),") ")}}function Mt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Ot(o,n){1&o&&(e.TgZ(0,"clr-alert",27)(1,"clr-alert-item")(2,"span",28),e._uU(3),e.ALo(4,"translate"),e.qZA()()()),2&o&&(e.Q6J("clrAlertClosable",!1),e.xp6(3),e.hij(" ",e.lcZ(4,2,"error.no-default-tax-zone-set")," "))}function wt(o,n){if(1&o&&(e.TgZ(0,"option",26),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Qt(o,n){1&o&&(e.TgZ(0,"clr-alert",29)(1,"clr-alert-item")(2,"span",28),e._uU(3),e.ALo(4,"translate"),e.qZA()()()),2&o&&(e.Q6J("clrAlertClosable",!1),e.xp6(3),e.hij(" ",e.lcZ(4,2,"error.no-default-shipping-zone-set")," "))}function Rt(o,n){if(1&o&&(e.TgZ(0,"section",30)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",31),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class ce extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.serverConfigService=i,this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.currencyCodes=Object.values(s.NEm),this.updatePermission=[s.y3$.SuperAdmin,s.y3$.UpdateChannel,s.y3$.CreateChannel],this.customFields=this.getCustomFieldConfig("Channel"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],token:["",a.kI.required],pricesIncludeTax:[!1],currencyCode:[""],defaultShippingZoneId:["",a.kI.required],defaultLanguageCode:[],defaultTaxZoneId:["",a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.zones$=this.dataService.settings.getZones().mapSingle(n=>n.zones),this.availableLanguageCodes$=this.serverConfigService.getAvailableLanguages()}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={code:n.code,token:n.token,defaultLanguageCode:n.defaultLanguageCode,pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZoneId,defaultTaxZoneId:n.defaultTaxZoneId,customFields:n.customFields};this.dataService.settings.createChannel(t).pipe((0,T.z)(({createChannel:i})=>this.dataService.auth.currentUser().single$.pipe((0,L.U)(({me:r})=>({me:r,createChannel:i})))),(0,T.z)(({me:i,createChannel:r})=>this.dataService.client.updateUserChannels(i.channels).pipe((0,L.U)(()=>r)))).subscribe(i=>{switch(i.__typename){case"Channel":this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Channel"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.id],{relativeTo:this.route});break;case"LanguageNotAvailableError":this.notificationService.error(i.message)}})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.entity$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,code:n.code,token:n.token,pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZoneId,defaultLanguageCode:n.defaultLanguageCode,defaultTaxZoneId:n.defaultTaxZoneId,customFields:n.customFields};return this.dataService.settings.updateChannel(i)})).subscribe(({updateChannel:t})=>{switch(t.__typename){case"Channel":this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Channel"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck();break;case"LanguageNotAvailableError":this.notificationService.error(t.message)}})}setFormValues(n,t){if(this.detailForm.patchValue({code:n.code,token:n.token||this.generateToken(),pricesIncludeTax:n.pricesIncludeTax,currencyCode:n.currencyCode,defaultShippingZoneId:n.defaultShippingZone?n.defaultShippingZone.id:"",defaultLanguageCode:n.defaultLanguageCode,defaultTaxZoneId:n.defaultTaxZone?n.defaultTaxZone.id:""}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n),n.code===se.z$){const i=this.detailForm.get("code");i&&i.disable()}}generateToken(){const n=()=>Math.random().toString(36).substr(3,10);return`${n()}${n()}`}}ce.\u0275fac=function(n){return new(n||ce)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ce.\u0275cmp=e.Xpm({type:ce,selectors:[["vdr-channel-detail"]],features:[e.qOj],decls:53,vars:65,consts:[[3,"entity"],["locationId","channel-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","code",3,"label"],["id","code","type","text","formControlName","code",3,"readonly"],["for","token",3,"label"],["id","token","type","text","formControlName","token",3,"readonly"],["for","defaultTaxZoneId",3,"label"],["clrSelect","","name","currencyCode","formControlName","currencyCode",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["for","defaultLanguage",3,"label"],["clrSelect","","name","defaultLanguageCode","formControlName","defaultLanguageCode",3,"vdrDisabled"],["for","pricesIncludeTax",3,"label"],["type","checkbox","clrToggle","","id","pricesIncludeTax","formControlName","pricesIncludeTax",3,"vdrDisabled"],["clrSelect","","name","defaultTaxZoneId","formControlName","defaultTaxZoneId",3,"vdrDisabled"],["selected","","value","",2,"display","none"],["clrAlertType","danger",3,"clrAlertClosable",4,"ngIf"],["for","defaultShippingZoneId",3,"label"],["clrSelect","","name","defaultShippingZoneId","formControlName","defaultShippingZoneId",3,"vdrDisabled"],["clrAlertType","warning",3,"clrAlertClosable",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","channel-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"value"],["clrAlertType","danger",3,"clrAlertClosable"],[1,"alert-text"],["clrAlertType","warning",3,"clrAlertClosable"],["formGroupName","customFields"],["entityName","Channel",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,St,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Ut,1,2,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e._UZ(17,"input",8),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",9),e.ALo(20,"translate"),e.TgZ(21,"select",10),e.ALo(22,"hasPermission"),e.YNc(23,It,3,4,"option",11),e.qZA()(),e.TgZ(24,"vdr-form-field",12),e.ALo(25,"translate"),e.TgZ(26,"select",13),e.ALo(27,"hasPermission"),e.YNc(28,Nt,4,7,"option",11),e.ALo(29,"async"),e.qZA()(),e.TgZ(30,"vdr-form-field",14),e.ALo(31,"translate"),e.TgZ(32,"clr-toggle-wrapper"),e._UZ(33,"input",15),e.ALo(34,"hasPermission"),e.qZA()(),e.TgZ(35,"vdr-form-field",9),e.ALo(36,"translate"),e.TgZ(37,"select",16),e.ALo(38,"hasPermission"),e._UZ(39,"option",17),e.YNc(40,Mt,2,2,"option",11),e.ALo(41,"async"),e.qZA()(),e.YNc(42,Ot,5,4,"clr-alert",18),e.TgZ(43,"vdr-form-field",19),e.ALo(44,"translate"),e.TgZ(45,"select",20),e.ALo(46,"hasPermission"),e._UZ(47,"option",17),e.YNc(48,wt,2,2,"option",11),e.ALo(49,"async"),e.qZA()(),e.YNc(50,Qt,5,4,"clr-alert",21),e.YNc(51,Rt,6,8,"section",22),e._UZ(52,"vdr-custom-detail-component-host",23),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,27,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,29,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,31,"common.code")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,33,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,35,"settings.channel-token")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,37,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(20,39,"settings.currency")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(22,41,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",t.currencyCodes),e.xp6(1),e.Q6J("label",e.lcZ(25,43,"common.default-language")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(27,45,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(29,47,t.availableLanguageCodes$)),e.xp6(2),e.Q6J("label",e.lcZ(31,49,"settings.prices-include-tax")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(34,51,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(36,53,"settings.default-tax-zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(38,55,t.updatePermission)),e.xp6(3),e.Q6J("ngForOf",e.lcZ(41,57,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.detailForm.value.code&&!t.detailForm.value.defaultTaxZoneId),e.xp6(1),e.Q6J("label",e.lcZ(44,59,"settings.default-shipping-zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(46,61,t.updatePermission)),e.xp6(3),e.Q6J("ngForOf",e.lcZ(49,63,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.detailForm.value.code&&!t.detailForm.value.defaultShippingZoneId),e.xp6(1),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,a.EJ,u.otW,R.x,p.sg,a.YN,a.Kr,u.PEh,a.Wl,u.KKC,u.TIm,u.CyW,u.I9z,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j,Dt.u,Re.B,p.gd],styles:["clr-alert[_ngcontent-%COMP%]{max-width:30rem;margin-bottom:12px}"],changeDetection:0});var qe=m(253),Ye=m(4874),$e=m(1185);const Yt=function(){return["./create"]};function $t(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Yt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-channel")," "))}const jt=function(o){return["./",o]},zt=function(){return["SuperAdmin","DeleteChannel"]};function Et(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._UZ(1,"vdr-channel-badge",6),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA(),e.TgZ(5,"td",7),e._UZ(6,"vdr-table-row-action",8),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"td",7)(9,"vdr-dropdown")(10,"button",9),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",10),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",11)(15,"button",12),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteChannel(l.id)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",13),e._uU(18),e.ALo(19,"translate"),e.qZA()()()()}if(2&o){const t=n.item,i=e.oxw();e.xp6(1),e.Q6J("channelCode",t.code),e.xp6(1),e.hij(" ",e.lcZ(3,8,e.lcZ(4,10,t.code))," "),e.xp6(4),e.Q6J("label",e.lcZ(7,12,"common.edit"))("linkTo",e.VKq(20,jt,t.id)),e.xp6(4),e.Q6J("disabled",i.isDefaultChannel(t.code)),e.xp6(1),e.hij(" ",e.lcZ(12,14,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,16,e.DdM(22,zt))),e.xp6(3),e.hij(" ",e.lcZ(19,18,"common.delete")," ")}}const Ht=function(){return["SuperAdmin","CreateChannel"]};class de{constructor(n,t,i){this.dataService=n,this.modalService=t,this.notificationService=i,this.refresh$=new qe.x,this.channels$=this.refresh$.pipe((0,Ye.O)(1),(0,v.w)(()=>this.dataService.settings.getChannels().mapStream(r=>r.channels)))}isDefaultChannel(n){return n===se.z$}deleteChannel(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-channel"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteChannel(n):J.E),(0,T.z)(()=>this.dataService.auth.currentUser().single$),(0,T.z)(t=>this.dataService.client.updateUserChannels(t.me.channels))).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Channel"}),this.refresh$.next(1)},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Channel"})})}}de.\u0275fac=function(n){return new(n||de)(e.Y36(s.DoR),e.Y36(s.Z7U),e.Y36(s.gqp))},de.\u0275cmp=e.Xpm({type:de,selectors:[["vdr-channel-list"]],decls:12,vars:8,consts:[["locationId","channel-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"channelCode"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm",3,"disabled"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,$t,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.ALo(5,"async"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"vdr-dt-column")(10,"vdr-dt-column"),e.YNc(11,Et,20,23,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(7,Ht)),e.xp6(1),e.Q6J("items",e.lcZ(5,3,t.channels$)),e.xp6(3),e.Oqu(e.lcZ(8,5,"common.code")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,$e.n,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Ue.E,Z.j],styles:[""],changeDetection:0});var w=m(6562),De=m(7425);function Gt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Vt(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Bt(o,n){if(1&o&&e.YNc(0,Vt,3,4,"button",15),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function Kt(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class me extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateCountry],this.customFields=this.getCustomFieldConfig("Country"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],enabled:[!0],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.country$=this.entity$}ngOnDestroy(){this.destroy()}create(){!this.detailForm.dirty||(0,w.a)(this.country$,this.languageCode$).pipe((0,F.q)(1),(0,T.z)(([n,t])=>{const i=this.detailForm.value,r=(0,s.iSy)({translatable:n,updatedFields:i,customFieldConfig:this.customFields,languageCode:t,defaultTranslation:{name:i.name,languageCode:t}});return this.dataService.settings.createCountry(r)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Country"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",n.createCountry.id],{relativeTo:this.route})},n=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Country"})})}save(){(0,w.a)(this.country$,this.languageCode$).pipe((0,F.q)(1),(0,T.z)(([n,t])=>{const i=this.detailForm.value,r=(0,s.iSy)({translatable:n,updatedFields:i,customFieldConfig:this.customFields,languageCode:t,defaultTranslation:{name:i.name,languageCode:t}});return this.dataService.settings.updateCountry(r)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Country"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Country"})})}setFormValues(n,t){const i=(0,s.ZIM)(n,t);this.detailForm.patchValue({code:n.code,name:i?i.name:"",enabled:n.enabled}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,i)}}me.\u0275fac=function(n){return new(n||me)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},me.\u0275cmp=e.Xpm({type:me,selectors:[["vdr-country-detail"]],features:[e.qOj],decls:30,vars:38,consts:[[3,"entity"],[3,"disabled","availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","country-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","code",3,"label"],["id","code","type","text","formControlName","code",3,"readonly"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","enabled",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","country-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["formGroupName","customFields"],["entityName","Country",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.TgZ(4,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,Gt,3,4,"button",3),e.ALo(11,"async"),e.YNc(12,Bt,1,1,"ng-template",null,4,e.W1O),e.qZA()(),e.TgZ(14,"form",5)(15,"vdr-form-field",6),e.ALo(16,"translate"),e._UZ(17,"input",7),e.ALo(18,"hasPermission"),e.qZA(),e.TgZ(19,"vdr-form-field",8),e.ALo(20,"translate"),e._UZ(21,"input",9),e.ALo(22,"hasPermission"),e.qZA(),e.TgZ(23,"vdr-form-field",10),e.ALo(24,"translate"),e.TgZ(25,"clr-toggle-wrapper"),e._UZ(26,"input",11),e.ALo(27,"hasPermission"),e.qZA()(),e.YNc(28,Kt,6,8,"section",12),e._UZ(29,"vdr-custom-detail-component-host",13),e.qZA()),2&n){const i=e.MAs(13);e.xp6(2),e.Q6J("entity",e.lcZ(3,16,t.entity$)),e.xp6(2),e.Q6J("disabled",e.lcZ(5,18,t.isNew$))("availableLanguageCodes",e.lcZ(6,20,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,22,t.languageCode$)),e.xp6(6),e.Q6J("ngIf",e.lcZ(11,24,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(16,26,"common.code")),e.xp6(2),e.Q6J("readonly",!e.lcZ(18,28,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(20,30,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(22,32,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(24,34,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(27,36,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,De.S,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});var Se=m(9337),Pe=m(4447);const Wt=function(){return["./create"]};function Xt(o,n){1&o&&(e.TgZ(0,"a",6),e._UZ(1,"clr-icon",7),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Wt)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-country")," "))}const en=function(o){return{contents:o}},tn=function(o){return["/settings","zones",o]};function nn(o,n){if(1&o&&(e.TgZ(0,"a",17)(1,"vdr-chip",18),e._uU(2),e.qZA()()),2&o){const t=n.$implicit;e.Q6J("routerLink",e.VKq(5,tn,e.VKq(3,en,t.id))),e.xp6(1),e.Q6J("colorFrom",t.name),e.xp6(1),e.Oqu(t.name)}}const on=function(o){return["./",o]},rn=function(){return["DeleteSettings","DeleteCountry"]};function sn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",8),e._uU(1),e.qZA(),e.TgZ(2,"td",8),e._uU(3),e.qZA(),e.TgZ(4,"td",8),e.YNc(5,nn,3,7,"a",9),e.qZA(),e.TgZ(6,"td",8),e._UZ(7,"clr-icon"),e.qZA(),e.TgZ(8,"td",10),e._UZ(9,"vdr-table-row-action",11),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"td",10)(12,"vdr-dropdown")(13,"button",12),e._uU(14),e.ALo(15,"translate"),e._UZ(16,"clr-icon",13),e.qZA(),e.TgZ(17,"vdr-dropdown-menu",14)(18,"button",15),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteCountry(l.id)}),e.ALo(19,"hasPermission"),e._UZ(20,"clr-icon",16),e._uU(21),e.ALo(22,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngForOf",t.zones),e.xp6(2),e.ekj("is-success",t.enabled),e.uIk("shape",t.enabled?"check":"times"),e.xp6(2),e.Q6J("label",e.lcZ(10,11,"common.edit"))("linkTo",e.VKq(19,on,t.id)),e.xp6(5),e.hij(" ",e.lcZ(15,13,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(19,15,e.DdM(21,rn))),e.xp6(3),e.hij(" ",e.lcZ(22,17,"common.delete")," ")}}const an=function(){return["CreateSettings","CreateCountry"]};class ue{constructor(n,t,i,r){this.dataService=n,this.notificationService=t,this.modalService=i,this.serverConfigService=r,this.searchTerm=new a.NI(""),this.countries=[],this.destroy$=new qe.x,this.refresh$=new qe.x}ngOnInit(){this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:t})=>t.contentLanguage);const n=(0,w.a)(this.contentLanguage$,this.searchTerm.valueChanges.pipe((0,Ye.O)(null))).pipe((0,L.U)(([t,i])=>i),(0,v.w)(t=>this.dataService.settings.getCountries(999,0,t).single$),(0,Se.b)(t=>{this.countries=t.countries.items}),(0,L.U)(t=>t.countries.items));this.zones$=this.dataService.settings.getZones().mapStream(t=>t.zones),this.countriesWithZones$=(0,w.a)(n,this.zones$).pipe((0,L.U)(([t,i])=>t.map(r=>Object.assign(Object.assign({},r),{zones:i.filter(l=>!!l.members.find(d=>d.id===r.id))})))),this.availableLanguages$=this.serverConfigService.getAvailableLanguages()}ngOnDestroy(){this.destroy$.next(void 0),this.destroy$.complete()}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}deleteCountry(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-country"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteCountry(n):J.E)).subscribe(t=>{t.deleteCountry.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Country"}),this.dataService.settings.getCountries(999,0).single$.subscribe()):this.notificationService.error(t.deleteCountry.message||"")},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Country"})})}isZone(n){return n.hasOwnProperty("id")}}ue.\u0275fac=function(n){return new(n||ue)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U),e.Y36(s.iHG))},ue.\u0275cmp=e.Xpm({type:ue,selectors:[["vdr-country-list"]],decls:28,vars:28,consts:[["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","country-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[3,"expand"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"routerLink",4,"ngFor","ngForOf"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[3,"routerLink"],[3,"colorFrom"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.TgZ(4,"div")(5,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,Xt,4,5,"a",3),e.qZA()(),e.TgZ(11,"vdr-data-table",4),e.ALo(12,"async"),e.TgZ(13,"vdr-dt-column"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dt-column",5),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"vdr-dt-column"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.TgZ(22,"vdr-dt-column"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e._UZ(25,"vdr-dt-column")(26,"vdr-dt-column"),e.YNc(27,sn,23,22,"ng-template"),e.qZA()),2&n&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,11,"settings.search-country-by-name")),e.xp6(3),e.Q6J("availableLanguageCodes",e.lcZ(6,13,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,15,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(27,an)),e.xp6(1),e.Q6J("items",e.lcZ(12,17,t.countriesWithZones$)),e.xp6(3),e.Oqu(e.lcZ(15,19,"common.code")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(18,21,"common.name")),e.xp6(3),e.Oqu(e.lcZ(21,23,"settings.zone")),e.xp6(3),e.Oqu(e.lcZ(24,25,"common.enabled")))},directives:[_.Kk,_.BN,A.y,a.Fj,a.JJ,a.oH,De.S,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.sg,Pe.Y,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[".search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"],changeDetection:0});var ln=m(538);function cn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",13),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function dn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"span",14),e.NdJ("click",function(){const r=e.CHM(t),l=r.item;return r.clear.call(null,l)}),e._uU(1," \xd7 "),e.qZA(),e.TgZ(2,"span",15),e._uU(3),e.ALo(4,"localeLanguageName"),e.qZA()}if(2&o){const t=n.item;e.xp6(3),e.AsE("",e.lcZ(4,2,t)," (",t,")")}}function mn(o,n){if(1&o&&(e._uU(0),e.ALo(1,"localeLanguageName")),2&o){const t=n.item;e.AsE(" ",e.lcZ(1,2,t)," (",t,") ")}}function un(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class pe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.languageCodes=Object.values(s.spR),this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateGlobalSettings],this.customFields=this.getCustomFieldConfig("GlobalSettings"),this.detailForm=this.formBuilder.group({availableLanguages:[""],trackInventory:!1,outOfStockThreshold:[0,a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.dataService.client.userStatus().single$.subscribe(({userStatus:n})=>{if(!n.permissions.includes(s.y3$.UpdateSettings)){const t=this.detailForm.get("availableLanguages");t&&t.disable()}})}save(){!this.detailForm.dirty||this.dataService.settings.updateGlobalSettings(this.detailForm.value).pipe((0,Se.b)(({updateGlobalSettings:n})=>{switch(n.__typename){case"GlobalSettings":this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Settings"});break;case"ChannelDefaultLanguageError":this.notificationService.error(n.message)}}),(0,v.w)(()=>this.serverConfigService.refreshGlobalSettings()),(0,ln.M)(this.dataService.client.uiState().single$)).subscribe(([{globalSettings:n},{uiState:t}])=>{const i=n.availableLanguages;i.length&&!i.includes(t.contentLanguage)&&this.dataService.client.setContentLanguage(i[0]).subscribe()})}setFormValues(n,t){this.detailForm.patchValue({availableLanguages:n.availableLanguages,trackInventory:n.trackInventory,outOfStockThreshold:n.outOfStockThreshold}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}pe.\u0275fac=function(n){return new(n||pe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},pe.\u0275cmp=e.Xpm({type:pe,selectors:[["vdr-global-settings"]],features:[e.qOj],decls:23,vars:29,consts:[["locationId","global-settings-detail"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","availableLanguages",3,"label"],["multiple","true","appendTo","body","formControlName","availableLanguages",3,"items","addTag","hideSelected"],["ng-label-tmp",""],["ng-option-tmp",""],["for","outOfStockThreshold",3,"label","tooltip"],["id","outOfStockThreshold","type","number","formControlName","outOfStockThreshold",3,"readonly"],["for","enabled",3,"label","tooltip"],["type","checkbox","clrToggle","","name","enabled","formControlName","trackInventory",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","global-settings-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["aria-hidden","true",1,"ng-value-icon","left",3,"click"],[1,"ng-value-label"],["formGroupName","customFields"],["entityName","GlobalSettings",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,cn,3,4,"button",1),e.qZA()(),e.TgZ(4,"form",2)(5,"vdr-form-field",3),e.ALo(6,"translate"),e.TgZ(7,"ng-select",4),e.YNc(8,dn,5,4,"ng-template",5),e.YNc(9,mn,2,4,"ng-template",6),e.qZA()(),e.TgZ(10,"vdr-form-field",7),e.ALo(11,"translate"),e.ALo(12,"translate"),e._UZ(13,"input",8),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",9),e.ALo(16,"translate"),e.ALo(17,"translate"),e.TgZ(18,"clr-toggle-wrapper"),e._UZ(19,"input",10),e.ALo(20,"hasPermission"),e.qZA()(),e.YNc(21,un,6,8,"section",11),e._UZ(22,"vdr-custom-detail-component-host",12),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",t.updatePermission),e.xp6(1),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(6,15,"common.available-languages")),e.xp6(2),e.Q6J("items",t.languageCodes)("addTag",!1)("hideSelected",!0),e.xp6(3),e.Q6J("label",e.lcZ(11,17,"settings.global-out-of-stock-threshold"))("tooltip",e.lcZ(12,19,"settings.global-out-of-stock-threshold-tooltip")),e.xp6(3),e.Q6J("readonly",!e.lcZ(14,21,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,23,"settings.track-inventory-default"))("tooltip",e.lcZ(17,25,"catalog.track-inventory-tooltip")),e.xp6(4),e.Q6J("vdrDisabled",!e.lcZ(20,27,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm))},directives:[_.Kk,_.mz,C.W,x.H,a._Y,a.JL,a.sg,q.h,ke.w9,a.JJ,a.u,ke.mR,ke.ir,A.y,a.wV,a.Fj,u.PEh,a.Wl,u.KKC,R.x,p.O5,a.x0,u.MgK,I.y,O.C],pipes:[b.X$,Re.B,Z.j],styles:["ng-select .ng-value>span{margin:0!important} ng-select .ng-arrow-wrapper .ng-arrow{margin:0!important} ng-select .ng-select-container>span{margin:0!important}"],changeDetection:0});var Ie=m(2604),je=m(3628),ze=m(8931);function pn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function gn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedHandler),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function _n(o,n){if(1&o&&e.YNc(0,gn,3,4,"button",6),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function hn(o,n){if(1&o&&(e.TgZ(0,"section",23)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",24),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}function fn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",25),e.NdJ("remove",function(){return e.CHM(t),e.oxw(2).removeChecker()}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedChecker)("operationDefinition",t.selectedCheckerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function bn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectChecker(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function vn(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",26),e._UZ(3,"clr-icon",27),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",28),e.YNc(7,bn,2,1,"button",29),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.checkers)}}function Zn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",31),e.NdJ("remove",function(){return e.CHM(t),e.oxw(2).removeHandler()}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedHandler)("operationDefinition",t.selectedHandlerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function Cn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectHandler(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function yn(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",26),e._UZ(3,"clr-icon",27),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",28),e.YNc(7,Cn,2,1,"button",29),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.handlers)}}function xn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"form",7)(1,"vdr-form-field",8),e.ALo(2,"translate"),e.TgZ(3,"input",9),e.NdJ("input",function(r){const d=e.CHM(t).ngIf;return e.oxw().updateCode(d.code,r.target.value)}),e.ALo(4,"hasPermission"),e.qZA()(),e.TgZ(5,"vdr-form-field",10),e.ALo(6,"translate"),e.ALo(7,"hasPermission"),e._UZ(8,"input",11),e.ALo(9,"hasPermission"),e.qZA(),e._UZ(10,"vdr-rich-text-editor",12),e.ALo(11,"hasPermission"),e.ALo(12,"translate"),e.TgZ(13,"vdr-form-field",13),e.ALo(14,"translate"),e.TgZ(15,"clr-toggle-wrapper"),e._UZ(16,"input",14),e.ALo(17,"hasPermission"),e.qZA()(),e.YNc(18,hn,6,8,"section",15),e._UZ(19,"vdr-custom-detail-component-host",16),e.TgZ(20,"div",17)(21,"div",18)(22,"label",19),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.YNc(25,fn,2,5,"vdr-configurable-input",20),e.YNc(26,vn,8,4,"div",21),e.qZA(),e.TgZ(27,"div",18)(28,"label",19),e._uU(29),e.ALo(30,"translate"),e.qZA(),e.YNc(31,Zn,2,5,"vdr-configurable-input",22),e.YNc(32,yn,8,4,"div",21),e.qZA()()()}if(2&o){const t=e.oxw();e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(2,19,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(4,21,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(6,23,"common.code"))("readOnlyToggle",e.lcZ(7,25,t.updatePermission)),e.xp6(3),e.Q6J("readonly",!e.lcZ(9,27,t.updatePermission)),e.xp6(2),e.Q6J("readonly",!e.lcZ(11,29,t.updatePermission))("label",e.lcZ(12,31,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(14,33,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(17,35,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(4),e.Oqu(e.lcZ(24,37,"settings.payment-eligibility-checker")),e.xp6(2),e.Q6J("ngIf",t.selectedChecker&&t.selectedCheckerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedChecker||!t.selectedCheckerDefinition),e.xp6(3),e.Oqu(e.lcZ(30,39,"settings.payment-handler")),e.xp6(2),e.Q6J("ngIf",t.selectedHandler&&t.selectedHandlerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedHandler||!t.selectedHandlerDefinition)}}class ge extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.checkers=[],this.handlers=[],this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdatePaymentMethod],this.customFields=this.getCustomFieldConfig("PaymentMethod"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],description:"",enabled:[!0,a.kI.required],checker:{},handler:{},customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),(0,w.a)([this.dataService.settings.getPaymentMethodOperations().single$,this.entity$.pipe((0,F.q)(1))]).subscribe(([n,t])=>{this.checkers=n.paymentMethodEligibilityCheckers,this.handlers=n.paymentMethodHandlers,this.changeDetector.markForCheck(),this.selectedCheckerDefinition=n.paymentMethodEligibilityCheckers.find(i=>i.code===(t.checker&&t.checker.code)),this.selectedHandlerDefinition=n.paymentMethodHandlers.find(i=>i.code===(t.handler&&t.handler.code))})}ngOnDestroy(){this.destroy()}updateCode(n,t){if(!n){const i=this.detailForm.get(["code"]);i&&i.pristine&&i.setValue((0,Ie.U)(t,"-"))}}configArgsIsPopulated(){const n=this.detailForm.get("configArgs");return!!n&&0<Object.keys(n.controls).length}selectChecker(n){this.selectedCheckerDefinition=n,this.selectedChecker=(0,s.miO)(n);const t=this.detailForm.get("checker");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedChecker)),this.detailForm.markAsDirty()}selectHandler(n){this.selectedHandlerDefinition=n,this.selectedHandler=(0,s.miO)(n);const t=this.detailForm.get("handler");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedHandler)),this.detailForm.markAsDirty()}removeChecker(){this.selectedChecker=null,this.detailForm.markAsDirty()}removeHandler(){this.selectedHandler=null,this.detailForm.markAsDirty()}create(){const n=this.selectedChecker,t=this.selectedHandler;!t||this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:i})=>{const r=this.detailForm.value,l={name:r.name,code:r.code,description:r.description,enabled:r.enabled,checker:n?(0,s.RnJ)(n,r.checker):null,handler:(0,s.RnJ)(t,r.handler),customFields:r.customFields};return this.dataService.settings.createPaymentMethod(l)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"PaymentMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createPaymentMethod.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"PaymentMethod"})})}save(){const n=this.selectedChecker,t=this.selectedHandler;!t||this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:i})=>{const r=this.detailForm.value,l={id:i,name:r.name,code:r.code,description:r.description,enabled:r.enabled,checker:n?(0,s.RnJ)(n,r.checker):null,handler:(0,s.RnJ)(t,r.handler),customFields:r.customFields};return this.dataService.settings.updatePaymentMethod(l)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"PaymentMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},i=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"PaymentMethod"})})}setFormValues(n){this.detailForm.patchValue({name:n.name,code:n.code,description:n.description,enabled:n.enabled,checker:n.checker||{},handler:n.handler||{}}),this.selectedChecker||(this.selectedChecker=n.checker&&{code:n.checker.code,args:n.checker.args.map(t=>Object.assign(Object.assign({},t),{value:(0,s.sux)(t.value)}))}),this.selectedHandler||(this.selectedHandler=n.handler&&{code:n.handler.code,args:n.handler.args.map(t=>Object.assign(Object.assign({},t),{value:(0,s.sux)(t.value)}))}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}ge.\u0275fac=function(n){return new(n||ge)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},ge.\u0275cmp=e.Xpm({type:ge,selectors:[["vdr-payment-method-detail"]],features:[e.qOj],decls:12,vars:10,consts:[[3,"entity"],["locationId","payment-method-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],["class","form",3,"formGroup",4,"ngIf"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],["formControlName","description",3,"readonly","label"],["for","description",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","payment-method-detail",3,"entity$","detailForm"],[1,"clr-row","mt4"],[1,"clr-col"],[1,"clr-control-label"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[4,"ngIf"],["formControlName","handler",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],["formGroupName","customFields"],["entityName","PaymentMethod",3,"customFields","customFieldsFormGroup","readonly"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],["formControlName","handler",3,"operation","operationDefinition","readonly","remove"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,pn,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,_n,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.YNc(10,xn,33,41,"form",4),e.ALo(11,"async")),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,4,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,6,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",e.lcZ(11,8,t.entity$))}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,je.Y,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C,ze.q,D.J,S.U,u.qvL,k.N,p.sg,P.H],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Tn=function(){return["./create"]};function An(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Tn)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-payment-method")," "))}const Ln=function(o){return["./",o]},Fn=function(){return["DeleteSettings","DeletePaymentMethod"]};function Jn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",6),e._UZ(5,"vdr-table-row-action",7),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",6)(8,"vdr-dropdown")(9,"button",8),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",9),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",10)(14,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deletePaymentMethod(l.id)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",12),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.enabled),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,Ln,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,Fn))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}const qn=function(){return["CreateSettings","CreatePaymentMethod"]};class _e extends s.t7C{constructor(n,t,i,r,l){super(t,i),this.dataService=n,this.modalService=r,this.notificationService=l,super.setQueryFn((...d)=>this.dataService.settings.getPaymentMethods(...d).refetchOnChannelChange(),d=>d.paymentMethods)}deletePaymentMethod(n){this.showModalAndDelete(n).pipe((0,v.w)(t=>t.result===s.PcR.DELETED?[!0]:this.showModalAndDelete(n,t.message||"").pipe((0,L.U)(i=>i.result===s.PcR.DELETED))),(0,v.w)(()=>this.dataService.settings.getPaymentMethods(100).single$)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"PaymentMethod"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"PaymentMethod"})})}showModalAndDelete(n,t){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-payment-method"),body:t,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(i=>i?this.dataService.settings.deletePaymentMethod(n,!!t):J.E),(0,L.U)(i=>i.deletePaymentMethod))}}function Dn(o,n){1&o&&(e.TgZ(0,"vdr-form-field",15),e.ALo(1,"translate"),e._UZ(2,"input",12),e.qZA()),2&o&&e.Q6J("label",e.lcZ(1,1,"settings.password"))}function Sn(o,n){if(1&o&&(e.TgZ(0,"section",16)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",17),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,3,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))}}_e.\u0275fac=function(n){return new(n||_e)(e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.Z7U),e.Y36(s.gqp))},_e.\u0275cmp=e.Xpm({type:_e,selectors:[["vdr-payment-method-list"]],features:[e.qOj],decls:18,vars:20,consts:[["locationId","payment-method-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,An,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"vdr-dt-column")(16,"vdr-dt-column"),e.YNc(17,Jn,19,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(19,qn)),e.xp6(1),e.Q6J("items",e.lcZ(5,7,t.items$))("itemsPerPage",e.lcZ(6,9,t.itemsPerPage$))("totalItems",e.lcZ(7,11,t.totalItems$))("currentPage",e.lcZ(8,13,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,15,"common.code")),e.xp6(3),e.Oqu(e.lcZ(14,17,"common.enabled")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});class he extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.customFields=this.getCustomFieldConfig("Administrator"),this.detailForm=this.formBuilder.group({emailAddress:["",a.kI.required],firstName:["",a.kI.required],lastName:["",a.kI.required],password:[""],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init()}ngOnDestroy(){this.destroy()}save(){this.entity$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i={emailAddress:t.emailAddress,firstName:t.firstName,lastName:t.lastName,password:t.password,customFields:t.customFields};return this.dataService.administrator.updateActiveAdministrator(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Administrator"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Administrator"})})}setFormValues(n,t){this.detailForm.patchValue({emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}he.\u0275fac=function(n){return new(n||he)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},he.\u0275cmp=e.Xpm({type:he,selectors:[["vdr-profile"]],features:[e.qOj],decls:26,vars:27,consts:[[3,"entity"],["locationId","administrator-detail"],[1,"btn","btn-primary",3,"disabled","click"],[1,"form",3,"formGroup"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","password",3,"label",4,"ngIf"],["for","password",3,"label","readOnlyToggle"],["id","password","type","password","formControlName","password"],["formGroupName","customFields",4,"ngIf"],["locationId","administrator-profile",3,"entity$","detailForm"],["for","password",3,"label"],["formGroupName","customFields"],["entityName","Administrator",3,"customFields","customFieldsFormGroup"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.TgZ(6,"button",2),e.NdJ("click",function(){return t.save()}),e._uU(7),e.ALo(8,"translate"),e.qZA()()(),e.TgZ(9,"form",3)(10,"vdr-form-field",4),e.ALo(11,"translate"),e._UZ(12,"input",5),e.qZA(),e.TgZ(13,"vdr-form-field",6),e.ALo(14,"translate"),e._UZ(15,"input",7),e.qZA(),e.TgZ(16,"vdr-form-field",8),e.ALo(17,"translate"),e._UZ(18,"input",9),e.qZA(),e.YNc(19,Dn,3,3,"vdr-form-field",10),e.ALo(20,"async"),e.TgZ(21,"vdr-form-field",11),e.ALo(22,"translate"),e._UZ(23,"input",12),e.qZA(),e.YNc(24,Sn,5,5,"section",13),e._UZ(25,"vdr-custom-detail-component-host",14),e.qZA()),2&n&&(e.xp6(2),e.Q6J("entity",e.lcZ(3,13,t.entity$)),e.xp6(4),e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(8,15,"common.update")," "),e.xp6(2),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(11,17,"settings.email-address")),e.xp6(3),e.Q6J("label",e.lcZ(14,19,"settings.first-name")),e.xp6(3),e.Q6J("label",e.lcZ(17,21,"settings.last-name")),e.xp6(3),e.Q6J("ngIf",e.lcZ(20,23,t.isNew$)),e.xp6(2),e.Q6J("label",e.lcZ(22,25,"settings.password"))("readOnlyToggle",!0),e.xp6(3),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm))},directives:[_.Kk,_.BN,U.V,_.mz,C.W,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,p.O5,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$],styles:[""],changeDetection:0});var kn=m(9493),Pn=m(5646);function Un(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",12),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function In(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",12),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.invalid||t.detailForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Nn(o,n){1&o&&e.YNc(0,In,3,4,"button",13),2&o&&e.Q6J("vdrIfPermissions","UpdateAdministrator")}class fe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.detailForm=this.formBuilder.group({code:["",a.kI.required],description:["",a.kI.required],channelIds:[],permissions:[]})}ngOnInit(){this.init(),this.role$=this.entity$,this.permissionDefinitions=this.serverConfigService.getPermissionDefinitions()}ngOnDestroy(){this.destroy()}updateCode(n){const t=this.detailForm.get(["code"]);t&&t.pristine&&t.setValue((0,Ie.U)(n,"-"))}setPermission(n){const t=this.detailForm.get("permissions");if(t){const i=t.value,r=!0===n.value?(0,kn.T)([...i,n.permission]):i.filter(l=>l!==n.permission);t.setValue(r),t.markAsDirty()}}create(){const t=this.detailForm.value;this.dataService.administrator.createRole(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Role"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createRole.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Role"})})}save(){this.role$.pipe((0,F.q)(1),(0,T.z)(({id:n})=>{const t=this.detailForm.value,i=Object.assign({id:n},t);return this.dataService.administrator.updateRole(i)})).subscribe(n=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Role"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Role"})})}setFormValues(n,t){this.detailForm.patchValue({description:n.description,code:n.code,channelIds:n.channels.map(i=>i.id),permissions:n.permissions}),this.changeDetector.detectChanges()}}fe.\u0275fac=function(n){return new(n||fe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},fe.\u0275cmp=e.Xpm({type:fe,selectors:[["vdr-role-detail"]],features:[e.qOj],decls:29,vars:37,consts:[[3,"entity"],["locationId","role-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","description",3,"label"],["id","description","type","text","formControlName","description",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],[3,"label"],["formControlName","channelIds",3,"vdrDisabled"],[3,"permissionDefinitions","activePermissions","readonly","permissionChange"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,Un,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Nn,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e.TgZ(13,"input",6),e.NdJ("input",function(r){return t.updateCode(r.target.value)}),e.ALo(14,"hasPermission"),e.qZA()(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.ALo(17,"hasPermission"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA(),e.TgZ(20,"vdr-form-field",9),e.ALo(21,"translate"),e._UZ(22,"vdr-channel-assignment-control",10),e.ALo(23,"hasPermission"),e.qZA(),e.TgZ(24,"label"),e._uU(25),e.ALo(26,"translate"),e.qZA(),e.TgZ(27,"vdr-permission-grid",11),e.NdJ("permissionChange",function(r){return t.setPermission(r)}),e.ALo(28,"hasPermission"),e.qZA()()),2&n){const i=e.MAs(9);let r;e.xp6(2),e.Q6J("entity",e.lcZ(3,15,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,17,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,19,"common.description")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,21,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(16,23,"common.code"))("readOnlyToggle",e.lcZ(17,25,"UpdateAdministrator")),e.xp6(3),e.Q6J("readonly",!e.lcZ(19,27,"UpdateAdministrator")),e.xp6(2),e.Q6J("label",e.lcZ(21,29,"settings.channel")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(23,31,"UpdateAdministrator")),e.xp6(3),e.Oqu(e.lcZ(26,33,"settings.permissions")),e.xp6(2),e.Q6J("permissionDefinitions",t.permissionDefinitions)("activePermissions",null==(r=t.detailForm.get("permissions"))?null:r.value)("readonly",!e.lcZ(28,35,"UpdateAdministrator"))}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,Pn.S,R.x,u.MgK,z],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Mn=function(){return["./create"]};function On(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Mn)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-role")," "))}function wn(o,n){if(1&o&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&o){const t=e.oxw().item;e.xp6(1),e.Oqu(t.code)}}function Qn(o,n){if(1&o&&(e.TgZ(0,"vdr-chip"),e._UZ(1,"vdr-channel-badge",17),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"channelCodeToLabel"),e.qZA()),2&o){const t=n.$implicit;e.xp6(1),e.Q6J("channelCode",t.code),e.xp6(1),e.hij(" ",e.lcZ(3,2,e.lcZ(4,4,t.code))," ")}}function Rn(o,n){if(1&o&&(e.ynx(0),e.YNc(1,Qn,5,6,"vdr-chip",16),e.BQk()),2&o){const t=e.oxw().item;e.xp6(1),e.Q6J("ngForOf",t.channels)}}function Yn(o,n){if(1&o&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.xp6(1),e.Oqu(t)}}function $n(o,n){if(1&o&&(e.ynx(0),e._UZ(1,"clr-icon",4),e._uU(2),e.BQk()),2&o){const t=e.oxw(3).item,i=e.oxw();e.xp6(2),e.hij(" ",t.permissions.length-i.initialLimit," ")}}function jn(o,n){1&o&&e._UZ(0,"clr-icon",21)}function zn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2).item;return e.oxw().toggleDisplayLimit(r)}),e.YNc(1,$n,3,1,"ng-container",7),e.YNc(2,jn,1,0,"ng-template",null,20,e.W1O),e.qZA()}if(2&o){const t=e.MAs(3),i=e.oxw(2).item,r=e.oxw();e.xp6(1),e.Q6J("ngIf",(r.displayLimit[i.id]||0)<i.permissions.length)("ngIfElse",t)}}function En(o,n){if(1&o&&(e.ynx(0),e.YNc(1,Yn,2,1,"vdr-chip",16),e.ALo(2,"slice"),e.YNc(3,zn,4,2,"button",18),e.BQk()),2&o){const t=e.oxw().item,i=e.oxw();e.xp6(1),e.Q6J("ngForOf",e.Dn7(2,2,t.permissions,0,i.displayLimit[t.id]||3)),e.xp6(2),e.Q6J("ngIf",t.permissions.length>i.initialLimit)}}function Hn(o,n){1&o&&(e.TgZ(0,"span",22),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.default-role-label")))}const Gn=function(o){return["./",o]};function Vn(o,n){if(1&o&&(e._UZ(0,"vdr-table-row-action",23),e.ALo(1,"translate")),2&o){const t=e.oxw().item;e.Q6J("label",e.lcZ(1,2,"common.edit"))("linkTo",e.VKq(4,Gn,t.id))}}function Bn(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e.YNc(3,wn,2,1,"span",6),e.qZA(),e.TgZ(4,"td",5),e.YNc(5,Rn,2,1,"ng-container",6),e.qZA(),e.TgZ(6,"td",5),e.YNc(7,En,4,6,"ng-container",7),e.YNc(8,Hn,3,3,"ng-template",null,8,e.W1O),e.qZA(),e.TgZ(10,"td",9),e.YNc(11,Vn,2,6,"vdr-table-row-action",10),e.qZA(),e.TgZ(12,"td",9)(13,"vdr-dropdown")(14,"button",11),e._uU(15),e.ALo(16,"translate"),e._UZ(17,"clr-icon",12),e.qZA(),e.TgZ(18,"vdr-dropdown-menu",13)(19,"button",14),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteRole(l.id)}),e.ALo(20,"hasPermission"),e._UZ(21,"clr-icon",15),e._uU(22),e.ALo(23,"translate"),e.qZA()()()()}if(2&o){const t=n.item,i=e.MAs(9),r=e.oxw();e.xp6(1),e.Oqu(t.description),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(2),e.Q6J("ngIf",!r.isDefaultRole(t))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",!r.isDefaultRole(t)),e.xp6(3),e.Q6J("disabled",r.isDefaultRole(t)),e.xp6(1),e.hij(" ",e.lcZ(16,10,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(20,12,"SuperAdmin")),e.xp6(3),e.hij(" ",e.lcZ(23,14,"common.delete")," ")}}class be extends s.t7C{constructor(n,t,i,r,l){super(r,l),this.modalService=n,this.notificationService=t,this.dataService=i,this.initialLimit=3,this.displayLimit={},super.setQueryFn((...d)=>this.dataService.administrator.getRoles(...d),d=>d.roles)}ngOnInit(){super.ngOnInit(),this.visibleRoles$=this.items$.pipe((0,L.U)(n=>n.filter(t=>t.code!==se.RO)))}toggleDisplayLimit(n){this.displayLimit[n.id]===n.permissions.length?this.displayLimit[n.id]=this.initialLimit:this.displayLimit[n.id]=n.permissions.length}isDefaultRole(n){return n.code===se.Wi||n.code===se.RO}deleteRole(n){this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-role"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.administrator.deleteRole(n):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Role"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Role"})})}}be.\u0275fac=function(n){return new(n||be)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz))},be.\u0275cmp=e.Xpm({type:be,selectors:[["vdr-role-list"]],features:[e.qOj],decls:24,vars:25,consts:[["locationId","role-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[4,"ngIf"],[4,"ngIf","ngIfElse"],["defaultRole",""],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo",4,"ngIf"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm",3,"disabled"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[4,"ngFor","ngForOf"],[3,"channelCode"],["class","btn btn-sm btn-secondary btn-icon",3,"click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary","btn-icon",3,"click"],["collapse",""],["shape","minus"],[1,"default-role-label"],["iconShape","edit",3,"label","linkTo"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,On,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e._UZ(21,"vdr-dt-column")(22,"vdr-dt-column"),e.YNc(23,Bn,24,16,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions","CreateAdministrator"),e.xp6(1),e.Q6J("items",e.lcZ(5,9,t.visibleRoles$))("itemsPerPage",e.lcZ(6,11,t.itemsPerPage$))("totalItems",e.lcZ(7,13,t.totalItems$))("currentPage",e.lcZ(8,15,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,17,"common.description")),e.xp6(3),e.Oqu(e.lcZ(14,19,"common.code")),e.xp6(3),e.Oqu(e.lcZ(17,21,"settings.channel")),e.xp6(3),e.Oqu(e.lcZ(20,23,"settings.permissions")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.O5,p.sg,Pe.Y,$e.n,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Ue.E,p.OU,Z.j],styles:[".default-role-label[_ngcontent-%COMP%]{color:var(--color-grey-400)}"],changeDetection:0});var Ee=m(7368),He=m(2702),Ne=m(4187);function Kn(o,n){if(1&o&&e._UZ(0,"vdr-object-tree",11),2&o){const t=e.oxw().$implicit;e.Q6J("value",t.metadata)}}function Wn(o,n){if(1&o&&(e.TgZ(0,"div",6)(1,"div",7)(2,"vdr-labeled-data",8),e.ALo(3,"translate"),e._uU(4),e.qZA(),e.TgZ(5,"div",9)(6,"vdr-labeled-data",8),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA(),e.TgZ(10,"vdr-labeled-data",8),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.YNc(14,Kn,1,1,"vdr-object-tree",10),e.qZA()()),2&o){const t=n.$implicit,i=e.oxw();e.xp6(1),e.ekj("stale",i.testDataUpdated),e.xp6(1),e.Q6J("label",e.lcZ(3,9,"settings.shipping-method")),e.xp6(2),e.hij(" ",t.name," "),e.xp6(2),e.Q6J("label",e.lcZ(7,11,"common.price")),e.xp6(2),e.hij(" ",e.xi3(9,13,t.price,i.currencyCode)," "),e.xp6(2),e.Q6J("label",e.lcZ(11,16,"common.price-with-tax")),e.xp6(2),e.hij(" ",e.xi3(13,18,t.priceWithTax,i.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.metadata)}}function Xn(o,n){1&o&&(e.TgZ(0,"div",6),e._UZ(1,"clr-icon",12),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"settings.no-eligible-shipping-methods")," "))}class ve{constructor(){this.okToRun=!1,this.testDataUpdated=!1,this.runTest=new e.vpe}}ve.\u0275fac=function(n){return new(n||ve)},ve.\u0275cmp=e.Xpm({type:ve,selectors:[["vdr-shipping-eligibility-test-result"]],inputs:{testResult:"testResult",okToRun:"okToRun",testDataUpdated:"testDataUpdated",currencyCode:"currencyCode"},outputs:{runTest:"runTest"},decls:10,vars:9,consts:[[1,"test-result","card"],[1,"card-header"],["class","card-block",4,"ngFor","ngForOf"],["class","card-block",4,"ngIf"],[1,"card-footer"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"card-block"],[1,"result-details"],[3,"label"],[1,"price-row"],[3,"value",4,"ngIf"],[3,"value"],["shape","ban",1,"is-solid","error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Wn,15,21,"div",2),e.YNc(5,Xn,4,3,"div",3),e.TgZ(6,"div",4)(7,"button",5),e.NdJ("click",function(){return t.runTest.emit()}),e._uU(8),e.ALo(9,"translate"),e.qZA()()()),2&n&&(e.xp6(2),e.hij(" ",e.lcZ(3,5,"settings.test-result")," "),e.xp6(2),e.Q6J("ngForOf",t.testResult),e.xp6(1),e.Q6J("ngIf",0===(null==t.testResult?null:t.testResult.length)),e.xp6(2),e.Q6J("disabled",!t.okToRun),e.xp6(1),e.hij(" ",e.lcZ(9,7,"settings.test-shipping-methods")," "))},directives:[p.sg,Ee.W,p.O5,He._,u.qvL],pipes:[b.X$,Ne.k],styles:[".result-details[_ngcontent-%COMP%]{transition:opacity .2s}.result-details.stale[_ngcontent-%COMP%]{opacity:.5}.price-row[_ngcontent-%COMP%]{display:flex}.price-row[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(:first-child){margin-left:24px}clr-icon.error[_ngcontent-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});var Ge=m(745),eo=m(6646),to=m(8951),no=m(1588),oo=m(5983);function io(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"tr",10)(1,"td",11),e._UZ(2,"img",12),e.qZA(),e.TgZ(3,"td",13),e._uU(4),e.qZA(),e.TgZ(5,"td",14),e._uU(6),e.qZA(),e.TgZ(7,"td",15),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA(),e.TgZ(10,"td",16)(11,"input",17),e.NdJ("ngModelChange",function(r){return e.CHM(t).$implicit.quantity=r})("change",function(){return e.CHM(t),e.oxw(2).updateQuantity()}),e.qZA(),e.TgZ(12,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).removeLine(l)}),e._UZ(13,"clr-icon",19),e.qZA()(),e.TgZ(14,"td",20),e._uU(15),e.ALo(16,"localeCurrency"),e.qZA()()}if(2&o){const t=n.$implicit,i=e.oxw(2);e.xp6(2),e.Q6J("src",t.preview+"?preset=tiny",e.LSH),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.sku),e.xp6(2),e.hij(" ",e.xi3(9,6,t.unitPriceWithTax,i.currencyCode)," "),e.xp6(3),e.Q6J("ngModel",t.quantity),e.xp6(4),e.hij(" ",e.xi3(16,9,t.unitPriceWithTax*t.quantity,i.currencyCode)," ")}}function ro(o,n){if(1&o&&(e.TgZ(0,"table",6)(1,"thead")(2,"tr"),e._UZ(3,"th"),e.TgZ(4,"th"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.YNc(19,io,17,12,"tr",7),e.TgZ(20,"tr",8)(21,"td",9),e._uU(22),e.ALo(23,"translate"),e.qZA(),e._UZ(24,"td")(25,"td")(26,"td")(27,"td"),e.TgZ(28,"td"),e._uU(29),e.ALo(30,"localeCurrency"),e.qZA()()()),2&o){const t=e.oxw();e.xp6(5),e.Oqu(e.lcZ(6,8,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(9,10,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(12,12,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(15,14,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,16,"order.total")),e.xp6(2),e.Q6J("ngForOf",t.lines),e.xp6(3),e.Oqu(e.lcZ(23,18,"order.sub-total")),e.xp6(7),e.Oqu(e.xi3(30,20,t.subTotal,t.currencyCode))}}function so(o,n){1&o&&(e.TgZ(0,"div",21)(1,"div",22),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"clr-icon",23),e.qZA()),2&o&&(e.xp6(2),e.Oqu(e.lcZ(3,1,"settings.add-products-to-test-order")))}class E{constructor(n,t){this.dataService=n,this.localStorageService=t,this.orderLinesChange=new e.vpe,this.lines=[]}get subTotal(){return this.lines.reduce((n,t)=>n+t.unitPriceWithTax*t.quantity,0)}ngOnInit(){this.lines=this.loadFromLocalStorage(),this.lines&&this.orderLinesChange.emit(this.lines),this.dataService.settings.getActiveChannel("cache-first").single$.subscribe(n=>{this.currencyCode=n.activeChannel.currencyCode})}selectResult(n){n&&this.addToLines(n)}addToLines(n){var t,i;this.lines.find(r=>r.id===n.productVariantId)||(this.lines.push({id:n.productVariantId,name:n.productVariantName,preview:null!==(i=null===(t=n.productAsset)||void 0===t?void 0:t.preview)&&void 0!==i?i:"",quantity:1,sku:n.sku,unitPriceWithTax:"SinglePrice"===n.priceWithTax.__typename&&n.priceWithTax.value||0}),this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines))}updateQuantity(){this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines)}removeLine(n){this.lines=this.lines.filter(t=>t.id!==n.id),this.persistToLocalStorage(),this.orderLinesChange.emit(this.lines)}persistToLocalStorage(){this.localStorageService.setForCurrentLocation("shippingTestOrder",this.lines)}loadFromLocalStorage(){return this.localStorageService.getForCurrentLocation("shippingTestOrder")||[]}}function ao(o,n){if(1&o&&(e.TgZ(0,"option",9),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.code),e.xp6(1),e.hij(" ",t.name," ")}}E.\u0275fac=function(n){return new(n||E)(e.Y36(s.DoR),e.Y36(s.n2A))},E.\u0275cmp=e.Xpm({type:E,selectors:[["vdr-test-order-builder"]],outputs:{orderLinesChange:"orderLinesChange"},decls:9,vars:5,consts:[[1,"card"],[1,"card-header"],["class","order-table table",4,"ngIf","ngIfElse"],["emptyPlaceholder",""],[1,"card-block"],[3,"productSelected"],[1,"order-table","table"],["class","order-line",4,"ngFor","ngForOf"],[1,"sub-total"],[1,"left"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],["type","number","max","9999","min","1",3,"ngModel","ngModelChange","change"],[1,"icon-button",3,"click"],["shape","trash"],[1,"align-middle","total"],[1,"card-block","empty-placeholder"],[1,"empty-text"],["shape","arrow","dir","down","size","96"]],template:function(n,t){if(1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ro,31,23,"table",2),e.YNc(5,so,5,3,"ng-template",null,3,e.W1O),e.TgZ(7,"div",4)(8,"vdr-product-variant-selector",5),e.NdJ("productSelected",function(r){return t.selectResult(r)}),e.qZA()()()),2&n){const i=e.MAs(6);e.xp6(2),e.hij(" ",e.lcZ(3,3,"settings.test-order")," "),e.xp6(2),e.Q6J("ngIf",t.lines.length)("ngIfElse",i)}},directives:[p.O5,p.sg,A.y,a.Fd,a.qQ,a.wV,a.Fj,a.JJ,a.On,u.qvL,no.Lv,oo.e],pipes:[b.X$,Ne.k],styles:[".empty-placeholder[_ngcontent-%COMP%]{color:var(--color-grey-400);text-align:center}.empty-text[_ngcontent-%COMP%]{font-size:22px}"],changeDetection:0});class H{constructor(n,t,i){this.formBuilder=n,this.dataService=t,this.localStorageService=i,this.addressChange=new e.vpe}ngOnInit(){this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(i=>i.countries.items);const t=this.localStorageService.getForCurrentLocation("shippingTestAddress")||{city:"",countryCode:"",postalCode:"",province:""};this.addressChange.emit(t),this.form=this.formBuilder.group(t),this.subscription=this.form.valueChanges.subscribe(i=>{this.localStorageService.setForCurrentLocation("shippingTestAddress",i),this.addressChange.emit(i)})}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}}function lo(o,n){1&o&&e._UZ(0,"clr-icon",14)}function co(o,n){1&o&&e._UZ(0,"clr-icon",15)}function mo(o,n){1&o&&e._UZ(0,"clr-icon",16)}function uo(o,n){if(1&o&&(e.TgZ(0,"vdr-labeled-data",4),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&o){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"common.price")),e.xp6(2),e.hij(" ",e.xi3(3,4,null==t.testResult.quote?null:t.testResult.quote.price,t.currencyCode)," ")}}function po(o,n){if(1&o&&(e.TgZ(0,"vdr-labeled-data",4),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&o){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"common.price-with-tax")),e.xp6(2),e.hij(" ",e.xi3(3,4,null==t.testResult.quote?null:t.testResult.quote.priceWithTax,t.currencyCode)," ")}}function go(o,n){if(1&o&&e._UZ(0,"vdr-object-tree",17),2&o){const t=e.oxw();e.Q6J("value",null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.metadata)}}H.\u0275fac=function(n){return new(n||H)(e.Y36(a.qu),e.Y36(s.DoR),e.Y36(s.n2A))},H.\u0275cmp=e.Xpm({type:H,selectors:[["vdr-test-address-form"]],outputs:{addressChange:"addressChange"},decls:28,vars:19,consts:[[1,"card"],[1,"card-header"],[1,"card-block"],[3,"formGroup"],["formControlName","city","type","text","clrInput",""],["formControlName","province","type","text","clrInput",""],["formControlName","postalCode","type","text","clrInput",""],["name","countryCode","formControlName","countryCode","clrInput","","clrSelect",""],[3,"value",4,"ngFor","ngForOf"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",2)(5,"form",3)(6,"clr-input-container")(7,"label"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e._UZ(10,"input",4),e.qZA(),e.TgZ(11,"clr-input-container")(12,"label"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e._UZ(15,"input",5),e.qZA(),e.TgZ(16,"clr-input-container")(17,"label"),e._uU(18),e.ALo(19,"translate"),e.qZA(),e._UZ(20,"input",6),e.qZA(),e.TgZ(21,"clr-input-container")(22,"label"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.TgZ(25,"select",7),e.YNc(26,ao,2,2,"option",8),e.ALo(27,"async"),e.qZA()()()()()),2&n&&(e.xp6(2),e.hij(" ",e.lcZ(3,7,"settings.test-address")," "),e.xp6(3),e.Q6J("formGroup",t.form),e.xp6(3),e.Oqu(e.lcZ(9,9,"customer.city")),e.xp6(5),e.Oqu(e.lcZ(14,11,"customer.province")),e.xp6(5),e.Oqu(e.lcZ(19,13,"customer.postal-code")),e.xp6(5),e.Oqu(e.lcZ(24,15,"customer.country")),e.xp6(3),e.Q6J("ngForOf",e.lcZ(27,17,t.availableCountries$)))},directives:[a._Y,a.JL,a.sg,u.G55,u.MgK,A.y,a.Fj,a.JJ,a.u,u.xRP,a.EJ,u.otW,p.sg,a.YN,a.Kr],pipes:[b.X$,p.Ov],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});const _o=function(o,n,t){return{success:o,error:n,unknown:t}};class Ze{constructor(){this.okToRun=!1,this.testDataUpdated=!1,this.runTest=new e.vpe}}function ho(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedChecker||!t.selectedCalculator),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function fo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",t.detailForm.pristine||t.detailForm.invalid||!t.selectedChecker||!t.selectedCalculator),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function bo(o,n){if(1&o&&e.YNc(0,fo,3,4,"button",9),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function vo(o,n){if(1&o&&(e.TgZ(0,"option",27),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.code),e.xp6(1),e.AsE(" ",t.code,": ",t.description," ")}}function Zo(o,n){if(1&o&&(e.TgZ(0,"section",28)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",29),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}function Co(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",30),e.NdJ("remove",function(){e.CHM(t);return e.oxw(2).selectedChecker=null}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedChecker)("operationDefinition",t.selectedCheckerDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function yo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",35),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectChecker(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function xo(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",31),e._UZ(3,"clr-icon",32),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",33),e.YNc(7,yo,2,1,"button",34),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.checkers)}}function To(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"vdr-configurable-input",36),e.NdJ("remove",function(){e.CHM(t);return e.oxw(2).selectedCalculator=null}),e.ALo(1,"hasPermission"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("operation",t.selectedCalculator)("operationDefinition",t.selectedCalculatorDefinition)("readonly",!e.lcZ(1,3,t.updatePermission))}}function Ao(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",35),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).selectCalculator(l)}),e._uU(1),e.qZA()}if(2&o){const t=n.$implicit;e.xp6(1),e.hij(" ",t.description," ")}}function Lo(o,n){if(1&o&&(e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",31),e._UZ(3,"clr-icon",32),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",33),e.YNc(7,Ao,2,1,"button",34),e.qZA()()()),2&o){const t=e.oxw(2);e.xp6(4),e.hij(" ",e.lcZ(5,2,"common.select")," "),e.xp6(3),e.Q6J("ngForOf",t.calculators)}}function Fo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"form",10)(1,"vdr-form-field",11),e.ALo(2,"translate"),e.TgZ(3,"input",12),e.NdJ("input",function(r){const d=e.CHM(t).ngIf;return e.oxw().updateCode(d.code,r.target.value)}),e.ALo(4,"hasPermission"),e.qZA()(),e.TgZ(5,"vdr-form-field",13),e.ALo(6,"translate"),e.ALo(7,"hasPermission"),e._UZ(8,"input",14),e.ALo(9,"hasPermission"),e.qZA(),e._UZ(10,"vdr-rich-text-editor",15),e.ALo(11,"hasPermission"),e.ALo(12,"translate"),e.TgZ(13,"vdr-form-field",16),e.ALo(14,"translate"),e.TgZ(15,"select",17),e.ALo(16,"hasPermission"),e.YNc(17,vo,2,3,"option",18),e.qZA()(),e.YNc(18,Zo,6,8,"section",19),e._UZ(19,"vdr-custom-detail-component-host",20),e.TgZ(20,"div",21)(21,"div",22)(22,"label",23),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.YNc(25,Co,2,5,"vdr-configurable-input",24),e.YNc(26,xo,8,4,"div",25),e.qZA(),e.TgZ(27,"div",22)(28,"label",23),e._uU(29),e.ALo(30,"translate"),e.qZA(),e.YNc(31,To,2,5,"vdr-configurable-input",26),e.YNc(32,Lo,8,4,"div",25),e.qZA()()()}if(2&o){const t=e.oxw();e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(2,20,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(4,22,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(6,24,"common.code"))("readOnlyToggle",e.lcZ(7,26,t.updatePermission)),e.xp6(3),e.Q6J("readonly",!e.lcZ(9,28,t.updatePermission)),e.xp6(2),e.Q6J("readonly",!e.lcZ(11,30,t.updatePermission))("label",e.lcZ(12,32,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(14,34,"settings.fulfillment-handler")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(16,36,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",t.fulfillmentHandlers),e.xp6(1),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(4),e.Oqu(e.lcZ(24,38,"settings.shipping-eligibility-checker")),e.xp6(2),e.Q6J("ngIf",t.selectedChecker&&t.selectedCheckerDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedChecker||!t.selectedCheckerDefinition),e.xp6(3),e.Oqu(e.lcZ(30,40,"settings.shipping-calculator")),e.xp6(2),e.Q6J("ngIf",t.selectedCalculator&&t.selectedCalculatorDefinition),e.xp6(1),e.Q6J("ngIf",!t.selectedCalculator||!t.selectedCalculatorDefinition)}}function Jo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"div",37)(2,"div",22)(3,"vdr-test-order-builder",38),e.NdJ("orderLinesChange",function(r){return e.CHM(t),e.oxw().setTestOrderLines(r)}),e.qZA()(),e.TgZ(4,"div",22)(5,"vdr-test-address-form",39),e.NdJ("addressChange",function(r){return e.CHM(t),e.oxw().setTestAddress(r)}),e.qZA(),e.TgZ(6,"vdr-shipping-method-test-result",40),e.NdJ("runTest",function(){return e.CHM(t),e.oxw().runTest()}),e.ALo(7,"async"),e.ALo(8,"async"),e.qZA()()()()}if(2&o){const t=e.oxw();let i;e.xp6(6),e.Q6J("currencyCode",null==(i=e.lcZ(7,4,t.activeChannel$))?null:i.currencyCode)("okToRun",t.allTestDataPresent()&&t.testDataUpdated&&t.detailForm.valid)("testDataUpdated",t.testDataUpdated)("testResult",e.lcZ(8,6,t.testResult$))}}Ze.\u0275fac=function(n){return new(n||Ze)},Ze.\u0275cmp=e.Xpm({type:Ze,selectors:[["vdr-shipping-method-test-result"]],inputs:{testResult:"testResult",okToRun:"okToRun",testDataUpdated:"testDataUpdated",currencyCode:"currencyCode"},outputs:{runTest:"runTest"},decls:21,vars:24,consts:[[1,"test-result","card",3,"ngClass"],[1,"card-header"],[1,"card-block"],[1,"result-details"],[3,"label"],[1,"eligible-icon"],["shape","success-standard","class","is-solid success",4,"ngIf"],["shape","ban","class","is-solid error",4,"ngIf"],["shape","unknown-status",4,"ngIf"],[1,"price-row"],[3,"label",4,"ngIf"],[3,"value",4,"ngIf"],[1,"card-footer"],[1,"btn","btn-secondary",3,"disabled","click"],["shape","success-standard",1,"is-solid","success"],["shape","ban",1,"is-solid","error"],["shape","unknown-status"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",2)(5,"div",3)(6,"vdr-labeled-data",4),e.ALo(7,"translate"),e.TgZ(8,"div",5),e.YNc(9,lo,1,0,"clr-icon",6),e.YNc(10,co,1,0,"clr-icon",7),e.YNc(11,mo,1,0,"clr-icon",8),e.qZA(),e._uU(12),e.qZA(),e.TgZ(13,"div",9),e.YNc(14,uo,4,7,"vdr-labeled-data",10),e.YNc(15,po,4,7,"vdr-labeled-data",10),e.qZA(),e.YNc(16,go,1,1,"vdr-object-tree",11),e.qZA()(),e.TgZ(17,"div",12)(18,"button",13),e.NdJ("click",function(){return t.runTest.emit()}),e._uU(19),e.ALo(20,"translate"),e.qZA()()()),2&n&&(e.Q6J("ngClass",e.kEZ(20,_o,!0===(null==t.testResult?null:t.testResult.eligible),!1===(null==t.testResult?null:t.testResult.eligible),!t.testResult)),e.xp6(2),e.hij(" ",e.lcZ(3,14,"settings.test-result")," "),e.xp6(3),e.ekj("stale",t.testDataUpdated),e.xp6(1),e.Q6J("label",e.lcZ(7,16,"settings.eligible")),e.xp6(3),e.Q6J("ngIf",null==t.testResult?null:t.testResult.eligible),e.xp6(1),e.Q6J("ngIf",!1===(null==t.testResult?null:t.testResult.eligible)),e.xp6(1),e.Q6J("ngIf",!t.testResult),e.xp6(1),e.hij(" ",null==t.testResult?null:t.testResult.eligible," "),e.xp6(2),e.Q6J("ngIf",null!=(null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.price)),e.xp6(1),e.Q6J("ngIf",null!=(null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.priceWithTax)),e.xp6(1),e.Q6J("ngIf",null==t.testResult||null==t.testResult.quote?null:t.testResult.quote.metadata),e.xp6(2),e.Q6J("disabled",!t.okToRun),e.xp6(1),e.hij(" ",e.lcZ(20,18,"settings.test-shipping-method")," "))},directives:[p.mk,Ee.W,p.O5,u.qvL,He._],pipes:[b.X$,Ne.k],styles:[".test-result.success[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-success-100)}.test-result.error[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-error-100)}.test-result.unknown[_ngcontent-%COMP%] .card-block[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.result-details[_ngcontent-%COMP%]{transition:opacity .2s}.result-details.stale[_ngcontent-%COMP%]{opacity:.5}.eligible-icon[_ngcontent-%COMP%]{display:inline-block}.eligible-icon[_ngcontent-%COMP%] .success[_ngcontent-%COMP%]{color:var(--color-success-500)}.eligible-icon[_ngcontent-%COMP%] .error[_ngcontent-%COMP%]{color:var(--color-error-500)}.price-row[_ngcontent-%COMP%]{display:flex}.price-row[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(:first-child){margin-left:24px}"],changeDetection:0});class Ce extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.checkers=[],this.calculators=[],this.fulfillmentHandlers=[],this.testDataUpdated=!1,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateShippingMethod],this.fetchTestResult$=new qe.x,this.customFields=this.getCustomFieldConfig("ShippingMethod"),this.detailForm=this.formBuilder.group({code:["",a.kI.required],name:["",a.kI.required],description:"",fulfillmentHandler:["",a.kI.required],checker:{},calculator:{},customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),(0,w.a)([this.dataService.shippingMethod.getShippingMethodOperations().single$,this.entity$.pipe((0,F.q)(1))]).subscribe(([n,t])=>{this.checkers=n.shippingEligibilityCheckers,this.calculators=n.shippingCalculators,this.fulfillmentHandlers=n.fulfillmentHandlers,this.changeDetector.markForCheck(),this.selectedCheckerDefinition=n.shippingEligibilityCheckers.find(i=>i.code===(t.checker&&t.checker.code)),this.selectedCalculatorDefinition=n.shippingCalculators.find(i=>i.code===(t.calculator&&t.calculator.code))}),this.activeChannel$=this.dataService.settings.getActiveChannel().mapStream(n=>n.activeChannel),this.testResult$=this.fetchTestResult$.pipe((0,v.w)(([n,t])=>{if(!this.selectedChecker||!this.selectedCalculator)return(0,Ge.of)(void 0);const i=this.detailForm.value,r={shippingAddress:Object.assign(Object.assign({},n),{streetLine1:"test"}),lines:t.map(l=>({productVariantId:l.id,quantity:l.quantity})),checker:(0,s.RnJ)(this.selectedChecker,i.checker),calculator:(0,s.RnJ)(this.selectedCalculator,i.calculator)};return this.dataService.shippingMethod.testShippingMethod(r).mapSingle(l=>l.testShippingMethod)})),(0,eo.T)(this.detailForm.get(["checker"]).valueChanges,this.detailForm.get(["calculator"]).valueChanges).pipe((0,to.R)(this.destroy$)).subscribe(()=>this.testDataUpdated=!0)}ngOnDestroy(){this.destroy()}updateCode(n,t){if(!n){const i=this.detailForm.get(["code"]);i&&i.pristine&&i.setValue((0,Ie.U)(t,"-"))}}selectChecker(n){this.selectedCheckerDefinition=n,this.selectedChecker=(0,s.miO)(n);const t=this.detailForm.get("checker");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedChecker)),this.detailForm.markAsDirty()}selectCalculator(n){this.selectedCalculatorDefinition=n,this.selectedCalculator=(0,s.miO)(n);const t=this.detailForm.get("calculator");t&&(t.clearValidators(),t.updateValueAndValidity({onlySelf:!0}),t.patchValue(this.selectedCalculator)),this.detailForm.markAsDirty()}create(){const n=this.selectedChecker,t=this.selectedCalculator;!n||!t||(0,w.a)([this.entity$,this.languageCode$]).pipe((0,F.q)(1),(0,T.z)(([i,r])=>{const l=this.detailForm.value,d=Object.assign(Object.assign({},this.getUpdatedShippingMethod(i,this.detailForm,r)),{checker:(0,s.RnJ)(n,l.checker),calculator:(0,s.RnJ)(t,l.calculator)});return this.dataService.shippingMethod.createShippingMethod(d)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"ShippingMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createShippingMethod.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"ShippingMethod"})})}save(){const n=this.selectedChecker,t=this.selectedCalculator;!n||!t||(0,w.a)([this.entity$,this.languageCode$]).pipe((0,F.q)(1),(0,T.z)(([i,r])=>{const l=this.detailForm.value,d=Object.assign(Object.assign({},this.getUpdatedShippingMethod(i,this.detailForm,r)),{checker:(0,s.RnJ)(n,l.checker),calculator:(0,s.RnJ)(t,l.calculator)});return this.dataService.shippingMethod.updateShippingMethod(d)})).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"ShippingMethod"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},i=>{console.error(i),this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"ShippingMethod"})})}setTestOrderLines(n){this.testOrderLines=n,this.testDataUpdated=!0}setTestAddress(n){this.testAddress=n,this.testDataUpdated=!0}allTestDataPresent(){return!!(this.testAddress&&this.testOrderLines&&this.testOrderLines.length&&this.selectedChecker&&this.selectedCalculator)}runTest(){this.fetchTestResult$.next([this.testAddress,this.testOrderLines]),this.testDataUpdated=!1}getUpdatedShippingMethod(n,t,i){const r=t.value,l=(0,s.iSy)({translatable:n,updatedFields:r,customFieldConfig:this.customFields,languageCode:i,defaultTranslation:{languageCode:i,name:n.name||"",description:n.description||""}});return Object.assign(Object.assign({},l),{fulfillmentHandler:r.fulfillmentHandler})}setFormValues(n,t){var i,r,l,d;const h=(0,s.ZIM)(n,t);this.detailForm.patchValue({name:null!==(i=null==h?void 0:h.name)&&void 0!==i?i:"",description:null!==(r=null==h?void 0:h.description)&&void 0!==r?r:"",code:n.code,fulfillmentHandler:n.fulfillmentHandlerCode,checker:n.checker||{},calculator:n.calculator||{}}),this.selectedChecker||(this.selectedChecker=n.checker&&{code:n.checker.code,args:n.checker.args.map(f=>Object.assign(Object.assign({},f),{value:(0,s.sux)(f.value)}))}),this.selectedCalculator||(this.selectedCalculator=n.calculator&&{code:null===(l=n.calculator)||void 0===l?void 0:l.code,args:null===(d=n.calculator)||void 0===d?void 0:d.args.map(f=>Object.assign(Object.assign({},f),{value:(0,s.sux)(f.value)}))}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n,h)}}Ce.\u0275fac=function(n){return new(n||Ce)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},Ce.\u0275cmp=e.Xpm({type:Ce,selectors:[["vdr-shipping-method-detail"]],features:[e.qOj],decls:23,vars:22,consts:[[3,"entity"],[3,"disabled","availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","shipping-method-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],["class","form",3,"formGroup",4,"ngIf"],[1,"testing-tool"],[4,"clrIfExpanded"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly","input"],["for","code",3,"label","readOnlyToggle"],["id","code","type","text","formControlName","code",3,"readonly"],["formControlName","description",3,"readonly","label"],["for","fulfillmentHandler",1,"mb2",3,"label"],["name","fulfillmentHandler","formControlName","fulfillmentHandler",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","customFields",4,"ngIf"],["locationId","shipping-method-detail",3,"entity$","detailForm"],[1,"clr-row","mt4"],[1,"clr-col"],[1,"clr-control-label"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[4,"ngIf"],["formControlName","calculator",3,"operation","operationDefinition","readonly","remove",4,"ngIf"],[3,"value"],["formGroupName","customFields"],["entityName","ShippingMethod",3,"customFields","customFieldsFormGroup","readonly"],["formControlName","checker",3,"operation","operationDefinition","readonly","remove"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],["formControlName","calculator",3,"operation","operationDefinition","readonly","remove"],[1,"clr-row"],[3,"orderLinesChange"],[3,"addressChange"],[3,"currencyCode","okToRun","testDataUpdated","testResult","runTest"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.TgZ(4,"vdr-language-selector",1),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.qZA()(),e.TgZ(8,"vdr-ab-right"),e._UZ(9,"vdr-action-bar-items",2),e.YNc(10,ho,3,4,"button",3),e.ALo(11,"async"),e.YNc(12,bo,1,1,"ng-template",null,4,e.W1O),e.qZA()(),e.YNc(14,Fo,33,42,"form",5),e.ALo(15,"async"),e.TgZ(16,"div",6)(17,"clr-accordion")(18,"clr-accordion-panel")(19,"clr-accordion-title"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.YNc(22,Jo,9,8,"clr-accordion-content",7),e.qZA()()()),2&n){const i=e.MAs(13);e.xp6(2),e.Q6J("entity",e.lcZ(3,8,t.entity$)),e.xp6(2),e.Q6J("disabled",e.lcZ(5,10,t.isNew$))("availableLanguageCodes",e.lcZ(6,12,t.availableLanguages$))("currentLanguageCode",e.lcZ(7,14,t.languageCode$)),e.xp6(6),e.Q6J("ngIf",e.lcZ(11,16,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("ngIf",e.lcZ(15,18,t.entity$)),e.xp6(6),e.Oqu(e.lcZ(21,20,"settings.test-shipping-method"))}},directives:[_.Kk,_.BN,U.V,De.S,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,je.Y,a.EJ,R.x,p.sg,a.YN,a.Kr,a.x0,u.MgK,I.y,O.C,ze.q,D.J,S.U,u.qvL,k.N,P.H,u.bZL,u.twP,u.GmI,u.dxz,u.UJ5,u.Nz$,u.DbV,u.r6y,E,H,Ze],pipes:[p.Ov,b.X$,Z.j],styles:[".testing-tool[_ngcontent-%COMP%]{margin-top:48px;margin-bottom:128px}.testing-tool[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});const qo=function(){return["./create"]};function Do(o,n){1&o&&(e.TgZ(0,"a",6),e._UZ(1,"clr-icon",7),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,qo)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-shipping-method")," "))}const So=function(o){return["./",o]},ko=function(){return["DeleteSettings","DeleteShippingMethod"]};function Po(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",8),e._uU(1),e.qZA(),e.TgZ(2,"td",8),e._uU(3),e.qZA(),e.TgZ(4,"td",9),e._UZ(5,"vdr-table-row-action",10),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",9)(8,"vdr-dropdown")(9,"button",11),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",12),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",13)(14,"button",14),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteShippingMethod(l.id)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",15),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,So,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,ko))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}function Uo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"div",16)(2,"div",17)(3,"vdr-test-order-builder",18),e.NdJ("orderLinesChange",function(r){return e.CHM(t),e.oxw().setTestOrderLines(r)}),e.qZA()(),e.TgZ(4,"div",17)(5,"vdr-test-address-form",19),e.NdJ("addressChange",function(r){return e.CHM(t),e.oxw().setTestAddress(r)}),e.qZA(),e.TgZ(6,"vdr-shipping-eligibility-test-result",20),e.NdJ("runTest",function(){return e.CHM(t),e.oxw().runTest()}),e.ALo(7,"async"),e.ALo(8,"async"),e.qZA()()()()}if(2&o){const t=e.oxw();let i;e.xp6(6),e.Q6J("currencyCode",null==(i=e.lcZ(7,4,t.activeChannel$))?null:i.currencyCode)("okToRun",t.allTestDataPresent())("testDataUpdated",t.testDataUpdated)("testResult",e.lcZ(8,6,t.testResult$))}}const Io=function(){return["CreateSettings","CreateShippingMethod"]};class ye extends s.t7C{constructor(n,t,i,r,l,d){super(l,d),this.modalService=n,this.notificationService=t,this.dataService=i,this.serverConfigService=r,this.testDataUpdated=!1,this.fetchTestResult$=new qe.x,super.setQueryFn((...h)=>this.dataService.shippingMethod.getShippingMethods(...h).refetchOnChannelChange(),h=>h.shippingMethods)}ngOnInit(){super.ngOnInit(),this.testResult$=this.fetchTestResult$.pipe((0,v.w)(([n,t])=>{const i={shippingAddress:Object.assign(Object.assign({},n),{streetLine1:"test"}),lines:t.map(r=>({productVariantId:r.id,quantity:r.quantity}))};return this.dataService.shippingMethod.testEligibleShippingMethods(i).mapSingle(r=>r.testEligibleShippingMethods)})),this.activeChannel$=this.dataService.settings.getActiveChannel().mapStream(n=>n.activeChannel),this.availableLanguages$=this.serverConfigService.getAvailableLanguages(),this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:n})=>n.contentLanguage).pipe((0,Se.b)(()=>this.refresh()))}deleteShippingMethod(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-shipping-method"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.shippingMethod.deleteShippingMethod(n):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"ShippingMethod"}),this.refresh()},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"ShippingMethod"})})}setTestOrderLines(n){this.testOrderLines=n,this.testDataUpdated=!0}setTestAddress(n){this.testAddress=n,this.testDataUpdated=!0}allTestDataPresent(){return!!(this.testAddress&&this.testOrderLines&&this.testOrderLines.length)}runTest(){this.fetchTestResult$.next([this.testAddress,this.testOrderLines]),this.testDataUpdated=!1}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}}function No(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Mo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Oo(o,n){if(1&o&&e.YNc(0,Mo,3,4,"button",12),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function wo(o,n){if(1&o&&(e.TgZ(0,"section",13)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",14),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}ye.\u0275fac=function(n){return new(n||ye)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(s.iHG),e.Y36(g.F0),e.Y36(g.gz))},ye.\u0275cmp=e.Xpm({type:ye,selectors:[["vdr-shipping-method-list"]],features:[e.qOj],decls:29,vars:29,consts:[[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","shipping-method-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"testing-tool"],[4,"clrIfExpanded"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"],[1,"clr-row"],[1,"clr-col"],[3,"orderLinesChange"],[3,"addressChange"],[3,"currencyCode","okToRun","testDataUpdated","testResult","runTest"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"vdr-language-selector",0),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()(),e.TgZ(5,"vdr-ab-right"),e._UZ(6,"vdr-action-bar-items",1),e.YNc(7,Do,4,5,"a",2),e.qZA()(),e.TgZ(8,"vdr-data-table",3),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(9,"async"),e.ALo(10,"async"),e.ALo(11,"async"),e.ALo(12,"async"),e.TgZ(13,"vdr-dt-column"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dt-column"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e._UZ(19,"vdr-dt-column")(20,"vdr-dt-column"),e.YNc(21,Po,19,18,"ng-template"),e.qZA(),e.TgZ(22,"div",4)(23,"clr-accordion")(24,"clr-accordion-panel")(25,"clr-accordion-title"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.YNc(28,Uo,9,8,"clr-accordion-content",5),e.qZA()()()),2&n&&(e.xp6(2),e.Q6J("availableLanguageCodes",e.lcZ(3,10,t.availableLanguages$))("currentLanguageCode",e.lcZ(4,12,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(28,Io)),e.xp6(1),e.Q6J("items",e.lcZ(9,14,t.items$))("itemsPerPage",e.lcZ(10,16,t.itemsPerPage$))("totalItems",e.lcZ(11,18,t.totalItems$))("currentPage",e.lcZ(12,20,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(15,22,"common.code")),e.xp6(3),e.Oqu(e.lcZ(18,24,"common.name")),e.xp6(9),e.Oqu(e.lcZ(27,26,"settings.test-shipping-methods")))},directives:[_.Kk,_.BN,De.S,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H,u.bZL,u.twP,u.GmI,u.dxz,u.UJ5,u.Nz$,u.DbV,u.r6y,E,H,ve],pipes:[p.Ov,b.X$,Z.j],styles:[".testing-tool[_ngcontent-%COMP%]{margin-top:48px}"],changeDetection:0});class xe extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateTaxCategory],this.customFields=this.getCustomFieldConfig("TaxCategory"),this.detailForm=this.formBuilder.group({name:["",a.kI.required],isDefault:!1,customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.taxCategory$=this.entity$}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={name:n.name,isDefault:n.isDefault,customFields:n.customFields};this.dataService.settings.createTaxCategory(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"TaxCategory"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createTaxCategory.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"TaxCategory"})})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.taxCategory$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,name:n.name,isDefault:n.isDefault,customFields:n.customFields};return this.dataService.settings.updateTaxCategory(i)})).subscribe(t=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"TaxCategory"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"TaxCategory"})})}setFormValues(n,t){this.detailForm.patchValue({name:n.name,isDefault:n.isDefault}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}xe.\u0275fac=function(n){return new(n||xe)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},xe.\u0275cmp=e.Xpm({type:xe,selectors:[["vdr-tax-detail"]],features:[e.qOj],decls:22,vars:23,consts:[[3,"entity"],["locationId","tax-category-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","isDefault",3,"label"],["type","checkbox","clrToggle","","id","isDefault","formControlName","isDefault",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","tax-category-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["formGroupName","customFields"],["entityName","TaxCategory",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,No,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Oo,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.TgZ(17,"clr-toggle-wrapper"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA()(),e.YNc(20,wo,6,8,"section",9),e._UZ(21,"vdr-custom-detail-component-host",10),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,11,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,13,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,15,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,17,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,19,"common.default-tax-category")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(19,21,t.updatePermission)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const Qo=function(){return["./create"]};function Ro(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,Qo)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-tax-category")," "))}function Yo(o,n){1&o&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.default-tax-category")))}const $o=function(o){return["./",o]},jo=function(){return["DeleteSettings","DeleteTaxCategory"]};function zo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e.YNc(3,Yo,3,3,"vdr-chip",6),e.qZA(),e.TgZ(4,"td",7),e._UZ(5,"vdr-table-row-action",8),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"td",7)(8,"vdr-dropdown")(9,"button",9),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",10),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",11)(14,"button",12),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteTaxCategory(l)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",13),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",t.isDefault),e.xp6(2),e.Q6J("label",e.lcZ(6,7,"common.edit"))("linkTo",e.VKq(15,$o,t.id)),e.xp6(5),e.hij(" ",e.lcZ(11,9,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,11,e.DdM(17,jo))),e.xp6(3),e.hij(" ",e.lcZ(18,13,"common.delete")," ")}}const Eo=function(){return["CreateSettings","CreateTaxCategory"]};class Te{constructor(n,t,i){this.dataService=n,this.notificationService=t,this.modalService=i,this.queryResult=this.dataService.settings.getTaxCategories(),this.taxCategories$=this.queryResult.mapStream(r=>r.taxCategories)}deleteTaxCategory(n){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-tax-category"),body:n.name,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteTaxCategory(n.id):J.E),(0,L.U)(t=>t.deleteTaxCategory)).subscribe(t=>{t.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"TaxRate"}),this.queryResult.ref.refetch()):this.notificationService.error(t.message||(0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})})}}Te.\u0275fac=function(n){return new(n||Te)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U))},Te.\u0275cmp=e.Xpm({type:Te,selectors:[["vdr-tax-list"]],decls:13,vars:8,consts:[["locationId","tax-category-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[4,"ngIf"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,Ro,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.ALo(5,"async"),e.TgZ(6,"vdr-dt-column"),e._uU(7),e.ALo(8,"translate"),e.qZA(),e._UZ(9,"vdr-dt-column")(10,"vdr-dt-column")(11,"vdr-dt-column"),e.YNc(12,zo,19,18,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(7,Eo)),e.xp6(1),e.Q6J("items",e.lcZ(5,3,t.taxCategories$)),e.xp6(3),e.Oqu(e.lcZ(8,5,"common.name")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,p.O5,Pe.Y,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});var Ho=m(7122);function Go(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Vo(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&o){const t=e.oxw(2);e.Q6J("disabled",!t.saveButtonEnabled()),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Bo(o,n){if(1&o&&e.YNc(0,Vo,3,4,"button",20),2&o){const t=e.oxw();e.Q6J("vdrIfPermissions",t.updatePermission)}}function Ko(o,n){if(1&o&&(e.TgZ(0,"option",21),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.hij(" ",t.name," ")}}function Wo(o,n){if(1&o&&(e.TgZ(0,"option",21),e._uU(1),e.qZA()),2&o){const t=n.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function Xo(o,n){if(1&o&&(e.TgZ(0,"section",22)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",23),e.ALo(5,"hasPermission"),e.qZA()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,4,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.lcZ(5,6,t.updatePermission))}}class Ae extends s.UT_{constructor(n,t,i,r,l,d,h){super(t,n,i,l),this.changeDetector=r,this.dataService=l,this.formBuilder=d,this.notificationService=h,this.updatePermission=[s.y3$.UpdateSettings,s.y3$.UpdateTaxRate],this.customFields=this.getCustomFieldConfig("TaxRate"),this.detailForm=this.formBuilder.group({name:["",a.kI.required],enabled:[!0],value:[0,a.kI.required],taxCategoryId:[""],zoneId:[""],customerGroupId:[""],customFields:this.formBuilder.group(this.customFields.reduce((f,y)=>Object.assign(Object.assign({},f),{[y.name]:""}),{}))})}ngOnInit(){this.init(),this.taxCategories$=this.dataService.settings.getTaxCategories().mapSingle(n=>n.taxCategories),this.zones$=this.dataService.settings.getZones().mapSingle(n=>n.zones)}ngOnDestroy(){this.destroy()}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid}create(){if(!this.detailForm.dirty)return;const n=this.detailForm.value,t={name:n.name,enabled:n.enabled,value:n.value,categoryId:n.taxCategoryId,zoneId:n.zoneId,customerGroupId:n.customerGroupId,customFields:n.customFields};this.dataService.settings.createTaxRate(t).subscribe(i=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"TaxRate"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.createTaxRate.id],{relativeTo:this.route})},i=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"TaxRate"})})}save(){if(!this.detailForm.dirty)return;const n=this.detailForm.value;this.entity$.pipe((0,F.q)(1),(0,T.z)(t=>{const i={id:t.id,name:n.name,enabled:n.enabled,value:n.value,categoryId:n.taxCategoryId,zoneId:n.zoneId,customerGroupId:n.customerGroupId,customFields:n.customFields};return this.dataService.settings.updateTaxRate(i)})).subscribe(t=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"TaxRate"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"TaxRate"})})}setFormValues(n,t){this.detailForm.patchValue({name:n.name,enabled:n.enabled,value:n.value,taxCategoryId:n.category?n.category.id:"",zoneId:n.zone?n.zone.id:"",customerGroupId:n.customerGroup?n.customerGroup.id:""}),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),n)}}Ae.\u0275fac=function(n){return new(n||Ae)(e.Y36(g.F0),e.Y36(g.gz),e.Y36(s.iHG),e.Y36(e.sBO),e.Y36(s.DoR),e.Y36(a.qu),e.Y36(s.gqp))},Ae.\u0275cmp=e.Xpm({type:Ae,selectors:[["vdr-tax-rate-detail"]],features:[e.qOj],decls:39,vars:47,consts:[[3,"entity"],["locationId","tax-rate-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","enabled",3,"label"],["type","checkbox","clrToggle","","id","enabled","formControlName","enabled",3,"vdrDisabled"],["for","value",3,"label"],["suffix","%"],["id","value","type","number","step","0.1","formControlName","value",3,"readonly"],["for","taxCategoryId",3,"label"],["clrSelect","","name","taxCategoryId","formControlName","taxCategoryId",3,"vdrDisabled"],[3,"value",4,"ngFor","ngForOf"],["for","zoneId",3,"label"],["clrSelect","","name","zoneId","formControlName","zoneId",3,"vdrDisabled"],["formGroupName","customFields",4,"ngIf"],["locationId","tax-rate-detail",3,"entity$","detailForm"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],[3,"value"],["formGroupName","customFields"],["entityName","TaxRate",3,"customFields","customFieldsFormGroup","readonly"]],template:function(n,t){if(1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"vdr-entity-info",0),e.ALo(3,"async"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,Go,3,4,"button",2),e.ALo(7,"async"),e.YNc(8,Bo,1,1,"ng-template",null,3,e.W1O),e.qZA()(),e.TgZ(10,"form",4)(11,"vdr-form-field",5),e.ALo(12,"translate"),e._UZ(13,"input",6),e.ALo(14,"hasPermission"),e.qZA(),e.TgZ(15,"vdr-form-field",7),e.ALo(16,"translate"),e.TgZ(17,"clr-toggle-wrapper"),e._UZ(18,"input",8),e.ALo(19,"hasPermission"),e.qZA()(),e.TgZ(20,"vdr-form-field",9),e.ALo(21,"translate"),e.TgZ(22,"vdr-affixed-input",10),e._UZ(23,"input",11),e.ALo(24,"hasPermission"),e.qZA()(),e.TgZ(25,"vdr-form-field",12),e.ALo(26,"translate"),e.TgZ(27,"select",13),e.ALo(28,"hasPermission"),e.YNc(29,Ko,2,2,"option",14),e.ALo(30,"async"),e.qZA()(),e.TgZ(31,"vdr-form-field",15),e.ALo(32,"translate"),e.TgZ(33,"select",16),e.ALo(34,"hasPermission"),e.YNc(35,Wo,2,2,"option",14),e.ALo(36,"async"),e.qZA()(),e.YNc(37,Xo,6,8,"section",17),e._UZ(38,"vdr-custom-detail-component-host",18),e.qZA()),2&n){const i=e.MAs(9);e.xp6(2),e.Q6J("entity",e.lcZ(3,19,t.entity$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(7,21,t.isNew$))("ngIfElse",i),e.xp6(4),e.Q6J("formGroup",t.detailForm),e.xp6(1),e.Q6J("label",e.lcZ(12,23,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(14,25,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(16,27,"common.enabled")),e.xp6(3),e.Q6J("vdrDisabled",!e.lcZ(19,29,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(21,31,"settings.rate")),e.xp6(3),e.Q6J("readonly",!e.lcZ(24,33,t.updatePermission)),e.xp6(2),e.Q6J("label",e.lcZ(26,35,"settings.tax-category")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(28,37,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(30,39,t.taxCategories$)),e.xp6(2),e.Q6J("label",e.lcZ(32,41,"settings.zone")),e.xp6(2),e.Q6J("vdrDisabled",!e.lcZ(34,43,t.updatePermission)),e.xp6(2),e.Q6J("ngForOf",e.lcZ(36,45,t.zones$)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm)}},directives:[_.Kk,_.BN,U.V,_.mz,C.W,p.O5,x.H,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,u.PEh,a.Wl,u.KKC,R.x,Ho.K,a.wV,a.EJ,u.otW,p.sg,a.YN,a.Kr,a.x0,u.MgK,I.y,O.C],pipes:[p.Ov,b.X$,Z.j],styles:[""],changeDetection:0});const ei=function(){return["./create"]};function ti(o,n){1&o&&(e.TgZ(0,"a",3),e._UZ(1,"clr-icon",4),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&o&&(e.Q6J("routerLink",e.DdM(4,ei)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"settings.create-new-tax-rate")," "))}const ni=function(o){return["./",o]},oi=function(){return["DeleteSettings","DeleteTaxRate"]};function ii(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"td",5),e._uU(1),e.qZA(),e.TgZ(2,"td",5),e._uU(3),e.qZA(),e.TgZ(4,"td",5),e._uU(5),e.qZA(),e.TgZ(6,"td",5),e._uU(7),e.qZA(),e.TgZ(8,"td",6),e._UZ(9,"vdr-table-row-action",7),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"td",6)(12,"vdr-dropdown")(13,"button",8),e._uU(14),e.ALo(15,"translate"),e._UZ(16,"clr-icon",9),e.qZA(),e.TgZ(17,"vdr-dropdown-menu",10)(18,"button",11),e.NdJ("click",function(){const l=e.CHM(t).item;return e.oxw().deleteTaxRate(l)}),e.ALo(19,"hasPermission"),e._UZ(20,"clr-icon",12),e._uU(21),e.ALo(22,"translate"),e.qZA()()()()}if(2&o){const t=n.item;e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Oqu(t.category.name),e.xp6(2),e.Oqu(t.zone.name),e.xp6(2),e.hij("",t.value,"%"),e.xp6(2),e.Q6J("label",e.lcZ(10,9,"common.edit"))("linkTo",e.VKq(17,ni,t.id)),e.xp6(5),e.hij(" ",e.lcZ(15,11,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(19,13,e.DdM(19,oi))),e.xp6(3),e.hij(" ",e.lcZ(22,15,"common.delete")," ")}}const ri=function(){return["CreateSettings","CreateTaxRate"]};class Le extends s.t7C{constructor(n,t,i,r,l){super(r,l),this.modalService=n,this.notificationService=t,this.dataService=i,super.setQueryFn((...d)=>this.dataService.settings.getTaxRates(...d),d=>d.taxRates)}deleteTaxRate(n){return this.modalService.dialog({title:(0,c.J)("settings.confirm-delete-tax-rate"),body:n.name,buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteTaxRate(n.id):J.E),(0,L.U)(t=>t.deleteTaxRate)).subscribe(t=>{t.result===s.PcR.DELETED?(this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"TaxRate"}),this.refresh()):this.notificationService.error(t.message||(0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"TaxRate"})})}}function si(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.update-zone")))}function ai(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.create-zone")))}function li(o,n){if(1&o&&(e.YNc(0,si,3,3,"span",6),e.YNc(1,ai,3,3,"span",6)),2&o){const t=e.oxw();e.Q6J("ngIf",t.zone.id),e.xp6(1),e.Q6J("ngIf",!t.zone.id)}}function ci(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.update-zone")))}function di(o,n){1&o&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"settings.create-zone")))}function mi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e.YNc(4,ci,3,3,"span",6),e.YNc(5,di,3,3,"span",6),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.form.invalid),e.xp6(1),e.Q6J("ngIf",t.zone.id),e.xp6(1),e.Q6J("ngIf",!t.zone.id)}}Le.\u0275fac=function(n){return new(n||Le)(e.Y36(s.Z7U),e.Y36(s.gqp),e.Y36(s.DoR),e.Y36(g.F0),e.Y36(g.gz))},Le.\u0275cmp=e.Xpm({type:Le,selectors:[["vdr-tax-rate-list"]],features:[e.qOj],decls:24,vars:26,consts:[["locationId","tax-rate-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-right"),e._UZ(2,"vdr-action-bar-items",0),e.YNc(3,ti,4,5,"a",1),e.qZA()(),e.TgZ(4,"vdr-data-table",2),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(5,"async"),e.ALo(6,"async"),e.ALo(7,"async"),e.ALo(8,"async"),e.TgZ(9,"vdr-dt-column"),e._uU(10),e.ALo(11,"translate"),e.qZA(),e.TgZ(12,"vdr-dt-column"),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e._UZ(21,"vdr-dt-column")(22,"vdr-dt-column"),e.YNc(23,ii,23,20,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("vdrIfPermissions",e.DdM(25,ri)),e.xp6(1),e.Q6J("items",e.lcZ(5,9,t.items$))("itemsPerPage",e.lcZ(6,11,t.itemsPerPage$))("totalItems",e.lcZ(7,13,t.totalItems$))("currentPage",e.lcZ(8,15,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(11,17,"common.name")),e.xp6(3),e.Oqu(e.lcZ(14,19,"settings.tax-category")),e.xp6(3),e.Oqu(e.lcZ(17,21,"settings.zone")),e.xp6(3),e.Oqu(e.lcZ(20,23,"settings.tax-rate")))},directives:[_.Kk,_.mz,C.W,x.H,g.yS,u.qvL,N.Q,M.E,Q.v,D.J,S.U,k.N,P.H],pipes:[b.X$,p.Ov,Z.j],styles:[""],changeDetection:0});const Ve=function(){return["UpdateSettings","UpdateZone"]};class G{constructor(n,t){this.serverConfigService=n,this.formBuilder=t,this.customFields=this.serverConfigService.getCustomFieldsFor("Zone")}ngOnInit(){var n;if(this.form=this.formBuilder.group({name:[this.zone.name,a.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,i)=>Object.assign(Object.assign({},t),{[i.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const i of this.customFields){const r=i.name,l=null===(n=this.zone.customFields)||void 0===n?void 0:n[r],d=t.get(r);d&&d.patchValue(l)}}}cancel(){this.resolveWith()}save(){this.resolveWith(this.form.value)}}G.\u0275fac=function(n){return new(n||G)(e.Y36(s.iHG),e.Y36(a.qu))},G.\u0275cmp=e.Xpm({type:G,selectors:[["vdr-zone-detail-dialog"]],decls:9,vars:14,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["entityName","Zone",3,"customFields","customFieldsFormGroup","readonly"],["vdrDialogButtons",""],[4,"ngIf"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,li,2,2,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"input",3),e.ALo(5,"hasPermission"),e.qZA(),e._UZ(6,"vdr-tabbed-custom-fields",4),e.ALo(7,"hasPermission"),e.qZA(),e.YNc(8,mi,6,6,"ng-template",5)),2&n&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,6,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(5,8,e.DdM(12,Ve))),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.form.get("customFields"))("readonly",!e.lcZ(7,10,e.DdM(13,Ve))))},directives:[Oe.q,p.O5,a._Y,a.JL,a.sg,q.h,A.y,a.Fj,a.JJ,a.u,I.y,we.n],pipes:[b.X$,Z.j],styles:[""],changeDetection:0});var ui=m(8977),pi=m(73);function gi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&o&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"settings.create-new-zone")," "))}const _i=function(o){return{contents:o}},hi=function(o){return["./",o]},fi=function(){return["DeleteSettings","DeleteZone"]};function bi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"tr"),e.ALo(1,"async"),e.TgZ(2,"td",11),e._UZ(3,"vdr-entity-info",12),e.qZA(),e.TgZ(4,"td",11)(5,"vdr-chip",13),e._uU(6),e.qZA()(),e.TgZ(7,"td",14)(8,"a",15),e._UZ(9,"clr-icon",16),e._uU(10),e.ALo(11,"translate"),e.qZA()(),e.TgZ(12,"td",17)(13,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().update(l)}),e._UZ(14,"clr-icon",19),e._uU(15),e.ALo(16,"translate"),e.qZA()(),e.TgZ(17,"td",17)(18,"vdr-dropdown")(19,"button",20),e._uU(20),e.ALo(21,"translate"),e._UZ(22,"clr-icon",21),e.qZA(),e.TgZ(23,"vdr-dropdown-menu",22)(24,"button",23),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw().delete(l.id)}),e.ALo(25,"hasPermission"),e._UZ(26,"clr-icon",24),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&o){const t=n.$implicit,i=e.oxw();let r;e.ekj("active",t.id===(null==(r=e.lcZ(1,11,i.activeZone$))?null:r.id)),e.xp6(3),e.Q6J("entity",t),e.xp6(2),e.Q6J("colorFrom",t.name),e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Q6J("routerLink",e.VKq(25,hi,e.VKq(23,_i,t.id))),e.xp6(2),e.hij(" ",e.lcZ(11,13,"settings.view-zone-members")," "),e.xp6(5),e.hij(" ",e.lcZ(16,15,"common.edit")," "),e.xp6(5),e.hij(" ",e.lcZ(21,17,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(25,19,e.DdM(27,fi))),e.xp6(3),e.hij(" ",e.lcZ(28,21,"common.delete")," ")}}const vi=function(o){return{count:o}},Be=function(){return["UpdateSettings","UpdateZone"]},Zi=function(o){return{zoneName:o}};function Ci(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"div")(1,"div",28)(2,"div",29),e._uU(3),e.qZA(),e._UZ(4,"div",30),e.TgZ(5,"button",31),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).closeMembers()}),e._UZ(6,"clr-icon",32),e.qZA()(),e.TgZ(7,"div",33)(8,"vdr-dropdown")(9,"button",34),e._uU(10),e.ALo(11,"translate"),e._UZ(12,"clr-icon",21),e.qZA(),e.TgZ(13,"vdr-dropdown-menu",22)(14,"button",35),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().ngIf,l=e.oxw();return l.removeFromZone(r,l.selectedMemberIds)}),e.ALo(15,"hasPermission"),e._UZ(16,"clr-icon",24),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"button",36),e.NdJ("click",function(){e.CHM(t);const r=e.oxw().ngIf;return e.oxw().addToZone(r)}),e._uU(20),e.ALo(21,"translate"),e.qZA()()()}if(2&o){const t=e.oxw().ngIf,i=e.oxw();e.xp6(3),e.AsE(" ",t.name," (",t.members.length,") "),e.xp6(6),e.Q6J("disabled",0===i.selectedMemberIds.length),e.xp6(1),e.hij(" ",e.xi3(11,7,"common.with-selected",e.VKq(17,vi,i.selectedMemberIds.length))," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(15,10,e.DdM(19,Be))),e.xp6(3),e.hij(" ",e.lcZ(18,12,"settings.remove-from-zone")," "),e.xp6(3),e.hij(" ",e.xi3(21,14,"settings.add-countries-to-zone",e.VKq(20,Zi,t.name))," ")}}const yi=function(o){return["/settings","countries",o]};function xi(o,n){if(1&o){const t=e.EpF();e.TgZ(0,"div")(1,"vdr-dropdown")(2,"button",20),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"clr-icon",21),e.qZA(),e.TgZ(6,"vdr-dropdown-menu",22)(7,"a",37),e._UZ(8,"clr-icon",19),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"button",35),e.NdJ("click",function(){const l=e.CHM(t).member,d=e.oxw().ngIf;return e.oxw().removeFromZone(d,[l.id])}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",24),e._uU(14),e.ALo(15,"translate"),e.qZA()()()()}if(2&o){const t=n.member;e.xp6(3),e.hij(" ",e.lcZ(4,5,"common.actions")," "),e.xp6(4),e.Q6J("routerLink",e.VKq(13,yi,t.id)),e.xp6(2),e.hij(" ",e.lcZ(10,7,"common.edit")," "),e.xp6(2),e.Q6J("disabled",!e.lcZ(12,9,e.DdM(15,Be))),e.xp6(3),e.hij(" ",e.lcZ(15,11,"settings.remove-from-zone")," ")}}function Ti(o,n){if(1&o){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-zone-member-list",25),e.NdJ("selectionChange",function(r){e.CHM(t);return e.oxw().selectedMemberIds=r}),e.YNc(2,Ci,22,22,"div",26),e.YNc(3,xi,16,16,"div",27),e.qZA(),e.BQk()}if(2&o){const t=n.ngIf,i=e.oxw();e.xp6(1),e.Q6J("members",t.members)("selectedMemberIds",i.selectedMemberIds)}}const Ai=function(){return["CreateSettings","CreateZone"]};class Fe{constructor(n,t,i,r,l,d){this.dataService=n,this.notificationService=t,this.modalService=i,this.route=r,this.router=l,this.serverConfigService=d,this.selectedMemberIds=[]}ngOnInit(){const n=this.dataService.settings.getZones().ref;this.zones$=n.valueChanges.pipe((0,L.U)(i=>i.data.zones));const t=this.route.paramMap.pipe((0,L.U)(i=>i.get("contents")),(0,ui.x)(),(0,Se.b)(()=>this.selectedMemberIds=[]));this.activeZone$=(0,w.a)(this.zones$,t).pipe((0,L.U)(([i,r])=>{if(r)return i.find(l=>l.id===r)})),this.availableLanguages$=this.serverConfigService.getAvailableLanguages(),this.contentLanguage$=this.dataService.client.uiState().mapStream(({uiState:i})=>i.contentLanguage).pipe((0,Se.b)(()=>n.refetch()))}setLanguage(n){this.dataService.client.setContentLanguage(n).subscribe()}create(){this.modalService.fromComponent(G,{locals:{zone:{name:""}}}).pipe((0,v.w)(n=>n?this.dataService.settings.createZone(Object.assign(Object.assign({},n),{memberIds:[]})):J.E),(0,v.w)(()=>this.dataService.settings.getZones().single$)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-create-success"),{entity:"Zone"})},n=>{this.notificationService.error((0,c.J)("common.notify-create-error"),{entity:"Zone"})})}delete(n){this.modalService.dialog({title:(0,c.J)("catalog.confirm-delete-zone"),buttons:[{type:"secondary",label:(0,c.J)("common.cancel")},{type:"danger",label:(0,c.J)("common.delete"),returnValue:!0}]}).pipe((0,v.w)(t=>t?this.dataService.settings.deleteZone(n):J.E),(0,v.w)(t=>t.deleteZone.result===s.PcR.DELETED?this.dataService.settings.getZones().mapSingle(()=>({errorMessage:!1})):(0,Ge.of)({errorMessage:t.deleteZone.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):this.notificationService.success((0,c.J)("common.notify-delete-success"),{entity:"Zone"})},t=>{this.notificationService.error((0,c.J)("common.notify-delete-error"),{entity:"Zone"})})}update(n){this.modalService.fromComponent(G,{locals:{zone:n}}).pipe((0,v.w)(t=>t?this.dataService.settings.updateZone(Object.assign({id:n.id},t)):J.E)).subscribe(()=>{this.notificationService.success((0,c.J)("common.notify-update-success"),{entity:"Zone"})},t=>{this.notificationService.error((0,c.J)("common.notify-update-error"),{entity:"Zone"})})}closeMembers(){const n=Object.assign({},this.route.snapshot.params);delete n.contents,this.router.navigate(["./",n],{relativeTo:this.route,queryParamsHandling:"preserve"})}addToZone(n){this.modalService.fromComponent(re,{locals:{zoneName:n.name,currentMembers:n.members},size:"md"}).pipe((0,v.w)(t=>t?this.dataService.settings.addMembersToZone(n.id,t).pipe((0,pi.h)(t)):J.E)).subscribe({next:t=>{this.notificationService.success((0,c.J)("settings.add-countries-to-zone-success"),{countryCount:t.length,zoneName:n.name})},error:t=>{this.notificationService.error(t)}})}removeFromZone(n,t){this.dataService.settings.removeMembersFromZone(n.id,t).subscribe({complete:()=>{this.notificationService.success((0,c.J)("settings.remove-countries-from-zone-success"),{countryCount:t.length,zoneName:n.name})}})}}Fe.\u0275fac=function(n){return new(n||Fe)(e.Y36(s.DoR),e.Y36(s.gqp),e.Y36(s.Z7U),e.Y36(g.gz),e.Y36(g.F0),e.Y36(s.iHG))},Fe.\u0275cmp=e.Xpm({type:Fe,selectors:[["vdr-zone-list"]],decls:18,vars:18,consts:[[3,"availableLanguageCodes","currentLanguageCode","languageCodeChange"],["locationId","zone-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"zone-wrapper"],[1,"zone-list"],[1,"table","mt0"],[3,"active",4,"ngFor","ngForOf"],[1,"zone-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],[1,"text-right","align-middle"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","trash",1,"is-danger"],[3,"members","selectedMemberIds","selectionChange"],[4,"vdrZoneMemberListHeader"],[4,"vdrZoneMemberControls"],[1,"flex"],[1,"header-title-row"],[1,"flex-spacer"],["type","button",1,"close-button",3,"click"],["shape","close"],[1,"controls"],["type","button","vdrDropdownTrigger","",1,"btn","btn-secondary","btn-sm",3,"disabled"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],[1,"btn","btn-secondary","btn-sm",3,"click"],["type","button","vdrDropdownItem","",3,"routerLink"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"vdr-language-selector",0),e.NdJ("languageCodeChange",function(r){return t.setLanguage(r)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()(),e.TgZ(5,"vdr-ab-right"),e._UZ(6,"vdr-action-bar-items",1),e.YNc(7,gi,4,3,"button",2),e.qZA()(),e.TgZ(8,"div",3)(9,"div",4)(10,"table",5)(11,"tbody"),e.YNc(12,bi,29,28,"tr",6),e.ALo(13,"async"),e.qZA()()(),e.TgZ(14,"div",7),e.ALo(15,"async"),e.YNc(16,Ti,4,2,"ng-container",8),e.ALo(17,"async"),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("availableLanguageCodes",e.lcZ(3,7,t.availableLanguages$))("currentLanguageCode",e.lcZ(4,9,t.contentLanguage$)),e.xp6(5),e.Q6J("vdrIfPermissions",e.DdM(17,Ai)),e.xp6(5),e.Q6J("ngForOf",e.lcZ(13,11,t.zones$)),e.xp6(2),e.ekj("expanded",e.lcZ(15,13,t.activeZone$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(17,15,t.activeZone$)))},directives:[_.Kk,_.BN,De.S,_.mz,C.W,x.H,u.qvL,p.sg,U.V,Pe.Y,g.yS,D.J,S.U,k.N,P.H,p.O5,j,$,Y],pipes:[p.Ov,b.X$,Z.j],styles:[".zone-wrapper[_ngcontent-%COMP%]{display:flex;height:calc(100% - 50px)}.zone-wrapper[_ngcontent-%COMP%] .zone-list[_ngcontent-%COMP%]{flex:1;overflow:auto;margin-top:0}.zone-wrapper[_ngcontent-%COMP%] .zone-list[_ngcontent-%COMP%] tr.active[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.zone-members[_ngcontent-%COMP%]{height:100%;width:0;opacity:0;visibility:hidden;overflow:auto;transition:width .3s,opacity .2s .3s,visibility 0s .3s}.zone-members.expanded[_ngcontent-%COMP%]{width:40vw;visibility:visible;opacity:1;padding-left:12px}.zone-members[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin:0;background:none;border:none;cursor:pointer}.zone-members[_ngcontent-%COMP%] table.table{margin-top:0}.zone-members[_ngcontent-%COMP%] table.table th{top:0}.zone-members[_ngcontent-%COMP%] .controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0});class V extends s.p_9{constructor(n,t){super(n,{__typename:"Administrator",id:"",createdAt:"",updatedAt:"",emailAddress:"",firstName:"",lastName:"",user:{roles:[]}},i=>t.administrator.getAdministrator(i).mapStream(r=>r.administrator))}}V.\u0275fac=function(n){return new(n||V)(e.LFG(g.F0),e.LFG(s.DoR))},V.\u0275prov=e.Yz7({token:V,factory:V.\u0275fac,providedIn:"root"});class B extends s.p_9{constructor(n,t){super(n,{__typename:"Channel",id:"",createdAt:"",updatedAt:"",code:"",token:"",pricesIncludeTax:!1,currencyCode:s.NEm.USD,defaultLanguageCode:(0,s.kAh)(),defaultShippingZone:{},defaultTaxZone:{}},i=>t.settings.getChannel(i).mapStream(r=>r.channel))}}B.\u0275fac=function(n){return new(n||B)(e.LFG(g.F0),e.LFG(s.DoR))},B.\u0275prov=e.Yz7({token:B,factory:B.\u0275fac,providedIn:"root"});class K extends s.p_9{constructor(n,t){super(n,{__typename:"Country",id:"",createdAt:"",updatedAt:"",code:"",name:"",enabled:!1,translations:[]},i=>t.settings.getCountry(i).mapStream(r=>r.country))}}K.\u0275fac=function(n){return new(n||K)(e.LFG(g.F0),e.LFG(s.DoR))},K.\u0275prov=e.Yz7({token:K,factory:K.\u0275fac,providedIn:"root"});class W extends s.p_9{constructor(n,t){super(n,{},()=>t.settings.getGlobalSettings().mapStream(i=>i.globalSettings))}}W.\u0275fac=function(n){return new(n||W)(e.LFG(g.F0),e.LFG(s.DoR))},W.\u0275prov=e.Yz7({token:W,factory:W.\u0275fac,providedIn:"root"});class X extends s.p_9{constructor(n,t){super(n,{__typename:"PaymentMethod",id:"",createdAt:"",updatedAt:"",name:"",code:"",description:"",enabled:!0,checker:void 0,handler:void 0},i=>t.settings.getPaymentMethod(i).mapStream(r=>r.paymentMethod))}}X.\u0275fac=function(n){return new(n||X)(e.LFG(g.F0),e.LFG(s.DoR))},X.\u0275prov=e.Yz7({token:X,factory:X.\u0275fac,providedIn:"root"});class ee extends s.p_9{constructor(n,t){super(n,{__typename:"Administrator",id:"",createdAt:"",updatedAt:"",emailAddress:"",firstName:"",lastName:"",user:{roles:[]}},i=>t.administrator.getActiveAdministrator().mapStream(r=>r.activeAdministrator))}}ee.\u0275fac=function(n){return new(n||ee)(e.LFG(g.F0),e.LFG(s.DoR))},ee.\u0275prov=e.Yz7({token:ee,factory:ee.\u0275fac,providedIn:"root"});class te extends s.p_9{constructor(n,t){super(n,{__typename:"Role",id:"",createdAt:"",updatedAt:"",code:"",description:"",permissions:[],channels:[]},i=>t.administrator.getRole(i).mapStream(r=>r.role))}}te.\u0275fac=function(n){return new(n||te)(e.LFG(g.F0),e.LFG(s.DoR))},te.\u0275prov=e.Yz7({token:te,factory:te.\u0275fac,providedIn:"root"});class ne extends s.p_9{constructor(n,t){super(n,{__typename:"ShippingMethod",createdAt:"",updatedAt:"",id:"",code:"",name:"",description:"",fulfillmentHandlerCode:void 0,checker:void 0,calculator:void 0,translations:[]},i=>t.shippingMethod.getShippingMethod(i).mapStream(r=>r.shippingMethod))}}ne.\u0275fac=function(n){return new(n||ne)(e.LFG(g.F0),e.LFG(s.DoR))},ne.\u0275prov=e.Yz7({token:ne,factory:ne.\u0275fac,providedIn:"root"});class oe extends s.p_9{constructor(n,t){super(n,{__typename:"TaxCategory",id:"",createdAt:"",updatedAt:"",name:"",isDefault:!1},i=>t.settings.getTaxCategory(i).mapStream(r=>r.taxCategory))}}oe.\u0275fac=function(n){return new(n||oe)(e.LFG(g.F0),e.LFG(s.DoR))},oe.\u0275prov=e.Yz7({token:oe,factory:oe.\u0275fac,providedIn:"root"});class ie extends s.p_9{constructor(n,t){super(n,{__typename:"TaxRate",id:"",createdAt:"",updatedAt:"",name:"",value:0,enabled:!0,category:{},zone:{},customerGroup:null},i=>t.settings.getTaxRate(i).mapStream(r=>r.taxRate))}}ie.\u0275fac=function(n){return new(n||ie)(e.LFG(g.F0),e.LFG(s.DoR))},ie.\u0275prov=e.Yz7({token:ie,factory:ie.\u0275fac,providedIn:"root"});const Ke=[{path:"profile",component:he,resolve:(0,s.Po4)(ee),canDeactivate:[s.TSp],data:{breadcrumb:(0,c.J)("breadcrumb.profile")}},{path:"administrators",component:le,data:{breadcrumb:(0,c.J)("breadcrumb.administrators")}},{path:"administrators/:id",component:ae,resolve:(0,s.Po4)(V),canDeactivate:[s.TSp],data:{breadcrumb:We}},{path:"channels",component:de,data:{breadcrumb:(0,c.J)("breadcrumb.channels")}},{path:"channels/:id",component:ce,resolve:(0,s.Po4)(B),canDeactivate:[s.TSp],data:{breadcrumb:Xe}},{path:"roles",component:be,data:{breadcrumb:(0,c.J)("breadcrumb.roles")}},{path:"roles/:id",component:fe,resolve:(0,s.Po4)(te),canDeactivate:[s.TSp],data:{breadcrumb:et}},{path:"tax-categories",component:Te,data:{breadcrumb:(0,c.J)("breadcrumb.tax-categories")}},{path:"tax-categories/:id",component:xe,resolve:(0,s.Po4)(oe),canDeactivate:[s.TSp],data:{breadcrumb:tt}},{path:"tax-rates",component:Le,data:{breadcrumb:(0,c.J)("breadcrumb.tax-rates")}},{path:"tax-rates/:id",component:Ae,resolve:(0,s.Po4)(ie),canDeactivate:[s.TSp],data:{breadcrumb:nt}},{path:"countries",component:ue,data:{breadcrumb:(0,c.J)("breadcrumb.countries")}},{path:"countries/:id",component:me,resolve:(0,s.Po4)(K),canDeactivate:[s.TSp],data:{breadcrumb:ot}},{path:"zones",component:Fe,data:{breadcrumb:(0,c.J)("breadcrumb.zones")}},{path:"shipping-methods",component:ye,data:{breadcrumb:(0,c.J)("breadcrumb.shipping-methods")}},{path:"shipping-methods/:id",component:Ce,resolve:(0,s.Po4)(ne),canDeactivate:[s.TSp],data:{breadcrumb:it}},{path:"payment-methods",component:_e,data:{breadcrumb:(0,c.J)("breadcrumb.payment-methods")}},{path:"payment-methods/:id",component:ge,resolve:(0,s.Po4)(X),canDeactivate:[s.TSp],data:{breadcrumb:rt}},{path:"global-settings",component:pe,resolve:(0,s.Po4)(W),canDeactivate:[s.TSp],data:{breadcrumb:(0,c.J)("breadcrumb.global-settings")}}];function We(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.administrators",getName:t=>`${t.firstName} ${t.lastName}`,route:"administrators"})}function Xe(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.channels",getName:t=>t.code,route:"channels"})}function et(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.roles",getName:t=>t.description,route:"roles"})}function tt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.tax-categories",getName:t=>t.name,route:"tax-categories"})}function nt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.tax-rates",getName:t=>t.name,route:"tax-rates"})}function ot(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.countries",getName:t=>t.name,route:"countries"})}function it(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.shipping-methods",getName:t=>t.name,route:"shipping-methods"})}function rt(o,n){return(0,s.YWC)({entity:o.entity,id:n.id,breadcrumbKey:"breadcrumb.payment-methods",getName:t=>t.code,route:"payment-methods"})}class Je{}Je.\u0275fac=function(n){return new(n||Je)},Je.\u0275mod=e.oAB({type:Je}),Je.\u0275inj=e.cJS({imports:[[s.m81,g.Bz.forChild(Ke)]]})}}]);
|
|
2
|
+
//# sourceMappingURL=26.5cc3bfffe8943e16.js.map
|