import{i as n}from"./emotion-use-insertion-effect-with-fallbacks.browser.esm-6809063d.js";import{a as e,B as r,j as s,F as x}from"./Tooltip-ae8d7992.js";import{C as f,a as g}from"./Slide-2a94fa39.js";import{i as F,j as y,k as b,b as w,T as l,Q as C,E as L}from"./index-dfa17bed.js";/* empty css                  */import{a as T}from"./abrirPDF-ed56ab2a.js";import{L as j}from"./Loader-45efafef.js";const A=async o=>{const{data:i}=await F.post(`${y}/${b}/rest/firma/docsFirmados`,{idFirma:o});return i},{useState:p}=await n("react"),D=await n("react"),{Button:S,List:k,ListItem:B,ListItemIcon:I,ListItemText:$}=await n("@mui/material"),O=o=>{const{authFirma:i,unAuthenticateSignature:c}=w();if(!i)return c(o.tipo);const[d,u]=p([]),[h,m]=p(!0);return D.useEffect(()=>{const t=JSON.parse(localStorage.getItem("authFirma"));(async()=>{m(!0);try{const a=await A(t.idFirma);a.success?u(a.documentos):a.success||L.error(a.msg)}catch{}finally{m(!1)}})()},[]),e(r,{sx:{backgroundColor:"#F4F5FA",height:"100dvh"},children:e(f,{maxWidth:"xl",children:s(r,{children:[e(r,{width:"100%",display:"flex",justifyContent:"right",children:e(S,{sx:{marginTop:"1em"},variant:"contained",size:"small",onClick:()=>c(o.tipo),children:"Salir"})}),s(r,{width:"100%",sx:{paddingTop:"2em",display:"flex"},children:[e(r,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:e(l,{level:"h1",gutterBottom:!0,component:"h1",children:"Documentos firmados"})}),e(g,{})]}),e(r,{width:"100%",sx:{marginTop:"1em"},children:h?e(j,{}):e(x,{children:d.length?e(k,{sx:{backgroundColor:"#FFF",padding:"0.5em",borderRadius:"2px",boxShadow:"rgba(149, 157, 165, 0.2) 0px 8px 24px"},children:d.map(t=>s(B,{sx:{borderRadius:"2px",backgroundColor:"#FAFAF9",marginY:"0.5em"},secondaryAction:e("span",{style:{borderBottom:"1px solid rgb(8 141 245)",color:"rgb(8 141 245)",cursor:"pointer"},onClick:()=>T(t.urlTemp,"tset"),children:"Ver"}),children:[e(I,{children:e(C,{sx:{color:"#D72219"}})}),e($,{primary:`${t.nombre}.pdf`,secondary:`${t.descripcion} - ${t.fecha?t.fecha:""}`})]}))}):e(l,{sx:{marginTop:"2em"},textAlign:"center",children:"No hay documentos firmados"})})})]})})})};export{O as default};
