1import{a as H}from"./chunk-GVFN3SWO.js";import{a as v}from"./chunk-JCMV7ZHV.js";import{k as fe,m as X,n as Y,p as Z,u as he,x as ve}from"./chunk-QKTCHBQ6.js";import{b as ce,g as ue,i as Ce}from"./chunk-DFKZW7UB.js";import"./chunk-LHL6P6QN.js";import{La as j}from"./chunk-4EPKCIIO.js";import"./chunk-6CH5VT5Y.js";import{a as L,e as me,f as Q}from"./chunk-OQD4OI47.js";import{$ as w,S as pe,Y as _,_ as de}from"./chunk-VNDZELRY.js";import{B as q,H as V,f as O,h as G,i as D,j as N,m as k,o as F,s as B,t as A}from"./chunk-LDTCJEUT.js";import{a as h}from"./chunk-BDI22N23.js";import"./chunk-B5C5DYKA.js";import{l as se}from"./chunk-TGKGJDKC.js";import"./chunk-GUQO2XLO.js";import{Cc as J,Dd as le,Ea as x,Hb as P,Hc as l,Ic as c,Jc as g,Kc as ne,Nb as oe,Wb as y,Yb as b,bc as u,cc as a,dc as n,ec as K,ed as s,fd as p,kd as ae,ma as ie,mc as re,ob as r,qc as S,ra as d,sc as f,w as E,wc as I,xc as M,ya as U,yc as R,za as W}from"./chunk-7HY23MAY.js";import{i as C}from"./chunk-YOT3ZMHW.js";var T=class o{constructor(){this.http=d(se)}getCostCenters(i){return this.http.get(`management/edit-employee/${i}/cost-centers`)}changeCostCenter(i,e){let t={costCenterNumber:e};return this.http.put(`management/edit-employee/${i}/cost-center`,t)}changeStatus(i,e){let t={statusCode:e};return this.http.put(`management/edit-employee/${i}/status`,t)}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275prov=ie({token:o,factory:o.\u0275fac,providedIn:"root"})}};function Se(o,i){if(o&1&&(a(0,"div",7)(1,"label",8),l(2),s(3,"translate"),n(),a(4,"p",9),l(5),s(6,"translate"),n()(),a(7,"form",10)(8,"eb-combo-input",11),s(9,"formControl"),l(10),s(11,"translate"),n()()),o&2){let e=f();r(2),c(p(3,8,e.labelPrefix+"CurrentCostCenter")),r(3),c(e.currentName||p(6,10,e.labelPrefix+"NoCostCenter")),r(2),u("formGroup",e.formGroup),r(),u("control",e.costCenterControl)("options",e.costCenterOptions)("required",!0)("formControl",p(9,12,e.formGroup.controls.costCenter)),r(2),g(" ",p(11,14,e.labelPrefix+"NewCostCenter")," ")}}var $=class o{constructor(){this.changed=!1;this.formLoaded=!1;this.costCenterOptions=[];this.selectStyles={formGroupClasses:"col-md-12"};this.activeModal=d(L);this.editEmployeeService=d(T);this.translate=d(_);this.alertService=d(Q);this.destroyRef=d(x)}ngOnInit(){this.loadCostCenters()}confirm(){if(this.formGroup.markAllAsTouched(),this.formGroup.invalid)return;let i=Number(this.formGroup.controls.costCenter.value);this.editEmployeeService.changeCostCenter(this.employeeId,i).pipe(h(this.destroyRef)).subscribe({next:()=>C(this,null,function*(){this.changed=!0,yield this.alertService.open(this.labelPrefix+"ChangeCostCenterSuccess",this.labelPrefix+"ChangeCostCenterSuccessDescription"),this.closeModal()}),error:()=>C(this,null,function*(){yield this.alertService.open(this.labelPrefix+"ChangeCostCenterError",this.labelPrefix+"ChangeCostCenterErrorDescription")})})}closeModal(){this.activeModal.hide()}loadCostCenters(){return C(this,null,function*(){try{let i=yield E(this.editEmployeeService.getCostCenters(this.employeeId).pipe(h(this.destroyRef)));this.currentName=i.currentCostCenterName,this.costCenterOptions=(i.availableCostCenters??[]).map(t=>({value:String(t.costCenterNumber),title:t.costCenterName,search:t.costCenterName}));let e=yield E(this.translate.fetch([this.labelPrefix+"CostCenterPlaceholder"]).pipe(h(this.destroyRef)));this.costCenterControl={uniqueInputId:"costCenter",placeholder:e[this.labelPrefix+"CostCenterPlaceholder"],placeholderValue:-1,styleOptions:this.selectStyles},this.formGroup=new N({costCenter:new k("",{nonNullable:!0,validators:[O.required]})}),this.formLoaded=!0}catch{yield this.alertService.open(this.labelPrefix+"LoadCostCentersError",this.labelPrefix+"LoadCostCentersErrorDescription"),this.closeModal()}})}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275cmp=P({type:o,selectors:[["ebc-change-cost-center"]],inputs:{employeeId:"employeeId",labelPrefix:"labelPrefix"},decls:17,vars:14,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],["type","button",1,"btn","btn-secondary",3,"click"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"form-group"],["for","currentCostCenter"],["id","currentCostCenter",1,"font-weight-bold"],[3,"formGroup"],[3,"control","options","required","formControl"]],template:function(e,t){e&1&&(a(0,"div",0)(1,"div",1)(2,"h1",2),l(3),s(4,"translate"),n()(),a(5,"div",3)(6,"p"),l(7),s(8,"translate"),n(),y(9,Se,12,16),n(),a(10,"div",4)(11,"button",5),S("click",function(){return t.closeModal()}),l(12),s(13,"translate"),n(),a(14,"button",6),S("click",function(){return t.confirm()}),l(15),s(16,"translate"),n()()()),e&2&&(r(3),c(p(4,6,t.labelPrefix+"ChangeCostCenterModalTitle")),r(4),c(p(8,8,t.labelPrefix+"ChangeCostCenterModalDescription")),r(2),b(t.formLoaded?9:-1),r(3),g(" ",p(13,10,t.labelPrefix+"CloseModalBtn")," "),r(2),u("disabled",!t.formLoaded),r(),g(" ",p(16,12,t.labelPrefix+"ConfirmBtn")," "))},dependencies:[V,F,G,D,q,B,A,j,w,H],encapsulation:2})}};function ge(o,i){if(o&1&&(a(0,"div",7)(1,"label",8),l(2),s(3,"translate"),n(),a(4,"p",9),l(5),n()(),a(6,"form",10)(7,"eb-combo-input",11),s(8,"formControl"),l(9),s(10,"translate"),n()()),o&2){let e=f();r(2),c(p(3,8,e.labelPrefix+"CurrentStatus")),r(3),c(e.currentStatusName),r(),u("formGroup",e.formGroup),r(),u("control",e.statusControl)("options",e.statusOptions)("required",!0)("formControl",p(8,10,e.formGroup.controls.status)),r(2),g(" ",p(10,12,e.labelPrefix+"NewStatus")," ")}}var z=class o{constructor(){this.changed=!1;this.formLoaded=!1;this.statusOptions=[];this.selectStyles={formGroupClasses:"col-md-12"};this.activeModal=d(L);this.editEmployeeService=d(T);this.translate=d(_);this.alertService=d(Q);this.destroyRef=d(x)}static{this.AllowedStatuses=[40,150]}ngOnInit(){this.loadStatuses()}confirm(){if(this.formGroup.markAllAsTouched(),this.formGroup.invalid)return;let i=Number(this.formGroup.controls.status.value);this.editEmployeeService.changeStatus(this.employeeId,i).pipe(h(this.destroyRef)).subscribe({next:()=>C(this,null,function*(){this.changed=!0,yield this.alertService.open(this.labelPrefix+"ChangeStatusSuccess",this.labelPrefix+"ChangeStatusSuccessDescription"),this.closeModal()}),error:()=>C(this,null,function*(){yield this.alertService.open(this.labelPrefix+"ChangeStatusError",this.labelPrefix+"ChangeStatusErrorDescription")})})}closeModal(){this.activeModal.hide()}loadStatuses(){return C(this,null,function*(){this.currentStatusName=this.currentStatusCode!==null&&this.currentStatusCode!==void 0?v[this.currentStatusCode]+" ("+this.currentStatusCode+")":"-";let i=o.AllowedStatuses.map(t=>this.labelPrefix+"StatusOption_"+v[t]),e=yield E(this.translate.fetch([...i,this.labelPrefix+"StatusPlaceholder"]).pipe(h(this.destroyRef)));this.statusOptions=o.AllowedStatuses.map(t=>({value:String(t),title:e[this.labelPrefix+"StatusOption_"+v[t]],search:e[this.labelPrefix+"StatusOption_"+v[t]]})),this.statusControl={uniqueInputId:"status",placeholder:e[this.labelPrefix+"StatusPlaceholder"],placeholderValue:-1,styleOptions:this.selectStyles},this.formGroup=new N({status:new k("",{nonNullable:!0,validators:[O.required]})}),this.formLoaded=!0})}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275cmp=P({type:o,selectors:[["ebc-change-status"]],inputs:{employeeId:"employeeId",labelPrefix:"labelPrefix",currentStatusCode:"currentStatusCode"},decls:17,vars:14,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],["type","button",1,"btn","btn-secondary",3,"click"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"form-group"],["for","currentStatus"],["id","currentStatus",1,"font-weight-bold"],[3,"formGroup"],[3,"control","options","required","formControl"]],template:function(e,t){e&1&&(a(0,"div",0)(1,"div",1)(2,"h1",2),l(3),s(4,"translate"),n()(),a(5,"div",3)(6,"p"),l(7),s(8,"translate"),n(),y(9,ge,11,14),n(),a(10,"div",4)(11,"button",5),S("click",function(){return t.closeModal()}),l(12),s(13,"translate"),n(),a(14,"button",6),S("click",function(){return t.confirm()}),l(15),s(16,"translate"),n()()()),e&2&&(r(3),c(p(4,6,t.labelPrefix+"ChangeStatusModalTitle")),r(4),c(p(8,8,t.labelPrefix+"ChangeStatusModalDescription")),r(2),b(t.formLoaded?9:-1),r(3),g(" ",p(13,10,t.labelPrefix+"CloseModalBtn")," "),r(2),u("disabled",!t.formLoaded),r(),g(" ",p(16,12,t.labelPrefix+"ConfirmBtn")," "))},dependencies:[V,F,G,D,q,B,A,j,w,H],encapsulation:2})}};var Ee=["statusColumnTemplate"];function xe(o,i){if(o&1){let e=re();a(0,"eb-grid-wide-search",5,1),s(2,"translate"),a(3,"div",8),S("click",function(){U(e);let m=J(1);return W(m.doSearch())})("keydown.enter",function(){U(e);let m=J(1);return W(m.doSearch())}),a(4,"span",9),K(5,"i",10),n()()()}if(o&2){let e=f();u("grid",e.grid)("placeholderText",p(2,2,e.labelPrefix+"MasterSearchPlaceholder"))}}function Pe(o,i){if(o&1&&(a(0,"eb-grid",6)(1,"span",11),l(2),s(3,"translate"),n(),a(4,"div",12),l(5),s(6,"translate"),n()()),o&2){let e=f();u("columns",e.gridColumns)("dataSource",e.dataSource)("rowActions",e.gridActions)("selectRows",!1)("resetPageOnChanges",!0)("paginationType",e.DataSourcePaginationType.SKIP_TOP),r(2),c(p(3,8,e.labelPrefix+"GridLoading")),r(3),c(p(6,10,e.labelPrefix+"GridNoResults"))}}function _e(o,i){if(o&1&&l(0),o&2){let e=f().$implicit,t=f();ne(" ",t.RelationStatus[e.value]," (",e.value,") ")}}function we(o,i){o&1&&l(0," - ")}function Te(o,i){if(o&1&&y(0,_e,1,2)(1,we,1,0),o&2){let e=i.$implicit;b(e.value!==null&&e.value!==void 0?0:1)}}var te=class o{constructor(){this.labelPrefix="EditEmployee_Management_";this.DataSourcePaginationType=ue;this.RelationStatus=v;this.gridColumns=[];this.gridActions=[];this.gridInitialized=!1;this.translateService=d(_);this.modalService=d(me);
1this.cdRef=d(le);this.destroyRef=d(x);this.dataSource=new Ce("employeeId","management/edit-employee/overview","POST")}set setGrid(i){this.grid=i,this.cdRef.detectChanges()}set setSearch(i){this.gridSearch=i}ngOnInit(){this.prepareGrid()}prepareGrid(){return C(this,null,function*(){let i=yield E(this.translateService.fetch([this.labelPrefix+"Column_EmployerName",this.labelPrefix+"Column_ParticipantName",this.labelPrefix+"Column_ExternalRelationNumber",this.labelPrefix+"Column_Status",this.labelPrefix+"Action_ChangeCostCenter",this.labelPrefix+"Action_ChangeStatus"]).pipe(h(this.destroyRef))),e=Object.values(v).filter(t=>typeof t=="number").map(t=>({value:t,title:v[t]+" ("+t+")"}));this.gridColumns=[this.createTextColumn("employerName","EmployerName",i[this.labelPrefix+"Column_EmployerName"]),this.createTextColumn("participantName","ParticipantName",i[this.labelPrefix+"Column_ParticipantName"]),this.createTextColumn("externalRelationNumber","ExternalRelationNumber",i[this.labelPrefix+"Column_ExternalRelationNumber"]),{name:"StatusCode",title:i[this.labelPrefix+"Column_Status"],class:"no-underline",rowProperty:"statusCode",sorterComponent:Z,template:this.statusColumnTemplateRef,filterComponent:he,filterExcludeFromGridWideSearch:!0,filterOptions:{options:e,dataType:ce.NUMERIC}}],this.gridActions=[{title:i[this.labelPrefix+"Action_ChangeCostCenter"],icon:'<i class="fas fa-coins"></i>',isActive:t=>t.employerHasCostCenters,onClick:(t,m)=>{m(),this.openChangeCostCenter(t)}},{title:i[this.labelPrefix+"Action_ChangeStatus"],icon:'<i class="fas fa-edit"></i>',onClick:(t,m)=>{m(),this.openChangeStatus(t)}}],this.gridInitialized=!0})}createTextColumn(i,e,t){return{name:e,title:t,class:"no-underline",rowProperty:i,sorterComponent:Z,filterComponent:ve}}openChangeCostCenter(i){let e=this.modalService.show($,{initialState:{employeeId:i.employeeId,labelPrefix:this.labelPrefix},class:"modal-lg"});e.onHide.then(()=>C(this,null,function*(){e.ref?.content?.changed&&(yield this.grid?.refreshGrid(!0,!0))}))}openChangeStatus(i){let e=this.modalService.show(z,{initialState:{employeeId:i.employeeId,currentStatusCode:i.statusCode,labelPrefix:this.labelPrefix},class:"modal-lg"});e.onHide.then(()=>C(this,null,function*(){e.ref?.content?.changed&&(yield this.grid?.refreshGrid(!0,!0))}))}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275cmp=P({type:o,selectors:[["ebc-management-edit-employee"]],viewQuery:function(e,t){if(e&1&&(I(Ee,7),I(X,5),I(Y,5)),e&2){let m;M(m=R())&&(t.statusColumnTemplateRef=m.first),M(m=R())&&(t.setGrid=m.first),M(m=R())&&(t.setSearch=m.first)}},decls:10,vars:7,consts:[["statusColumnTemplate",""],["gridSearch",""],[1,"intro"],[3,"ebTranslate"],[1,"d-flex","mb-4"],[1,"ml-auto","justify-content-end","input-group",3,"grid","placeholderText"],[3,"columns","dataSource","rowActions","selectRows","resetPageOnChanges","paginationType"],[3,"ebTemplateRef"],["role","button","tabindex","0",1,"input-group-append","cursor-pointer",3,"click","keydown.enter"],[1,"input-group-text","bg-dark","text-light","border-dark"],[1,"fas","fa-search"],["ebGridLoader",""],[1,"empty"]],template:function(e,t){e&1&&(a(0,"section",2)(1,"h1"),l(2),s(3,"translate"),n(),K(4,"p",3),n(),a(5,"div",4),y(6,xe,6,4,"eb-grid-wide-search",5),n(),y(7,Pe,7,12,"eb-grid",6),oe(8,Te,2,1,"ng-template",7,0,ae)),e&2&&(r(2),c(p(3,5,t.labelPrefix+"PageTitle")),r(2),u("ebTranslate",t.labelPrefix+"PageDescription"),r(2),b(t.gridInitialized?6:-1),r(),b(t.gridInitialized?7:-1),r(),u("ebTemplateRef",t.statusColumnTemplateRef))},dependencies:[de,X,Y,fe,pe,w],encapsulation:2})}};export{te as default};
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.