import{U as u,u as h,j as r,N as f,r as i,B as t,l as n,z as x,F as g,L as F,H as y,t as b}from"./index-57016b76.js";import{D as L}from"./Divider-03534251.js";import{a as C}from"./abrirPDF-eff5ea84.js";import{L as w,d as D}from"./PictureAsPdf-126488ed.js";import{b as T,p as A}from"./env-198ff0f3.js";import{C as S}from"./Container-fe1ab53f.js";import{T as d}from"./Typography-5c6b5f62.js";import{L as j}from"./ListItemIcon-cdc64cd8.js";import{L as v}from"./ListItemText-3dfae1c8.js";import"./createContainer-80c97b9d.js";import"./useThemeProps-dc4c84f8.js";import"./useSlot-7545b28c.js";const k=async a=>{const{data:s}=await u.post(`${T}/${A}/rest/firma/docsFirmados`,{idFirma:a});return s},V=()=>{const{authFirma:a,unAuthenticateSignature:s}=h();if(!a)return r(f,{to:"/firma-verificar"});const[m,l]=i.useState([]),[p,c]=i.useState(!0);return i.useEffect(()=>{const e=JSON.parse(localStorage.getItem("authFirma"));(async()=>{c(!0);try{const o=await k(e.idFirma);o.success?l(o.documentos):o.success||b.error(o.msg)}catch{}finally{c(!1)}})()},[]),r(t,{sx:{backgroundColor:"#F4F5FA",height:"100dvh"},children:r(S,{maxWidth:"xl",children:n(t,{children:[r(t,{width:"100%",display:"flex",justifyContent:"right",children:r(x,{sx:{marginTop:"1em"},variant:"contained",size:"small",onClick:s,children:"Salir"})}),n(t,{width:"100%",sx:{paddingTop:"2em",display:"flex"},children:[r(t,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:r(d,{level:"h1",gutterBottom:!0,component:"h1",children:"Documentos firmados"})}),r(L,{})]}),r(t,{width:"100%",sx:{marginTop:"1em"},children:p?r(w,{}):r(g,{children:m.length?r(F,{sx:{backgroundColor:"#FFF",padding:"0.5em",borderRadius:"2px",boxShadow:"rgba(149, 157, 165, 0.2) 0px 8px 24px"},children:m.map(e=>n(y,{sx:{borderRadius:"2px",backgroundColor:"#FAFAF9",marginY:"0.5em"},secondaryAction:r("span",{style:{borderBottom:"1px solid rgb(8 141 245)",color:"rgb(8 141 245)",cursor:"pointer"},onClick:()=>C(e.urlTemp,"tset"),children:"Ver"}),children:[r(j,{children:r(D,{sx:{color:"#D72219"}})}),r(v,{primary:`${e.nombre}.pdf`,secondary:`${e.descripcion} - ${e.fecha?e.fecha:""}`})]}))}):r(d,{sx:{marginTop:"2em"},textAlign:"center",children:"No hay documentos firmados"})})})]})})})};export{V as default};
