import{S as z,f as W,p as U,q as Y}from"./chunk-JPMLUYPC.js";import{C as M,D as T,G as L,H as D,J as j}from"./chunk-XLTCISYS.js";import{Ca as O,Da as H,Ea as G,Ha as q,ya as V}from"./chunk-TV2MZFBF.js";import{b as F,d as J}from"./chunk-R5GBW5HQ.js";import{C as B,c as A,h as N,n as k,p as x,y as w}from"./chunk-FY6HFFAL.js";import{Ac as p,Ea as b,Kb as n,Lb as s,Mb as f,S,Tb as g,gc as c,hc as y,ib as l,ic as h,jb as a,jc as _,mc as C,nc as E,oc as I,pd as P,rc as R,va as v,ya as u,zc as m}from"./chunk-3NIPUOIR.js";var K=(()=>{class i{constructor(t,e){this.httpClient=t,this.commonHttpErrorService=e}saveLogRetentionSettings(t,e){let o=`retention/${e}`,r={retentionPeriod:t};return this.httpClient.post(o,r).pipe(S(this.commonHttpErrorService.handleError))}static{this.\u0275fac=function(e){return new(e||i)(u(P),u(F))}}static{this.\u0275prov=v({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ht=(()=>{class i{constructor(t,e,o,r,d,Q){this.data=t,this.dialogRef=e,this.securityService=o,this.logRetentionService=r,this.translationService=d,this.toastrService=Q,this.subscribeCompanyProfile()}subscribeCompanyProfile(){this.securityService.companyProfile.subscribe(t=>{this.companyProfile=t,this.retentionPeriod=this.data.type==="login-audit-log-setting"?t.loginAuditRetentionPeriod:this.data.type==="email-log-setting"?t.emailLogRetentionPeriod:this.data.type==="cron-job-log-setting"?t.cronJobLogRetentionPeriod:null})}closeDialog(){this.dialogRef.close()}saveSettings(){this.logRetentionService.saveLogRetentionSettings(this.retentionPeriod,this.data.type).subscribe(()=>{this.toastrService.success(this.translationService.getValue("RETENTION_SETTINGS_SUCCESSFULLY_SAVED")),this.data.type==="login-audit-log-setting"?this.companyProfile.loginAuditRetentionPeriod=this.retentionPeriod:this.data.type==="email-log-setting"?this.companyProfile.emailLogRetentionPeriod=this.retentionPeriod:this.data.type==="cron-job-log-setting"&&(this.companyProfile.cronJobLogRetentionPeriod=this.retentionPeriod),this.securityService.updateProfile(this.companyProfile),this.closeDialog()})}static{this.\u0275fac=function(e){return new(e||i)(a(T),a(M),a(J),a(K),a(G),a(V))}}static{this.\u0275cmp=b({type:i,selectors:[["app-logs-retention-settings"]],standalone:!0,features:[R],decls:24,vars:16,consts:[[1,"d-flex"],["mat-dialog-title","",1,"dialog-title"],["mat-icon-button","",1,"close-button","ms-auto",3,"click"],["color","warn",1,"close-icon"],[1,"col-md-8"],[1,"form-label"],["type","number","min","1",1,"form-control",3,"ngModelChange","ngModel"],[1,"row"],[1,"col-md-8","mt-2"],[1,"btn","btn-success","btn-sm","m-r-10",3,"click"],["name","save",1,"small-icon"],[1,"btn","btn-danger","btn-sm",3,"click"],["name","x-circle",1,"small-icon"]],template:function(e,o){e&1&&(n(0,"div",0)(1,"span",1),c(2),m(3,"translate"),s(),n(4,"button",2),g("click",function(){return o.closeDialog()}),n(5,"mat-icon",3),c(6,"close"),s()()(),n(7,"mat-dialog-content")(8,"div",4)(9,"label",5),c(10),m(11,"translate"),m(12,"translate"),s(),n(13,"input",6),I("ngModelChange",function(d){return E(o.retentionPeriod,d)||(o.retentionPeriod=d),d}),s()(),n(14,"div",7)(15,"div",8)(16,"button",9),g("click",function(){return o.saveSettings()}),f(17,"i-feather",10),c(18),m(19,"translate"),s(),n(20,"button",11),g("click",function(){return o.closeDialog()}),f(21,"i-feather",12),c(22),m(23,"translate"),s()()()()),e&2&&(l(2),y(p(3,6,"RETENTION_SETTINGS")),l(8),_("",p(11,8,"RETENTION_PERIOD")," (",p(12,10,"DAY"),")"),l(3),C("ngModel",o.retentionPeriod),l(5),h(" ",p(19,12,"SAVE"),""),l(4),h(" ",p(23,14,"CANCEL"),""))},dependencies:[H,O,Y,U,B,A,x,N,w,k,j,L,D,z,q,W]})}}return i})();export{ht as a};
