import{a2 as p,r as m,A as g,h as f,Y as r,gn as h,j as e,F as x,ah as b,o as C,ab as y,aP as E,O as $,aL as j}from"./index-e47c07e2.js";const v="https://archt.com.ar",w="quo",S=`${v}/${w}/Engine?paquete=wf&clase=ExportaTramites&metodo=getExportadorCols&data=&parametros=`,O=async()=>(await p.get(`${S}`)).data.data,T="https://archt.com.ar",q="quo",F=`${T}/${q}/Engine?paquete=wf&clase=ExportaTramites&metodo=setColsExportador&data=&parametros=`,L=async(t,s)=>(await p.get(`${F}${JSON.stringify({empId:t,data:s})}`)).data,k=()=>{const{empresaActual:t}=m.useContext(g),{watch:s,reset:n,control:c,handleSubmit:d,formState:U}=f({defaultValues:{columnas:[]}});m.useEffect(()=>{O().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}=h({control:c,name:"columnas"});return console.log("fields",l),e(x,{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 L(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};
