1import{a as I,b as se}from"./chunk-TKHDAPN6.js";import{a as Y}from"./chunk-4NEG7OVH.js";import{b as Z,c as ee,d as te,e as ie,g as ne,h as oe,i as re,j as ae,m as me}from"./chunk-T4EAU4LF.js";import"./chunk-2TEF2TZJ.js";import"./chunk-QTCFFNBM.js";import"./chunk-3RK6DDJD.js";import"./chunk-LKMMAAB3.js";import"./chunk-APYRT7RB.js";import{a as Q,b as X}from"./chunk-ZHQN3VEY.js";import"./chunk-ZPP3AZII.js";import"./chunk-PFZE4HOT.js";import"./chunk-7WBI3YQQ.js";import"./chunk-HRMEW5GN.js";import"./chunk-5CJCHN2S.js";import"./chunk-FNI7RJRZ.js";import"./chunk-QMIXMJPI.js";import"./chunk-N27IYGCO.js";import"./chunk-6EQVF4ZV.js";import"./chunk-IQUHMA37.js";import"./chunk-3CNZLL2W.js";import{b as K}from"./chunk-H4YBLBJJ.js";import{a as G,c as H}from"./chunk-2OVOW2RQ.js";import"./chunk-7WYL3NSW.js";import"./chunk-5JZO6BWG.js";import"./chunk-YSPZQPOC.js";import"./chunk-XT2LPE6R.js";import"./chunk-IQG3TZRO.js";import"./chunk-FGG2KBZO.js";import"./chunk-UQ4USSF2.js";import{c as U,d as W}from"./chunk-YAJ3K7JW.js";import"./chunk-24UDROAB.js";import"./chunk-3LLHTMOC.js";import"./chunk-LL35JMVY.js";import{j as A,o as M,p as J}from"./chunk-32UQG7L5.js";import{k as w}from"./chunk-TJ3TBAF4.js";import"./chunk-6ZS3PTEB.js";import"./chunk-CS4JSWOF.js";import{k as R,y as z}from"./chunk-VMAYYK2O.js";import{Aa as p,Ba as _,Cb as v,Gc as $,Ic as j,Jb as O,Kb as b,Lc as l,Mc as B,Nc as S,Pb as h,Yb as P,ec as u,fc as a,gc as m,hc as D,jd as T,kd as q,nc as L,oc as C,od as F,qa as E,qb as d,t as x,ua as V,uc as g,wc as s}from"./chunk-OF5PZF73.js";import{a as N,b as k,p as f}from"./chunk-JMI2PEGB.js";function pe(t,i){if(t&1&&(a(0,"div",7),D(1,"app-spinner-overlay",8),m()),t&2){let o=s();d(),u("showSpinner",o.isLoading)}}function _e(t,i){if(t&1){let o=C();a(0,"button",9),g("click",function(){p(o);let e=s();return _(e.addNode(null))}),a(1,"mat-icon"),l(2," add "),m()()}}function ue(t,i){if(t&1){let o=C();a(0,"mat-tree-node",10),l(1),T(2,"translate"),a(3,"button",9),g("click",function(){let e=p(o).$implicit,r=s();return _(r.deleteCategory(e))}),a(4,"mat-icon"),l(5,"remove"),m()(),a(6,"button",9),g("click",function(){let e=p(o).$implicit,r=s();return _(r.addNode(e))}),a(7,"mat-icon"),l(8,"add"),m()(),a(9,"button",9),g("click",function(){let e=p(o).$implicit,r=s();return _(r.editNode(e))}),a(10,"mat-icon"),l(11,"edit"),m()(),a(12,"button",9),g("click",function(){let e=p(o).$implicit,r=s();return _(r.transferItems(e))}),a(13,"mat-icon"),l(14,"multiple_stop"),m()()()}if(t&2){let o=i.$implicit;d(),S(" ",q(2,1,o.name)," ")}}function ge(t,i){if(t&1&&(a(0,"div"),l(1),T(2,"translate"),m()),t&2){let o=s().$implicit;d(),S(" ",q(2,1,o.name)," ")}}function fe(t,i){if(t&1&&(a(0,"strong"),l(1),T(2,"translate"),m()),t&2){let o=s().$implicit;d(),B(q(2,1,o.name))}}function Ce(t,i){if(t&1){let o=C();a(0,"button",9),g("click",function(){p(o);let e=s().$implicit,r=s();return _(r.deleteCategory(e))}),a(1,"mat-icon"),l(2,"remove"),m()()}}function he(t,i){if(t&1){let o=C();a(0,"button",9),g("click",function(){p(o);let e=s().$implicit,r=s();return _(r.editNode(e))}),a(1,"mat-icon"),l(2,"edit"),m()()}}function xe(t,i){if(t&1){let o=C();a(0,"button",9),g("click",function(){p(o);let e=s().$implicit,r=s();return _(r.transferItems(e))}),a(1,"mat-icon"),l(2,"multiple_stop"),m()()}}function ye(t,i){if(t&1){let o=C();a(0,"mat-nested-tree-node")(1,"div",11)(2,"button",12)(3,"mat-icon",13),l(4),m()(),h(5,ge,3,3,"div",14)(6,fe,3,3,"ng-template",null,0,F)(8,Ce,3,0,"button",3),a(9,"button",9),g("click",function(){let e=p(o).$implicit,r=s();return _(r.addNode(e))}),a(10,"mat-icon"),l(11,"add"),m()(),h(12,he,3,0,"button",3)(13,xe,3,0,"button",3),m(),a(14,"div",15),L(15,16),m()()}if(t&2){let o=i.$implicit,n=$(7),e=s();d(2),P("aria-label","Toggle "+o.name),d(2),S(" ",e.treeControl.isExpanded(o)?"expand_more":"chevron_right"," "),d(),u("ngIf",o.parentEquipmentCategoryId!==null)("ngIfElse",n),d(3),u("ngIf",!e.hasChild),d(4),u("ngIf",o.parentEquipmentCategoryId!==null),d(),u("ngIf",!e.hasChild),d(),j("equipment-tree-invisible",!e.treeControl.isExpanded(o))}}var le=(()=>{let i=class i{constructor(n,e,r){this.equipmentService=n,this.snackbarDialogService=e,this.dialogService=r,this.dataState=V(J),this.isLoading=!1,this.treeControl=new Z(c=>c.children),this.dataSource=new me,this.hasChild=(c,y)=>!!y.children&&y.children.length>0}ngOnInit(){this.isLoading=!0,this.fetchCategories(),this.isLoading=!1}fetchCategories(){return f(this,null,function*(){let n=[...this.dataState.equipmentCategories()];
1this.categoryTree=[{name:"Produktkategorien",parentEquipmentCategoryId:null,children:n}],M(this.categoryTree[0]),this.dataSource.data=this.categoryTree,this.treeControl.dataNodes=this.categoryTree,this.treeControl.expandAll()})}deleteCategory(n){return f(this,null,function*(){n&&(this.isLoading=!0,yield x(this.equipmentService.deleteEquipmentCategoryById({id:n.id})).then(()=>this.fetchCategories()).catch(e=>{this.snackbarDialogService.showError(e)}).finally(()=>this.isLoading=!1))})}addNode(n){return f(this,null,function*(){let e={height:"auto",width:"600px",showSaveButton:!0,dialogTitle:"Produktkategorie hinzuf\xFCgen"};this.dialogService.open(I,{parentCategoryId:n?n.id:null},e).afterClosed().pipe().subscribe(c=>f(this,null,function*(){c&&(this.isLoading=!0,yield x(this.equipmentService.addOrUpdateEquipmentCategory$Json({body:c.equipmentForm.value})).then(()=>this.fetchCategories()).finally(()=>this.isLoading=!1).catch(()=>this.isLoading=!1))}))})}transferItems(n){let e={height:"auto",width:"auto",showSaveButton:!0};M({children:this.categoryTree}),this.dialogService.open(se,{category:n,categories:this.categoryTree},e).afterClosed().pipe().subscribe(c=>f(this,null,function*(){c&&(yield x(this.equipmentService.transferEquipmentCategory({idFrom:n.id,idTo:c.transferForm.get("to").value?.id})).then(()=>this.fetchCategories()).finally(()=>this.isLoading=!1).catch(()=>this.isLoading=!1))}))}editNode(n){return f(this,null,function*(){let e={height:"auto",width:"600px",showSaveButton:!0,dialogTitle:"Produktkategorie bearbeiten"};this.dialogService.open(I,{prefilledData:n},e).afterClosed().pipe().subscribe(c=>f(this,null,function*(){if(c){this.isLoading=!0;let y=k(N({},c.equipmentForm.value),{id:n.id});yield x(this.equipmentService.addOrUpdateEquipmentCategory$Json({body:y}
1)).then(()=>this.fetchCategories()).finally(()=>this.isLoading=!1).catch(()=>this.isLoading=!1)}}))})}};i.\u0275fac=function(e){return new(e||i)(v(A),v(K),v(Y))},i.\u0275cmp=O({type:i,selectors:[["app-equipment-category-editor"]],standalone:!1,decls:6,vars:5,consts:[["strong",""],["class","fixed inset-0 flex items-center justify-center bg-white/70 z-50",4,"ngIf"],[1,"mt-4"],["mat-icon-button","",3,"click",4,"ngIf"],[1,"equipment-tree",3,"dataSource","treeControl"],["matTreeNodeToggle","",4,"matTreeNodeDef"],[4,"matTreeNodeDef","matTreeNodeDefWhen"],[1,"fixed","inset-0","flex","items-center","justify-center","bg-white/70","z-50"],[3,"showSpinner"],["mat-icon-button","",3,"click"],["matTreeNodeToggle",""],[1,"mat-tree-node"],["mat-icon-button","","matTreeNodeToggle",""],[1,"mat-icon-rtl-mirror"],[4,"ngIf","ngIfElse"],["role","group"],["matTreeNodeOutlet",""]],template:function(e,r){e&1&&(h(0,pe,2,1,"div",1),a(1,"div",2),h(2,_e,3,0,"button",3),a(3,"mat-tree",4),h(4,ue,15,3,"mat-tree-node",5)(5,ye,16,9,"mat-nested-tree-node",6),m()()),e&2&&(u("ngIf",r.isLoading),d(2),u("ngIf",r.treeControl&&r.treeControl.dataNodes&&r.treeControl.dataNodes.length===0),d(),u("dataSource",r.dataSource)("treeControl",r.treeControl),d(2),u("matTreeNodeDefWhen",r.hasChild))},dependencies:[R,ie,te,re,oe,ee,ne,Q,G,U],styles:[".equipment-tree-invisible[_ngcontent-%COMP%]{display:none}.equipment-tree[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], .equipment-tree[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-top:0;margin-bottom:0;list-style-type:none}.equipment-tree[_ngcontent-%COMP%] .mat-tree-node[_ngcontent-%COMP%]{padding-left:10px}.equipment-tree[_ngcontent-%COMP%] .mat-nested-tree-node[_ngcontent-%COMP%] div[role=group][_ngcontent-%COMP%]{padding-left:30px}.equipment-tree[_ngcontent-%COMP%] div[role=group][_ngcontent-%COMP%] > .mat-tree-node[_ngcontent-%COMP%]{padding-left:50px}"]});let t=i;return t})();var Ee=[{path:"",component:le}],ce=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=b({type:i}),i.\u0275inj=E({imports:[w.forChild(Ee),w]});let t=i;return t})();var Ye=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=b({type:i}),i.\u0275inj=E({imports:[z,ae,X,H,W.forChild(),ce]});let t=i;return t})();export{Ye as EquipmentCategoryEditorModule};
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.