import{i as u}from"./emotion-use-insertion-effect-with-fallbacks.browser.esm-2ce7a1bc.js";import{a as o,F as g,j as f}from"./Tooltip-5ec3092e.js";import{i as p,A as h,h as x,z as r,ad as b,O as C,x as y}from"./index-76588cc8.js";const E="https://archt.com.ar",$="quo",j=`${E}/${$}/Engine?paquete=wf&clase=ExportaTramites&metodo=getExportadorCols&data=&parametros=`,v=async()=>(await p.get(`${j}`)).data.data,w="https://archt.com.ar",S="quo",A=`${w}/${S}/Engine?paquete=wf&clase=ExportaTramites&metodo=setColsExportador&data=&parametros=`,O=async(a,s)=>(await p.get(`${A}${JSON.stringify({empId:a,data:s})}`)).data,{Container:T,Divider:q,Chip:F}=await u("@mui/material"),{useContext:U,useEffect:B}=await u("react"),D=()=>{const{empresaActual:a}=U(h),{watch:s,reset:n,control:c,handleSubmit:d,formState:L}=x({defaultValues:{columnas:[]}});B(()=>{v().then(e=>{console.log("data",e);const t=Object.entries(e.config).map(([l,m])=>({...m,visible:m.visible!==0}));n({columnas:t})}).catch(e=>{r.error("Hubo un error al recuperar configuración de columnas"),console.error(e)})},[]);const{fields:i}=b({control:c,name:"columnas"});return console.log("fields",i),o(g,{children:o(T,{children:f("form",{style:{marginTop:"1em"},onSubmit:d(async e=>{console.log("data",e);let t={};t.config=e.columnas,console.log("obj",t);try{(await O(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:[o(q,{textAlign:"left",style:{marginBottom:"10px"},children:o(F,{label:"Columnas visibles en el exportador de bandeja"})}),o("div",{style:{marginBottom:"10px"},children:i.map((e,t)=>o("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",alignItems:"flex-end"},children:o(C,{control:c,name:`columnas.${t}.visible`,type:"checkbox",label:e.columna})},`input-group-${t}`))}),o("div",{style:{marginTop:"1.5em"},children:o(y,{type:"submit",variant:"contained",sx:{color:"white"},children:"Guardar Cambios"})})]})})})};export{D as default};
