1import{b as H}from"./chunk-BYOPMSAG.js";import"./chunk-4JCIYYZK.js";import{a as P}from"./chunk-3N3UW4YH.js";import{a as G}from"./chunk-6GESDAY4.js";import{a as A}from"./chunk-OOK67WDD.js";import{c as O}from"./chunk-OAJAHVPQ.js";import"./chunk-VFVFO4Q2.js";import"./chunk-IT5VQHCU.js";import"./chunk-QY6LNFQZ.js";import{f as b,g as I,h as y,j as W}from"./chunk-ZU25APYH.js";import{b as V}from"./chunk-TXHNFF7M.js";import"./chunk-MXMHOVT4.js";import{a as B}from"./chunk-NZT47JED.js";import{b as D,c as F}from"./chunk-NSWWH5YR.js";import"./chunk-ZXBEE3CE.js";import"./chunk-JPASRPME.js";import"./chunk-CV2ZWZQE.js";import{o as L}from"./chunk-3MXYNL5S.js";import{t as R}from"./chunk-Y77WZKKD.js";import"./chunk-F2X3VGZZ.js";import{Gb as v,Gc as p,Hc as _,Ic as T,Lb as d,Mb as o,Nb as x,Rb as N,Va as a,Wb as C,X as m,Xb as l,da as g,ea as h,ib as k,ic as f,kc as M,ob as u,pc as w,qc as E,rc as S,zb as c}from"./chunk-HRVRTH5A.js";import"./chunk-PHUH23IY.js";function U(r,s){if(r&1&&(f(0),p(1,"date")),r&2){let t=l(2);M(" (",T(1,1,t.data.consentNewsletterGranted,"medium"),") ")}}function j(r,s){if(r&1&&(f(0),p(1,"date")),r&2){let t=l(2);M(" (",T(1,1,t.data.consentMarketingGranted,"medium"),") ")}}function K(r,s){if(r&1){let t=N();d(0,"div",4),f(1),p(2,"translate"),o(),d(3,"div",4),x(4,"app-checkbox",5),p(5,"translate"),o(),d(6,"div",6)(7,"app-checkbox",7),p(8,"translate"),S("valueChange",function(n){g(t);let i=l();return E(i.data.consentNewsletter,n)||(i.data.consentNewsletter=n),h(n)}),C("valueChange",function(){g(t);let n=l();return h(n.dataChanged=!0)}),o(),u(9,U,2,4),o(),d(10,"div",6)(11,"app-checkbox",7),p(12,"translate"),S("valueChange",function(n){g(t);let i=l();return E(i.data.consentMarketing,n)||(i.data.consentMarketing=n),h(n)}),C("valueChange",function(){g(t);let n=l();return h(n.dataChanged=!0)}),o(),u(13,j,2,4),o(),d(14,"div",8)(15,"p-button",9),p(16,"translate"),C("onClick",function(){g(t);let n=l();return h(n.saveData())}),o()()}if(r&2){let t=l();a(),M(" ",_(2,13,"CONSENT_MAIL_DESCRIPTION")," "),a(3),c("value",!0)("label",_(5,15,"PRODUCT_RELATED_EMAILS"))("disabled",!0),a(3),w("value",t.data.consentNewsletter),c("label",_(8,17,"NEWSLETTER")),a(2),v(t.data.consentNewsletterGranted&&t.data.consentNewsletter?9:-1),a(2),w("value",t.data.consentMarketing),c("label",_(12,19,"MARKETING")),a(2),v(t.data.consentMarketingGranted&&t.data.consentMarketing?13:-1),a(2),c("label",_(16,21,"SAVE"))("disabled",t.saving||!t.dataChanged)("loading",t.saving)}}var de=(()=>{let s=class s{constructor(){this.route=m(L),this.messagesService=m(H),this.frontendTitleService=m(G),this.translate=m(D),this.restErrorHelper=m(W)}ngOnInit(){this.code=A.getParameterFromRoute(this.route,"code"),this.loadData(),this.frontendTitleService.title="CONSENTS"}loadData(){this.code||(this.errorMsg=new y,this.errorMsg.message=this.translate.instant("WRONG_PARAMETER"),this.errorMsg.severity=b.warn,this.errorMsg.reload=!0),this.loading=!0,this.errorMsg=void 0,this.messagesService.getMailConsent(this.code).subscribe({next:e=>{console.log("Consent erhalten",e),this.dataLoaded(e),this.loading=!1},error:e=>{console.log("error",e),this.loading=!1,this.errorMsg=this.restErrorHelper.getErrorType(e,!0)}})}saveData(){this.saving||!this.code||(this.saving=!0,this.messagesService.saveMailConsent(this.code,this.createBody()).subscribe({next:e=>{console.log("Consent gespeichert",e),this.dataLoaded(e),this.saving=!1,this.dataChanged=!1,this.restErrorHelper.showInfoMessageService("SUCCESS_CLOSE_WINDOW",B.toastDurationLong)},error:e=>{this.saving=!1,this.restErrorHelper.handleErrorService(e)}}))}dataLoaded(e){e?.errorMsg?(this.errorMsg=new y,this.errorMsg.message=e.errorMsg,this.errorMsg.severity=b.warn,this.errorMsg.reload=!0):(this.data=e,this.consentNewsletterBefore=this.data?.consentNewsletter,this.consentMarketingBefore=this.data?.consentMarketing)}createBody(){return{consentNewsletter:!!this.data.consentNewsletter!=!!this.consentNewsletterBefore?this.data.consentNewsletter:void 0,consentMarketing:!!this.data.consentMarketing!=!!this.consentMarketingBefore?this.data.consentMarketing:void 0}}};s.\u0275fac=function(n){return new(n||s)},s.\u0275cmp=k({type:s,selectors:[["app-frontend-mail-consent"]],decls:5,vars:4,consts:[[1,"w-full","center-container-black","md:pt-3"],[1,"pl-2","pr-2","md:pl-3","md:pr-3"],[3,"active"],[3,"onReload","active","message"],[1,"py-2"],[3,"value","label","disabled"],[1,"py-2","flex","align-items-center","gap-2"],[3,"valueChange","value","label"],[1,"pt-2"],["icon","pi pi-save",3,"onClick","label","disabled","loading"]],template:function(n,i){n&1&&(d(0,"div",0)(1,"div",1),x(2,"app-loading",2),d(3,"app-message",3),C("onReload",function(){return i.loadD
1ata()}),o()(),u(4,K,17,23),o()),n&2&&(a(2),c("active",i.loading),a(),c("active",!!i.errorMsg)("message",i.errorMsg),a(),v(!i.loading&&!i.errorMsg&&i.data?4:-1))},dependencies:[O,I,P,R,F,V],encapsulation:2});let r=s;return r})();export{de as FrontendMailConsentComponent};
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.