import{$ as p,r as m,A as g,h as f,W as r,fI as x,j as e,F as h,a9 as b,o as C,a6 as y,aI as E,O as $,aE as j}from"./index-7722cded.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=`,I=async(a,s)=>(await p.get(`${F}${JSON.stringify({empId:a,data:s})}`)).data,L=()=>{const{empresaActual:a}=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 t=Object.entries(o.config).map(([i,u])=>({...u,visible:u.visible!==0}));n({columnas:t})}).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 t={};t.config=o.columnas,console.log("obj",t);try{(await I(a==null?void 0:a.empId,t)).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,t)=>e("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",alignItems:"flex-end"},children:e($,{control:c,name:`columnas.${t}.visible`,type:"checkbox",label:o.columna})},`input-group-${t}`))}),e("div",{style:{marginTop:"1.5em"},children:e(j,{type:"submit",variant:"contained",sx:{color:"white"},children:"Guardar Cambios"})})]})})})};export{L as default};
