1import{a as Z,c as $e}from"./chunk-GLQ324RZ.js";import"./chunk-PKDG4ZFA.js";import{a as U}from"./chunk-Q22WCJC5.js";import"./chunk-ZSNVHXGE.js";import"./chunk-6UMFXTLI.js";import{e as M}from"./chunk-NENT3XC3.js";import"./chunk-QQQGWTT6.js";import{a as Mt,b as Ot}from"./chunk-4VNJSZOP.js";import{a as F}from"./chunk-PVKIKK7O.js";import{a as Pe,c as V}from"./chunk-Y5IZFTHQ.js";import{a as Me}from"./chunk-OYPFZKJN.js";import{b as G,c as Tt}from"./chunk-KBMZUBTS.js";import{Gb as Dt,H as Oe,K as Be,L as we,Pb as Rt,Qb as Nt,ca as St,da as Le,j as Re,n as Ne,pb as At,qb as Ve,rb as yt,sb as xt,vb as It}from"./chunk-L5LIZCWL.js";import{a as bt}from"./chunk-62TMHTOW.js";import{a as gt}from"./chunk-66MJED5H.js";import"./chunk-NAU2Z33Z.js";import"./chunk-DMJOIEZX.js";import"./chunk-IJJXZCMA.js";import"./chunk-Z6LNA6S5.js";import{a as vt}from"./chunk-MEFDTAVO.js";import"./chunk-B36GLEBS.js";import"./chunk-RDJJO7ZO.js";import{a as Et}from"./chunk-GT7BSWBO.js";import{a as De,c as Ct,e as ht}from"./chunk-JI4LIEP5.js";import"./chunk-2R2AGTAB.js";import"./chunk-TFWDDEP5.js";import{h as _t}from"./chunk-I47VKUEQ.js";import{a as A}from"./chunk-3RKFVFMW.js";import"./chunk-Z6Z2BSTT.js";import"./chunk-3TZSFXZ4.js";import"./chunk-WAXSQR7J.js";import"./chunk-QFFHVXQN.js";import"./chunk-ODFXI44U.js";import"./chunk-2FG7ELTG.js";import"./chunk-VWTK4XCA.js";import{ia as ft,ka as ye,la as xe}from"./chunk-ATT3TY24.js";import{d as ct,e as ut,g as Ae,z as Ie}from"./chunk-R4OF56YW.js";import{p as Se}from"./chunk-SOW3IEMS.js";import"./chunk-JCXI7DCY.js";import"./chunk-Y4TRFKLK.js";import"./chunk-J3HBQNFQ.js";import{D as Y,G as dt}from"./chunk-TKY4JD25.js";import"./chunk-OTTTIJST.js";import{b as W}from"./chunk-4IIT6T7T.js";import{Db as P,Gc as mt,Hc as pt,Ic as lt,Kc as H,Yb as st,a as ue,ba as at,bc as fe,dc as L,fc as Ce,gc as he,h as rt,ld as E,mc as _e,md as Te,n as nt,nd as J,od as I,pc as ge,qc as ve,rc as be,tb as w,uc as Ee}from"./chunk-B6Z6LCBX.js";import{$a as We,$b as a,Ac as ze,Ad as it,Bb as x,Ca as Je,Cb as se,Da as re,Fb as Ye,Fe as de,Ga as _,Hb as f,Je as ot,Kc as Qe,L as te,Lc as Xe,Na as v,Nb as X,Nc as N,Oa as b,Oc as me,Pc as Ze,Qb as s,Sa as ne,Ta as ae,Ve as K,Wb as O,Wc as m,Xc as p,Yc as et,ac as n,bc as h,cd as pe,e as ee,fa as j,fc as R,hc as T,hd as q,ic as c,id as le,lb as je,lc as g,mc as He,nf as Ge,p as Ke,pb as r,rd as ce,tb as d,ua as ie,ud as B,xc as C,xd as tt,ya as oe,yc as S,zc as y}from"./chunk-XJX5BABA.js";function Qt(e,l){if(e&1){let t=R();a(0,"div",2)(1,"h1",3),C(2),m(3,"transloco"),n(),a(4,"div",4)(5,"span",5),C(6,"*"),n(),C(7),m(8,"transloco"),n(),a(9,"form",6)(10,"p-card",7)(11,"div",8)(12,"div")(13,"ppg-input-group",9),h(14,"input",10),n()(),a(15,"div",11)(16,"ppg-input-group",12),h(17,"input",13),n()(),a(18,"div",11),h(19,"app-phone-number-input",14),n(),a(20,"div",11)(21,"ppg-input-group",15),h(22,"input",16),m(23,"async"),n()()()()(),a(24,"div",17)(25,"div",18)(26,"p-button",19),T("onClick",function(){v(t);let o=c();return b(o.cancelHandler())}),n()(),a(27,"div",18)(28,"p-button",20),T("onClick",function(){v(t);let o=c();return b(o.submitHandler())}),n()()()()}if(e&2){let t,i=l.$implicit,o=c();r(2),S(p(3,17,"CUSTOMER.ADD_NEW")),r(5),y(" ",p(8,19,"CUSTOMER.REQUIRED_HEADER")," "),r(2),s("formGroup",o.customerForm),r(),s("header",i("CUSTOMER_INFO_TITLE")),r(),X("aria-label",i("CUSTOMER_INFO_TITLE")),r(2),s("label",i("NAME")),r(),s("fieldType",o.ERROR_FIELD_TYPE.CustomerName),r(2),s("label",i("EMAIL")),r(),s("fieldType",o.ERROR_FIELD_TYPE.Email),r(2),s("formGroup",o.customerForm)("phoneControl","phoneNumber")("label",i("PHONE_NUMBER")),r(2),s("label",i("PARENT_ACCOUNT")),r(),s("fieldType",o.ERROR_FIELD_TYPE.ParentAccountNumber),X("maxlength",(t=p(23,21,o.accountNumberRules$))==null?null:t.maxLength),r(4),s("label",i("CANCEL")),r(2),s("label",i("SUBMIT"))}}var Lt=(()=>{class e{#e;#t;constructor(t,i,o,u,D,k){this.customerService=t,this.changeDetectorRef=i,this.formBuilder=o,this.router=u,this.notificationService=D,this.injector=k,this.#e=_(W),this.#t=_(P),this.ERROR_FIELD_TYPE=Re,this.deactivateDialogTranslationPrefix="CUSTOMER.CANCEL_ADD_MODAL",this.isFormSaved=!1,this.accountNumberRules$=this.#e.accountNumberValidationRules$.pipe(j(1)),this.customerForm=this.formBuilder.group({name:["",[L.required,G.notOnlyWhiteSpaces()]],email:["",[L.required,G.email()]],phoneNumber:[""],ppgParentAccountNumber:["",[L.required],[Tt.alreadyExists(this.customerService.validateIfParentAccountNumberAlreadyExists)]],isTradeElite:[!1]});let Q=_(Se).minDigitLengthValidator;le(()=>{let ke=Q();this.customerForm.controls.phoneNumber.setValidators([Me.customPhone(),ke])})}get ppgParentAccountNumber(){return this.customerForm.controls.ppgParentAccountNumber}ngOnInit(){G.applyAccountNumberValidators(this.ppgParentAccountNumber,this.injector)}ngAfterViewChecked(){this.changeDetectorRef.detectChanges()}isDeactivationAllowed(){return this.customerForm.pristine||this.isFormSaved}submitHandler(){if(!this.customerForm.valid){Ne(this.customerForm,!0);return}let t=ee(this.customerForm.getRawValue(),[]),i=new Ot(t);this.customerService.post(i).pipe(this.notificationService.message("ADD_CUSTOMER")).subscribe(()=>this.navigateToCustomers()),Z(this.customerForm),this.isFormSaved=!0}
1cancelHandler(){Z(this.customerForm),this.navigateToCustomers()}navigateToCustomers(){this.router.navigate([this.#t.getPathByAppRouteFeatureModule(w.Customer)])}static{this.\u0275fac=function(i){return new(i||e)(d(V),d(pe),d(Ee),d(K),d(_t),d(ne))}}static{this.\u0275cmp=x({type:e,selectors:[["app-add-customer"]],standalone:!1,decls:2,vars:1,consts:[[1,"flex","flex-column","justify-content-center","align-items-center","pb-2"],["class","form-container",4,"transloco","translocoRead"],[1,"form-container"],["data-test-id","AddCustomer.Header"],["data-test-id","AddCustomer.RequiredHeader",1,"mt-0","pb-4"],[1,"p-error"],[3,"formGroup"],["styleClass","ppg-form-card",3,"header"],["role","group"],["required","true","displaySuffix","true","data-test-id","AddCustomer.CustomerNameLabel",3,"label"],["pInputText","","type","text","formControlName","name","id","customer-name","name","name","data-test-id","AddCustomer.CustomerNameInput","ppgValidator","","autocomplete","off",1,"p-inputtext","w-full",3,"fieldType"],[1,"mt-4"],["required","true","displaySuffix","true","data-test-id","AddCustomer.CustomerEmailLabel",3,"label"],["pInputText","","type","email","formControlName","email","id","email","name","email","data-test-id","AddCustomer.CustomerEmailInput","ppgValidator","","required","true","autocomplete","off",1,"p-inputtext","w-full",3,"fieldType"],["styleModifier","p-inputtext w-full","data-test-id","AddCustomer.CustomerPhoneNumber","id","phoneNumber","name","phoneNumber",3,"formGroup","phoneControl","label"],["required","true","displaySuffix","true","data-test-id","AddCustomer.AccountNumberLabel",3,"label"],["pInputText","","type","text","formControlName","ppgParentAccountNumber","id","ppgParentAccountNumber","name","ppgParentAccountNumber","data-test-id","AddCustomer.AccountNumberInput","ppgValidator","","required","true",1,"p-inputtext","w-full",3,"fieldType"],[1,"p-fluid","mt-3","grid","align-items-center","flex-column-reverse","sm:flex-row"],[1,"col-12","sm:col"],["data-test-id","AddCustomer.cancelButton","styleClass","font-bold","outlined","true",1,"flex-1",3,"onClick","label"],["styleClass","font-bold","data-test-id","AddCustomer.submitButton",3,"onClick","label"]],template:function(i,o){i&1&&(a(0,"div",0),f(1,Qt,29,23,"div",1),n()),i&2&&(r(),s("translocoRead","CUSTOMER.FORM"))},dependencies:[Y,_e,fe,Ce,he,be,ge,ve,Oe,J,we,Ae,Ie,Be,B,I],encapsulation:2})}}return e})();var Vt=(()=>{class e{constructor(){this._customer=new Ke(null),this.customer=this._customer.asObservable()}update(t){this._customer.next(t)}getValue(){return this._customer.getValue()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Je({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var ii=e=>({label:e,routerLink:"/",automationId:"customersDetailsPage.breadcrumbHome"}),oi=(e,l)=>({label:e,routerLink:l,automationId:"customersDetailsPage.breadcrumbCustomers"}),ri=e=>({label:e,automationId:"customersDetailsPage.breadcrumbCustomer"}),ni=(e,l,t)=>[e,l,t];function ai(e,l){if(e&1&&(h(0,"ppg-cdp-breadcrumbs",17),m(1,"transloco"),m(2,"transloco"),m(3,"transloco")),e&2){let t=c().ngIf,i=c();s("model",Ze(14,ni,N(7,ii,p(1,1,"NAV.HOME")),me(9,oi,p(2,3,"NAV.CUSTOMERS"),i.customerBaseUrl()),N(12,ri,p(3,5,t.name))))}}function si(e,l){e&1&&(a(0,"h5",14),C(1),m(2,"transloco"),m(3,"transloco"),n()),e&2&&(r(),ze(" ",p(2,2,"CUSTOMER.DETAILS.STATUS"),": ",p(3,4,"CUSTOMER.DETAILS.TRADE_ELITE")," "))}function mi(e,l){if(e&1&&(a(0,"div",1),f(1,ai,4,18,"ppg-cdp-breadcrumbs",2),a(2,"h1",3),C(3),n(),a(4,"p-accordion")(5,"p-accordionTab",4),m(6,"transloco"),a(7,"h5",5),C(8),m(9,"transloco"),n(),a(10,"div",6),h(11,"i",7),a(12,"span",8),C(13),m(14,"transloco"),n(),a(15,"a",9),C(16),n()(),a(17,"div",10),h(18,"i",11),a(19,"span",12),C(20),m(21,"transloco"),n(),a(22,"a",13),C(23),n()(),f(24,si,4,6,"h5",14),n()(),a(25,"div",15),h(26,"p-tabMenu",16)(27,"router-outlet"),n()()),e&2){let t=l.ngIf,i=c();r(3),S(t.name),r(2),s("header",p(6,14,"CUSTOMER.DETAILS.VIEW_DETAILS_PANEL_TITLE")),r(3),S(p(9,16,"CUSTOMER.DETAILS.ADMINISTRATIVE_INFO")),r(5),y("",p(14,18,"CUSTOMER.DETAILS.PHONE"),":"),r(2),He("href","tel:+",t.phoneNumber,"",je),r(),y(" ",t.phoneNumber," "),r(4),y("",p(21,20,"CUSTOMER.DETAILS.EMAIL"),":"),r(2),He("href","mailto:",t.email,"",je),r(),y(" ",t.email," "),r(),O(i.isTradeEliteVisible&&t.isTradeElite?24:-1),r(2),s("model",i.item)("scrollable",!0)}}var Ft=(()=>{class e{#e;constructor(t,i,o,u,D,k){this.customerPubSubService=t,this.customerService=i,this.route=o,this.permissionsService=u,this.translocoService=D,this.destroyRef=k,this.#e=_(P),this.customerBaseUrl=q(()=>this.#e.getPathByAppRouteFeatureModule(w.Customer)),this.item=[]}ngOnInit(){this.initRoutingTable();let{customerKey:t}
1=this.route.snapshot.params;this.translocoService.langChanges$.pipe(ie(()=>this.translocoService.selectTranslate("")),ue(this.destroyRef)).subscribe(()=>{this.initRoutingTable()}),this.customer$=this.customerService.getByKey(t).pipe(oe(i=>this.customerPubSubService.update(i)))}initRoutingTable(){this.item=[];let t=this.permissionsService.getPermissions();t.view_jobs&&this.item.push({label:E("CUSTOMER.DETAILS.JOBS_TAB_TITLE"),routerLink:[M.CustomerDetailsJobs],automationId:"customerDetails.tabJobs"}),t.view_orders&&this.item.push({label:E("CUSTOMER.DETAILS.ORDERS_TAB_TITLE"),routerLink:[M.CustomerOrders],automationId:"customerDetails.tabOrders"}),t.view_all_users&&this.item.push({label:E("CUSTOMER.DETAILS.USERS_TAB_TITLE"),routerLink:[M.CustomerUsers],automationId:"customerDetails.tabUsers"})}static{this.\u0275fac=function(i){return new(i||e)(d(Vt),d(V),d(de),d(pt),d(Te),d(ae))}}static{this.\u0275cmp=x({type:e,selectors:[["app-customer-details"]],standalone:!1,decls:2,vars:3,consts:[["class","layout-container",4,"ngIf"],[1,"layout-container"],["data-test-id","customersDetailsPage.breadcrumbs",3,"model",4,"ppgHideOnMobileAppView"],["data-test-id","customer.name",1,"pb-1","pt-5"],["data-test-id","customerDetails.tabMenu",3,"header"],["data-test-id","customer.administrativeInfo.title"],["data-test-id","customer.phoneNumber",1,"flex"],["data-test-id","customer.phoneNumber.icon",1,"pi","pi-phone","mr-2"],["data-test-id","customer.phoneNumber.label",1,"mr-2"],["data-test-id","customer.phoneNumber.link",1,"p-button","p-button-link","p-0",3,"href"],["data-test-id","customer.email",1,"flex","mt-2"],["data-test-id","customer.email.icon",1,"pi","pi-envelope","mr-2"],["data-test-id","customer.email.label",1,"mr-2"],["data-test-id","customer.email.link",1,"p-button","p-button-link","p-0",3,"href"],["data-test-id","customer.tradeElite.status"],[1,"mt-5"],["data-test-id","customerDetails.tabMenu","ppgMenuItemTestIdTarget","span.p-menuitem-text",3,"model","scrollable"],["data-test-id","customersDetailsPage.breadcrumbs",3,"model"]],template:function(i,o){i&1&&(f(0,mi,28,22,"div",0),m(1,"async")),i&2&&s("ngIf",p(1,1,o.customer$))},dependencies:[ce,ot,Le,gt,ut,ct,St,De,B,I],styles:["[_nghost-%COMP%] .p-tabmenu-nav-btn{width:25px;box-shadow:none}"]})}}return e})();var Ue=class{constructor(l,t,i,o,u,D,k,Q=!1){this.key=l,this.name=t,this.phoneNumber=i,this.email=o,this.createdOn=u,this.isTradeElite=D,this.isActive=k,this.isNew=Q}};var pi=e=>({label:e,routerLink:"/",automationId:"customersPage.breadcrumbHome"}),li=e=>({label:e,automationId:"customersPage.breadcrumbCustomers"}),ci=(e,l)=>[e,l];function ui(e,l){e&1&&(h(0,"ppg-cdp-breadcrumbs",8),m(1,"transloco"),m(2,"transloco")),e&2&&s("model",me(9,ci,N(5,pi,p(1,1,"NAV.HOME")),N(7,li,p(2,3,"NAV.CUSTOMERS"))))}var z=(()=>{class e{constructor(){this.showInactiveEntities=!1,this.switchLabel="switchLabel"}onToggleSwitch(t){this.showInactiveEntities=t.checked}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=x({type:e,selectors:[["app-customers-page"]],standalone:!1,decls:12,vars:9,consts:[[1,"layout-container"],["data-test-id","customersPage.breadcrumbs",3,"model",4,"ppgHideOnMobileAppView"],[1,"flex","justify-content-between","flex-column","sm:flex-row","gap-4","mb-4"],["data-test-id","customersPage.title",1,"p-0"],[1,"flex","align-items-center","gap-2"],["data-test-id","customersPage.showInactiveText",3,"id"],["data-test-id","customersPage.showInactiveSwitch","styleClass","flex align-items-center",3,"onChange","ariaLabelledBy"],[3,"showInactiveEntities"],["data-test-id","customersPage.breadcrumbs",3,"model"]],template:function(i,o){i&1&&(a(0,"div",0),f(1,ui,3,12,"ppg-cdp-breadcrumbs",1),a(2,"div",2)(3,"h1",3),C(4),m(5,"transloco"),n(),a(6,"div",4)(7,"span",5),C(8),m(9,"transloco"),n(),a(10,"p-inputSwitch",6),T("onChange",function(D){return o.onToggleSwitch(D)}),n()()(),h(11,"app-customers",7),n()),i&2&&(r(4),S(p(5,5,"ADMIN.CUSTOMERS.TITLE")),r(3),s("id",o.switchLabel),r(),S(p(9,7,"CUSTOMER.SHOW_INACTIVE")),r(2),s("ariaLabelledBy",o.switchLabel),r(),s("showInactiveEntities",o.showInactiveEntities))},encapsulation:2})}}return e})();var Ut=e=>[e];function fi(e,l){if(e&1){let t=R();a(0,"p-button",12),T("onClick",function(){v(t);let o=c().row,u=c(2);return b(u.navigate(o))}),n()}if(e&2){let t=c().cell;g("label",t),s("link",!0)}}function Ci(e,l){if(e&1&&C(0),e&2){let t=c().cell;y(" ",t," ")}}function hi(e,l){if(e&1&&f(0,fi,1,2,"p-button",11)(1,Ci,1,1),e&2){let t=l.row;O(t.isActive?0:1)}}function _i(e,l){if(e&1&&(a(0,"span",13),C(1),n()),e&2){let t=l.cell;r(),S(t)}}function gi(e,l){e&1&&(a(0,"i",15),m(1,"transloco"),C(2," monetization_on "),n()),e&2&&g("title",p(1,1,"DASHBOARD.TABLE_COLUMN.IS_TRADE_ELITE"))}function vi(e,l){if(e&1&&(a(0,"span",14),f(1,gi,3,3,"i",15),n()),e&2){let t=l.cell;r(),O(t?1:-1)}}function bi(e,l){e&1&&(a(0,"ppg-table-column",7),m(1,"transloco"),f(2,vi,2,1,"ng-template",4),n()),e&2&&(g("title",p(1,2,"DASHBOARD.TABLE_COLUMN.IS_TRADE_ELITE")),s("sortable",!0))}function Ei(e,l){e&1&&(h(0,"p-tag",18),m(1,"transloco")),e&2&&g("value",p(1,1,"SHARED.TABLE.NEW"))}function Ti(e,l){if(e&1&&(a(0,"div",16)(1,"span",17),C(2),m(3,"transloco"),m(4,"date"),n(),f(5,Ei,2,3,"p-tag",18),n()),e&2){let t=l.cell,i=l.row;r(2),S(et(4,4,t,p(3,2,"DATE_FORMAT"))),r(3),O(i.isNew?5:-1)}}function Si(e,l){if(e&1){let t=R();a(0,"p-splitButton",22),m(1,"transloco"),m(2,"transloco"),T("onClick",function(){v(t);let o=c().row,u=c(3);return b(u.edit(o))})("onDropdownClick",function(){v(t);let o=c().row,u=c(3);return b(u.handleActionsClick(o))}),n()}if(e&2){let t=c(4);g("label",p(1,4,"SHARED.BUTTON.EDIT")),g("expandAriaLabel",p(2,6,"SHARED.BUTTON.ACTIONS_MENU")),s("model",t.items)("outlined",!0)}}function Ai(e,l){if(e&1){let t=R();a(0,"p-button",23),m(1,"transloco"),T("click",function(){v(t);let o=c().row,u=c(3);return b(u.activate(o))}),n()}if(e&2){let t=c(3).$implicit;g("label",p(1,4,"SHARED.BUTTON.REACTIVATE")),s("outlined",!0)("pTooltip",t("REACTIVATE_TOOLTIP"))("escape",!1)}}function yi(e,l){if(e&1&&f(0,Si,3,8,"p-splitButton",20)(1,Ai,2,6,"p-button",21),e&2){let t=l.row;O(t.isActive?0:1)}}function xi(e,l){e&1&&(a(0,"ppg-table-column",19),m(1,"transloco"),f(2,yi,2,1,"ng-template",4),n()),e&2&&(g("title",p(1,2,"SHARED.TABLE.ACTIONS")),s("showColumnTitleOnMobile",!1))}function Ii(e,l){if(e&1){let t=R();a(0,"div")(1,"ppg-table",1),m(2,"async"),m(3,"async"),m(4,"async"),T("pageSizeChange",function(o){v(t);let u=c();return b(u.pageSizeHandler(o))})("pageNumberChange",function(o){v(t);let u=c();return b(u.changePageHandler(o))})("sortChange",function(o){v(t);let u=c();return b(u.sortHandler(o))}),a(5,"ppg-table-header",2),m(6,"transloco"),m(7,"transloco"),T("searchChange",function(o){v(t);let u=c();return b(u.searchHandler(o))})("actionButtonClick",function(){v(t);let o=c();return b(o.addCustomer())}),n(),a(8,"ppg-table-column",3),m(9,"transloco"),f(10,hi,2,1,"ng-template",4),n(),h(11,"ppg-table-column",5),m(12,"transloco"),a(13,"ppg-table-column",6),m(14,"transloco"),f(15,_i,2,1,"ng-template",4),n(),f(16,bi,3,4,"ppg-table-column",7),a(17,"ppg-table-column",8),m(18,"transloco"),f(19,Ti,6,7,"ng-template",4),n(),f(20,xi,3,4,"ppg-table-column",9),n(),h(21,"ppg-confirmation-dialog",10),n()}if(e&2){let t=c();r(),s("paginatorPhoneVersion",p(2,18,t.isSmallPhoneView$))("data",p(3,20,t.data$))("loading",p(4,22,t.loading$)),r(4),g("searchPlaceholder",p(6,24,"DASHBOARD.SEARCH_PLACEHOLDER")),g("actionButtonLabel",p(7,26,"DASHBOARD.ADD_CUSTOMER")),s("actionButtonPermissions",N(36,Ut,t.permissions.MANAGE_CUSTOMERS)),r(3),g("title",p(9,28,"DASHBOARD.TABLE_COLUMN.CUSTOMER_NAME")),s("sortable",!0),r(3),g("title",p(12,30,"DASHBOARD.TABLE_COLUMN.PHONE")),s("sortable",!0),r(2),g("title",p(14,32,"DASHBOARD.TABLE_COLUMN.EMAIL")),s("sortable",!0),r(3),O(t.isTradeEliteVisible?16:-1),r(),g("title",p(18,34,"USERS.TABLE_COLUMN.DATE_REGISTERED")),s("sortable",!0),r(3),s("ngxPermissionsOnly",N(38,Ut,t.permissions.MANAGE_CUSTOMERS)),r(),s("config",t.currentDialogConfig())("key",t.dialogKey)}}var kt=(()=>{class e extends At{#e;#t;#i;#r;#a;#s;#o;#m;#n;#p;constructor(t){super(t),this.tableDateFacade=t,this.firstPageNumber=0,this.permissions=A,this.#e=_(ye),this.#t=_(K),this.#i=_(V),this.#r=_(Te),this.#a=_(ae),this.#s=_(Ct),this.#o=_(Pe),this.#m=_(P),this.customerUrl=q(()=>this.#m.getPathByAppRouteFeatureModule(w.Customer)),this.actionType=at,this.dialogResources={deactivate:{header:E("CUSTOMER.DEACTIVATION_MODAL.HEADER"),body:E("CUSTOMER.DEACTIVATION_MODAL.BODY"),continueButton:E("CUSTOMER.DEACTIVATION_MODAL.CONTINUE_BUTTON"),cancelButton:E("CUSTOMER.DEACTIVATION_MODAL.CANCEL_BUTTON"),closeAriaLabel:E("SHARED.BUTTON.CANCEL")},activate:{header:E("CUSTOMER.ACTIVATION_MODAL.HEADER"),body:E("CUSTOMER.ACTIVATION_MODAL.BODY"),continueButton:E("CUSTOMER.ACTIVATION_MODAL.CONTINUE_BUTTON"),cancelButton:E("CUSTOMER.ACTIVATION_MODAL.CANCEL_BUTTON"),closeAriaLabel:E("SHARED.BUTTON.CANCEL")}},this.dialogKey="customersActivationDeactivationDialog",this.#n={message:this.dialogResources.deactivate.body,header:this.dialogResources.deactivate.header,acceptLabel:this.dialogResources.deactivate.continueButton,rejectLabel:this.dialogResources.deactivate.cancelButton,closeAriaLabel:this.dialogResources.deactivate.closeAriaLabel,accept:()=>this.confirmDeactivation()},this.#p={message:this.dialogResources.activate.body,header:this.dialogResources.activate.header,acceptLabel:this.dialogResources.activate.continueButton,rejectLabel:this.dialogResources.activate.cancelButton,closeAriaLabel:this.dialogResources.activate.closeAriaLabel,accept:()=>this.confirmActivation()},this.currentDialogConfig=We(this.#n),this.getCustomersSource=i=>this.#i.getAll(i,this.showInactive).pipe(te(o=>this.mapResponse(o)))}ngOnInit(){this.isSmallPhoneView$=this.#s.observePrimeNgBreakpoint(ht.Phone),this.tableDateFacade.updateSource(this.getCustomersSource),this.#r.langChanges$.pipe(ie(()=>this.#r.selectTranslate("")),ue(this.#a)).subscribe(()=>{this.initButtonActions()})}initButtonActions(){this.items=[{label:E("SHARED.BUTTON.DEACTIVATE"),icon:nt.TRASH,styleClass:"p-menuitem-error",command:()=>{this.deactivate()}}]}set showInactiveEntities(t){this.showInactive=t,this.tableDateFacade.updatePageNumber(this.firstPageNumber),this.refreshData()}addCustomer(){this.#o.addCustomerGA(),this.#t.navigateByUrl(`${this.customerUrl()}/${this.actionType.NEW}`)}handleActionsClick(t){this.selectedRowkey=t.key}navigate(t){this.#t.navigate([`${this.customerUrl()}/${t.key}`])}edit(t){this.#o.editCustomerGA(),this.#t.navigate([`${this.customerUrl()}/${this.actionType.EDIT}/${t.key}`])}deactivate(){this.currentDialogConfig.set(this.#n),this.#e.showBasicDialog(this.dialogKey,this.currentDialogConfig().header,this.currentDialogConfig().message)}confirmDeactivation(){this.#i.deactivate(this.selectedRowkey).pipe(j(1)).subscribe(()=>{this.#o.deleteCustomerGA(),this.tableDataFacade.refreshSourceData(),this.#e.closeBasicDialog()})}activate(t){this.selectedRowkey=t.key,this.currentDialogConfig.set(this.#p),this.#e.showBasicDialog(this.dialogKey,this.currentDialogConfig().header,this.currentDialogConfig().message)}confirmActivation(){this.#i.activateCustomer(this.selectedRowkey).pipe(j(1)).subscribe(()=>{this.#o.pushActivateCustomerGTMTag(),this.tableDateFacade.refreshSourceData(),this.#e.closeBasicDialog()})}mapResponse(t){return{items:t.items.map(o=>new Ue(o.key,o.name,o.phoneNumber,o.email,o.createdOn,o.isTradeElite,o.isActive,st(o.createdOn,7))),pageNumber:t.pageNumber,pageSize:t.pageSize,pagesCount:t.pagesCount,totalItemsCount:t.totalItemsCount}}refreshData(){this.tableDataFacade.refreshSourceData()}static{this.\u0275fac=function(i){return new(i||e)(d(Ve))}}static{this.\u0275cmp=x({type:e,selectors:[["app-customers"]],inputs:{showInactiveEntities:"showInactiveEntities"},standalone:!1,features:[Qe([Ve,z]),Ye],decls:1,vars:1,consts:[[4,"transloco","translocoRead"],["behavior","card-to-table","itemActivePredicate","isActive",3,"pageSizeChange","pageNumberChange","sortChange","paginatorPhoneVersion","data","loading"],["actionButtonIconName","pi pi-plus-circle","actionButtonIconPosition","left","data-test-id","customers.tableHeader",3,"searchChange","actionButtonClick","searchPlaceholder","actionButtonLabel","actionButtonPermissions"],["data-test-id","customers.nameColumn","field","name",3,"title","sortable"],["appColumnTemplate",""],["data-test-id","customers.phoneColumn","field","phoneNumber",3,"title","sortable"],["data-test-id","customers.emailColumn","field","email",3,"title","sortable"],["data-test-id","customers.tradeEliteColumn","field","isTradeElite",3,"title","sortable"],["data-test-id","customers.dateRegisteredColumn","field","createdOn",3,"title","sortable"],["data-test-id","customers.actionsColumn",3,"title","showColumnTitleOnMobile",4,"ngxPermissionsOnly"],[3,"config","key"],["data-test-id","customers.activeName","styleClass","p-0 text-sm text-left",3,"label","link"],["data-test-id","customers.activeName","styleClass","p-0 text-sm text-left",3,"onClick","label","link"],["data-test-id","customers.email",1,"u-break-word"],["data-test-id","customers.tradeElite"],[3,"title"],[1,"flex","align-items-center"],["data-test-id","customers.dateRegistered"],["data-test-id","customers.newTag","severity","info","styleClass","ml-2",3,"value"],["data-test-id","customers.actionsColumn",3,"title","showColumnTitleOnMobile"],["data-test-id","customers.editSplitButton","icon","pi pi-pencil","styleClass","w-full",1,"w-full",3,"label","model","outlined","expandAriaLabel"],["data-test-id","customers.reactivateButton","icon","pi pi-refresh","styleClass","w-full p-button-type","tooltipPosition","top","showDelay","100","outlined","true",1,"w-full",3,"label","outlined","pTooltip","escape"],["data-test-id","customers.editSplitButton","icon","pi pi-pencil","styleClass","w-full",1,"w-full",3,"onClick","onDropdownClick","label","model","outlined","expandAriaLabel"],["data-test-id","customers.reactivateButton","icon","pi pi-refresh","styleClass","w-full p-button-type","tooltipPosition","top","showDelay","100","outlined","true",1,"w-full",3,"click","label","outlined","pTooltip","escape"]],template:function(i,o){i&1&&f(0,Ii,22,40,"div",0),i&2&&s("translocoRead","CUSTOMER")},dependencies:[Y,J,It,xt,Dt,lt,yt,dt,Rt,vt,xe,B,tt,I],encapsulation:2})}}return e})();function Di(e,l){if(e&1){let t=R();a(0,"div",3)(1,"h1",4),C(2),m(3,"transloco"),n(),a(4,"div",5)(5,"span",6),C(6,"*"),n(),C(7),m(8,"transloco"),n(),a(9,"form",7)(10,"p-card",8)(11,"div")(12,"ppg-input-group",9),h(13,"input",10),n()(),a(14,"div",11)(15,"ppg-input-group",12),h(16,"input",13),n()(),a(17,"div",11),h(18,"app-phone-number-input",14),n(),a(19,"div",11)(20,"ppg-input-group",15),h(21,"input",16),m(22,"async"),n()()()(),a(23,"div",17)(24,"div",18)(25,"p-button",19),m(26,"transloco"),T("click",function(){v(t);let o=c(2);return b(o.cancelHandler())}),n()(),a(27,"div",18)(28,"p-button",20),m(29,"transloco"),T("click",function(){v(t);let o=c(2);return b(o.submitHandler())}),n()()()()}if(e&2){let t,i=c().$implicit,o=c();r(2),S(p(3,16,"CUSTOMER.EDIT")),r(5),y(" ",p(8,18,"CUSTOMER.REQUIRED_HEADER")," "),r(2),s("formGroup",o.customerForm),r(),s("header",i("CUSTOMER_INFO_TITLE")),r(2),s("label",i("NAME")),r(),s("fieldType",o.ERROR_FIELD_TYPE.CustomerName),r(2),s("label",i("EMAIL")),r(),s("fieldType",o.ERROR_FIELD_TYPE.Email),r(2),s("formGroup",o.customerForm)("phoneControl","phoneNumber")("label",i("PHONE_NUMBER")),r(2),s("label",i("PARENT_ACCOUNT")),r(),s("fieldType",o.ERROR_FIELD_TYPE.ParentAccountNumber),X("maxlength",(t=p(22,20,o.accountNumberRules$))==null?null:t.maxLength),r(4),g("label",p(26,22,"SHARED.BUTTON.CANCEL")),r(3),g("label",p(29,24,"SHARED.BUTTON.SUBMIT"))}}function Ri(e,l){if(e&1&&(a(0,"div",1),f(1,Di,30,26,"div",2),m(2,"async"),n()),e&2){let t=c();r(),s("ngIf",p(2,1,t.customer$))}}var jt=(()=>{class e{#e;#t;#i;constructor(t,i,o,u,D,k,Q){this.customerService=t,this.changeDetectorRef=i,this.formBuilder=o,this.router=u,this.route=D,this.customerGtmService=k,this.injector=Q,this.#e=_(W),this.#t=_(P),this.#i=_(Se),this.customerUrl=q(()=>this.#t.getPathByAppRouteFeatureModule(w.Customer)),this.ERROR_FIELD_TYPE=Re,this.deactivateDialogTranslationPrefix="CUSTOMER.CANCEL_EDIT_MODAL",this.isFormSaved=!1,this.accountNumberRules$=this.#e.accountNumberValidationRules$.pipe(j(1)),this.customerKey=this.route.
1snapshot.params.customerKey,this.customerForm=this.formBuilder.group({name:["",[L.required]],email:["",[L.required,G.email()]],phoneNumber:[""],ppgParentAccountNumber:["",[L.required]],isTradeElite:[!1]});let ke=this.#i.minDigitLengthValidator;le(()=>{let $t=ke();this.customerForm.controls.phoneNumber.setValidators([Me.customPhone(),$t])})}get ppgParentAccountNumber(){return this.customerForm.controls.ppgParentAccountNumber}ngOnInit(){this.customer$=this.customerService.getByKey(this.customerKey).pipe(oe(t=>this.initForm(t)))}ngAfterViewChecked(){this.changeDetectorRef.detectChanges()}initForm(t){this.customerForm.patchValue({name:t.name,email:t.email,phoneNumber:this.#i.unmask(t.phoneNumber),ppgParentAccountNumber:t.ppgParentAccountNumber,isTradeElite:t.isTradeElite}),G.applyAccountNumberValidators(this.ppgParentAccountNumber,this.injector)}isDeactivationAllowed(){return this.customerForm.pristine||this.isFormSaved}submitHandler(){if(!this.customerForm.valid){Ne(this.customerForm,!0);return}let t=ee(this.customerForm.getRawValue(),[]),i=new Mt(t);this.customerService.put(i,this.customerKey).subscribe(()=>{this.router.navigate([this.customerUrl()])}),this.customerGtmService.submitDataGA(this.customerKey),Z(this.customerForm),this.isFormSaved=!0}cancelHandler(){this.router.navigate([this.customerUrl()]),this.customerGtmService.cancelSubmitGA()}static{this.\u0275fac=function(i){return new(i||e)(d(V),d(pe),d(Ee),d(K),d(de),d(Pe),d(ne))}}static{this.\u0275cmp=x({type:e,selectors:[["app-edit-customer"]],standalone:!1,decls:1,vars:1,consts:[["class","flex flex-column justify-content-center align-items-center pb-2",4,"transloco","translocoRead"],[1,"flex","flex-column","justify-content-center","align-items-center","pb-2"],["class","form-container",4,"ngIf"],[1,"form-container"],["data-test-id","EditCustomer.Header"],["data-test-id","AddCustomer.RequiredHeader",1,"mt-0","pb-4"],[1,"p-error"],[3,"formGroup"],["styleClass","ppg-form-card",3,"header"],["required","true","displaySuffix","true","data-test-id","EditCustomer.CustomerNameLabel",3,"label"],["pInputText","","type","text","formControlName","name","id","customer-name","name","name","data-test-id","EditCustomer.CustomerNameInput","ppgValidator","",1,"p-inputtext","w-full",3,"fieldType"],[1,"mt-4"],["required","true","displaySuffix","true","data-test-id","EditCustomer.CustomerEmailLabel",3,"label"],["pInputText","","type","email","formControlName","email","id","email","name","email","data-test-id","EditCustomer.CustomerEmailInput","ppgValidator","","required","true",1,"p-inputtext","w-full",3,"fieldType"],["data-test-id","EditCustomer.CustomerPhoneNumber","styleModifier","p-inputtext w-full","id","phoneNumber","name","phoneNumber",3,"formGroup","phoneControl","label"],["required","true","displaySuffix","true","data-test-id","EditCustomer.AccountNumberLabel",3,"label"],["pInputText","","type","text","formControlName","ppgParentAccountNumber","id","ppgParentAccountNumber","name","ppgParentAccountNumber","data-test-id","EditCustomer.AccountNumberInput","ppgValidator","","required","true",1,"p-inputtext","w-full",3,"fieldType"],[1,"p-fluid","mt-3","grid","align-items-center","flex-column-reverse","sm:flex-row"],[1,"col-12","sm:col"],["type","button","styleClass","font-bold","outlined","true","data-test-id","EditCustomer.CancleButton",1,"flex-1",3,"click","label"],["type","submit","styleClass","font-bold","data-test-id","EditCustomer.SubmitButton",1,"p-fluid",3,"click","label"]],template:function(i,o){i&1&&f(0,Ri,3,3,"div",0),i&2&&s("translocoRead","CUSTOMER.FORM")},dependencies:[Y,ce,_e,fe,Ce,he,be,ge,ve,Oe,J,we,Ae,Ie,Be,B,I],encapsulation:2})}}return e})();var Ht=()=>_(W).jobAccountValidationEnabledFeatureFlag$.pipe(te(l=>l?[A.MANAGE_JOBS,A.MANAGE_ALL_JOBS,A.MANAGE_CUSTOMER_JOBS]:[A.MANAGE_JOBS,A.MANAGE_ALL_JOBS])),Ni=[{path:"",component:z,canActivate:[H],data:{permissions:{only:[A.VIEW_CUSTOMERS],redirectTo:"/"}}},{path:`:${U.CustomerKey}/jobs/:${U.JobKey}/edit`,component:$e,loadChildren:()=>import("./chunk-DCCVX2NY.js").then(e=>e.JobModule),pathMatch:"full",canDeactivate:[F],canActivate:[H],data:{permissions:{only:()=>Ht(),redirectTo:"/"},gtm:{pageTitle:"Edit Job"}}},{path:`:${U.CustomerKey}/jobs/new`,component:$e,loadChildren:()=>import("./chunk-DCCVX2NY.js").then(e=>e.JobModule),pathMatch:"full",canDeactivate:[F],canActivate:[H],data:{permissions:{only:()=>Ht(),redirectTo:"/"},gtm:{pageTitle:"Add Job"}}},{path:"new",component:Lt,canDeactivate:[F],canActivate:[H],data:{permissions:{only:[A.MANAGE_CUSTOMERS],redirectTo:"/"}}},{path:`edit/:${U.CustomerKey}`,component:jt,canDeactivate:[F],canActivate:[H],data:{permissions:{only:[A.MANAGE_CUSTOMERS],redirectTo:"/"}}},{path:`:${U.CustomerKey}`,redirectTo:`:${U.CustomerKey}/${M.CustomerDetailsJobs}`,pathMatch:"full"},{path:`:${U.CustomerKey}`,component:Ft,canActivate:[H],data:{permissions:{only:[A.VIEW_CUSTOMERS],redirectTo:"/"}},children:[{path:M.CustomerDetailsJobs,loadChildren:()=>import("./chunk-DCCVX2NY.js").then(e=>e.JobModule)},{path:M.CustomerOrders,loadChildren:()=>import("./chunk-VJ5GIYB2.js").then(e=>e.OrderModule)},{path:M.CustomerUsers,loadChildren:()=>import("./chunk-PM6TDI72.js").then(e=>e.UserModule),data:{onPage:Et.CustomerDetailsPage}}]}],Gt=(()=>{class e{static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275mod=se({type:e})}static{this.\u0275inj=re({providers:[F],imports:[Ge.forChild(mt(Ni)),Ge]})}}return e})();var an=(()=>{class e{static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275mod=se({type:e})}static{this.\u0275inj=re({providers:[F,rt,ye],imports:[ft,it,Gt,Nt,xe]})}}return e})();Xe(z,[Le,bt,De,kt],[I]);export{an as CustomerModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.