2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
import{j as e}from"./query-vendor-BLVqILA6.js";import{r as d}from"./router-vendor-D4by-_6Z.js";import{T as S}from"./ThemeToggle-Cryh6OOS.js";import{S as G,d as p,A as x,m as l,l as j,B as D,F as g,W as E,ae as z,C as k,U,b as I,T as B,c as P,e as M,f as q,a3 as v,ao as L,M as O,ap as $}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const V=[{id:"1",title:"Relatório de Obras",description:"Status geral das obras em andamento",type:"obras",icon:D,data:{total:15,em_andamento:8,concluidas:5,pausadas:2,progresso_medio:67},lastGenerated:"2024-01-15T10:30:00",status:"updated"},{id:"2",title:"Relatório de RDOs",description:"Análise dos relatórios diários de obra",type:"rdos",icon:g,data:{total_mes:124,pendentes:8,aprovados:110,rejeitados:6,media_diaria:4.1},lastGenerated:"2024-01-15T09:15:00",status:"updated"},{id:"3",title:"Relatório de Equipamentos",description:"Status e utilização dos equipamentos",type:"equipamentos",icon:E,data:{total:45,em_uso:32,disponivel:8,manutencao:3,inativo:2,taxa_utilizacao:71},lastGenerated:"2024-01-15T08:45:00",status:"updated"},{id:"4",title:"Relatório de Produtividade",description:"Análise de produtividade por obra e equipe",type:"produtividade",icon:z,data:{eficiencia_media:85,horas_trabalhadas:1240,atividades_concluidas:89,atrasos:12,meta_mensal:95},lastGenerated:"2024-01-15T07:20:00",status:"outdated"},{id:"5",title:"Relatório Financeiro",description:"Custos e orçamentos das obras",type:"financeiro",icon:k,data:{orcamento_total:125e5,gasto_atual:875e4,economia:125e3,obras_no_orcamento:12,obras_acima_orcamento:3},lastGenerated:"2024-01-14T16:30:00",status:"outdated"},{id:"6",title:"Relatório de Usuários",description:"Atividade e engajamento dos usuários",type:"usuarios",icon:U,data:{total_usuarios:28,ativos_mes:24,novos_cadastros:3,ultimo_acesso_medio:2,rdos_por_usuario:4.4},lastGenerated:"2024-01-15T11:00:00",status:"updated"}],i={updated:{label:"Atualizado",color:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",icon:P},outdated:{label:"Desatualizado",color:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300",icon:B},generating:{label:"Gerando...",color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",icon:I}},W=[{id:"pdf",label:"PDF",icon:g},{id:"excel",label:"Excel",icon:k},{id:"csv",label:"CSV",icon:g}];function Y(){const[u,N]=d.useState(null),[n,f]=d.useState(!1),[m,w]=d.useState("pdf"),[b,y]=d.useState({dateRange:{start:"2024-01-01",end:"2024-01-31"},obras:[],status:[],usuarios:[]}),[_,h]=d.useState([]),o=a=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(a),R=a=>new Date(a).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),T=async a=>{h(t=>[...t,a]),setTimeout(()=>{h(t=>t.filter(c=>c!==a))},3e3)},C=(a,t)=>{},F=({report:a})=>{const t=a.icon,c=i[a.status].icon,r=_.includes(a.id);return e.jsxs(l.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-6 border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center",children:e.jsx(t,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-lg",children:a.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.description})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${r?i.generating.color:i[a.status].color}`,children:[e.jsx(c,{className:"w-3 h-3"}),r?"Gerando...":i[a.status].label]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[a.type==="obras"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.em_andamento}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Em Andamento"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:[a.data.progresso_medio,"%"]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Progresso Médio"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600 dark:text-orange-400",children:a.data.concluidas}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Concluídas"})]})]}),a.type==="rdos"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total_mes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total do Mês"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.aprovados}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Aprovados"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.data.pendentes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Pendentes"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:a.data.media_diaria}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Média Diária"})]})]}),a.type==="equipamentos"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.data.total}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.data.em_uso}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Em Uso"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:[a.data.taxa_utilizacao,"%"]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Taxa Utilização"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.data.manutencao}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Manutenção"})]})]}),a.type==="financeiro"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"col-span-2 text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:o(a.data.orcamento_total)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Orçamento Total"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:o(a.data.gasto_atual)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Gasto Atual"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:o(a.data.economia)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Economia"})]})]}),(a.type==="produtividade"||a.type==="usuarios")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:a.type==="produtividade"?`${a.data.eficiencia_media}%`:a.data.total_usuarios}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Eficiência":"Total Usuários"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:a.type==="produtividade"?a.data.atividades_concluidas:a.data.ativos_mes}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Atividades":"Ativos"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:a.type==="produtividade"?a.data.horas_trabalhadas:a.data.novos_cadastros}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Horas":"Novos"})]}),e.jsxs("div",{className:"text-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400",children:a.type==="produtividade"?a.data.atrasos:a.data.rdos_por_usuario}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:a.type==="produtividade"?"Atrasos":"RDOs/Usuário"})]})]})]}),e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Última atualização: ",R(a.lastGenerated)]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>N(u===a.id?null:a.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-900/50 transition-colors",children:[e.jsx(M,{className:"w-4 h-4"}),"Visualizar"]}),e.jsxs("button",{onClick:()=>T(a.id),disabled:r,className:"flex items-center justify-center gap-2 px-4 py-2 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 rounded-lg hover:bg-green-200 dark:hover:bg-green-900/50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[r?e.jsx(l.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:e.jsx(q,{className:"w-4 h-4"})}):e.jsx(v,{className:"w-4 h-4"}),r?"Gerando...":"Gerar"]})]}),e.jsx(x,{children:u===a.id&&e.jsxs(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Exportar Relatório"}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-3",children:W.map(s=>{const A=s.icon;return e.jsxs("button",{onClick:()=>w(s.id),className:`flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${m===s.id?"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-300 dark:border-blue-600":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[e.jsx(A,{className:"w-4 h-4"}),s.label]},s.id)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>C(a.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(v,{className:"w-4 h-4"}),"Exportar ",m.toUpperCase()]}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx(L,{className:"w-4 h-4"})}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx("button",{className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:e.jsx($,{className:"w-4 h-4"})})]})]})})]})};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:[e.jsx("div",{className:"bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-700/50",children:e.jsxs("div",{className:"px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Relatórios"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Análises e relatórios consolidados do sistema"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(G,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:"Buscar relatórios...",className:"pl-12 pr-4 py-3 bg-white/50 dark:bg-gray-700/50 border border-gray-300 dark:border-gray-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent w-64"})]}),e.jsx(S,{}),e.jsxs("button",{onClick:()=>f(!n),className:`flex items-center gap-2 px-6 py-3 rounded-xl border transition-colors ${n?"bg-blue-100 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300":"bg-white/50 dark:bg-gray-700/50 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600"}`,children:[e.jsx(p,{className:"w-5 h-5"}),"Filtros Avançados"]})]})]}),e.jsx(x,{children:n&&e.jsxs(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-white/50 dark:bg-gray-700/50 rounded-xl p-4 mb-6 border border-gray-200 dark:border-gray-600",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(j,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Data Início"]}),e.jsx("input",{type:"text",value:b.dateRange.start,onChange:a=>y(t=>({...t,dateRange:{...t.dateRange,start:a.target.value}})),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let t=a.currentTarget.value.replace(/\D/g,"");t.length>=2&&(t=t.slice(0,2)+"/"+t.slice(2)),t.length>=5&&(t=t.slice(0,5)+"/"+t.slice(5,7)),a.currentTarget.value=t}})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(j,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Data Fim"]}),e.jsx("input",{type:"text",value:b.dateRange.end,onChange:a=>y(t=>({...t,dateRange:{...t.dateRange,end:a.target.value}})),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"dd/mm/aa",maxLength:8,onInput:a=>{let t=a.currentTarget.value.replace(/\D/g,"");t.length>=2&&(t=t.slice(0,2)+"/"+t.slice(2)),t.length>=5&&(t=t.slice(0,5)+"/"+t.slice(5,7)),a.currentTarget.value=t}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Obras"}),e.jsxs("select",{className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Todas as obras"}),e.jsx("option",{value:"1",children:"Edifício Residencial Aurora"}),e.jsx("option",{value:"2",children:"Centro Comercial Plaza"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx(p,{className:"w-4 h-4 text-gray-400 dark:text-gray-500 inline mr-2"}),"Status"]}),e.jsxs("select",{className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Todos os status"}),e.jsx("option",{value:"updated",children:"Atualizado"}),e.jsx("option",{value:"outdated",children:"Desatualizado"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{className:"px-4 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:"Limpar Filtros"}),e.jsx("button",{className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Aplicar Filtros"})]})]})})]})}),e.jsx("div",{className:"px-6 py-6",children:e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:e.jsx(x,{children:V.map(a=>e.jsx(F,{report:a},a.id))})})})]})}export{Y as default};
|