@vendure/admin-ui-plugin 2.0.0-next.21 → 2.0.0-next.22
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/165.6aeb6ecf722558ee.js.map +1 -1
- package/lib/admin-ui/451.78e2f76fc4ba7c88.js +65 -0
- package/lib/admin-ui/451.78e2f76fc4ba7c88.js.map +1 -0
- package/lib/admin-ui/{600.17470a2c90aa79d8.js → 600.1a41f364d643a053.js} +2 -2
- package/lib/admin-ui/600.1a41f364d643a053.js.map +1 -0
- package/lib/admin-ui/625.03d0edb29157642d.js +2 -0
- package/lib/admin-ui/625.03d0edb29157642d.js.map +1 -0
- package/lib/admin-ui/i18n-messages/de.json +3 -1
- package/lib/admin-ui/i18n-messages/en.json +3 -1
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/main.f7416d323741bfdf.js +2944 -0
- package/lib/admin-ui/main.f7416d323741bfdf.js.map +1 -0
- package/lib/admin-ui/{runtime.28bd5da02a9b1f7b.js → runtime.c510bdbf2f041bdd.js} +2 -2
- package/lib/admin-ui/{runtime.28bd5da02a9b1f7b.js.map → runtime.c510bdbf2f041bdd.js.map} +1 -1
- package/lib/admin-ui/styles/_variables.scss +1 -0
- package/lib/src/plugin.js +2 -1
- package/lib/src/plugin.js.map +1 -1
- package/package.json +4 -4
- package/lib/admin-ui/451.a7fd4069c4f4c687.js +0 -65
- package/lib/admin-ui/451.a7fd4069c4f4c687.js.map +0 -1
- package/lib/admin-ui/600.17470a2c90aa79d8.js.map +0 -1
- package/lib/admin-ui/625.3c0c5821b952b58e.js +0 -2
- package/lib/admin-ui/625.3c0c5821b952b58e.js.map +0 -1
- package/lib/admin-ui/main.65109179713dd228.js +0 -2944
- package/lib/admin-ui/main.65109179713dd228.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[600],{4847:(Ao,ce,i)=>{i.r(ce),i.d(ce,{AddCustomerToGroupDialogComponent:()=>L,AddressCardComponent:()=>I,AddressDetailDialogComponent:()=>S,CustomerDetailComponent:()=>F,CustomerGroupDetailDialogComponent:()=>T,CustomerGroupListComponent:()=>P,CustomerGroupMemberListComponent:()=>A,CustomerHistoryComponent:()=>J,CustomerListComponent:()=>w,CustomerModule:()=>M,CustomerResolver:()=>D,CustomerStatusLabelComponent:()=>Z,SelectCustomerGroupDialogComponent:()=>O,customerBreadcrumb:()=>Ce,customerRoutes:()=>fe});var G=i(6317),g=i(2673),p=i(635),e=i(3184),d=i(8098),q=i(309),l=i(587),W=i(253),K=i(6562),E=i(4874),z=i(8977),ee=i(1989),te=i(9337),oe=i(8951),C=i(9720),U=i(7890),$=i(365),se=i(901),re=i(8899),v=i(7514),_=i(6362),N=i(7388);const xe=function(s){return["/customer","customers",s]};function be(s,o){if(1&s&&(e.TgZ(0,"td",3),e._uU(1),e.qZA(),e.TgZ(2,"td",3),e._uU(3),e.qZA(),e.TgZ(4,"td",4),e._UZ(5,"vdr-table-row-action",5),e.ALo(6,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("label",e.lcZ(6,6,"common.edit"))("linkTo",e.VKq(8,xe,t.id))}}class A{constructor(o,t){this.router=o,this.dataService=t,this.selectedMemberIds=[],this.selectionChange=new e.vpe,this.fetchParamsChange=new e.vpe,this.filterTermControl=new l.NI(""),this.refresh$=new G.X(!0),this.destroy$=new W.x,this.isMemberSelected=r=>-1<this.selectedMemberIds.indexOf(r.id)}ngOnInit(){this.membersCurrentPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPage")),(0,p.U)(t=>t?+t:1),(0,E.O)(1),(0,z.x)()),this.membersItemsPerPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPerPage")),(0,p.U)(t=>t?+t:10),(0,E.O)(10),(0,z.x)());const o=this.filterTermControl.valueChanges.pipe((0,ee.b)(250),(0,te.b)(()=>this.setContentsPageNumber(1)),(0,E.O)(""));(0,K.a)(this.membersCurrentPage$,this.membersItemsPerPage$,o,this.refresh$).pipe((0,oe.R)(this.destroy$)).subscribe(([t,r,n])=>{const a=r,c=(t-1)*r;this.fetchParamsChange.emit({filterTerm:n,skip:c,take:a})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}setContentsPageNumber(o){this.setParam("membersPage",o)}setContentsItemsPerPage(o){this.setParam("membersPerPage",o)}refresh(){this.refresh$.next(!0)}setParam(o,t){this.router.navigate(["./",Object.assign(Object.assign({},this.route.snapshot.params),{[o]:t})],{relativeTo:this.route,queryParamsHandling:"merge"})}areAllSelected(){return!!this.members&&this.selectedMemberIds.length===this.members.length}toggleSelectAll(){this.areAllSelected()?this.selectionChange.emit([]):this.selectionChange.emit(this.members.map(o=>o.id))}toggleSelectMember({item:o}){this.selectedMemberIds.includes(o.id)?this.selectionChange.emit(this.selectedMemberIds.filter(t=>t!==o.id)):this.selectionChange.emit([...this.selectedMemberIds,o.id])}}A.\u0275fac=function(o){return new(o||A)(e.Y36(C.F0),e.Y36(d.DoR))},A.\u0275cmp=e.Xpm({type:A,selectors:[["vdr-customer-group-member-list"]],inputs:{members:"members",totalItems:"totalItems",route:"route",selectedMemberIds:"selectedMemberIds"},outputs:{selectionChange:"selectionChange",fetchParamsChange:"fetchParamsChange"},decls:14,vars:24,consts:[["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[3,"items","itemsPerPage","totalItems","currentPage","allSelected","isRowSelectedFn","pageChange","itemsPerPageChange","rowSelectChange","allSelectChange"],[3,"expand"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"]],template:function(o,t){1&o&&(e._UZ(0,"input",0),e.ALo(1,"translate"),e.TgZ(2,"vdr-data-table",1),e.NdJ("pageChange",function(n){return t.setContentsPageNumber(n)})("itemsPerPageChange",function(n){return t.setContentsItemsPerPage(n)})("rowSelectChange",function(n){return t.toggleSelectMember(n)})("allSelectChange",function(){return t.toggleSelectAll()}),e.ALo(3,"async"),e.ALo(4,"async"),e.ALo(5,"hasPermission"),e.TgZ(6,"vdr-dt-column",2),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"vdr-dt-column",2),e._uU(10),e.ALo(11,"translate"),e.qZA(),e._UZ(12,"vdr-dt-column"),e.YNc(13,be,7,10,"ng-template"),e.qZA()),2&o&&(e.Q6J("formControl",t.filterTermControl)("placeholder",e.lcZ(1,12,"customer.search-customers-by-email")),e.xp6(2),e.Q6J("items",t.members)("itemsPerPage",e.lcZ(3,14,t.membersItemsPerPage$))("totalItems",t.totalItems)("currentPage",e.lcZ(4,16,t.membersCurrentPage$))("allSelected",t.areAllSelected())("isRowSelectedFn",e.lcZ(5,18,"UpdateCustomerGroup")&&t.isMemberSelected),e.xp6(4),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(8,20,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(11,22,"customer.email-address")))},directives:[U.y,l.Fj,l.JJ,l.oH,$.Q,se.E,re.v],pipes:[v.X$,_.Ov,N.j],styles:[""],changeDetection:0});var k=i(8318);const ye=function(s){return{groupName:s}};function Ae(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw();e.hij(" ",e.xi3(1,1,"customer.add-customers-to-group-with-name",e.VKq(4,ye,t.group.name)),"\n")}}const Ze=function(s){return{count:s}};function Te(s,o){if(1&s){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&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customers-to-group-with-count",e.VKq(8,Ze,t.selectedCustomerIds.length))," ")}}class L{constructor(o){this.dataService=o,this.selectedCustomerIds=[],this.fetchGroupMembers$=new G.X({skip:0,take:10,filterTerm:""})}ngOnInit(){const o=this.fetchGroupMembers$.pipe((0,g.w)(({skip:t,take:r,filterTerm:n})=>this.dataService.customer.getCustomerList(r,t,n).mapStream(a=>a.customers)));this.customers$=o.pipe((0,p.U)(t=>t.items)),this.customersTotal$=o.pipe((0,p.U)(t=>t.totalItems))}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedCustomerIds)}}L.\u0275fac=function(o){return new(o||L)(e.Y36(d.DoR))},L.\u0275cmp=e.Xpm({type:L,selectors:[["vdr-add-customer-to-group-dialog"]],decls:5,vars:8,consts:[["vdrDialogTitle",""],[3,"members","totalItems","route","selectedMemberIds","fetchParamsChange","selectionChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Ae,2,6,"ng-template",0),e.TgZ(1,"vdr-customer-group-member-list",1),e.NdJ("fetchParamsChange",function(n){return t.fetchGroupMembers$.next(n)})("selectionChange",function(n){return t.selectedCustomerIds=n}),e.ALo(2,"async"),e.ALo(3,"async"),e.qZA(),e.YNc(4,Te,6,10,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("members",e.lcZ(2,4,t.customers$))("totalItems",e.lcZ(3,6,t.customersTotal$))("route",t.route)("selectedMemberIds",t.selectedCustomerIds))},directives:[q.q,A,k.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var Y=i(116),le=i(9295),De=i(1480);function Ue(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij("",t,",")}}function Ne(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij(" ",t,"")}}function Le(s,o){if(1&s&&(e.YNc(0,Ue,2,1,"span",3),e.YNc(1,Ne,2,1,"span",3)),2&s){const t=e.oxw();let r,n;e.Q6J("ngIf",null==(r=t.addressForm.get("streetLine1"))?null:r.value),e.xp6(1),e.Q6J("ngIf",null==(n=t.addressForm.get("countryCode"))?null:n.value)}}function Se(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.addressForm.valid||!t.addressForm.touched),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.update")," ")}}class S{constructor(o){this.changeDetector=o,this.availableCountries=[]}ngOnInit(){this.addressForm.valueChanges.subscribe(()=>this.changeDetector.markForCheck())}cancel(){this.resolveWith()}save(){this.resolveWith(this.addressForm)}}S.\u0275fac=function(o){return new(o||S)(e.Y36(e.sBO))},S.\u0275cmp=e.Xpm({type:S,selectors:[["vdr-address-detail-dialog"]],decls:3,vars:3,consts:[["vdrDialogTitle",""],[3,"formGroup","availableCountries","customFields"],["vdrDialogButtons",""],[4,"ngIf"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Le,2,2,"ng-template",0),e._UZ(1,"vdr-address-form",1),e.YNc(2,Se,6,7,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.addressForm)("availableCountries",t.availableCountries)("customFields",t.customFields))},directives:[q.q,_.O5,De.C,l.JL,l.sg,k.n],pipes:[v.X$],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});var Q=i(4447),y=i(2748),Ie=i(9667),ne=i(3146),j=i(735),H=i(1519),R=i(8854),B=i(5111);function Oe(s,o){if(1&s&&(e.TgZ(0,"span",13),e._uU(1),e.qZA()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.hij("",t.streetLine1,",")}}function Je(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",15),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-shipping-address")," "))}function Fe(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",16),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-billing-address")," "))}function Pe(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",17),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).editAddress()}),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown")(5,"button",18),e._uU(6),e.ALo(7,"translate"),e._UZ(8,"clr-icon",19),e.qZA(),e.TgZ(9,"vdr-dropdown-menu")(10,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultShippingAddress()}),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultBillingAddress()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",21),e.TgZ(17,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).delete()}),e._UZ(18,"clr-icon",23),e._uU(19),e.ALo(20,"translate"),e.qZA()()(),e.BQk()}if(2&s){const t=e.oxw(2);e.xp6(2),e.hij(" ",e.lcZ(3,7,"common.edit")," "),e.xp6(4),e.hij(" ",e.lcZ(7,9,"common.more")," "),e.xp6(4),e.Q6J("disabled",t.isDefaultShipping),e.xp6(1),e.hij(" ",e.lcZ(12,11,"customer.set-as-default-shipping-address")," "),e.xp6(2),e.Q6J("disabled",t.isDefaultBilling),e.xp6(1),e.hij(" ",e.lcZ(15,13,"customer.set-as-default-billing-address")," "),e.xp6(5),e.hij(" ",e.lcZ(20,15,"common.delete")," ")}}function we(s,o){if(1&s&&(e.TgZ(0,"div",1)(1,"div",2)(2,"div",3),e.YNc(3,Oe,2,1,"span",4),e._uU(4),e.qZA(),e.TgZ(5,"div",5),e.YNc(6,Je,4,3,"vdr-chip",6),e.YNc(7,Fe,4,3,"vdr-chip",6),e.qZA()(),e.TgZ(8,"div",7)(9,"div",8),e._UZ(10,"vdr-formatted-address",9),e.qZA()(),e.TgZ(11,"div",10),e._UZ(12,"vdr-entity-info",11),e.YNc(13,Pe,21,17,"ng-container",12),e.qZA()()),2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.Q6J("ngIf",t.streetLine1),e.xp6(1),e.hij(" ",t.countryCode," "),e.xp6(2),e.Q6J("ngIf",r.isDefaultShipping),e.xp6(1),e.Q6J("ngIf",r.isDefaultBilling),e.xp6(3),e.Q6J("address",t),e.xp6(2),e.Q6J("entity",t),e.xp6(1),e.Q6J("ngIf",r.editable)}}class I{constructor(o,t){this.modalService=o,this.changeDetector=t,this.availableCountries=[],this.editable=!0,this.setAsDefaultShipping=new e.vpe,this.setAsDefaultBilling=new e.vpe,this.deleteAddress=new e.vpe,this.dataDependenciesPopulated=new G.X(!1)}ngOnInit(){this.addressForm.get("streetLine1").value||this.dataDependenciesPopulated.pipe((0,Y.h)(t=>t),(0,le.q)(1)).subscribe(()=>{this.editAddress()})}ngOnChanges(o){null!=this.customFields&&null!=this.availableCountries&&this.dataDependenciesPopulated.next(!0)}getCountryName(o){if(!this.availableCountries)return"";const t=this.availableCountries.find(r=>r.code===o);return t?t.name:""}setAsDefaultBillingAddress(){this.setAsDefaultBilling.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}setAsDefaultShippingAddress(){this.setAsDefaultShipping.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}delete(){this.deleteAddress.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}editAddress(){this.modalService.fromComponent(S,{locals:{addressForm:this.addressForm,customFields:this.customFields,availableCountries:this.availableCountries},size:"md",closable:!0}).subscribe(()=>{this.changeDetector.markForCheck()})}}I.\u0275fac=function(o){return new(o||I)(e.Y36(d.Z7U),e.Y36(e.sBO))},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-address-card"]],inputs:{addressForm:"addressForm",customFields:"customFields",availableCountries:"availableCountries",isDefaultBilling:"isDefaultBilling",isDefaultShipping:"isDefaultShipping",editable:"editable"},outputs:{setAsDefaultShipping:"setAsDefaultShipping",setAsDefaultBilling:"setAsDefaultBilling",deleteAddress:"deleteAddress"},features:[e.TTD],decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"address-title"],["class","street-line",4,"ngIf"],[1,"default-controls"],["class","is-default p8",4,"ngIf"],[1,"card-block"],[1,"card-text"],[3,"address"],[1,"card-footer"],[3,"entity"],[4,"ngIf"],[1,"street-line"],[1,"is-default","p8"],["shape","truck"],["shape","credit-card"],[1,"btn","btn-sm","btn-link",3,"click"],["type","button","vdrDropdownTrigger","",1,"btn","btn-sm","btn-link"],["shape","caret down"],["vdrDropdownItem","",1,"button",3,"disabled","click"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"delete-button",3,"click"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&e.YNc(0,we,14,7,"div",0),2&o&&e.Q6J("ngIf",t.addressForm.value)},directives:[_.O5,Q.Y,y.qvL,Ie.b,ne.V,j.J,H.U,R.N,B.H],pipes:[v.X$],styles:["[_nghost-%COMP%]{display:block;max-width:360px}clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}.defaul-controls[_ngcontent-%COMP%]{display:flex}.is-default[_ngcontent-%COMP%]{margin:0;color:var(--color-success-500)}"],changeDetection:0});var Me=i(4929),m=i(8270),Ge=i(234),Qe=i(1640),de=i(7400),x=i(591),qe=i(9196),Ee=i(1944);const{isArray:$e}=Array;var Ye=i(1308),me=i(420);function je(...s){const o=(0,me.yG)(s),t=(0,me._6)(s,1/0);return s=function ke(s){return 1===s.length&&$e(s[0])?s[0]:s}(s),(0,Ee.e)((r,n)=>{(0,Ye.J)(t)((0,de.D)([r,...s],o)).subscribe(n)})}var He=i(9525),Re=i(3853),ie=i(8660);function Be(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.add-customer-to-group"),"\n")}function Ve(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"span",5),e.NdJ("click",function(){const n=e.CHM(t),a=n.item;return n.clear(a)}),e._uU(1," \xd7 "),e.qZA(),e.TgZ(2,"vdr-chip",6),e._uU(3),e.qZA()}if(2&s){const t=o.item;e.xp6(2),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Xe(s,o){if(1&s&&(e.TgZ(0,"vdr-chip",6),e._uU(1),e.qZA()),2&s){const t=o.item;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}const We=function(s){return{count:s}};function Ke(s,o){if(1&s){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().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedGroupIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customer-to-groups-with-count",e.VKq(8,We,t.selectedGroupIds.length))," ")}}class O{constructor(o){this.dataService=o,this.selectedGroupIds=[]}ngOnInit(){this.groups$=this.dataService.customer.getCustomerGroupList().mapStream(o=>o.customerGroups.items)}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedGroupIds)}}O.\u0275fac=function(o){return new(o||O)(e.Y36(d.DoR))},O.\u0275cmp=e.Xpm({type:O,selectors:[["vdr-select-customer-group-dialog"]],decls:6,vars:8,consts:[["vdrDialogTitle",""],["appendTo","body","bindValue","id",3,"items","addTag","multiple","ngModel","clearable","searchable","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],["vdrDialogButtons",""],["aria-hidden","true",1,"ng-value-icon","left",3,"click"],[3,"colorFrom"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Be,2,3,"ng-template",0),e.TgZ(1,"ng-select",1),e.NdJ("ngModelChange",function(n){return t.selectedGroupIds=n}),e.ALo(2,"async"),e.YNc(3,Ve,4,2,"ng-template",2),e.YNc(4,Xe,2,2,"ng-template",3),e.qZA(),e.YNc(5,Ke,6,10,"ng-template",4)),2&o&&(e.xp6(1),e.Q6J("items",e.lcZ(2,6,t.groups$))("addTag",!1)("multiple",!0)("ngModel",t.selectedGroupIds)("clearable",!0)("searchable",!1))},directives:[q.q,ie.w9,l.JJ,l.On,ie.mR,Q.Y,ie.ir,k.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var b=i(7346);function ze(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",1),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.verified")," "))}function et(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",2),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.registered")," "))}function tt(s,o){if(1&s&&(e.TgZ(0,"vdr-chip"),e.YNc(1,ze,4,3,"ng-container",0),e.YNc(2,et,4,3,"ng-container",0),e.qZA()),2&s){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.verified),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.verified))}}function ot(s,o){1&s&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.guest")))}class Z{}Z.\u0275fac=function(o){return new(o||Z)},Z.\u0275cmp=e.Xpm({type:Z,selectors:[["vdr-customer-status-label"]],inputs:{customer:"customer"},decls:2,vars:2,consts:[[4,"ngIf"],["shape","check-circle",1,"verified-user-icon"],["shape","check-circle",1,"registered-user-icon"]],template:function(o,t){1&o&&(e.YNc(0,tt,3,2,"vdr-chip",0),e.YNc(1,ot,3,3,"vdr-chip",0)),2&o&&(e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.id),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.id)))},directives:[_.O5,Q.Y,y.qvL],pipes:[v.X$],styles:[".registered-user-icon[_ngcontent-%COMP%]{color:var(--color-grey-300)}.verified-user-icon[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});var ae=i(8276),V=i(9416),ue=i(4652),pe=i(837),st=i(2505),rt=i(2355),nt=i(4664),it=i(2702),at=i(7368);function ct(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",4)(1,"div",5)(2,"textarea",6),e.NdJ("ngModelChange",function(n){e.CHM(t);return e.oxw().note=n}),e.qZA(),e.TgZ(3,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().addNoteToCustomer()}),e._uU(4),e.ALo(5,"translate"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(5,3,"order.add-note")," ")}}function lt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}const _e=function(s){return{strategy:s}};function dt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function mt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,lt,3,3,"ng-container",12),e.YNc(5,dt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-registered")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}function ut(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}function pt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function _t(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ut,3,3,"ng-container",12),e.YNc(5,pt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-verified")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}function gt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail"),e._UZ(5,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.history-customer-detail-updated")," "),e.xp6(3),e.Q6J("value",t.data.input)}}const ge=function(s){return{groupName:s}};function ht(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-added-to-group",e.VKq(4,ge,t.data.groupName))," ")}}function ft(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-removed-from-group",e.VKq(4,ge,t.data.groupName))," ")}}function Ct(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-created")," "),e.xp6(4),e.Oqu(t.data.address)}}function vt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA(),e.TgZ(6,"vdr-history-entry-detail"),e._UZ(7,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"customer.history-customer-address-updated")," "),e.xp6(4),e.Oqu(t.data.address),e.xp6(2),e.Q6J("value",t.data.input)}}function xt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",16),e._uU(4),e.qZA(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-deleted")," "),e.xp6(3),e.Oqu(t.data.address)}}function bt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-updated")," "))}function yt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-requested")," "))}function At(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-verified")," "))}function Zt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-requested")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function Tt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-verified")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function Dt(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",14)(2,"div",18),e._uU(3),e.qZA(),e._UZ(4,"div",19),e.TgZ(5,"vdr-dropdown")(6,"button",20),e._UZ(7,"clr-icon",21),e.qZA(),e.TgZ(8,"vdr-dropdown-menu",22)(9,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().updateNote.emit(n)}),e.ALo(10,"hasPermission"),e._UZ(11,"clr-icon",24),e._uU(12),e.ALo(13,"translate"),e.qZA(),e._UZ(14,"div",25),e.TgZ(15,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().deleteNote.emit(n)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",26),e._uU(18),e.ALo(19,"translate"),e.qZA()()()(),e.BQk()}if(2&s){const t=e.oxw().$implicit;e.xp6(3),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(10,5,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(13,7,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(16,9,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(19,11,"common.delete")," ")}}function Ut(s,o){if(1&s&&(e.TgZ(0,"vdr-timeline-entry",8),e.ynx(1,9),e.YNc(2,mt,7,5,"ng-container",10),e.YNc(3,_t,7,5,"ng-container",10),e.YNc(4,gt,6,4,"ng-container",10),e.YNc(5,ht,3,6,"ng-container",10),e.YNc(6,ft,3,6,"ng-container",10),e.YNc(7,Ct,6,4,"ng-container",10),e.YNc(8,vt,8,5,"ng-container",10),e.YNc(9,xt,5,4,"ng-container",10),e.YNc(10,bt,3,3,"ng-container",10),e.YNc(11,yt,3,3,"ng-container",10),e.YNc(12,At,3,3,"ng-container",10),e.YNc(13,Zt,11,11,"ng-container",10),e.YNc(14,Tt,11,11,"ng-container",10),e.YNc(15,Dt,20,13,"ng-container",10),e.BQk(),e.qZA()),2&s){const t=o.$implicit,r=e.oxw();e.Q6J("displayType",r.getDisplayType(t))("iconShape",r.getTimelineIcon(t))("createdAt",t.createdAt)("name",r.getName(t))("featured",r.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REGISTERED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_DETAIL_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDED_TO_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REMOVED_FROM_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_CREATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_DELETED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_NOTE)}}class J{constructor(){this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.type=d.iYD}getDisplayType(o){switch(o.type){case d.iYD.CUSTOMER_VERIFIED:case d.iYD.CUSTOMER_EMAIL_UPDATE_VERIFIED:case d.iYD.CUSTOMER_PASSWORD_RESET_VERIFIED:return"success";case d.iYD.CUSTOMER_REGISTERED:return"muted";case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"error";default:return"default"}}getTimelineIcon(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:return"user";case d.iYD.CUSTOMER_VERIFIED:return["assign-user","is-solid"];case d.iYD.CUSTOMER_NOTE:return"note";case d.iYD.CUSTOMER_ADDED_TO_GROUP:case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"users"}}isFeatured(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:case d.iYD.CUSTOMER_VERIFIED:return!0;default:return!1}}getName(o){const{administrator:t}=o;return t?`${t.firstName} ${t.lastName}`:`${this.customer.firstName} ${this.customer.lastName}`}addNoteToCustomer(){this.addNote.emit({note:this.note}),this.note=""}}J.\u0275fac=function(o){return new(o||J)},J.\u0275cmp=e.Xpm({type:J,selectors:[["vdr-customer-history"]],inputs:{customer:"customer",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:7,vars:6,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",4,"vdrIfPermissions"],[3,"displayType","iconShape","createdAt","name","featured",4,"ngFor","ngForOf"],[3,"isLast"],["iconShape","note","displayType","muted"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[3,"displayType","iconShape","createdAt","name","featured"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"title"],[4,"ngIf","ngIfElse"],["namedStrategy",""],[1,"flex"],[3,"value"],[1,"address-string"],[3,"label"],[1,"note-text"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0),e.YNc(4,ct,6,5,"vdr-timeline-entry",1),e.YNc(5,Ut,16,20,"vdr-timeline-entry",2),e._UZ(6,"vdr-timeline-entry",3),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,4,"customer.customer-history")),e.xp6(3),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0))},directives:[V.H,rt._,U.y,l.Fj,l.JJ,l.On,_.sg,_.RF,_.n9,_.O5,nt.C,it._,at.W,j.J,H.U,y.qvL,R.N,B.H],pipes:[v.X$,N.j],styles:[".entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-text-100);white-space:pre-wrap}.address-string[_ngcontent-%COMP%]{font-size:smaller;color:var(--color-text-200)}"],changeDetection:0});var Nt=i(2651),Lt=i(6826),St=i(4187);function It(s,o){if(1&s&&(e.TgZ(0,"div",23),e.ALo(1,"localeDate"),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"timeAgo"),e.qZA()),2&s){const t=o.ngIf;e.Q6J("title",e.xi3(1,3,t,"medium")),e.xp6(2),e.AsE(" ",e.lcZ(3,6,"customer.last-login"),": ",e.lcZ(4,8,t)," ")}}function Ot(s,o){if(1&s){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&s){const t=e.oxw();e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Jt(s,o){if(1&s){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&s){const t=e.oxw(2);e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Ft(s,o){1&s&&e.YNc(0,Jt,3,4,"button",25),2&s&&e.Q6J("vdrIfPermissions","UpdateCustomer")}function Pt(s,o){1&s&&(e.TgZ(0,"vdr-form-field",26),e.ALo(1,"translate"),e._UZ(2,"input",27),e.qZA()),2&s&&e.Q6J("label",e.lcZ(1,1,"customer.password"))}const wt=function(){return["customer","customFields"]};function Mt(s,o){if(1&s&&(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.qZA()),2&s){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(e.DdM(5,wt)))}}function Gt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-chip",36),e.NdJ("iconClick",function(){const a=e.CHM(t).$implicit;return e.oxw(3).removeFromGroup(a)}),e._uU(1),e.qZA()}if(2&s){const t=o.$implicit;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Qt(s,o){if(1&s&&(e.ynx(0),e.YNc(1,Gt,2,2,"vdr-chip",35),e.BQk()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t)}}function qt(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.not-a-member-of-any-groups")," ")}function Et(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",37),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addToGroup()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.add-customer-to-group")," "))}function $t(s,o){if(1&s&&(e.TgZ(0,"div",30)(1,"label",31),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Qt,2,1,"ng-container",32),e.YNc(5,qt,2,3,"ng-template",null,33,e.W1O),e.TgZ(7,"div"),e.YNc(8,Et,4,3,"button",34),e.qZA()()),2&s){const t=o.ngIf,r=e.MAs(6);e.xp6(2),e.Oqu(e.lcZ(3,4,"customer.customer-groups")),e.xp6(2),e.Q6J("ngIf",t.length)("ngIfElse",r),e.xp6(4),e.Q6J("vdrIfPermissions","UpdateCustomerGroup")}}const kt=function(){return["UpdateCustomer"]};function Yt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-address-card",45),e.NdJ("setAsDefaultBilling",function(n){return e.CHM(t),e.oxw(2).setDefaultBillingAddressId(n)})("setAsDefaultShipping",function(n){return e.CHM(t),e.oxw(2).setDefaultShippingAddressId(n)})("deleteAddress",function(n){return e.CHM(t),e.oxw(2).toggleDeleteAddress(n)}),e.ALo(1,"async"),e.ALo(2,"hasPermission"),e.qZA()}if(2&s){const t=o.$implicit,r=e.oxw(2);e.ekj("to-delete",r.addressesToDeleteIds.has(t.value.id)),e.Q6J("availableCountries",e.lcZ(1,8,r.availableCountries$))("isDefaultBilling",r.defaultBillingAddressId===t.value.id)("isDefaultShipping",r.defaultShippingAddressId===t.value.id)("addressForm",t)("customFields",r.addressCustomFields)("editable",e.lcZ(2,10,e.DdM(12,kt))&&!r.addressesToDeleteIds.has(t.value.id))}}function jt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",46),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addAddress()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-address")," "))}const Ht=function(s){return["/orders/",s]};function Rt(s,o){if(1&s&&(e.TgZ(0,"td",47),e._uU(1),e.qZA(),e.TgZ(2,"td",47),e._uU(3),e.qZA(),e.TgZ(4,"td",47),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.TgZ(7,"td",47),e._uU(8),e.ALo(9,"localeDate"),e.qZA(),e.TgZ(10,"td",48),e._UZ(11,"vdr-table-row-action",49),e.ALo(12,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.state),e.xp6(2),e.Oqu(e.xi3(6,6,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.xi3(9,9,t.updatedAt,"medium")),e.xp6(3),e.Q6J("label",e.lcZ(12,12,"common.open"))("linkTo",e.VKq(14,Ht,t.id))}}function Bt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",40)(2,"h3"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,Yt,3,13,"vdr-address-card",41),e.YNc(6,jt,4,3,"button",42),e.qZA(),e.TgZ(7,"div",43)(8,"h3"),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"vdr-data-table",44),e.NdJ("itemsPerPageChange",function(n){return e.CHM(t),e.oxw().setOrderItemsPerPage(n)})("pageChange",function(n){return e.CHM(t),e.oxw().setOrderCurrentPage(n)}),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"translate"),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.TgZ(21,"vdr-dt-column"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e.TgZ(24,"vdr-dt-column"),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"vdr-dt-column"),e.YNc(28,Rt,13,16,"ng-template"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,13,"customer.addresses")),e.xp6(2),e.Q6J("ngForOf",t.getAddressFormControls()),e.xp6(1),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(3),e.Oqu(e.lcZ(10,15,"customer.orders")),e.xp6(2),e.Q6J("items",e.lcZ(12,17,t.orders$))("itemsPerPage",t.ordersPerPage)("totalItems",e.lcZ(13,19,t.ordersCount$))("currentPage",t.currentOrdersPage)("emptyStateLabel",e.lcZ(14,21,"customer.no-orders-placed")),e.xp6(5),e.Oqu(e.lcZ(17,23,"common.code")),e.xp6(3),e.Oqu(e.lcZ(20,25,"order.state")),e.xp6(3),e.Oqu(e.lcZ(23,27,"order.total")),e.xp6(3),e.Oqu(e.lcZ(26,29,"common.updated-at"))}}function Vt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",50)(2,"vdr-customer-history",51),e.NdJ("addNote",function(n){return e.CHM(t),e.oxw().addNoteToCustomer(n)})("updateNote",function(n){return e.CHM(t),e.oxw().updateNote(n)})("deleteNote",function(n){return e.CHM(t),e.oxw().deleteNote(n)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("customer",e.lcZ(3,2,t.entity$))("history",e.lcZ(4,4,t.history$))}}class F extends d.UT_{constructor(o,t,r,n,a,c,u,h){super(o,t,r,c),this.changeDetector=n,this.formBuilder=a,this.dataService=c,this.modalService=u,this.notificationService=h,this.fetchHistory=new W.x,this.addressesToDeleteIds=new Set,this.addressDefaultsUpdated=!1,this.ordersPerPage=10,this.currentOrdersPage=1,this.orderListUpdates$=new W.x,this.customFields=this.getCustomFieldConfig("Customer"),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.detailForm=this.formBuilder.group({customer:this.formBuilder.group({title:"",firstName:["",l.kI.required],lastName:["",l.kI.required],phoneNumber:"",emailAddress:["",[l.kI.required,l.kI.email]],password:"",customFields:this.formBuilder.group(this.customFields.reduce((f,X)=>Object.assign(Object.assign({},f),{[X.name]:""}),{}))}),addresses:new l.Oe([])})}ngOnInit(){this.init(),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(t=>t.countries.items).pipe((0,qe.d)(1));const o=this.entity$.pipe(je(this.orderListUpdates$));this.orders$=o.pipe((0,p.U)(t=>t.orders.items)),this.ordersCount$=this.entity$.pipe((0,p.U)(t=>t.orders.totalItems)),this.history$=this.fetchHistory.pipe((0,E.O)(null),(0,g.w)(()=>this.dataService.customer.getCustomerHistory(this.id,{sort:{createdAt:d.Asd.DESC}}).mapStream(t=>{var r;return null===(r=t.customer)||void 0===r?void 0:r.history.items})))}ngOnDestroy(){this.destroy(),this.orderListUpdates$.complete()}getAddressFormControls(){return this.detailForm.get(["addresses"]).controls}setDefaultBillingAddressId(o){this.defaultBillingAddressId=o,this.addressDefaultsUpdated=!0}setDefaultShippingAddressId(o){this.defaultShippingAddressId=o,this.addressDefaultsUpdated=!0}toggleDeleteAddress(o){this.addressesToDeleteIds.has(o)?this.addressesToDeleteIds.delete(o):this.addressesToDeleteIds.add(o)}addAddress(){const o=this.detailForm.get("addresses"),t=this.formBuilder.group({fullName:"",company:"",streetLine1:["",l.kI.required],streetLine2:"",city:"",province:"",postalCode:"",countryCode:["",l.kI.required],phoneNumber:"",defaultShippingAddress:!1,defaultBillingAddress:!1});if(this.addressCustomFields.length){const r=this.formBuilder.group({});for(const n of this.addressCustomFields)r.addControl(n.name,new l.NI(""));t.addControl("customFields",r)}o.push(t)}setOrderItemsPerPage(o){this.ordersPerPage=+o,this.fetchOrdersList()}setOrderCurrentPage(o){this.currentOrdersPage=+o,this.fetchOrdersList()}create(){var o;const t=this.detailForm.get("customer");if(!t)return;const r=t.value,n=null===(o=t.get("customFields"))||void 0===o?void 0:o.value,a={title:r.title,emailAddress:r.emailAddress,firstName:r.firstName,lastName:r.lastName,phoneNumber:r.phoneNumber,customFields:n};this.dataService.customer.createCustomer(a,r.password).subscribe(({createCustomer:c})=>{switch(c.__typename){case"Customer":this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Customer"}),c.emailAddress&&!r.password&&this.notificationService.notify({message:(0,m.J)("customer.email-verification-sent"),translationVars:{emailAddress:r.emailAddress},type:"info",duration:1e4}),this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.router.navigate(["../",c.id],{relativeTo:this.route});break;case"EmailAddressConflictError":this.notificationService.error(c.message)}})}save(){this.entity$.pipe((0,le.q)(1),(0,He.z)(({id:o})=>{var t;const r=[],n=this.detailForm.get("customer");if(n&&n.dirty){const c=n.value,u=null===(t=n.get("customFields"))||void 0===t?void 0:t.value,h={id:o,title:c.title,emailAddress:c.emailAddress,firstName:c.firstName,lastName:c.lastName,phoneNumber:c.phoneNumber,customFields:u};r.push(this.dataService.customer.updateCustomer(h).pipe((0,p.U)(f=>f.updateCustomer)))}const a=this.detailForm.get("addresses");if(a&&a.dirty||this.addressDefaultsUpdated)for(const c of a.controls)if(c.dirty||this.addressDefaultsUpdated){const u=c.value,h={fullName:u.fullName,company:u.company,streetLine1:u.streetLine1,streetLine2:u.streetLine2,city:u.city,province:u.province,postalCode:u.postalCode,countryCode:u.countryCode,phoneNumber:u.phoneNumber,defaultShippingAddress:this.defaultShippingAddressId===u.id,defaultBillingAddress:this.defaultBillingAddressId===u.id,customFields:u.customFields};u.id?this.addressesToDeleteIds.has(u.id)?r.push(this.dataService.customer.deleteCustomerAddress(u.id).pipe((0,p.U)(f=>f.deleteCustomerAddress))):r.push(this.dataService.customer.updateCustomerAddress(Object.assign(Object.assign({},h),{id:u.id})).pipe((0,p.U)(f=>f.updateCustomerAddress))):r.push(this.dataService.customer.createCustomerAddress(o,h).pipe((0,p.U)(f=>f.createCustomerAddress)))}return(0,Qe.D)(r)})).subscribe(o=>{let t=!1;for(const r of o)switch(r.__typename){case"Customer":case"Address":case"Success":t||(this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Customer"}),t=!0,this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.fetchHistory.next(),this.dataService.customer.getCustomer(this.id).single$.subscribe());break;case"EmailAddressConflictError":this.notificationService.error(r.message)}},o=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"Customer"})})}addToGroup(){this.modalService.fromComponent(O,{size:"md"}).pipe((0,g.w)(o=>o?(0,de.D)(o):x.E),(0,Re.b)(o=>this.dataService.customer.addCustomersToGroup(o,[this.id]))).subscribe({next:o=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:1,groupName:o.addCustomersToGroup.name})},complete:()=>{this.dataService.customer.getCustomer(this.id,{take:0}).single$.subscribe(),this.fetchHistory.next()}})}removeFromGroup(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-remove-customer-from-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.removeCustomersFromGroup(o.id,[this.id]):x.E),(0,g.w)(()=>this.dataService.customer.getCustomer(this.id,{take:0}).single$)).subscribe(t=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:1,groupName:o.name}),this.fetchHistory.next()})}addNoteToCustomer({note:o}){this.dataService.customer.addNoteToCustomer(this.id,o).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(o){this.modalService.fromComponent(d.UlA,{closable:!0,locals:{displayPrivacyControls:!1,note:o.data.note}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerNote({noteId:o.id,note:t.note}):x.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(o){return this.modalService.dialog({title:(0,m.J)("common.confirm-delete-note"),body:o.data.note,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerNote(o.id):x.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Note"})})}setFormValues(o){var t;const r=this.detailForm.get("customer");if(r&&r.patchValue({title:o.title,firstName:o.firstName,lastName:o.lastName,phoneNumber:o.phoneNumber,emailAddress:o.emailAddress}),o.addresses){const n=new l.Oe([]);for(const a of o.addresses){const c=a,{customFields:u}=c,h=(0,Me._T)(c,["customFields"]),f=this.formBuilder.group(Object.assign(Object.assign({},h),{countryCode:a.country.code}));if(n.push(f),a.defaultShippingAddress&&(this.defaultShippingAddressId=a.id),a.defaultBillingAddress&&(this.defaultBillingAddressId=a.id),this.addressCustomFields.length){const X=this.formBuilder.group({});for(const xo of this.addressCustomFields){const ve=xo.name,bo=null===(t=a.customFields)||void 0===t?void 0:t[ve],yo=new l.NI(bo);X.addControl(ve,yo)}f.addControl("customFields",X)}}this.detailForm.setControl("addresses",n)}this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customer","customFields"]),o),this.changeDetector.markForCheck()}fetchOrdersList(){this.dataService.customer.getCustomer(this.id,{take:this.ordersPerPage,skip:(this.currentOrdersPage-1)*this.ordersPerPage}).single$.pipe((0,p.U)(o=>o.customer),(0,Y.h)(Ge.notNullOrUndefined)).subscribe(o=>this.orderListUpdates$.next(o))}}function Xt(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function Wt(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function Kt(s,o){if(1&s&&(e.YNc(0,Xt,3,3,"span",6),e.YNc(1,Wt,3,3,"span",6)),2&s){const t=e.oxw();e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}function zt(s,o){if(1&s&&(e.TgZ(0,"section",7)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",8),e.qZA()),2&s){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.form.get("customFields"))}}function eo(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function to(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function oo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e.YNc(4,eo,3,3,"span",6),e.YNc(5,to,3,3,"span",6),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.form.valid),e.xp6(1),e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}F.\u0275fac=function(o){return new(o||F)(e.Y36(C.gz),e.Y36(C.F0),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(l.qu),e.Y36(d.DoR),e.Y36(d.Z7U),e.Y36(d.gqp))},F.\u0275cmp=e.Xpm({type:F,selectors:[["vdr-customer-detail"]],features:[e.qOj],decls:46,vars:59,consts:[[1,"flex","clr-align-items-center"],[3,"entity"],[3,"customer"],["class","last-login",3,"title",4,"ngIf"],["locationId","customer-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","title",3,"label","readOnlyToggle"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label","readOnlyToggle"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label","readOnlyToggle"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label","readOnlyToggle"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label","readOnlyToggle"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["for","password",3,"label",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","customer-detail",3,"entity$","detailForm"],["class","groups",4,"ngIf"],["class","clr-row",4,"ngIf"],[1,"last-login",3,"title"],[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"],["formGroupName","customFields"],["entityName","Customer",3,"customFields","customFieldsFormGroup"],[1,"groups"],[1,"clr-control-label"],[4,"ngIf","ngIfElse"],["noGroups",""],["class","btn btn-sm btn-secondary",3,"click",4,"vdrIfPermissions"],["icon","times",3,"colorFrom","iconClick",4,"ngFor","ngForOf"],["icon","times",3,"colorFrom","iconClick"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","plus"],[1,"clr-row"],[1,"clr-col-md-4"],[3,"to-delete","availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress",4,"ngFor","ngForOf"],["class","btn btn-secondary",3,"click",4,"vdrIfPermissions"],[1,"clr-col-md-8"],[3,"items","itemsPerPage","totalItems","currentPage","emptyStateLabel","itemsPerPageChange","pageChange"],[3,"availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress"],[1,"btn","btn-secondary",3,"click"],[1,"left"],[1,"right"],["iconShape","shopping-cart",3,"label","linkTo"],[1,"clr-col-md-6"],[3,"customer","history","addNote","updateNote","deleteNote"]],template:function(o,t){if(1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e._UZ(3,"vdr-entity-info",1),e.ALo(4,"async"),e._UZ(5,"vdr-customer-status-label",2),e.ALo(6,"async"),e.YNc(7,It,5,10,"div",3),e.ALo(8,"async"),e.qZA()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",4),e.YNc(11,Ot,3,4,"button",5),e.ALo(12,"async"),e.YNc(13,Ft,1,1,"ng-template",null,6,e.W1O),e.qZA()(),e.TgZ(15,"form",7)(16,"vdr-form-field",8),e.ALo(17,"translate"),e.ALo(18,"async"),e._UZ(19,"input",9),e.qZA(),e.TgZ(20,"vdr-form-field",10),e.ALo(21,"translate"),e.ALo(22,"async"),e._UZ(23,"input",11),e.qZA(),e.TgZ(24,"vdr-form-field",12),e.ALo(25,"translate"),e.ALo(26,"async"),e._UZ(27,"input",13),e.qZA(),e.TgZ(28,"vdr-form-field",14),e.ALo(29,"translate"),e.ALo(30,"async"),e._UZ(31,"input",15),e.qZA(),e.TgZ(32,"vdr-form-field",16),e.ALo(33,"translate"),e.ALo(34,"async"),e._UZ(35,"input",17),e.qZA(),e.YNc(36,Pt,3,3,"vdr-form-field",18),e.ALo(37,"async"),e.YNc(38,Mt,5,6,"section",19),e._UZ(39,"vdr-custom-detail-component-host",20),e.qZA(),e.YNc(40,$t,9,6,"div",21),e.ALo(41,"async"),e.YNc(42,Bt,29,31,"div",22),e.ALo(43,"async"),e.YNc(44,Vt,5,6,"div",22),e.ALo(45,"async")),2&o){const r=e.MAs(14);let n,a;e.xp6(3),e.Q6J("entity",e.lcZ(4,23,t.entity$)),e.xp6(2),e.Q6J("customer",e.lcZ(6,25,t.entity$)),e.xp6(2),e.Q6J("ngIf",null==(n=e.lcZ(8,27,t.entity$))||null==n.user?null:n.user.lastLogin),e.xp6(4),e.Q6J("ngIf",e.lcZ(12,29,t.isNew$))("ngIfElse",r),e.xp6(4),e.Q6J("formGroup",t.detailForm.get("customer")),e.xp6(1),e.Q6J("label",e.lcZ(17,31,"customer.title"))("readOnlyToggle",!e.lcZ(18,33,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(21,35,"customer.first-name"))("readOnlyToggle",!e.lcZ(22,37,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(25,39,"customer.last-name"))("readOnlyToggle",!e.lcZ(26,41,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(29,43,"customer.email-address"))("readOnlyToggle",!e.lcZ(30,45,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(33,47,"customer.phone-number"))("readOnlyToggle",!e.lcZ(34,49,t.isNew$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(37,51,t.isNew$)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(1),e.Q6J("ngIf",null==(a=e.lcZ(41,53,t.entity$))?null:a.groups),e.xp6(2),e.Q6J("ngIf",!e.lcZ(43,55,t.isNew$)),e.xp6(2),e.Q6J("ngIf",!e.lcZ(45,57,t.isNew$))}},directives:[b.Kk,b.BN,ne.V,Z,_.O5,b.mz,ae.W,V.H,l._Y,l.JL,l.sg,ue.h,U.y,l.Fj,l.JJ,l.u,l.x0,y.MgK,pe.y,st.C,_.sg,Q.Y,y.qvL,I,$.Q,se.E,re.v,J],pipes:[_.Ov,Nt.H,v.X$,Lt.e,N.j,St.k],styles:[".last-login[_ngcontent-%COMP%]{margin-left:6px;color:var(--color-grey-500)}.to-delete[_ngcontent-%COMP%]{opacity:.5}"],changeDetection:0});const so=function(){return["CreateCustomerGroup","UpdateCustomerGroup"]};class T{constructor(o,t){this.serverConfigService=o,this.formBuilder=t,this.customFields=this.serverConfigService.getCustomFieldsFor("CustomerGroup")}ngOnInit(){var o;if(this.form=this.formBuilder.group({name:[this.group.name,l.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,r)=>Object.assign(Object.assign({},t),{[r.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const r of this.customFields){const n=r.name,a=null===(o=this.group.customFields)||void 0===o?void 0:o[n],c=t.get(n);c&&c.patchValue(a)}}}cancel(){this.resolveWith()}save(){this.resolveWith(this.form.value)}}T.\u0275fac=function(o){return new(o||T)(e.Y36(d.iHG),e.Y36(l.qu))},T.\u0275cmp=e.Xpm({type:T,selectors:[["vdr-customer-group-detail-dialog"]],decls:8,vars:9,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["formGroupName","customFields",4,"ngIf"],["vdrDialogButtons",""],[4,"ngIf"],["formGroupName","customFields"],["entityName","CustomerGroup",3,"customFields","customFieldsFormGroup"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Kt,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.YNc(6,zt,5,5,"section",4),e.qZA(),e.YNc(7,oo,6,6,"ng-template",5)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,4,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(5,6,e.DdM(8,so))),e.xp6(2),e.Q6J("ngIf",t.customFields.length))},directives:[q.q,_.O5,l._Y,l.JL,l.sg,ue.h,U.y,l.Fj,l.JJ,l.u,l.x0,y.MgK,pe.y,k.n],pipes:[v.X$,N.j],styles:[""],changeDetection:0});var he=i(745),ro=i(73),no=i(5181);function io(s,o){if(1&s){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&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-customer-group")," "))}const ao=function(s){return{contents:s}},co=function(s){return["./",s]};function lo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",11),e._UZ(1,"vdr-entity-info",12),e.qZA(),e.TgZ(2,"td",11)(3,"vdr-chip",13),e._uU(4),e.qZA()(),e.TgZ(5,"td",11)(6,"a",14),e._UZ(7,"clr-icon",15),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"td",16)(11,"button",17),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().update(a)}),e._UZ(12,"clr-icon",18),e._uU(13),e.ALo(14,"translate"),e.qZA()(),e.TgZ(15,"td",19)(16,"vdr-dropdown")(17,"button",20),e._uU(18),e.ALo(19,"translate"),e._UZ(20,"clr-icon",21),e.qZA(),e.TgZ(21,"vdr-dropdown-menu",22)(22,"button",23),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().delete(a.id)}),e.ALo(23,"hasPermission"),e._UZ(24,"clr-icon",24),e._uU(25),e.ALo(26,"translate"),e.qZA()()()()}if(2&s){const t=o.item,r=e.oxw();e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("entity",t),e.xp6(1),e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name),e.xp6(1),e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("routerLink",e.VKq(31,co,e.VKq(29,ao,t.id))),e.xp6(2),e.hij(" ",e.lcZ(9,19,"customer.view-group-members")," "),e.xp6(2),e.ekj("active",t.id===r.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(14,21,"common.edit")," "),e.xp6(2),e.ekj("active",t.id===r.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(19,23,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(23,25,"DeleteCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(26,27,"common.delete")," ")}}function mo(s,o){1&s&&e._UZ(0,"vdr-empty-placeholder")}const uo=function(s){return{count:s}},po=function(s){return{groupName:s}};function _o(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",25)(2,"div",26),e._uU(3),e.ALo(4,"async"),e.qZA(),e._UZ(5,"div",27),e.TgZ(6,"button",28),e.NdJ("click",function(){return e.CHM(t),e.oxw().closeMembers()}),e._UZ(7,"clr-icon",29),e.qZA()(),e.TgZ(8,"div",30)(9,"vdr-dropdown")(10,"button",31),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",21),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",22)(15,"button",32),e.NdJ("click",function(){const a=e.CHM(t).ngIf,c=e.oxw();return c.removeFromGroup(a,c.selectedCustomerIds)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",24),e._uU(18),e.ALo(19,"translate"),e.qZA()()(),e.TgZ(20,"button",33),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().addToGroup(a)}),e._uU(21),e.ALo(22,"translate"),e.qZA()(),e.TgZ(23,"vdr-customer-group-member-list",34),e.NdJ("selectionChange",function(n){e.CHM(t);return e.oxw().selectedCustomerIds=n})("fetchParamsChange",function(n){return e.CHM(t),e.oxw().fetchGroupMembers$.next(n)}),e.ALo(24,"async"),e.ALo(25,"async"),e.qZA(),e.BQk()}if(2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.AsE("",t.name," (",e.lcZ(4,11,r.membersTotal$),")"),e.xp6(7),e.Q6J("disabled",0===r.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(12,13,"common.with-selected",e.VKq(27,uo,r.selectedCustomerIds.length))," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,16,"UpdateCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(19,18,"customer.remove-from-group")," "),e.xp6(3),e.hij(" ",e.xi3(22,20,"customer.add-customers-to-group",e.VKq(29,po,t.name))," "),e.xp6(2),e.Q6J("members",e.lcZ(24,23,r.members$))("route",r.route)("totalItems",e.lcZ(25,25,r.membersTotal$))("selectedMemberIds",r.selectedCustomerIds)}}class P extends d.t7C{constructor(o,t,r,n,a){super(a,n),this.dataService=o,this.notificationService=t,this.modalService=r,this.route=n,this.router=a,this.searchTerm=new l.NI(""),this.selectedCustomerIds=[],this.fetchGroupMembers$=new G.X({skip:0,take:0,filterTerm:""}),this.refreshActiveGroupMembers$=new G.X(void 0),super.setQueryFn((...c)=>this.dataService.customer.getCustomerGroupList(...c).refetchOnChannelChange(),c=>c.customerGroups,(c,u)=>({options:{skip:c,take:u,filter:{name:{contains:this.searchTerm.value}}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,Y.h)(r=>2<r.length||0===r.length),(0,ee.b)(250),(0,oe.R)(this.destroy$)).subscribe(()=>this.refresh());const o=this.route.paramMap.pipe((0,p.U)(r=>r.get("contents")),(0,z.x)(),(0,te.b)(()=>this.selectedCustomerIds=[]));this.listIsEmpty$=this.items$.pipe((0,p.U)(r=>0===r.length)),this.activeGroup$=(0,K.a)(this.items$,o).pipe((0,p.U)(([r,n])=>{if(n)return r.find(a=>a.id===n)}),(0,te.b)(r=>this.activeGroupId=null==r?void 0:r.id));const t=(0,K.a)(this.activeGroup$,this.fetchGroupMembers$,this.refreshActiveGroupMembers$).pipe((0,g.w)(([r,{skip:n,take:a,filterTerm:c}])=>r?this.dataService.customer.getCustomerGroupWithCustomers(r.id,{skip:n,take:a,filter:{emailAddress:{contains:c}}}).mapStream(u=>{var h;return null===(h=u.customerGroup)||void 0===h?void 0:h.customers}):(0,he.of)(void 0)));this.members$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.items)&&void 0!==n?n:[]})),this.membersTotal$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.totalItems)&&void 0!==n?n:0}))}create(){this.modalService.fromComponent(T,{locals:{group:{name:""}}}).pipe((0,g.w)(o=>o?this.dataService.customer.createCustomerGroup(Object.assign(Object.assign({},o),{customerIds:[]})):x.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"CustomerGroup"})},o=>{this.notificationService.error((0,m.J)("common.notify-create-error"),{entity:"CustomerGroup"})})}delete(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-delete-customer-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerGroup(o):x.E),(0,g.w)(t=>t.deleteCustomerGroup.result===d.PcR.DELETED?this.dataService.customer.getCustomerGroupList().mapSingle(()=>({errorMessage:!1})):(0,he.of)({errorMessage:t.deleteCustomerGroup.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):(this.refresh(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"CustomerGroup"}))},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"CustomerGroup"})})}update(o){this.modalService.fromComponent(T,{locals:{group:o}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerGroup(Object.assign({id:o.id},t)):x.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"CustomerGroup"})},t=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"CustomerGroup"})})}closeMembers(){const o=Object.assign({},this.route.snapshot.params);delete o.contents,this.router.navigate(["./",o],{relativeTo:this.route,queryParamsHandling:"preserve"})}addToGroup(o){this.modalService.fromComponent(L,{locals:{group:o,route:this.route},size:"md",verticalAlign:"top"}).pipe((0,g.w)(t=>t?this.dataService.customer.addCustomersToGroup(o.id,t).pipe((0,ro.h)(t)):x.E)).subscribe({next:t=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}removeFromGroup(o,t){this.dataService.customer.removeCustomersFromGroup(o.id,t).subscribe({complete:()=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}}P.\u0275fac=function(o){return new(o||P)(e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(C.gz),e.Y36(C.F0))},P.\u0275cmp=e.Xpm({type:P,selectors:[["vdr-customer-group-list"]],features:[e.qOj],decls:22,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-group-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"group-wrapper"],[1,"group-list"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],["emptyPlaceholder",""],[1,"group-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"right","align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],[1,"align-middle"],["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"],[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"],[3,"members","route","totalItems","selectedMemberIds","selectionChange","fetchParamsChange"]],template:function(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,io,4,3,"button",2),e.qZA()(),e.TgZ(7,"div",3)(8,"div",4)(9,"vdr-data-table",5),e.NdJ("pageChange",function(n){return t.setPageNumber(n)})("itemsPerPageChange",function(n){return t.setItemsPerPage(n)}),e.ALo(10,"async"),e.ALo(11,"async"),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"async"),e.YNc(15,lo,27,33,"ng-template"),e.qZA()(),e.YNc(16,mo,1,0,"ng-template",null,6,e.W1O),e.TgZ(18,"div",7),e.ALo(19,"async"),e.YNc(20,_o,26,31,"ng-container",8),e.ALo(21,"async"),e.qZA()()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-by-group-name")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomerGroup"),e.xp6(3),e.ekj("expanded",e.lcZ(10,14,t.activeGroup$)),e.Q6J("items",e.lcZ(11,16,t.items$))("itemsPerPage",e.lcZ(12,18,t.itemsPerPage$))("totalItems",e.lcZ(13,20,t.totalItems$))("currentPage",e.lcZ(14,22,t.currentPage$)),e.xp6(9),e.ekj("expanded",e.lcZ(19,24,t.activeGroup$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(21,26,t.activeGroup$)))},directives:[b.Kk,b.BN,U.y,l.Fj,l.JJ,l.oH,b.mz,ae.W,V.H,y.qvL,$.Q,ne.V,Q.Y,C.yS,j.J,H.U,R.N,B.H,no.j,_.O5,A],pipes:[v.X$,_.Ov,N.j],styles:[".group-wrapper[_ngcontent-%COMP%]{display:flex;height:calc(100% - 50px)}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%]{flex:1;overflow:auto;margin-top:0}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%] .active[_ngcontent-%COMP%]{background-color:var(--clr-global-selection-color)}.group-wrapper[_ngcontent-%COMP%] .group-list.expanded[_ngcontent-%COMP%]{width:calc(100% - 40vw)}vdr-data-table[_ngcontent-%COMP%] table{margin-top:0}.group-members[_ngcontent-%COMP%]{height:100%;width:0;opacity:0;visibility:hidden;overflow:auto;transition:width .3s,opacity .2s .3s,visibility 0s .3s}.group-members.expanded[_ngcontent-%COMP%]{width:40vw;visibility:visible;opacity:1;padding-left:12px}.group-members[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin:0;background:none;border:none;cursor:pointer}.group-members[_ngcontent-%COMP%] table.table{margin-top:0}.group-members[_ngcontent-%COMP%] table.table th{top:0}.group-members[_ngcontent-%COMP%] .controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between}vdr-empty-placeholder[_ngcontent-%COMP%]{flex:1}"],changeDetection:0});var go=i(8165);const ho=function(){return["./create"]};function fo(s,o){1&s&&(e.TgZ(0,"a",5),e._UZ(1,"clr-icon",6),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.Q6J("routerLink",e.DdM(4,ho)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.create-new-customer")," "))}const Co=function(s){return["./",s]};function vo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",7),e._uU(1),e.qZA(),e.TgZ(2,"td",7),e._uU(3),e.qZA(),e.TgZ(4,"td",7),e._UZ(5,"vdr-customer-status-label",8),e.qZA(),e.TgZ(6,"td",9),e._UZ(7,"vdr-table-row-action",10),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"td")(10,"vdr-dropdown")(11,"button",11),e._uU(12),e.ALo(13,"translate"),e._UZ(14,"clr-icon",12),e.qZA(),e.TgZ(15,"vdr-dropdown-menu",13)(16,"button",14),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().deleteCustomer(a)}),e.ALo(17,"hasPermission"),e._UZ(18,"clr-icon",15),e._uU(19),e.ALo(20,"translate"),e.qZA()()()()}if(2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("customer",t),e.xp6(2),e.Q6J("label",e.lcZ(8,10,"common.edit"))("linkTo",e.VKq(18,Co,t.id)),e.xp6(5),e.hij(" ",e.lcZ(13,12,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(17,14,"DeleteCustomer")),e.xp6(3),e.hij(" ",e.lcZ(20,16,"common.delete")," ")}}class w extends d.t7C{constructor(o,t,r,n,a){super(t,r),this.dataService=o,this.modalService=n,this.notificationService=a,this.searchTerm=new l.NI(""),super.setQueryFn((...c)=>this.dataService.customer.getCustomerList(...c).refetchOnChannelChange(),c=>c.customers,(c,u)=>({options:{skip:c,take:u,filter:{emailAddress:{contains:this.searchTerm.value},lastName:{contains:this.searchTerm.value},postalCode:{contains:this.searchTerm.value}},filterOperator:d.FnJ.OR,sort:{createdAt:go.As.DESC}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,Y.h)(o=>2<o.length||0===o.length),(0,ee.b)(250),(0,oe.R)(this.destroy$)).subscribe(()=>this.refresh())}deleteCustomer(o){return this.modalService.dialog({title:(0,m.J)("catalog.confirm-delete-customer"),body:`${o.firstName} ${o.lastName}`,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomer(o.id):x.E)).subscribe(()=>{this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Customer"}),this.refresh()},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"Customer"})})}}w.\u0275fac=function(o){return new(o||w)(e.Y36(d.DoR),e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.Z7U),e.Y36(d.gqp))},w.\u0275cmp=e.Xpm({type:w,selectors:[["vdr-customer-list"]],features:[e.qOj],decls:24,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[3,"expand"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"customer"],[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(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,fo,4,5,"a",2),e.qZA()(),e.TgZ(7,"vdr-data-table",3),e.NdJ("pageChange",function(n){return t.setPageNumber(n)})("itemsPerPageChange",function(n){return t.setItemsPerPage(n)}),e.ALo(8,"async"),e.ALo(9,"async"),e.ALo(10,"async"),e.ALo(11,"async"),e.TgZ(12,"vdr-dt-column",4),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column",4),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,vo,21,20,"ng-template"),e.qZA()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-customers-by-email-last-name-postal-code")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomer"),e.xp6(1),e.Q6J("items",e.lcZ(8,14,t.items$))("itemsPerPage",e.lcZ(9,16,t.itemsPerPage$))("totalItems",e.lcZ(10,18,t.totalItems$))("currentPage",e.lcZ(11,20,t.currentPage$)),e.xp6(5),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(14,22,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(17,24,"customer.email-address")),e.xp6(3),e.Oqu(e.lcZ(20,26,"customer.customer-type")))},directives:[b.Kk,b.BN,U.y,l.Fj,l.JJ,l.oH,b.mz,ae.W,V.H,C.yS,y.qvL,$.Q,se.E,Z,re.v,j.J,H.U,R.N,B.H],pipes:[v.X$,_.Ov,N.j],styles:[".search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"]});class D extends d.p_9{constructor(o,t){super(o,{__typename:"Customer",id:"",createdAt:"",updatedAt:"",title:"",firstName:"",lastName:"",emailAddress:"",phoneNumber:null,addresses:null,user:null},r=>t.customer.getCustomer(r).mapStream(n=>n.customer))}}D.\u0275fac=function(o){return new(o||D)(e.LFG(C.F0),e.LFG(d.DoR))},D.\u0275prov=e.Yz7({token:D,factory:D.\u0275fac,providedIn:"root"});const fe=[{path:"customers",component:w,pathMatch:"",data:{breadcrumb:(0,m.J)("breadcrumb.customers")}},{path:"customers/:id",component:F,resolve:(0,d.Po4)(D),canDeactivate:[d.TSp],data:{breadcrumb:Ce}},{path:"groups",component:P,data:{breadcrumb:(0,m.J)("breadcrumb.customer-groups")}}];function Ce(s,o){return(0,d.YWC)({entity:s.entity,id:o.id,breadcrumbKey:"breadcrumb.customers",getName:t=>`${t.firstName} ${t.lastName}`,route:"customers"})}class M{}M.\u0275fac=function(o){return new(o||M)},M.\u0275mod=e.oAB({type:M}),M.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(fe)]]})}}]);
|
|
2
|
-
//# sourceMappingURL=600.
|
|
1
|
+
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[600],{4847:(Ao,ce,i)=>{i.r(ce),i.d(ce,{AddCustomerToGroupDialogComponent:()=>L,AddressCardComponent:()=>I,AddressDetailDialogComponent:()=>S,CustomerDetailComponent:()=>F,CustomerGroupDetailDialogComponent:()=>T,CustomerGroupListComponent:()=>P,CustomerGroupMemberListComponent:()=>A,CustomerHistoryComponent:()=>J,CustomerListComponent:()=>w,CustomerModule:()=>M,CustomerResolver:()=>D,CustomerStatusLabelComponent:()=>Z,SelectCustomerGroupDialogComponent:()=>O,customerBreadcrumb:()=>Ce,customerRoutes:()=>fe});var G=i(6317),g=i(2673),p=i(635),e=i(3184),d=i(8098),Q=i(309),l=i(587),W=i(253),K=i(6562),q=i(4874),z=i(8977),ee=i(1989),te=i(9337),oe=i(8951),C=i(9720),U=i(7890),$=i(365),se=i(901),re=i(8899),v=i(7514),_=i(6362),N=i(7388);const xe=function(s){return["/customer","customers",s]};function be(s,o){if(1&s&&(e.TgZ(0,"td",3),e._uU(1),e.qZA(),e.TgZ(2,"td",3),e._uU(3),e.qZA(),e.TgZ(4,"td",4),e._UZ(5,"vdr-table-row-action",5),e.ALo(6,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("label",e.lcZ(6,6,"common.edit"))("linkTo",e.VKq(8,xe,t.id))}}class A{constructor(o,t){this.router=o,this.dataService=t,this.selectedMemberIds=[],this.selectionChange=new e.vpe,this.fetchParamsChange=new e.vpe,this.filterTermControl=new l.NI(""),this.refresh$=new G.X(!0),this.destroy$=new W.x,this.isMemberSelected=r=>-1<this.selectedMemberIds.indexOf(r.id)}ngOnInit(){this.membersCurrentPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPage")),(0,p.U)(t=>t?+t:1),(0,q.O)(1),(0,z.x)()),this.membersItemsPerPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPerPage")),(0,p.U)(t=>t?+t:10),(0,q.O)(10),(0,z.x)());const o=this.filterTermControl.valueChanges.pipe((0,ee.b)(250),(0,te.b)(()=>this.setContentsPageNumber(1)),(0,q.O)(""));(0,K.a)(this.membersCurrentPage$,this.membersItemsPerPage$,o,this.refresh$).pipe((0,oe.R)(this.destroy$)).subscribe(([t,r,n])=>{const a=r,c=(t-1)*r;this.fetchParamsChange.emit({filterTerm:n,skip:c,take:a})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}setContentsPageNumber(o){this.setParam("membersPage",o)}setContentsItemsPerPage(o){this.setParam("membersPerPage",o)}refresh(){this.refresh$.next(!0)}setParam(o,t){this.router.navigate(["./",Object.assign(Object.assign({},this.route.snapshot.params),{[o]:t})],{relativeTo:this.route,queryParamsHandling:"merge"})}areAllSelected(){return!!this.members&&this.selectedMemberIds.length===this.members.length}toggleSelectAll(){this.areAllSelected()?this.selectionChange.emit([]):this.selectionChange.emit(this.members.map(o=>o.id))}toggleSelectMember({item:o}){this.selectedMemberIds.includes(o.id)?this.selectionChange.emit(this.selectedMemberIds.filter(t=>t!==o.id)):this.selectionChange.emit([...this.selectedMemberIds,o.id])}}A.\u0275fac=function(o){return new(o||A)(e.Y36(C.F0),e.Y36(d.DoR))},A.\u0275cmp=e.Xpm({type:A,selectors:[["vdr-customer-group-member-list"]],inputs:{members:"members",totalItems:"totalItems",route:"route",selectedMemberIds:"selectedMemberIds"},outputs:{selectionChange:"selectionChange",fetchParamsChange:"fetchParamsChange"},decls:14,vars:24,consts:[["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[3,"items","itemsPerPage","totalItems","currentPage","allSelected","isRowSelectedFn","pageChange","itemsPerPageChange","rowSelectChange","allSelectChange"],[3,"expand"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"]],template:function(o,t){1&o&&(e._UZ(0,"input",0),e.ALo(1,"translate"),e.TgZ(2,"vdr-data-table",1),e.NdJ("pageChange",function(n){return t.setContentsPageNumber(n)})("itemsPerPageChange",function(n){return t.setContentsItemsPerPage(n)})("rowSelectChange",function(n){return t.toggleSelectMember(n)})("allSelectChange",function(){return t.toggleSelectAll()}),e.ALo(3,"async"),e.ALo(4,"async"),e.ALo(5,"hasPermission"),e.TgZ(6,"vdr-dt-column",2),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"vdr-dt-column",2),e._uU(10),e.ALo(11,"translate"),e.qZA(),e._UZ(12,"vdr-dt-column"),e.YNc(13,be,7,10,"ng-template"),e.qZA()),2&o&&(e.Q6J("formControl",t.filterTermControl)("placeholder",e.lcZ(1,12,"customer.search-customers-by-email")),e.xp6(2),e.Q6J("items",t.members)("itemsPerPage",e.lcZ(3,14,t.membersItemsPerPage$))("totalItems",t.totalItems)("currentPage",e.lcZ(4,16,t.membersCurrentPage$))("allSelected",t.areAllSelected())("isRowSelectedFn",e.lcZ(5,18,"UpdateCustomerGroup")&&t.isMemberSelected),e.xp6(4),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(8,20,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(11,22,"customer.email-address")))},directives:[U.y,l.Fj,l.JJ,l.oH,$.Q,se.E,re.v],pipes:[v.X$,_.Ov,N.j],styles:[""],changeDetection:0});var k=i(8318);const ye=function(s){return{groupName:s}};function Ae(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw();e.hij(" ",e.xi3(1,1,"customer.add-customers-to-group-with-name",e.VKq(4,ye,t.group.name)),"\n")}}const Ze=function(s){return{count:s}};function Te(s,o){if(1&s){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&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customers-to-group-with-count",e.VKq(8,Ze,t.selectedCustomerIds.length))," ")}}class L{constructor(o){this.dataService=o,this.selectedCustomerIds=[],this.fetchGroupMembers$=new G.X({skip:0,take:10,filterTerm:""})}ngOnInit(){const o=this.fetchGroupMembers$.pipe((0,g.w)(({skip:t,take:r,filterTerm:n})=>this.dataService.customer.getCustomerList(r,t,n).mapStream(a=>a.customers)));this.customers$=o.pipe((0,p.U)(t=>t.items)),this.customersTotal$=o.pipe((0,p.U)(t=>t.totalItems))}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedCustomerIds)}}L.\u0275fac=function(o){return new(o||L)(e.Y36(d.DoR))},L.\u0275cmp=e.Xpm({type:L,selectors:[["vdr-add-customer-to-group-dialog"]],decls:5,vars:8,consts:[["vdrDialogTitle",""],[3,"members","totalItems","route","selectedMemberIds","fetchParamsChange","selectionChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Ae,2,6,"ng-template",0),e.TgZ(1,"vdr-customer-group-member-list",1),e.NdJ("fetchParamsChange",function(n){return t.fetchGroupMembers$.next(n)})("selectionChange",function(n){return t.selectedCustomerIds=n}),e.ALo(2,"async"),e.ALo(3,"async"),e.qZA(),e.YNc(4,Te,6,10,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("members",e.lcZ(2,4,t.customers$))("totalItems",e.lcZ(3,6,t.customersTotal$))("route",t.route)("selectedMemberIds",t.selectedCustomerIds))},directives:[Q.q,A,k.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var Y=i(116),le=i(9295),De=i(1480);function Ue(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij("",t,",")}}function Ne(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij(" ",t,"")}}function Le(s,o){if(1&s&&(e.YNc(0,Ue,2,1,"span",3),e.YNc(1,Ne,2,1,"span",3)),2&s){const t=e.oxw();let r,n;e.Q6J("ngIf",null==(r=t.addressForm.get("streetLine1"))?null:r.value),e.xp6(1),e.Q6J("ngIf",null==(n=t.addressForm.get("countryCode"))?null:n.value)}}function Se(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.addressForm.valid||!t.addressForm.touched),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.update")," ")}}class S{constructor(o){this.changeDetector=o,this.availableCountries=[]}ngOnInit(){this.addressForm.valueChanges.subscribe(()=>this.changeDetector.markForCheck())}cancel(){this.resolveWith()}save(){this.resolveWith(this.addressForm)}}S.\u0275fac=function(o){return new(o||S)(e.Y36(e.sBO))},S.\u0275cmp=e.Xpm({type:S,selectors:[["vdr-address-detail-dialog"]],decls:3,vars:3,consts:[["vdrDialogTitle",""],[3,"formGroup","availableCountries","customFields"],["vdrDialogButtons",""],[4,"ngIf"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Le,2,2,"ng-template",0),e._UZ(1,"vdr-address-form",1),e.YNc(2,Se,6,7,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.addressForm)("availableCountries",t.availableCountries)("customFields",t.customFields))},directives:[Q.q,_.O5,De.C,l.JL,l.sg,k.n],pipes:[v.X$],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});var E=i(4447),y=i(2748),Ie=i(9667),ne=i(3146),j=i(735),H=i(1519),R=i(8854),B=i(5111);function Oe(s,o){if(1&s&&(e.TgZ(0,"span",13),e._uU(1),e.qZA()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.hij("",t.streetLine1,",")}}function Je(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",15),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-shipping-address")," "))}function Fe(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",16),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-billing-address")," "))}function Pe(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",17),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).editAddress()}),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown")(5,"button",18),e._uU(6),e.ALo(7,"translate"),e._UZ(8,"clr-icon",19),e.qZA(),e.TgZ(9,"vdr-dropdown-menu")(10,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultShippingAddress()}),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultBillingAddress()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",21),e.TgZ(17,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).delete()}),e._UZ(18,"clr-icon",23),e._uU(19),e.ALo(20,"translate"),e.qZA()()(),e.BQk()}if(2&s){const t=e.oxw(2);e.xp6(2),e.hij(" ",e.lcZ(3,7,"common.edit")," "),e.xp6(4),e.hij(" ",e.lcZ(7,9,"common.more")," "),e.xp6(4),e.Q6J("disabled",t.isDefaultShipping),e.xp6(1),e.hij(" ",e.lcZ(12,11,"customer.set-as-default-shipping-address")," "),e.xp6(2),e.Q6J("disabled",t.isDefaultBilling),e.xp6(1),e.hij(" ",e.lcZ(15,13,"customer.set-as-default-billing-address")," "),e.xp6(5),e.hij(" ",e.lcZ(20,15,"common.delete")," ")}}function we(s,o){if(1&s&&(e.TgZ(0,"div",1)(1,"div",2)(2,"div",3),e.YNc(3,Oe,2,1,"span",4),e._uU(4),e.qZA(),e.TgZ(5,"div",5),e.YNc(6,Je,4,3,"vdr-chip",6),e.YNc(7,Fe,4,3,"vdr-chip",6),e.qZA()(),e.TgZ(8,"div",7)(9,"div",8),e._UZ(10,"vdr-formatted-address",9),e.qZA()(),e.TgZ(11,"div",10),e._UZ(12,"vdr-entity-info",11),e.YNc(13,Pe,21,17,"ng-container",12),e.qZA()()),2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.Q6J("ngIf",t.streetLine1),e.xp6(1),e.hij(" ",t.countryCode," "),e.xp6(2),e.Q6J("ngIf",r.isDefaultShipping),e.xp6(1),e.Q6J("ngIf",r.isDefaultBilling),e.xp6(3),e.Q6J("address",t),e.xp6(2),e.Q6J("entity",t),e.xp6(1),e.Q6J("ngIf",r.editable)}}class I{constructor(o,t){this.modalService=o,this.changeDetector=t,this.availableCountries=[],this.editable=!0,this.setAsDefaultShipping=new e.vpe,this.setAsDefaultBilling=new e.vpe,this.deleteAddress=new e.vpe,this.dataDependenciesPopulated=new G.X(!1)}ngOnInit(){this.addressForm.get("streetLine1").value||this.dataDependenciesPopulated.pipe((0,Y.h)(t=>t),(0,le.q)(1)).subscribe(()=>{this.editAddress()})}ngOnChanges(o){null!=this.customFields&&null!=this.availableCountries&&this.dataDependenciesPopulated.next(!0)}getCountryName(o){if(!this.availableCountries)return"";const t=this.availableCountries.find(r=>r.code===o);return t?t.name:""}setAsDefaultBillingAddress(){this.setAsDefaultBilling.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}setAsDefaultShippingAddress(){this.setAsDefaultShipping.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}delete(){this.deleteAddress.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}editAddress(){this.modalService.fromComponent(S,{locals:{addressForm:this.addressForm,customFields:this.customFields,availableCountries:this.availableCountries},size:"md",closable:!0}).subscribe(()=>{this.changeDetector.markForCheck()})}}I.\u0275fac=function(o){return new(o||I)(e.Y36(d.Z7U),e.Y36(e.sBO))},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-address-card"]],inputs:{addressForm:"addressForm",customFields:"customFields",availableCountries:"availableCountries",isDefaultBilling:"isDefaultBilling",isDefaultShipping:"isDefaultShipping",editable:"editable"},outputs:{setAsDefaultShipping:"setAsDefaultShipping",setAsDefaultBilling:"setAsDefaultBilling",deleteAddress:"deleteAddress"},features:[e.TTD],decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"address-title"],["class","street-line",4,"ngIf"],[1,"default-controls"],["class","is-default p8",4,"ngIf"],[1,"card-block"],[1,"card-text"],[3,"address"],[1,"card-footer"],[3,"entity"],[4,"ngIf"],[1,"street-line"],[1,"is-default","p8"],["shape","truck"],["shape","credit-card"],[1,"btn","btn-sm","btn-link",3,"click"],["type","button","vdrDropdownTrigger","",1,"btn","btn-sm","btn-link"],["shape","caret down"],["vdrDropdownItem","",1,"button",3,"disabled","click"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"delete-button",3,"click"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&e.YNc(0,we,14,7,"div",0),2&o&&e.Q6J("ngIf",t.addressForm.value)},directives:[_.O5,E.Y,y.qvL,Ie.b,ne.V,j.J,H.U,R.N,B.H],pipes:[v.X$],styles:["[_nghost-%COMP%]{display:block;max-width:360px}clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}.defaul-controls[_ngcontent-%COMP%]{display:flex}.is-default[_ngcontent-%COMP%]{margin:0;color:var(--color-success-500)}"],changeDetection:0});var Me=i(4929),m=i(8270),Ge=i(234),Ee=i(1640),de=i(7400),x=i(591),Qe=i(9196),qe=i(1944);const{isArray:$e}=Array;var Ye=i(1308),me=i(420);function je(...s){const o=(0,me.yG)(s),t=(0,me._6)(s,1/0);return s=function ke(s){return 1===s.length&&$e(s[0])?s[0]:s}(s),(0,qe.e)((r,n)=>{(0,Ye.J)(t)((0,de.D)([r,...s],o)).subscribe(n)})}var He=i(9525),Re=i(3853),ie=i(8660);function Be(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.add-customer-to-group"),"\n")}function Ve(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"span",5),e.NdJ("click",function(){const n=e.CHM(t),a=n.item;return n.clear(a)}),e._uU(1," \xd7 "),e.qZA(),e.TgZ(2,"vdr-chip",6),e._uU(3),e.qZA()}if(2&s){const t=o.item;e.xp6(2),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Xe(s,o){if(1&s&&(e.TgZ(0,"vdr-chip",6),e._uU(1),e.qZA()),2&s){const t=o.item;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}const We=function(s){return{count:s}};function Ke(s,o){if(1&s){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().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedGroupIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customer-to-groups-with-count",e.VKq(8,We,t.selectedGroupIds.length))," ")}}class O{constructor(o){this.dataService=o,this.selectedGroupIds=[]}ngOnInit(){this.groups$=this.dataService.customer.getCustomerGroupList().mapStream(o=>o.customerGroups.items)}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedGroupIds)}}O.\u0275fac=function(o){return new(o||O)(e.Y36(d.DoR))},O.\u0275cmp=e.Xpm({type:O,selectors:[["vdr-select-customer-group-dialog"]],decls:6,vars:8,consts:[["vdrDialogTitle",""],["appendTo","body","bindValue","id",3,"items","addTag","multiple","ngModel","clearable","searchable","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],["vdrDialogButtons",""],["aria-hidden","true",1,"ng-value-icon","left",3,"click"],[3,"colorFrom"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Be,2,3,"ng-template",0),e.TgZ(1,"ng-select",1),e.NdJ("ngModelChange",function(n){return t.selectedGroupIds=n}),e.ALo(2,"async"),e.YNc(3,Ve,4,2,"ng-template",2),e.YNc(4,Xe,2,2,"ng-template",3),e.qZA(),e.YNc(5,Ke,6,10,"ng-template",4)),2&o&&(e.xp6(1),e.Q6J("items",e.lcZ(2,6,t.groups$))("addTag",!1)("multiple",!0)("ngModel",t.selectedGroupIds)("clearable",!0)("searchable",!1))},directives:[Q.q,ie.w9,l.JJ,l.On,ie.mR,E.Y,ie.ir,k.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var b=i(7346);function ze(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",1),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.verified")," "))}function et(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",2),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.registered")," "))}function tt(s,o){if(1&s&&(e.TgZ(0,"vdr-chip"),e.YNc(1,ze,4,3,"ng-container",0),e.YNc(2,et,4,3,"ng-container",0),e.qZA()),2&s){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.verified),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.verified))}}function ot(s,o){1&s&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.guest")))}class Z{}Z.\u0275fac=function(o){return new(o||Z)},Z.\u0275cmp=e.Xpm({type:Z,selectors:[["vdr-customer-status-label"]],inputs:{customer:"customer"},decls:2,vars:2,consts:[[4,"ngIf"],["shape","check-circle",1,"verified-user-icon"],["shape","check-circle",1,"registered-user-icon"]],template:function(o,t){1&o&&(e.YNc(0,tt,3,2,"vdr-chip",0),e.YNc(1,ot,3,3,"vdr-chip",0)),2&o&&(e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.id),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.id)))},directives:[_.O5,E.Y,y.qvL],pipes:[v.X$],styles:[".registered-user-icon[_ngcontent-%COMP%]{color:var(--color-grey-300)}.verified-user-icon[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});var ae=i(8276),V=i(9416),ue=i(4652),pe=i(837),st=i(2505),rt=i(2355),nt=i(4664),it=i(2702),at=i(7368);function ct(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",4)(1,"div",5)(2,"textarea",6),e.NdJ("ngModelChange",function(n){e.CHM(t);return e.oxw().note=n}),e.qZA(),e.TgZ(3,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().addNoteToCustomer()}),e._uU(4),e.ALo(5,"translate"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(5,3,"order.add-note")," ")}}function lt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}const _e=function(s){return{strategy:s}};function dt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function mt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,lt,3,3,"ng-container",12),e.YNc(5,dt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-registered")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}function ut(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}function pt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function _t(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ut,3,3,"ng-container",12),e.YNc(5,pt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-verified")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}function gt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail"),e._UZ(5,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.history-customer-detail-updated")," "),e.xp6(3),e.Q6J("value",t.data.input)}}const ge=function(s){return{groupName:s}};function ht(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-added-to-group",e.VKq(4,ge,t.data.groupName))," ")}}function ft(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-removed-from-group",e.VKq(4,ge,t.data.groupName))," ")}}function Ct(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-created")," "),e.xp6(4),e.Oqu(t.data.address)}}function vt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA(),e.TgZ(6,"vdr-history-entry-detail"),e._UZ(7,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"customer.history-customer-address-updated")," "),e.xp6(4),e.Oqu(t.data.address),e.xp6(2),e.Q6J("value",t.data.input)}}function xt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",16),e._uU(4),e.qZA(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-deleted")," "),e.xp6(3),e.Oqu(t.data.address)}}function bt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-updated")," "))}function yt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-requested")," "))}function At(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-verified")," "))}function Zt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-requested")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function Tt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-verified")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function Dt(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",14)(2,"div",18),e._uU(3),e.qZA(),e._UZ(4,"div",19),e.TgZ(5,"vdr-dropdown")(6,"button",20),e._UZ(7,"clr-icon",21),e.qZA(),e.TgZ(8,"vdr-dropdown-menu",22)(9,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().updateNote.emit(n)}),e.ALo(10,"hasPermission"),e._UZ(11,"clr-icon",24),e._uU(12),e.ALo(13,"translate"),e.qZA(),e._UZ(14,"div",25),e.TgZ(15,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().deleteNote.emit(n)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",26),e._uU(18),e.ALo(19,"translate"),e.qZA()()()(),e.BQk()}if(2&s){const t=e.oxw().$implicit;e.xp6(3),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(10,5,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(13,7,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(16,9,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(19,11,"common.delete")," ")}}function Ut(s,o){if(1&s&&(e.TgZ(0,"vdr-timeline-entry",8),e.ynx(1,9),e.YNc(2,mt,7,5,"ng-container",10),e.YNc(3,_t,7,5,"ng-container",10),e.YNc(4,gt,6,4,"ng-container",10),e.YNc(5,ht,3,6,"ng-container",10),e.YNc(6,ft,3,6,"ng-container",10),e.YNc(7,Ct,6,4,"ng-container",10),e.YNc(8,vt,8,5,"ng-container",10),e.YNc(9,xt,5,4,"ng-container",10),e.YNc(10,bt,3,3,"ng-container",10),e.YNc(11,yt,3,3,"ng-container",10),e.YNc(12,At,3,3,"ng-container",10),e.YNc(13,Zt,11,11,"ng-container",10),e.YNc(14,Tt,11,11,"ng-container",10),e.YNc(15,Dt,20,13,"ng-container",10),e.BQk(),e.qZA()),2&s){const t=o.$implicit,r=e.oxw();e.Q6J("displayType",r.getDisplayType(t))("iconShape",r.getTimelineIcon(t))("createdAt",t.createdAt)("name",r.getName(t))("featured",r.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REGISTERED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_DETAIL_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDED_TO_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REMOVED_FROM_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_CREATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_DELETED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_NOTE)}}class J{constructor(){this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.type=d.iYD}getDisplayType(o){switch(o.type){case d.iYD.CUSTOMER_VERIFIED:case d.iYD.CUSTOMER_EMAIL_UPDATE_VERIFIED:case d.iYD.CUSTOMER_PASSWORD_RESET_VERIFIED:return"success";case d.iYD.CUSTOMER_REGISTERED:return"muted";case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"error";default:return"default"}}getTimelineIcon(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:return"user";case d.iYD.CUSTOMER_VERIFIED:return["assign-user","is-solid"];case d.iYD.CUSTOMER_NOTE:return"note";case d.iYD.CUSTOMER_ADDED_TO_GROUP:case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"users"}}isFeatured(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:case d.iYD.CUSTOMER_VERIFIED:return!0;default:return!1}}getName(o){const{administrator:t}=o;return t?`${t.firstName} ${t.lastName}`:`${this.customer.firstName} ${this.customer.lastName}`}addNoteToCustomer(){this.addNote.emit({note:this.note}),this.note=""}}J.\u0275fac=function(o){return new(o||J)},J.\u0275cmp=e.Xpm({type:J,selectors:[["vdr-customer-history"]],inputs:{customer:"customer",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:7,vars:6,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",4,"vdrIfPermissions"],[3,"displayType","iconShape","createdAt","name","featured",4,"ngFor","ngForOf"],[3,"isLast"],["iconShape","note","displayType","muted"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[3,"displayType","iconShape","createdAt","name","featured"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"title"],[4,"ngIf","ngIfElse"],["namedStrategy",""],[1,"flex"],[3,"value"],[1,"address-string"],[3,"label"],[1,"note-text"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0),e.YNc(4,ct,6,5,"vdr-timeline-entry",1),e.YNc(5,Ut,16,20,"vdr-timeline-entry",2),e._UZ(6,"vdr-timeline-entry",3),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,4,"customer.customer-history")),e.xp6(3),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0))},directives:[V.H,rt._,U.y,l.Fj,l.JJ,l.On,_.sg,_.RF,_.n9,_.O5,nt.C,it._,at.W,j.J,H.U,y.qvL,R.N,B.H],pipes:[v.X$,N.j],styles:[".entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-text-100);white-space:pre-wrap}.address-string[_ngcontent-%COMP%]{font-size:smaller;color:var(--color-text-200)}"],changeDetection:0});var Nt=i(2651),Lt=i(6826),St=i(4187);function It(s,o){if(1&s&&(e.TgZ(0,"div",23),e.ALo(1,"localeDate"),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"timeAgo"),e.qZA()),2&s){const t=o.ngIf;e.Q6J("title",e.xi3(1,3,t,"medium")),e.xp6(2),e.AsE(" ",e.lcZ(3,6,"customer.last-login"),": ",e.lcZ(4,8,t)," ")}}function Ot(s,o){if(1&s){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&s){const t=e.oxw();e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Jt(s,o){if(1&s){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&s){const t=e.oxw(2);e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Ft(s,o){1&s&&e.YNc(0,Jt,3,4,"button",25),2&s&&e.Q6J("vdrIfPermissions","UpdateCustomer")}function Pt(s,o){1&s&&(e.TgZ(0,"vdr-form-field",26),e.ALo(1,"translate"),e._UZ(2,"input",27),e.qZA()),2&s&&e.Q6J("label",e.lcZ(1,1,"customer.password"))}const wt=function(){return["customer","customFields"]};function Mt(s,o){if(1&s&&(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.qZA()),2&s){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(e.DdM(5,wt)))}}function Gt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-chip",36),e.NdJ("iconClick",function(){const a=e.CHM(t).$implicit;return e.oxw(3).removeFromGroup(a)}),e._uU(1),e.qZA()}if(2&s){const t=o.$implicit;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Et(s,o){if(1&s&&(e.ynx(0),e.YNc(1,Gt,2,2,"vdr-chip",35),e.BQk()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t)}}function Qt(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.not-a-member-of-any-groups")," ")}function qt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",37),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addToGroup()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.add-customer-to-group")," "))}function $t(s,o){if(1&s&&(e.TgZ(0,"div",30)(1,"label",31),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Et,2,1,"ng-container",32),e.YNc(5,Qt,2,3,"ng-template",null,33,e.W1O),e.TgZ(7,"div"),e.YNc(8,qt,4,3,"button",34),e.qZA()()),2&s){const t=o.ngIf,r=e.MAs(6);e.xp6(2),e.Oqu(e.lcZ(3,4,"customer.customer-groups")),e.xp6(2),e.Q6J("ngIf",t.length)("ngIfElse",r),e.xp6(4),e.Q6J("vdrIfPermissions","UpdateCustomerGroup")}}const kt=function(){return["UpdateCustomer"]};function Yt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-address-card",45),e.NdJ("setAsDefaultBilling",function(n){return e.CHM(t),e.oxw(2).setDefaultBillingAddressId(n)})("setAsDefaultShipping",function(n){return e.CHM(t),e.oxw(2).setDefaultShippingAddressId(n)})("deleteAddress",function(n){return e.CHM(t),e.oxw(2).toggleDeleteAddress(n)}),e.ALo(1,"async"),e.ALo(2,"hasPermission"),e.qZA()}if(2&s){const t=o.$implicit,r=e.oxw(2);e.ekj("to-delete",r.addressesToDeleteIds.has(t.value.id)),e.Q6J("availableCountries",e.lcZ(1,8,r.availableCountries$))("isDefaultBilling",r.defaultBillingAddressId===t.value.id)("isDefaultShipping",r.defaultShippingAddressId===t.value.id)("addressForm",t)("customFields",r.addressCustomFields)("editable",e.lcZ(2,10,e.DdM(12,kt))&&!r.addressesToDeleteIds.has(t.value.id))}}function jt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",46),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addAddress()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-address")," "))}const Ht=function(s){return["/orders/",s]};function Rt(s,o){if(1&s&&(e.TgZ(0,"td",47),e._uU(1),e.qZA(),e.TgZ(2,"td",47),e._uU(3),e.qZA(),e.TgZ(4,"td",47),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.TgZ(7,"td",47),e._uU(8),e.ALo(9,"localeDate"),e.qZA(),e.TgZ(10,"td",48),e._UZ(11,"vdr-table-row-action",49),e.ALo(12,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.state),e.xp6(2),e.Oqu(e.xi3(6,6,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.xi3(9,9,t.updatedAt,"medium")),e.xp6(3),e.Q6J("label",e.lcZ(12,12,"common.open"))("linkTo",e.VKq(14,Ht,t.id))}}function Bt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",40)(2,"h3"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,Yt,3,13,"vdr-address-card",41),e.YNc(6,jt,4,3,"button",42),e.qZA(),e.TgZ(7,"div",43)(8,"h3"),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"vdr-data-table",44),e.NdJ("itemsPerPageChange",function(n){return e.CHM(t),e.oxw().setOrderItemsPerPage(n)})("pageChange",function(n){return e.CHM(t),e.oxw().setOrderCurrentPage(n)}),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"translate"),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.TgZ(21,"vdr-dt-column"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e.TgZ(24,"vdr-dt-column"),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"vdr-dt-column"),e.YNc(28,Rt,13,16,"ng-template"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,13,"customer.addresses")),e.xp6(2),e.Q6J("ngForOf",t.getAddressFormControls()),e.xp6(1),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(3),e.Oqu(e.lcZ(10,15,"customer.orders")),e.xp6(2),e.Q6J("items",e.lcZ(12,17,t.orders$))("itemsPerPage",t.ordersPerPage)("totalItems",e.lcZ(13,19,t.ordersCount$))("currentPage",t.currentOrdersPage)("emptyStateLabel",e.lcZ(14,21,"customer.no-orders-placed")),e.xp6(5),e.Oqu(e.lcZ(17,23,"common.code")),e.xp6(3),e.Oqu(e.lcZ(20,25,"order.state")),e.xp6(3),e.Oqu(e.lcZ(23,27,"order.total")),e.xp6(3),e.Oqu(e.lcZ(26,29,"common.updated-at"))}}function Vt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",50)(2,"vdr-customer-history",51),e.NdJ("addNote",function(n){return e.CHM(t),e.oxw().addNoteToCustomer(n)})("updateNote",function(n){return e.CHM(t),e.oxw().updateNote(n)})("deleteNote",function(n){return e.CHM(t),e.oxw().deleteNote(n)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("customer",e.lcZ(3,2,t.entity$))("history",e.lcZ(4,4,t.history$))}}class F extends d.UT_{constructor(o,t,r,n,a,c,u,h){super(o,t,r,c),this.changeDetector=n,this.formBuilder=a,this.dataService=c,this.modalService=u,this.notificationService=h,this.fetchHistory=new W.x,this.addressesToDeleteIds=new Set,this.addressDefaultsUpdated=!1,this.ordersPerPage=10,this.currentOrdersPage=1,this.orderListUpdates$=new W.x,this.customFields=this.getCustomFieldConfig("Customer"),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.detailForm=this.formBuilder.group({customer:this.formBuilder.group({title:"",firstName:["",l.kI.required],lastName:["",l.kI.required],phoneNumber:"",emailAddress:["",[l.kI.required,l.kI.email]],password:"",customFields:this.formBuilder.group(this.customFields.reduce((f,X)=>Object.assign(Object.assign({},f),{[X.name]:""}),{}))}),addresses:new l.Oe([])})}ngOnInit(){this.init(),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(t=>t.countries.items).pipe((0,Qe.d)(1));const o=this.entity$.pipe(je(this.orderListUpdates$));this.orders$=o.pipe((0,p.U)(t=>t.orders.items)),this.ordersCount$=this.entity$.pipe((0,p.U)(t=>t.orders.totalItems)),this.history$=this.fetchHistory.pipe((0,q.O)(null),(0,g.w)(()=>this.dataService.customer.getCustomerHistory(this.id,{sort:{createdAt:d.Asd.DESC}}).mapStream(t=>{var r;return null===(r=t.customer)||void 0===r?void 0:r.history.items})))}ngOnDestroy(){this.destroy(),this.orderListUpdates$.complete()}getAddressFormControls(){return this.detailForm.get(["addresses"]).controls}setDefaultBillingAddressId(o){this.defaultBillingAddressId=o,this.addressDefaultsUpdated=!0}setDefaultShippingAddressId(o){this.defaultShippingAddressId=o,this.addressDefaultsUpdated=!0}toggleDeleteAddress(o){this.addressesToDeleteIds.has(o)?this.addressesToDeleteIds.delete(o):this.addressesToDeleteIds.add(o)}addAddress(){const o=this.detailForm.get("addresses"),t=this.formBuilder.group({fullName:"",company:"",streetLine1:["",l.kI.required],streetLine2:"",city:"",province:"",postalCode:"",countryCode:["",l.kI.required],phoneNumber:"",defaultShippingAddress:!1,defaultBillingAddress:!1});if(this.addressCustomFields.length){const r=this.formBuilder.group({});for(const n of this.addressCustomFields)r.addControl(n.name,new l.NI(""));t.addControl("customFields",r)}o.push(t)}setOrderItemsPerPage(o){this.ordersPerPage=+o,this.fetchOrdersList()}setOrderCurrentPage(o){this.currentOrdersPage=+o,this.fetchOrdersList()}create(){var o;const t=this.detailForm.get("customer");if(!t)return;const r=t.value,n=null===(o=t.get("customFields"))||void 0===o?void 0:o.value,a={title:r.title,emailAddress:r.emailAddress,firstName:r.firstName,lastName:r.lastName,phoneNumber:r.phoneNumber,customFields:n};this.dataService.customer.createCustomer(a,r.password).subscribe(({createCustomer:c})=>{switch(c.__typename){case"Customer":this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Customer"}),c.emailAddress&&!r.password&&this.notificationService.notify({message:(0,m.J)("customer.email-verification-sent"),translationVars:{emailAddress:r.emailAddress},type:"info",duration:1e4}),this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.router.navigate(["../",c.id],{relativeTo:this.route});break;case"EmailAddressConflictError":this.notificationService.error(c.message)}})}save(){this.entity$.pipe((0,le.q)(1),(0,He.z)(({id:o})=>{var t;const r=[],n=this.detailForm.get("customer");if(n&&n.dirty){const c=n.value,u=null===(t=n.get("customFields"))||void 0===t?void 0:t.value,h={id:o,title:c.title,emailAddress:c.emailAddress,firstName:c.firstName,lastName:c.lastName,phoneNumber:c.phoneNumber,customFields:u};r.push(this.dataService.customer.updateCustomer(h).pipe((0,p.U)(f=>f.updateCustomer)))}const a=this.detailForm.get("addresses");if(a&&a.dirty||this.addressDefaultsUpdated)for(const c of a.controls)if(c.dirty||this.addressDefaultsUpdated){const u=c.value,h={fullName:u.fullName,company:u.company,streetLine1:u.streetLine1,streetLine2:u.streetLine2,city:u.city,province:u.province,postalCode:u.postalCode,countryCode:u.countryCode,phoneNumber:u.phoneNumber,defaultShippingAddress:this.defaultShippingAddressId===u.id,defaultBillingAddress:this.defaultBillingAddressId===u.id,customFields:u.customFields};u.id?this.addressesToDeleteIds.has(u.id)?r.push(this.dataService.customer.deleteCustomerAddress(u.id).pipe((0,p.U)(f=>f.deleteCustomerAddress))):r.push(this.dataService.customer.updateCustomerAddress(Object.assign(Object.assign({},h),{id:u.id})).pipe((0,p.U)(f=>f.updateCustomerAddress))):r.push(this.dataService.customer.createCustomerAddress(o,h).pipe((0,p.U)(f=>f.createCustomerAddress)))}return(0,Ee.D)(r)})).subscribe(o=>{let t=!1;for(const r of o)switch(r.__typename){case"Customer":case"Address":case"Success":t||(this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Customer"}),t=!0,this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.fetchHistory.next(),this.dataService.customer.getCustomer(this.id).single$.subscribe());break;case"EmailAddressConflictError":this.notificationService.error(r.message)}},o=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"Customer"})})}addToGroup(){this.modalService.fromComponent(O,{size:"md"}).pipe((0,g.w)(o=>o?(0,de.D)(o):x.E),(0,Re.b)(o=>this.dataService.customer.addCustomersToGroup(o,[this.id]))).subscribe({next:o=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:1,groupName:o.addCustomersToGroup.name})},complete:()=>{this.dataService.customer.getCustomer(this.id,{take:0}).single$.subscribe(),this.fetchHistory.next()}})}removeFromGroup(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-remove-customer-from-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.removeCustomersFromGroup(o.id,[this.id]):x.E),(0,g.w)(()=>this.dataService.customer.getCustomer(this.id,{take:0}).single$)).subscribe(t=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:1,groupName:o.name}),this.fetchHistory.next()})}addNoteToCustomer({note:o}){this.dataService.customer.addNoteToCustomer(this.id,o).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(o){this.modalService.fromComponent(d.UlA,{closable:!0,locals:{displayPrivacyControls:!1,note:o.data.note}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerNote({noteId:o.id,note:t.note}):x.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(o){return this.modalService.dialog({title:(0,m.J)("common.confirm-delete-note"),body:o.data.note,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerNote(o.id):x.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Note"})})}setFormValues(o){var t;const r=this.detailForm.get("customer");if(r&&r.patchValue({title:o.title,firstName:o.firstName,lastName:o.lastName,phoneNumber:o.phoneNumber,emailAddress:o.emailAddress}),o.addresses){const n=new l.Oe([]);for(const a of o.addresses){const c=a,{customFields:u}=c,h=(0,Me._T)(c,["customFields"]),f=this.formBuilder.group(Object.assign(Object.assign({},h),{countryCode:a.country.code}));if(n.push(f),a.defaultShippingAddress&&(this.defaultShippingAddressId=a.id),a.defaultBillingAddress&&(this.defaultBillingAddressId=a.id),this.addressCustomFields.length){const X=this.formBuilder.group({});for(const xo of this.addressCustomFields){const ve=xo.name,bo=null===(t=a.customFields)||void 0===t?void 0:t[ve],yo=new l.NI(bo);X.addControl(ve,yo)}f.addControl("customFields",X)}}this.detailForm.setControl("addresses",n)}this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customer","customFields"]),o),this.changeDetector.markForCheck()}fetchOrdersList(){this.dataService.customer.getCustomer(this.id,{take:this.ordersPerPage,skip:(this.currentOrdersPage-1)*this.ordersPerPage,sort:{orderPlacedAt:d.Asd.DESC}}).single$.pipe((0,p.U)(o=>o.customer),(0,Y.h)(Ge.notNullOrUndefined)).subscribe(o=>this.orderListUpdates$.next(o))}}function Xt(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function Wt(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function Kt(s,o){if(1&s&&(e.YNc(0,Xt,3,3,"span",6),e.YNc(1,Wt,3,3,"span",6)),2&s){const t=e.oxw();e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}function zt(s,o){if(1&s&&(e.TgZ(0,"section",7)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",8),e.qZA()),2&s){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.form.get("customFields"))}}function eo(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function to(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function oo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e.YNc(4,eo,3,3,"span",6),e.YNc(5,to,3,3,"span",6),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.form.valid),e.xp6(1),e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}F.\u0275fac=function(o){return new(o||F)(e.Y36(C.gz),e.Y36(C.F0),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(l.qu),e.Y36(d.DoR),e.Y36(d.Z7U),e.Y36(d.gqp))},F.\u0275cmp=e.Xpm({type:F,selectors:[["vdr-customer-detail"]],features:[e.qOj],decls:46,vars:59,consts:[[1,"flex","clr-align-items-center"],[3,"entity"],[3,"customer"],["class","last-login",3,"title",4,"ngIf"],["locationId","customer-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","title",3,"label","readOnlyToggle"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label","readOnlyToggle"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label","readOnlyToggle"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label","readOnlyToggle"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label","readOnlyToggle"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["for","password",3,"label",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","customer-detail",3,"entity$","detailForm"],["class","groups",4,"ngIf"],["class","clr-row",4,"ngIf"],[1,"last-login",3,"title"],[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"],["formGroupName","customFields"],["entityName","Customer",3,"customFields","customFieldsFormGroup"],[1,"groups"],[1,"clr-control-label"],[4,"ngIf","ngIfElse"],["noGroups",""],["class","btn btn-sm btn-secondary",3,"click",4,"vdrIfPermissions"],["icon","times",3,"colorFrom","iconClick",4,"ngFor","ngForOf"],["icon","times",3,"colorFrom","iconClick"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","plus"],[1,"clr-row"],[1,"clr-col-md-4"],[3,"to-delete","availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress",4,"ngFor","ngForOf"],["class","btn btn-secondary",3,"click",4,"vdrIfPermissions"],[1,"clr-col-md-8"],[3,"items","itemsPerPage","totalItems","currentPage","emptyStateLabel","itemsPerPageChange","pageChange"],[3,"availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress"],[1,"btn","btn-secondary",3,"click"],[1,"left"],[1,"right"],["iconShape","shopping-cart",3,"label","linkTo"],[1,"clr-col-md-6"],[3,"customer","history","addNote","updateNote","deleteNote"]],template:function(o,t){if(1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e._UZ(3,"vdr-entity-info",1),e.ALo(4,"async"),e._UZ(5,"vdr-customer-status-label",2),e.ALo(6,"async"),e.YNc(7,It,5,10,"div",3),e.ALo(8,"async"),e.qZA()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",4),e.YNc(11,Ot,3,4,"button",5),e.ALo(12,"async"),e.YNc(13,Ft,1,1,"ng-template",null,6,e.W1O),e.qZA()(),e.TgZ(15,"form",7)(16,"vdr-form-field",8),e.ALo(17,"translate"),e.ALo(18,"async"),e._UZ(19,"input",9),e.qZA(),e.TgZ(20,"vdr-form-field",10),e.ALo(21,"translate"),e.ALo(22,"async"),e._UZ(23,"input",11),e.qZA(),e.TgZ(24,"vdr-form-field",12),e.ALo(25,"translate"),e.ALo(26,"async"),e._UZ(27,"input",13),e.qZA(),e.TgZ(28,"vdr-form-field",14),e.ALo(29,"translate"),e.ALo(30,"async"),e._UZ(31,"input",15),e.qZA(),e.TgZ(32,"vdr-form-field",16),e.ALo(33,"translate"),e.ALo(34,"async"),e._UZ(35,"input",17),e.qZA(),e.YNc(36,Pt,3,3,"vdr-form-field",18),e.ALo(37,"async"),e.YNc(38,Mt,5,6,"section",19),e._UZ(39,"vdr-custom-detail-component-host",20),e.qZA(),e.YNc(40,$t,9,6,"div",21),e.ALo(41,"async"),e.YNc(42,Bt,29,31,"div",22),e.ALo(43,"async"),e.YNc(44,Vt,5,6,"div",22),e.ALo(45,"async")),2&o){const r=e.MAs(14);let n,a;e.xp6(3),e.Q6J("entity",e.lcZ(4,23,t.entity$)),e.xp6(2),e.Q6J("customer",e.lcZ(6,25,t.entity$)),e.xp6(2),e.Q6J("ngIf",null==(n=e.lcZ(8,27,t.entity$))||null==n.user?null:n.user.lastLogin),e.xp6(4),e.Q6J("ngIf",e.lcZ(12,29,t.isNew$))("ngIfElse",r),e.xp6(4),e.Q6J("formGroup",t.detailForm.get("customer")),e.xp6(1),e.Q6J("label",e.lcZ(17,31,"customer.title"))("readOnlyToggle",!e.lcZ(18,33,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(21,35,"customer.first-name"))("readOnlyToggle",!e.lcZ(22,37,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(25,39,"customer.last-name"))("readOnlyToggle",!e.lcZ(26,41,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(29,43,"customer.email-address"))("readOnlyToggle",!e.lcZ(30,45,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(33,47,"customer.phone-number"))("readOnlyToggle",!e.lcZ(34,49,t.isNew$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(37,51,t.isNew$)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(1),e.Q6J("ngIf",null==(a=e.lcZ(41,53,t.entity$))?null:a.groups),e.xp6(2),e.Q6J("ngIf",!e.lcZ(43,55,t.isNew$)),e.xp6(2),e.Q6J("ngIf",!e.lcZ(45,57,t.isNew$))}},directives:[b.Kk,b.BN,ne.V,Z,_.O5,b.mz,ae.W,V.H,l._Y,l.JL,l.sg,ue.h,U.y,l.Fj,l.JJ,l.u,l.x0,y.MgK,pe.y,st.C,_.sg,E.Y,y.qvL,I,$.Q,se.E,re.v,J],pipes:[_.Ov,Nt.H,v.X$,Lt.e,N.j,St.k],styles:[".last-login[_ngcontent-%COMP%]{margin-left:6px;color:var(--color-grey-500)}.to-delete[_ngcontent-%COMP%]{opacity:.5}"],changeDetection:0});const so=function(){return["CreateCustomerGroup","UpdateCustomerGroup"]};class T{constructor(o,t){this.serverConfigService=o,this.formBuilder=t,this.customFields=this.serverConfigService.getCustomFieldsFor("CustomerGroup")}ngOnInit(){var o;if(this.form=this.formBuilder.group({name:[this.group.name,l.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,r)=>Object.assign(Object.assign({},t),{[r.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const r of this.customFields){const n=r.name,a=null===(o=this.group.customFields)||void 0===o?void 0:o[n],c=t.get(n);c&&c.patchValue(a)}}}cancel(){this.resolveWith()}save(){this.resolveWith(this.form.value)}}T.\u0275fac=function(o){return new(o||T)(e.Y36(d.iHG),e.Y36(l.qu))},T.\u0275cmp=e.Xpm({type:T,selectors:[["vdr-customer-group-detail-dialog"]],decls:8,vars:9,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["formGroupName","customFields",4,"ngIf"],["vdrDialogButtons",""],[4,"ngIf"],["formGroupName","customFields"],["entityName","CustomerGroup",3,"customFields","customFieldsFormGroup"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Kt,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.YNc(6,zt,5,5,"section",4),e.qZA(),e.YNc(7,oo,6,6,"ng-template",5)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,4,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(5,6,e.DdM(8,so))),e.xp6(2),e.Q6J("ngIf",t.customFields.length))},directives:[Q.q,_.O5,l._Y,l.JL,l.sg,ue.h,U.y,l.Fj,l.JJ,l.u,l.x0,y.MgK,pe.y,k.n],pipes:[v.X$,N.j],styles:[""],changeDetection:0});var he=i(745),ro=i(73),no=i(5181);function io(s,o){if(1&s){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&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-customer-group")," "))}const ao=function(s){return{contents:s}},co=function(s){return["./",s]};function lo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",11),e._UZ(1,"vdr-entity-info",12),e.qZA(),e.TgZ(2,"td",11)(3,"vdr-chip",13),e._uU(4),e.qZA()(),e.TgZ(5,"td",11)(6,"a",14),e._UZ(7,"clr-icon",15),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"td",16)(11,"button",17),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().update(a)}),e._UZ(12,"clr-icon",18),e._uU(13),e.ALo(14,"translate"),e.qZA()(),e.TgZ(15,"td",19)(16,"vdr-dropdown")(17,"button",20),e._uU(18),e.ALo(19,"translate"),e._UZ(20,"clr-icon",21),e.qZA(),e.TgZ(21,"vdr-dropdown-menu",22)(22,"button",23),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().delete(a.id)}),e.ALo(23,"hasPermission"),e._UZ(24,"clr-icon",24),e._uU(25),e.ALo(26,"translate"),e.qZA()()()()}if(2&s){const t=o.item,r=e.oxw();e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("entity",t),e.xp6(1),e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name),e.xp6(1),e.ekj("active",t.id===r.activeGroupId),e.xp6(1),e.Q6J("routerLink",e.VKq(31,co,e.VKq(29,ao,t.id))),e.xp6(2),e.hij(" ",e.lcZ(9,19,"customer.view-group-members")," "),e.xp6(2),e.ekj("active",t.id===r.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(14,21,"common.edit")," "),e.xp6(2),e.ekj("active",t.id===r.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(19,23,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(23,25,"DeleteCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(26,27,"common.delete")," ")}}function mo(s,o){1&s&&e._UZ(0,"vdr-empty-placeholder")}const uo=function(s){return{count:s}},po=function(s){return{groupName:s}};function _o(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",25)(2,"div",26),e._uU(3),e.ALo(4,"async"),e.qZA(),e._UZ(5,"div",27),e.TgZ(6,"button",28),e.NdJ("click",function(){return e.CHM(t),e.oxw().closeMembers()}),e._UZ(7,"clr-icon",29),e.qZA()(),e.TgZ(8,"div",30)(9,"vdr-dropdown")(10,"button",31),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",21),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",22)(15,"button",32),e.NdJ("click",function(){const a=e.CHM(t).ngIf,c=e.oxw();return c.removeFromGroup(a,c.selectedCustomerIds)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",24),e._uU(18),e.ALo(19,"translate"),e.qZA()()(),e.TgZ(20,"button",33),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().addToGroup(a)}),e._uU(21),e.ALo(22,"translate"),e.qZA()(),e.TgZ(23,"vdr-customer-group-member-list",34),e.NdJ("selectionChange",function(n){e.CHM(t);return e.oxw().selectedCustomerIds=n})("fetchParamsChange",function(n){return e.CHM(t),e.oxw().fetchGroupMembers$.next(n)}),e.ALo(24,"async"),e.ALo(25,"async"),e.qZA(),e.BQk()}if(2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.AsE("",t.name," (",e.lcZ(4,11,r.membersTotal$),")"),e.xp6(7),e.Q6J("disabled",0===r.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(12,13,"common.with-selected",e.VKq(27,uo,r.selectedCustomerIds.length))," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,16,"UpdateCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(19,18,"customer.remove-from-group")," "),e.xp6(3),e.hij(" ",e.xi3(22,20,"customer.add-customers-to-group",e.VKq(29,po,t.name))," "),e.xp6(2),e.Q6J("members",e.lcZ(24,23,r.members$))("route",r.route)("totalItems",e.lcZ(25,25,r.membersTotal$))("selectedMemberIds",r.selectedCustomerIds)}}class P extends d.t7C{constructor(o,t,r,n,a){super(a,n),this.dataService=o,this.notificationService=t,this.modalService=r,this.route=n,this.router=a,this.searchTerm=new l.NI(""),this.selectedCustomerIds=[],this.fetchGroupMembers$=new G.X({skip:0,take:0,filterTerm:""}),this.refreshActiveGroupMembers$=new G.X(void 0),super.setQueryFn((...c)=>this.dataService.customer.getCustomerGroupList(...c).refetchOnChannelChange(),c=>c.customerGroups,(c,u)=>({options:{skip:c,take:u,filter:{name:{contains:this.searchTerm.value}}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,Y.h)(r=>2<r.length||0===r.length),(0,ee.b)(250),(0,oe.R)(this.destroy$)).subscribe(()=>this.refresh());const o=this.route.paramMap.pipe((0,p.U)(r=>r.get("contents")),(0,z.x)(),(0,te.b)(()=>this.selectedCustomerIds=[]));this.listIsEmpty$=this.items$.pipe((0,p.U)(r=>0===r.length)),this.activeGroup$=(0,K.a)(this.items$,o).pipe((0,p.U)(([r,n])=>{if(n)return r.find(a=>a.id===n)}),(0,te.b)(r=>this.activeGroupId=null==r?void 0:r.id));const t=(0,K.a)(this.activeGroup$,this.fetchGroupMembers$,this.refreshActiveGroupMembers$).pipe((0,g.w)(([r,{skip:n,take:a,filterTerm:c}])=>r?this.dataService.customer.getCustomerGroupWithCustomers(r.id,{skip:n,take:a,filter:{emailAddress:{contains:c}}}).mapStream(u=>{var h;return null===(h=u.customerGroup)||void 0===h?void 0:h.customers}):(0,he.of)(void 0)));this.members$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.items)&&void 0!==n?n:[]})),this.membersTotal$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.totalItems)&&void 0!==n?n:0}))}create(){this.modalService.fromComponent(T,{locals:{group:{name:""}}}).pipe((0,g.w)(o=>o?this.dataService.customer.createCustomerGroup(Object.assign(Object.assign({},o),{customerIds:[]})):x.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"CustomerGroup"})},o=>{this.notificationService.error((0,m.J)("common.notify-create-error"),{entity:"CustomerGroup"})})}delete(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-delete-customer-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerGroup(o):x.E),(0,g.w)(t=>t.deleteCustomerGroup.result===d.PcR.DELETED?this.dataService.customer.getCustomerGroupList().mapSingle(()=>({errorMessage:!1})):(0,he.of)({errorMessage:t.deleteCustomerGroup.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):(this.refresh(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"CustomerGroup"}))},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"CustomerGroup"})})}update(o){this.modalService.fromComponent(T,{locals:{group:o}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerGroup(Object.assign({id:o.id},t)):x.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"CustomerGroup"})},t=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"CustomerGroup"})})}closeMembers(){const o=Object.assign({},this.route.snapshot.params);delete o.contents,this.router.navigate(["./",o],{relativeTo:this.route,queryParamsHandling:"preserve"})}addToGroup(o){this.modalService.fromComponent(L,{locals:{group:o,route:this.route},size:"md",verticalAlign:"top"}).pipe((0,g.w)(t=>t?this.dataService.customer.addCustomersToGroup(o.id,t).pipe((0,ro.h)(t)):x.E)).subscribe({next:t=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}removeFromGroup(o,t){this.dataService.customer.removeCustomersFromGroup(o.id,t).subscribe({complete:()=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}}P.\u0275fac=function(o){return new(o||P)(e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(C.gz),e.Y36(C.F0))},P.\u0275cmp=e.Xpm({type:P,selectors:[["vdr-customer-group-list"]],features:[e.qOj],decls:22,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-group-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"group-wrapper"],[1,"group-list"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],["emptyPlaceholder",""],[1,"group-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"right","align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],[1,"align-middle"],["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"],[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"],[3,"members","route","totalItems","selectedMemberIds","selectionChange","fetchParamsChange"]],template:function(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,io,4,3,"button",2),e.qZA()(),e.TgZ(7,"div",3)(8,"div",4)(9,"vdr-data-table",5),e.NdJ("pageChange",function(n){return t.setPageNumber(n)})("itemsPerPageChange",function(n){return t.setItemsPerPage(n)}),e.ALo(10,"async"),e.ALo(11,"async"),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"async"),e.YNc(15,lo,27,33,"ng-template"),e.qZA()(),e.YNc(16,mo,1,0,"ng-template",null,6,e.W1O),e.TgZ(18,"div",7),e.ALo(19,"async"),e.YNc(20,_o,26,31,"ng-container",8),e.ALo(21,"async"),e.qZA()()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-by-group-name")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomerGroup"),e.xp6(3),e.ekj("expanded",e.lcZ(10,14,t.activeGroup$)),e.Q6J("items",e.lcZ(11,16,t.items$))("itemsPerPage",e.lcZ(12,18,t.itemsPerPage$))("totalItems",e.lcZ(13,20,t.totalItems$))("currentPage",e.lcZ(14,22,t.currentPage$)),e.xp6(9),e.ekj("expanded",e.lcZ(19,24,t.activeGroup$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(21,26,t.activeGroup$)))},directives:[b.Kk,b.BN,U.y,l.Fj,l.JJ,l.oH,b.mz,ae.W,V.H,y.qvL,$.Q,ne.V,E.Y,C.yS,j.J,H.U,R.N,B.H,no.j,_.O5,A],pipes:[v.X$,_.Ov,N.j],styles:[".group-wrapper[_ngcontent-%COMP%]{display:flex;height:calc(100% - 50px)}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%]{flex:1;overflow:auto;margin-top:0}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%] .active[_ngcontent-%COMP%]{background-color:var(--clr-global-selection-color)}.group-wrapper[_ngcontent-%COMP%] .group-list.expanded[_ngcontent-%COMP%]{width:calc(100% - 40vw)}vdr-data-table[_ngcontent-%COMP%] table{margin-top:0}.group-members[_ngcontent-%COMP%]{height:100%;width:0;opacity:0;visibility:hidden;overflow:auto;transition:width .3s,opacity .2s .3s,visibility 0s .3s}.group-members.expanded[_ngcontent-%COMP%]{width:40vw;visibility:visible;opacity:1;padding-left:12px}.group-members[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin:0;background:none;border:none;cursor:pointer}.group-members[_ngcontent-%COMP%] table.table{margin-top:0}.group-members[_ngcontent-%COMP%] table.table th{top:0}.group-members[_ngcontent-%COMP%] .controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between}vdr-empty-placeholder[_ngcontent-%COMP%]{flex:1}"],changeDetection:0});var go=i(8165);const ho=function(){return["./create"]};function fo(s,o){1&s&&(e.TgZ(0,"a",5),e._UZ(1,"clr-icon",6),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.Q6J("routerLink",e.DdM(4,ho)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.create-new-customer")," "))}const Co=function(s){return["./",s]};function vo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",7),e._uU(1),e.qZA(),e.TgZ(2,"td",7),e._uU(3),e.qZA(),e.TgZ(4,"td",7),e._UZ(5,"vdr-customer-status-label",8),e.qZA(),e.TgZ(6,"td",9),e._UZ(7,"vdr-table-row-action",10),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"td")(10,"vdr-dropdown")(11,"button",11),e._uU(12),e.ALo(13,"translate"),e._UZ(14,"clr-icon",12),e.qZA(),e.TgZ(15,"vdr-dropdown-menu",13)(16,"button",14),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().deleteCustomer(a)}),e.ALo(17,"hasPermission"),e._UZ(18,"clr-icon",15),e._uU(19),e.ALo(20,"translate"),e.qZA()()()()}if(2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("customer",t),e.xp6(2),e.Q6J("label",e.lcZ(8,10,"common.edit"))("linkTo",e.VKq(18,Co,t.id)),e.xp6(5),e.hij(" ",e.lcZ(13,12,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(17,14,"DeleteCustomer")),e.xp6(3),e.hij(" ",e.lcZ(20,16,"common.delete")," ")}}class w extends d.t7C{constructor(o,t,r,n,a){super(t,r),this.dataService=o,this.modalService=n,this.notificationService=a,this.searchTerm=new l.NI(""),super.setQueryFn((...c)=>this.dataService.customer.getCustomerList(...c).refetchOnChannelChange(),c=>c.customers,(c,u)=>({options:{skip:c,take:u,filter:{emailAddress:{contains:this.searchTerm.value},lastName:{contains:this.searchTerm.value},postalCode:{contains:this.searchTerm.value}},filterOperator:d.FnJ.OR,sort:{createdAt:go.As.DESC}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,Y.h)(o=>2<o.length||0===o.length),(0,ee.b)(250),(0,oe.R)(this.destroy$)).subscribe(()=>this.refresh())}deleteCustomer(o){return this.modalService.dialog({title:(0,m.J)("catalog.confirm-delete-customer"),body:`${o.firstName} ${o.lastName}`,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomer(o.id):x.E)).subscribe(()=>{this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Customer"}),this.refresh()},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"Customer"})})}}w.\u0275fac=function(o){return new(o||w)(e.Y36(d.DoR),e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.Z7U),e.Y36(d.gqp))},w.\u0275cmp=e.Xpm({type:w,selectors:[["vdr-customer-list"]],features:[e.qOj],decls:24,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[3,"expand"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"customer"],[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(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,fo,4,5,"a",2),e.qZA()(),e.TgZ(7,"vdr-data-table",3),e.NdJ("pageChange",function(n){return t.setPageNumber(n)})("itemsPerPageChange",function(n){return t.setItemsPerPage(n)}),e.ALo(8,"async"),e.ALo(9,"async"),e.ALo(10,"async"),e.ALo(11,"async"),e.TgZ(12,"vdr-dt-column",4),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column",4),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,vo,21,20,"ng-template"),e.qZA()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-customers-by-email-last-name-postal-code")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomer"),e.xp6(1),e.Q6J("items",e.lcZ(8,14,t.items$))("itemsPerPage",e.lcZ(9,16,t.itemsPerPage$))("totalItems",e.lcZ(10,18,t.totalItems$))("currentPage",e.lcZ(11,20,t.currentPage$)),e.xp6(5),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(14,22,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(17,24,"customer.email-address")),e.xp6(3),e.Oqu(e.lcZ(20,26,"customer.customer-type")))},directives:[b.Kk,b.BN,U.y,l.Fj,l.JJ,l.oH,b.mz,ae.W,V.H,C.yS,y.qvL,$.Q,se.E,Z,re.v,j.J,H.U,R.N,B.H],pipes:[v.X$,_.Ov,N.j],styles:[".search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"]});class D extends d.p_9{constructor(o,t){super(o,{__typename:"Customer",id:"",createdAt:"",updatedAt:"",title:"",firstName:"",lastName:"",emailAddress:"",phoneNumber:null,addresses:null,user:null},r=>t.customer.getCustomer(r,{sort:{orderPlacedAt:d.Asd.DESC}}).mapStream(n=>n.customer))}}D.\u0275fac=function(o){return new(o||D)(e.LFG(C.F0),e.LFG(d.DoR))},D.\u0275prov=e.Yz7({token:D,factory:D.\u0275fac,providedIn:"root"});const fe=[{path:"customers",component:w,pathMatch:"",data:{breadcrumb:(0,m.J)("breadcrumb.customers")}},{path:"customers/:id",component:F,resolve:(0,d.Po4)(D),canDeactivate:[d.TSp],data:{breadcrumb:Ce}},{path:"groups",component:P,data:{breadcrumb:(0,m.J)("breadcrumb.customer-groups")}}];function Ce(s,o){return(0,d.YWC)({entity:s.entity,id:o.id,breadcrumbKey:"breadcrumb.customers",getName:t=>`${t.firstName} ${t.lastName}`,route:"customers"})}class M{}M.\u0275fac=function(o){return new(o||M)},M.\u0275mod=e.oAB({type:M}),M.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(fe)]]})}}]);
|
|
2
|
+
//# sourceMappingURL=600.1a41f364d643a053.js.map
|