1import{j as e}from"./ui-916dc9d9.js";import{E as v}from"./EmptyPageGeneric-231f5a18.js";import{E as y}from"./ErrorRequestGeneric-6f936de2.js";import{b as N}from"./SkeletonsPortal-4886f27c.js";import{t as D,f as C,al as I,ap as P,J as S,j as k,a7 as A,V as T,H as E,a as M,aq as V}from"./index-a2ab00f7.js";import{I as F}from"./IconSaxArrowRightOutline-7369b4da.js";import{F as u}from"./PayInvoiceDrawerPortal-e5577e90.js";import{r as h}from"./vendor-aea060b0.js";import{m as L}from"./motion-b076d11a.js";import{e as Z}from"./CreditCardPaymentError-8e6ac17e.js";import{P as z}from"./PortalContent-6223febd.js";import{P as H}from"./PortalWrapperContent-90cda8af.js";import"./pdf-viewer-9b371a90.js";import"./useInvoicePixStatus-31b26f1f.js";import"./index-a3437bd6.js";import"./index-72cc605b.js";import"./IconCircleCheck-18392a9c.js";import"./EmbedPortalProvider-0af06648.js";import"./InvoiceInRecurrenceInfo-c3e1be5d.js";import"./IconBrandWhatsapp-ae42609f.js";import"./HelmetTitle-a7f2b938.js";import"./luxon-cc86f6dc.js";import"./QuickAccess-82f37059.js";import"./PaymentMethodConfig-665a382d.js";import"./AutomaticPixQrCode-f44b7341.js";import"./IconCircleX-8a9b6a2a.js";import"./swiper-442b9b58.js";import"./scroll-area-bfdb2458.js";import"./IconCirclePlus-1533132d.js";import"./FloatAlertSignContract-d00ee0ae.js";function j(s){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...s,children:[e.jsx("path",{opacity:"0.4",d:"M17.0833 8.49175H14.675C12.7 8.49175 11.0917 6.88341 11.0917 4.90841V2.50008C11.0917 2.04175 10.7167 1.66675 10.2583 1.66675H6.72501C4.15834 1.66675 2.08334 3.33341 2.08334 6.30842V13.6917C2.08334 16.6667 4.15834 18.3334 6.72501 18.3334H13.275C15.8417 18.3334 17.9167 16.6667 17.9167 13.6917V9.32508C17.9167 8.86675 17.5417 8.49175 17.0833 8.49175Z",fill:"#171717"}),e.jsx("path",{d:"M13.1667 1.84158C12.825 1.49991 12.2333 1.73325 12.2333 2.20825V5.11658C12.2333 6.33325 13.2667 7.34158 14.525 7.34158C15.3167 7.34991 16.4167 7.34991 17.3583 7.34991C17.8333 7.34991 18.0833 6.79158 17.75 6.45825C16.55 5.24991 14.4 3.07491 13.1667 1.84158ZM10.2333 12.2666C10.1157 12.1503 9.95703 12.0852 9.79167 12.0852C9.62631 12.0852 9.46762 12.1503 9.35 12.2666L8.75 12.8666V9.37491C8.75 9.03325 8.46667 8.74991 8.125 8.74991C7.78334 8.74991 7.5 9.03325 7.5 9.37491V12.8666L6.9 12.2666C6.78239 12.1503 6.62369 12.0852 6.45834 12.0852C6.29298 12.0852 6.13428 12.1503 6.01667 12.2666C5.775 12.5082 5.775 12.9082 6.01667 13.1499L7.68334 14.8166C7.69167 14.8249 7.7 14.8249 7.7 14.8332C7.75 14.8832 7.81667 14.9249 7.88334 14.9582C7.96667 14.9832 8.04167 14.9999 8.125 14.9999C8.20834 14.9999 8.28334 14.9832 8.35834 14.9499C8.43334 14.9166 8.5 14.8749 8.56667 14.8166L10.2333 13.1499C10.475 12.9082 10.475 12.5082 10.2333 12.2666Z",fill:"#171717"})]})}function w(s){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...s,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e.jsx("path",{opacity:"0.4",d:"M17.7083 7.62506C15.7833 4.60006 12.9667 2.8584 9.99999 2.8584C8.51666 2.8584 7.07499 3.29173 5.75832 4.10007C4.44166 4.91673 3.25832 6.1084 2.29166 7.62506C1.45832 8.9334 1.45832 11.0584 2.29166 12.3667C4.21666 15.4001 7.03332 17.1334 9.99999 17.1334C11.4833 17.1334 12.925 16.7001 14.2417 15.8917C15.5583 15.0751 16.7417 13.8834 17.7083 12.3667C18.5417 11.0667 18.5417 8.9334 17.7083 7.62506ZM9.99999 13.3667C8.13332 13.3667 6.63332 11.8584 6.63332 10.0001C6.63332 8.14173 8.13332 6.6334 9.99999 6.6334C11.8667 6.6334 13.3667 8.14173 13.3667 10.0001C13.3667 11.8584 11.8667 13.3667 9.99999 13.3667Z",fill:"#171717"}),e.jsx("path",{d:"M9.99834 7.6167C9.36734 7.6167 8.76219 7.86736 8.31601 8.31354C7.86983 8.75972 7.61917 9.36487 7.61917 9.99587C7.61917 10.6269 7.86983 11.232 8.31601 11.6782C8.76219 12.1244 9.36734 12.375 9.99834 12.375C11.3067 12.375 12.3817 11.3084 12.3817 10C12.3817 8.6917 11.3067 7.6167 9.99834 7.6167Z",fill:"#171717"})]})}function b({status:s,documentId:t}){const n=s===1?"bg-supportWarning":"bg-supportsuccess",r=s===1?"text-warning":"text-success",o=s===1?"Assinar":"Assinado",p=t!=null&&t!=="",i=l=>{window.location.href=`/documents/${l}`};return p&&s===1?e.jsx("div",{className:`flex flex-row items-center gap-2 ${s===1?"cursor-pointer":""}`,onClick:()=>i(t),children:e.jsx("div",{className:"px-3 py-2 rounded "+n,children:e.jsx("div",{className:"text-xs leading-[130%] uppercase "+r,children:o})})}):e.jsx("div",{className:"flex flex-row items-center gap-2",children:e.jsx("div",{className:"px-3 py-2 rounded "+n,children:e.jsx("div",{className:"text-xs leading-[130%] uppercase "+r,children:o})})})}function O({document:s}){const[t,n]=h.useState(!1),[r,o]=h.useState("download"),{isExtraLargeScreen:p}=D(),i=C(a=>a.contracts.activeContract),[l,m]=h.useState(!1),c=localStorage.getItem("7azAppMode")??!1,d=localStorage.getItem("7azFrontToken");function x(a="download"){t||(n(!0),o(a),c?(I({type:"download",api:window.location.origin,endpoint:`/api/contracts/${(s==null?void 0:s.erpContractId)??(i==null?void 0:i.id)}/documents/${s==null?void 0:s.id}/pdf`,token:d}),setTimeout(()=>{n(!1)},5e3)):P((s==null?void 0:s.erpContractId)??(i==null?void 0:i.id),s==null?void 0:s.id).then(g=>{a==="download"?u.downloadFile(g,s.name,"application/pdf"):u.openFile(g,"application/pdf"),n(!1)}).catch(g=>{n(!1)}).finally(()=>n(!1)))}return e.jsxs(e.Fragment,{children:[p&&e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl lg:w-full max-w-screen-xxl p-4 mt-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center justify-start gap-4 lg:max-w-[680px]",children:[e.jsx("div",{className:"font-bold text-sm text-gray-900 line-clamp-1",children:s.name}),e.jsx(b,{status:s==null?void 0:s.status,documentId:s==null?void 0:s.id})]}),e.jsxs("div",{className:"flex gap-2 ",children:[e.jsxs("div",{className:"flex text-sm leading-6 bg-neutral-100 items-center gap-2 p-3 border border-gray-100 cursor-pointer rounded-lg hover:bg-neutral-200",onClick:a=>{a.stopPropagation(),x("download")},children:[e.jsx(j,{className:"w-6 h-6 "}),t&&r==="download"?"Carregando...":" Download"]}),e.jsxs("div",{className:"flex text-sm leading-6 items-center gap-2 p-3 bg-neutral-100 border border-gray-100 cursor-pointer rounded-lg hover:bg-neutral-200",onClick:a=>{a.stopPropagation(),x("open")},children:[e.jsx(w,{className:"w-6 h-6 "}),t&&r==="open"?"Carregando...":"Visualizar"]})]})]})}),!p&&e.jsxs("div",{className:"bg-white border border-gray-200 rounded flex flex-col items-center justify-center w-full p-3 mb-4",onClick:()=>m(a=>!a),children:[e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex flex-row gap-3 justify-between w-full max-w-[95%] items-center pr-3",children:[e.jsx("div",{className:"text-sm leading-[130%] font-bold text-neutral-900 line-clamp-2",children:s.name}),e.jsx(b,{status:s==null?void 0:s.status,documentId:s==null?void 0:s.id})]}),e.jsx("div",{className:"border-gray-200 flex gap-3",children:e.jsx(L.div,{animate:{rotate:l?180:0},transition:{duration:.3},className:"flex flex-row items-center justify-center",children:e.jsx(F,{className:"w-3 h-4 stroke-defaultTextDark"})})})]}),l&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs("div",{className:"flex text-sm leading-6 items-center gap-2 px-2 py-1 border bg-neutral-100 border-gray-100 cursor-pointer rounded",onClick:a=>{a.stopPropagation(),x("download")},children:[e.jsx(j,{className:"w-6 h-6 "}),t&&r==="download"?"Carregando...":"Download"]}),e.jsxs("div",{className:"flex text-sm leading-6 items-center gap-2 p-3 border bg-neutral-100 border-gray-100 cursor-pointer rounded",onClick:a=>{a.stopPropagation(),x("open")},children:[e.jsx(w,{className:"w-6 h-6 "}),t&&r==="open"?"Carregando...":"Visualizar"]})]})]})]})}function W(){return{companyId:S.getInstance().getCompanyId()??null}}function $(){const s=k(),{isPortalApp:t}=A(s),{isMultiTenant:n}=T(),{permissions:r}=E(),o=C(a=>a.contracts.activeContract),[p,i]=h.useState(!1),l=C(a=>a.contracts.contracts),{companyId:m}=W(),{data:c,isLoading:d,error:x}=M(["getDocumentsPage",o==null?void 0:o.id,p],async({queryKey:a})=>{if(!(r!=null&&r.viewContractDocuments))return[];const g=await V();return a[2]?g.data.filter(f=>(f==null?void 0:f.erpContractId)!==void 0):g.data.filter(f=>(f==null?void 0:f.erpContractId)===a[1])},{refetchOnWindowFocus:!1,refetchOnMount:!1,enabled:!!((o==null?void 0:o.id)!==void 0&&(r!=null&&r.viewContractDocuments))});return h.useEffect(()=>{m&&m==="6856b6af-17ab-4711-948c-359788eeb327"&&i(!0)},[m]),e.jsxs(e.Fragment,{children:[d&&e.jsx(N,{}),!d&&e.jsxs(e.Fragment,{children:[t&&l&&(l==null?void 0:l.length)>1&&!d&&!n&&e.jsx("div",{className:"mb-2",children:e.jsx(Z,{label:"Todos os contratos",value:p,setter:i})}),c==null?void 0:c.map(a=>e.jsx(O,{document:a},a==null?void 0:a.id))]}),!d&&x&&e.jsx(y,{message:"Erro ao carregar os documentos"}),!d&&!x&&(c==null?void 0:c.length)==0&&e.jsx("div",{className:"mt-4",children:e.jsx(v,{message:"Não há documentos disponÃveis."})})]})}function je(){return e.jsx(H,{pageTitle:"Meus documentos",children:e.jsx(z,{quickAccess:!1,children:e.jsx($,{})})})}export{je as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.