import{$ as p,r as m,A as g,h as f,W as r,fS as x,j as e,F as h,aa as b,o as C,a6 as y,aJ as E,O as $,aF as j}from"./index-28356639.js";const v="https://archt.com.ar",w="quo",S=`${v}/${w}/Engine?paquete=wf&clase=ExportaTramites&metodo=getExportadorCols&data=&parametros=`,F=async()=>(await p.get(`${S}`)).data.data,O="https://archt.com.ar",T="quo",q=`${O}/${T}/Engine?paquete=wf&clase=ExportaTramites&metodo=setColsExportador&data=&parametros=`,U=async(t,s)=>(await p.get(`${q}${JSON.stringify({empId:t,data:s})}`)).data,k=()=>{const{empresaActual:t}=m.useContext(g),{watch:s,reset:n,control:c,handleSubmit:d,formState:A}=f({defaultValues:{columnas:[]}});m.useEffect(()=>{F().then(o=>{console.log("data",o);const a=Object.entries(o.config).map(([i,u])=>({...u,visible:u.visible!==0}));n({columnas:a})}).catch(o=>{r.error("Hubo un error al recuperar configuración de columnas"),console.error(o)})},[]);const{fields:l}=x({control:c,name:"columnas"});return console.log("fields",l),e(h,{children:e(b,{children:C("form",{style:{marginTop:"1em"},onSubmit:d(async o=>{console.log("data",o);let a={};a.config=o.columnas,console.log("obj",a);try{(await U(t==null?void 0:t.empId,a)).success?r.success("Configuración guardada con éxito"):r.error("Ocurrió un error al guardar configuración, por favor reintente")}catch{}}),children:[e(y,{textAlign:"left",style:{marginBottom:"10px"},children:e(E,{label:"Columnas visibles en el exportador de bandeja"})}),e("div",{style:{marginBottom:"10px"},children:l.map((o,a)=>e("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",alignItems:"flex-end"},children:e($,{control:c,name:`columnas.${a}.visible`,type:"checkbox",label:o.columna})},`input-group-${a}`))}),e("div",{style:{marginTop:"1.5em"},children:e(j,{type:"submit",variant:"contained",sx:{color:"white"},children:"Guardar Cambios"})})]})})})};export{k as default};
