2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
import{j as e}from"./query-vendor-BLVqILA6.js";import{c as j,r as m,L as i}from"./router-vendor-D4by-_6Z.js";import{T as f}from"./ThemeToggle-Cryh6OOS.js";import{o as w,j as k,F as h,n as p,c as x,m as l,X as N,q as _,v as C,U as D,l as u,P as b,w as R,b as T}from"./ui-vendor-CyRvbSfR.js";import"./react-vendor-CqRd3GwO.js";const S=[{id:"1",data:"2024-01-15",status:"aprovado",responsavel:"João Silva",atividades:5,ocorrencias:0},{id:"2",data:"2024-01-14",status:"aprovado",responsavel:"Maria Santos",atividades:3,ocorrencias:1},{id:"3",data:"2024-01-13",status:"enviado",responsavel:"Pedro Costa",atividades:4,ocorrencias:0},{id:"4",data:"2024-01-12",status:"rascunho",responsavel:"Ana Costa",atividades:2,ocorrencias:0},{id:"5",data:"2024-01-11",status:"aprovado",responsavel:"Carlos Lima",atividades:6,ocorrencias:2}],F=[{id:"1",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20concrete%20foundation%20work%20modern%20building&image_size=landscape_4_3",data:"2024-01-15",descricao:"Fundação do edifício"},{id:"2",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20workers%20steel%20structure%20building%20site&image_size=landscape_4_3",data:"2024-01-14",descricao:"Estrutura metálica"},{id:"3",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20concrete%20pouring%20workers%20safety%20equipment&image_size=landscape_4_3",data:"2024-01-13",descricao:"Concretagem da laje"},{id:"4",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20electrical%20installation%20modern%20building&image_size=landscape_4_3",data:"2024-01-12",descricao:"Instalações elétricas"},{id:"5",url:"https://trae-api-us.mchost.guru/api/ide/v1/text_to_image?prompt=construction%20site%20plumbing%20installation%20modern%20building&image_size=landscape_4_3",data:"2024-01-11",descricao:"Instalações hidráulicas"}],P=d=>{switch(d){case"aprovado":return e.jsx(x,{className:"w-4 h-4 text-green-500"});case"enviado":return e.jsx(T,{className:"w-4 h-4 text-yellow-500"});case"rascunho":return e.jsx(R,{className:"w-4 h-4 text-gray-500"});default:return null}},I=d=>{switch(d){case"aprovado":return"text-green-600 bg-green-100 dark:bg-green-900/30 dark:text-green-400";case"enviado":return"text-yellow-600 bg-yellow-100 dark:bg-yellow-900/30 dark:text-yellow-400";case"rascunho":return"text-gray-600 bg-gray-100 dark:bg-gray-700 dark:text-gray-400";default:return"text-gray-600 bg-gray-100"}};function z(){const{id:d}=j(),[o,y]=m.useState("info"),r={id:d||"1",nome:"Edifício Residencial Aurora",endereco:"Rua das Flores, 123 - Centro",descricao:"Edifício residencial de 15 andares com 120 apartamentos",dataInicio:"2023-06-01",dataPrevistaFim:"2024-12-31",progresso:75,status:"ativa",responsavel:"Eng. Carlos Mendes"},[c,g]=m.useState(!1),[t,n]=m.useState(r);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-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(i,{to:"/",className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors",children:e.jsx(w,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:r.nome}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300 flex items-center gap-1",children:[e.jsx(k,{className:"w-4 h-4"}),r.endereco]})]})]}),e.jsx(f,{})]}),e.jsx("div",{className:"flex gap-1 bg-gray-100 dark:bg-gray-700 rounded-xl p-1 overflow-x-auto scrollbar-hide",children:[{key:"info",label:"Informações",icon:h},{key:"rdos",label:"RDOs",icon:h},{key:"fotos",label:"Fotos",icon:p},{key:"tarefas",label:"Tarefas",icon:x}].map(({key:a,label:s,icon:v})=>e.jsxs("button",{onClick:()=>y(a),className:`flex-1 min-w-fit flex items-center justify-center gap-2 py-2 px-4 rounded-lg text-sm font-medium transition-all whitespace-nowrap ${o===a?"bg-white dark:bg-gray-600 text-blue-600 dark:text-blue-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:[e.jsx(v,{className:"w-4 h-4"}),s]},a))})]})}),e.jsxs("div",{className:"px-6 py-6",children:[o==="info"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{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",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Detalhes da Obra"}),e.jsx("div",{className:"flex items-center gap-2",children:c?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{g(!1),n(r)},className:"flex items-center gap-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:[e.jsx(N,{className:"w-4 h-4"}),"Cancelar"]}),e.jsxs("button",{onClick:()=>{Object.assign(r,t),g(!1)},className:"flex items-center gap-2 px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(_,{className:"w-4 h-4"}),"Salvar"]})]}):e.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-2 px-3 py-2 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(C,{className:"w-4 h-4"}),"Editar"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Descrição"}),c?e.jsx("textarea",{value:t.descricao,onChange:a=>n({...t,descricao:a.target.value}),"aria-label":"Descrição da obra",className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 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 resize-none",rows:3}):e.jsx("p",{className:"text-gray-900 dark:text-white",children:r.descricao})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Responsável"}),c?e.jsx("input",{type:"text",value:t.responsavel,onChange:a=>n({...t,responsavel:a.target.value}),"aria-label":"Responsável pela obra",className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 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"}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),r.responsavel]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Data de Início"}),c?e.jsx("input",{type:"text",value:t.dataInicio,onChange:a=>n({...t,dataInicio:a.target.value}),className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 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 s=a.currentTarget.value.replace(/\D/g,"");s.length>=2&&(s=s.slice(0,2)+"/"+s.slice(2)),s.length>=5&&(s=s.slice(0,5)+"/"+s.slice(5,7)),a.currentTarget.value=s}}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),new Date(r.dataInicio).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Previsão de Término"}),c?e.jsx("input",{type:"text",value:t.dataPrevistaFim,onChange:a=>n({...t,dataPrevistaFim:a.target.value}),className:"w-full mt-1 px-3 py-2 bg-white dark:bg-gray-700 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 s=a.currentTarget.value.replace(/\D/g,"");s.length>=2&&(s=s.slice(0,2)+"/"+s.slice(2)),s.length>=5&&(s=s.slice(0,5)+"/"+s.slice(5,7)),a.currentTarget.value=s}}):e.jsxs("p",{className:"text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),new Date(r.dataPrevistaFim).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Progresso"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 h-3 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${r.progresso}%`}})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r.progresso,"%"]})]})]})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(i,{to:`/obra/${r.id}/rdo/novo`,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(b,{className:"w-5 h-5"}),"Criar RDO"]}),e.jsxs(i,{to:`/obra/${r.id}/tarefas`,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 bg-gray-600 text-white rounded-xl hover:bg-gray-700 transition-colors",children:[e.jsx(x,{className:"w-5 h-5"}),"Ver Tarefas"]})]})]}),o==="rdos"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Histórico de RDOs"}),e.jsxs(i,{to:`/obra/${r.id}/rdo/novo`,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),"Novo RDO"]})]}),S.map((a,s)=>e.jsx(l.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:s*.1},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl p-4 border border-gray-200/50 dark:border-gray-700/50 shadow-lg",children:e.jsxs(i,{to:`/obra/${r.id}/rdo/${a.id}`,className:"block",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(h,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white",children:["RDO - ",new Date(a.data).toLocaleDateString("pt-BR")]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Por ",a.responsavel]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[P(a.status),e.jsx("span",{className:`px-2 py-1 rounded-lg text-xs font-medium ${I(a.status)}`,children:a.status.charAt(0).toUpperCase()+a.status.slice(1)})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:[a.atividades," atividades"]}),e.jsxs("span",{children:[a.ocorrencias," ocorrências"]})]})]})},a.id))]}),o==="fotos"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Galeria de Fotos"}),e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:[e.jsx(p,{className:"w-4 h-4"}),"Adicionar Foto"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:F.map((a,s)=>e.jsxs(l.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:s*.1},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-md rounded-2xl overflow-hidden border border-gray-200/50 dark:border-gray-700/50 shadow-lg hover:shadow-xl transition-all duration-300",children:[e.jsx("div",{className:"aspect-square overflow-hidden",children:e.jsx("img",{src:a.url,alt:a.descricao,className:"w-full h-full object-cover hover:scale-110 transition-transform duration-300"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white mb-1",children:a.descricao}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:new Date(a.data).toLocaleDateString("pt-BR")})]})]},a.id))})]}),o==="tarefas"&&e.jsxs(l.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Tarefas da Obra"}),e.jsx(i,{to:`/obra/${r.id}/tarefas`,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-colors",children:"Ver Todas"})]}),e.jsxs("div",{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 text-center",children:[e.jsx(x,{className:"w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Acesse a página de tarefas para ver o controle completo"})]})]})]})]})}export{z as default};
|