PageSourceSearch

https://portal.cosemsmg.org.br/assets/RelatorioUsuarios.cc8c1df4.js

js cosemsmg.org.br collected 2026-10-04 13:59:58 UTC 3,718 bytes, 1 lines download raw bytes

1import{r as s,l as r,Y as O,j as a,a6 as I,Z as L,$ as b,a0 as i,a7 as g,a1 as v,aO as S,a8 as y}from"./index.5c93ad43.js";import{a as w,av as T}from"./App.8ad1f1a5.js";import{m as F}from"./request.64a6c93d.js";const $="https://api.cosemsmg.org.br",C=`${$}/api/relatorio-usuarios`;async function j(n){return(await w.post(`${C}/get`,n)).data}async function k(n){return(await w.post(`${C}/`,n)).data}async function G(n){return(await w.downloadPdf(`${C}/pdf`,n)).data}const R={getDados:j,getCsv:k,getPdf:G};function q(){const n="Relat\xF3rio Usu\xE1rios",[u,A]=s.exports.useState([]),[d,x]=s.exports.useState([]),[p,l]=s.exports.useState(!1),[t,m]=s.exports.useState({tipo:"",municipio:"",nome:""}),E=[{value:"",label:"Todos"},{value:"DIRETORIA",label:"Secret\xE1rio de Sa\xFAde"},{value:"APOIADOR_REGIONAL",label:"Apoiador Regional"},{value:"EQUIPE",label:"Equipe"},{value:"PROFISSIONAL_EXTERNO",label:"Profissional Externo"},{value:"USUARIO_PADRAO",label:"Usu\xE1rio padr\xE3o"}];s.exports.useEffect(()=>{async function e(){const c=await F.getAllMunicipios();A(c.data||[])}e()},[]),s.exports.useEffect(()=>{d.length>0&&x([])},[t]);function h(){return{tipo:t.tipo||null,municipio:t.municipio||null,nome:t.nome||null}}async function N(){try{l(!0);const e=await R.getDados(h());x(e)}catch(e){console.log(e)}finally{l(!1)}}async function P(){try{l(!0);const e=await R.getCsv(h()),c=new Blob([e],{type:"application/text/csv"}),f=window.URL.createObjectURL(c),o=document.createElement("a");o.href=f,o.setAttribute("download","relatorio_usuarios.csv"),document.body.appendChild(o),o.click(),o.parentNode.removeChild(o)}catch(e){console.log(e)}finally{l(!1)}}async function U(){try{l(!0);const e=await R.getPdf(h()),c=new Blob([e],{type:"application/pdf"}),f=window.URL.createObjectURL(c),o=document.createElement("a");o.href=f,o.setAttribute("download","relatorio_usuarios.pdf"),document.body.appendChild(o),o.click(),o.parentNode.removeChild(o)}catch(e){console.log(e)}finally{l(!1)}}const D=[{name:"CPF",sortable:!0,selector:e=>e.cpf},{name:"Nome",sortable:!0,wrap:!0,selector:e=>e.nome},{name:"Data Nascimento",sortable:!0,selector:e=>e.dataNascimento},{name:"Telefone",sortable:!0,selector:e=>e.telefone},{name:"Email",sortable:!0,wrap:!0,selector:e=>e.email},{name:"Munic\xEDpio de Atua\xE7\xE3o",sortable:!0,wrap:!0,selector:e=>e.municipioAtuacao}];return r(s.exports.Fragment,{children:[r(O,{children:[a(I,{children:a("div",{className:"content-header",children:a("h5",{className:"mb-0",children:n})})}),r(L,{children:[r(b,{children:[r(i,{md:3,children:[a(g,{children:"Tipo"}),a(v,{type:"select",value:t.tipo,onChange:e=>m({...t,tipo:e.target.value}),children:E.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),r(i,{md:3,children:[a(g,{children:"Munic\xEDpio"}),r(v,{type:"select",value:t.municipio,onChange:e=>m({...t,municipio:e.target.value}),children:[a("option",{value:"",children:"Todos os munic\xEDpios"}),u.map(e=>a("option",{value:e.id,children:e.nome},e.id))]})]}),r(i,{md:4,children:[a(g,{children:"Nome"}),a(S,{children:a(v,{value:t.nome,onChange:e=>m({...t,nome:e.target.value}),placeholder:"Digite o nome do usu\xE1rio"})})]})]}),a(b,{children:a(i,{className:"mt-1",children:a(y,{color:"primary",disabled:p,onClick:N,children:"Gerar"})})})]})]}),a(T,{itensPerPage:10,noHeader:!0,search:!1,columns:D,className:"react-dataTable",data:d,noDataComponent:!0}),r(b,{style:{width:"400px"},children:[a(i,{className:"mt-1",children:a(y,{outline:!0,color:"primary",disabled:p||d.length<=0,onClick:P,children:"Gerar Relat\xF3rio CSV"})}),a(i,{className:"mt-1",children:a(y,{outline:!0,color:"danger",disabled:p||d.length<=0,onClick:U,children:"Gerar Relat\xF3rio PDF"})})]})]})}export{q 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.