PageSourceSearch

https://artefatospro.com.br/assets/decisoes-B3siZqje.js

js artefatospro.com.br collected 2026-09-24 14:34:57 UTC 11,112 bytes, 2 lines download raw bytes

1import{r as d,j as e}from"./vendor-react-O1HtssjF.js";import{a as P,u as D,b as F}from"./vendor-query-C57Ujfuk.js";import{u as H,d as T,e as E,P as K,B as u,I as U,r as R,O as W,Q as G,M as J,s as Y,R as X,U as Z,V as ee}from"./index-DE-2a8lD.js";import{F as se,a as te}from"./FilterBar-ChyvzrUr.js";import{Q as ae}from"./QueryErrorState-yJLjEIb2.js";import{E as ie}from"./EmptyState-yGty-Krw.js";import{u as re,a as oe,P as le}from"./Paginacao-DRgzifQ-.js";import{p as ne,A as ce}from"./acesso-na-tela-CDSWhdlZ.js";import{P as de,ac as k,a4 as A,a3 as z,af as me,e as ve}from"./vendor-icons-2dxAfxR_.js";import"./vendor-radix-Cn4zZLa9.js";import"./vendor-datefns-RsZNnTnu.js";import"./vendor-openai-PX4_LG7y.js";import"./Select--eowR-J1.js";import"./error-messages-izhQU6MT.js";import"./acesso-projeto-BvV9qzfo.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new s.Error().stack;l&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[l]="f7b94f01-8cf5-488b-9b5b-98435ec92000",s._sentryDebugIdIdentifier="sentry-dbid-f7b94f01-8cf5-488b-9b5b-98435ec92000")}catch{}})();const y=["/api/decisions"];function L(s){if(!s)return"-";const l=new Date(s);return Number.isNaN(l.getTime())?"-":l.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})}function Te(){const s=P(),[,l]=H(),[r,m]=d.useState("all"),[t,a]=d.useState(""),[n,c]=d.useState(null),[h,o]=d.useState(!1),{data:j,isLoading:O,isError:B,error:M,refetch:q}=D({queryKey:y}),{data:x=[]}=D({queryKey:["/api/projects"]}),b=d.useMemo(()=>ne(x),[x]),N=b.length>0,v=(j==null?void 0:j.decisions)??[],S=t!==""||r!=="all",p=d.useMemo(()=>v.filter(i=>(r==="all"||i.projectId===r)&&(!t||i.title.toLowerCase().includes(t.toLowerCase())||(i.projectName??"").toLowerCase().includes(t.toLowerCase()))),[v,r,t]),Q=re(44),C=oe(p,Q),g=d.useMemo(()=>{const i=v.length,_=v.filter(f=>!!f.meetingId).length,$=v.filter(f=>!!f.projectId).length;return{total:i,deReuniao:_,comProjeto:$}},[v]),w=()=>s.invalidateQueries({queryKey:y}),{toast:V}=T(),I=F({mutationFn:async i=>(await E("POST","/api/decisions",i)).json(),onSuccess:()=>{w(),o(!1)},onError:()=>V({title:"Erro ao salvar decisão",description:"Tente novamente.",variant:"destructive"})});return e.jsxs(K,{children:[e.jsxs("div",{className:"v2-page-head",children:[e.jsxs("div",{className:"v2-page-head-title",children:[e.jsx("h1",{children:"Log de Decisões"}),e.jsxs("div",{className:"v2-sub",children:["Registro permanente das decisões do projeto · cada decisão guarda o link para a ",e.jsx("strong",{children:"reunião de origem"})]})]}),e.jsx("div",{className:"v2-page-head-actions",children:e.jsx(u,{leftIcon:e.jsx(de,{className:"h-4 w-4"}),onClick:()=>o(!0),disabled:!N,title:N?void 0:ce,children:"Nova decisão"})})]}),e.jsxs("div",{className:"v2-kpis",style:{gridTemplateColumns:"repeat(3, 1fr)"},children:[e.jsxs("div",{className:"v2-kpi",children:[e.jsx("div",{className:"v2-kpi-label",children:"Decisões registradas"}),e.jsx("div",{className:"v2-kpi-value",children:g.total})]}),e.jsxs("div",{className:"v2-kpi",children:[e.jsx("div",{className:"v2-kpi-label",children:"De reuniões"}),e.jsx("div",{className:"v2-kpi-value",children:g.deReuniao})]}),e.jsxs("div",{className:"v2-kpi",children:[e.jsx("div",{className:"v2-kpi-label",children:"Vinculadas a projeto"}),e.jsx("div",{className:"v2-kpi-value",children:g.comProjeto})]})]}),e.jsx(se,{className:"v2-mb-4",value:{projectId:r==="all"?null:r},onChange:i=>m(i.projectId??"all"),projects:x.map(i=>({id:i.id,name:R(i)})),onClear:()=>{a(""),m("all")},hasActiveFilters:S,slots:e.jsx(te,{label:"Buscar",children:e.jsx(U,{type:"search",placeholder:"Decisão ou projeto…","aria-label":"Buscar decisão",value:t,onChange:i=>a(i.target.value)})})}),e.jsxs("div",{style:{fontSize:12,color:"var(--v2-text-subtle)",marginBottom:8},children:[p.length," decis",p.length!==1?"ões":"ão",p.length!==v.length?` (de ${v.length})`:""]}),B?e.jsx(ae,{error:M,recurso:"as decisões",onRetry:()=>q()}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{rows:C.itens,onOpen:c,loading:O,temFiltroAt
1ivo:S,navigate:l}),e.jsx(le,{estado:C,rotulo:"decisões"})]}),e.jsx(W,{open:!!n,onOpenChange:i=>!i&&c(null),children:e.jsx(G,{className:"v2-scope",style:{width:460,maxWidth:"90vw"},children:n&&e.jsx(pe,{decision:n,onChanged:()=>{w(),c(null)},navigate:l})})}),e.jsx(J,{open:h,onClose:()=>o(!1),title:"Nova decisão",size:"md",children:e.jsx(he,{projects:b,onCancel:()=>o(!1),onCreate:i=>I.mutate(i),submitting:I.isPending})})]})}function ue({rows:s,onOpen:l,loading:r,temFiltroAtivo:m,navigate:t}){return e.jsx("div",{className:"v2-t-wrap",children:e.jsxs("table",{className:"v2-clean",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Decisão"}),e.jsx("th",{style:{width:180},children:"Projeto"}),e.jsx("th",{style:{width:110},children:"Data"}),e.jsx("th",{style:{width:180},children:"Origem"})]})}),e.jsxs("tbody",{children:[s.map(a=>e.jsxs("tr",{onClick:()=>l(a),children:[e.jsx("td",{style:{fontWeight:500,maxWidth:360},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(k,{className:"h-3.5 w-3.5",style:{color:"var(--v2-color-primary-700)",flexShrink:0}}),a.title]})}),e.jsx("td",{children:a.projectName?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:12.5},children:[e.jsx(A,{className:"h-3 w-3",style:{color:"var(--v2-color-primary-700)"}}),a.projectName]}):e.jsx("span",{style:{fontSize:"var(--v2-text-xs)",color:"var(--v2-text-subtle)",fontStyle:"italic"},children:"sem projeto"})}),e.jsx("td",{style:{fontFamily:"var(--v2-font-mono)",fontSize:12,color:"var(--v2-text-muted)"},children:L(a.decidedAt)}),e.jsx("td",{children:a.meetingId?e.jsxs("button",{className:"v2-link-btn",onClick:n=>{n.stopPropagation(),t(`/minhas-reunioes?meeting=${a.meetingId}`)},style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:12,color:"var(--v2-color-primary-700)",background:"none",border:"none",cursor:"pointer",padding:0},children:[e.jsx(z,{className:"h-3 w-3"}),a.meetingTitle??"Reunião"]}):e.jsx("span",{style:{fontSize:"var(--v2-text-xs)",color:"var(--v2-text-subtle)"},children:a.source==="manual"?"Registro manual":"-"})})]},a.id)),s.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:e.jsx(ie,{icon:e.jsx(k,{className:"h-6 w-6"}),hasActiveFilters:m,title:r?"Carregando…":"Nenhuma decisão registrada ainda",description:r?void 0:e.jsxs(e.Fragment,{children:['Use "Nova decisão" acima para registrar a primeira, ou aprove um fato do tipo ',e.jsx("strong",{children:"Decisão"}),' em "Para revisar".']}),filteredTitle:r?"Carregando…":"Nenhuma decisão com esses filtros",filteredDescription:r?void 0:'Nenhuma decisão combina com a busca ou o projeto escolhido. Use "Limpar" acima para ver todas.'})})})]})]})})}function pe({decision:s,onChanged:l,navigate:r}){const m=P(),t=()=>{m.invalidateQueries({queryKey:y}),l()},{toast:a}=T(),n=Y(),c=F({mutationFn:async()=>(await E("DELETE",`/api/decisions/${s.id}`)).json(),onSuccess:t,onError:()=>a({title:"Erro ao remover",description:"Tente novamente.",variant:"destructive"})});return e.jsxs(e.Fragment,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Detalhe da decisão"})}),e.jsxs("div",{style:{overflowY:"auto",flex:1,paddingTop:8},children:[e.jsxs("div",{style:{fontSize:"var(--v2-text-xs)",fontFamily:"var(--v2-font-mono)",textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--v2-text-subtle)",marginBottom:6,display:"flex",alignItems:"center",gap:6},children:[e.jsx(A,{className:"h-3 w-3",style:{color:"var(--v2-color-primary-700)"}}),s.projectName??"Sem projeto"," · ",L(s.decidedAt)]}),e.jsx("div",{style:{fontSize:15,fontWeight:500,lineHeight:1.45,marginBottom:12},children:s.title}),s.body&&e.jsx("p",{style:{margin:"0 0 16px",fontSize:13,color:"var(--v2-text-muted)",lineHeight:1.55},children:s.body}),s.meetingId&&e.jsxs("div",{style:{padding:"10px 12px",borderRadius:8,border:"1px solid var(--v2-color-ink-100)",background:"var(--v2-surface)",marginBottom:16},children:[e.jsx("div",{className:"v2-eyebrow",style:{fontSize:"var(--v2-text-xs)",marginBottom:6},children:"Origem"}),e.jsxs("button",{onClick:()=>r(`/minhas-reunioes?meeting=${s.meetingId}`),style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,color:"var(--v2-color-primary-700)",background:"none",border:"none",cursor:"pointer",padding:0},children:[e.jsx(z,{className:"h-3.5 w-3.5"}),s.meetingTitle??"Ver reunião de origem",e.jsx(me,{className:"h-3 w-3"})]})]})]}),e.jsxs(ee,{style:{marginTop:16,display:"flex",justifyContent:"space-between"},children:[e.jsx(u,{variant:"ghost",leftIcon:e.jsx(ve,{className:"h-4 w-4"}),onClick:async()=>{await n({title:"Remover decisão",message:"Remover esta decisão? Esta ação não pode ser desfeita.",confirmLabel:"Remover",destructive:!0})&&c.mutate()},disabled:c.isPending,children:"Remover"}),s.projectId&&e.jsx(u,{onClick:()=>r(`/dashboards/pm?project=${s.projectId}`),children:"Ver projeto →"})]})]})}function he({projects:s,onCancel:l,onCreate:r,submitting:m}){const[t,a]=d.useState({title:"",body:"",projectId:"",decidedAt:new Date().toISOString().slice(0,10)}
1),[n,c]=d.useState(""),h=()=>{if(!t.title.trim()){c("Descreva a decisão");return}r({title:t.title.trim(),body:t.body.trim()||null,projectId:t.projectId||null,decidedAt:t.decidedAt||null})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"v2-col v2-gap-4",children:[e.jsxs("div",{className:"v2-field",children:[e.jsx("label",{className:"v2-field-label",children:"Decisão *"}),e.jsx("input",{className:`v2-input ${n?"v2-error":""}`,value:t.title,autoFocus:!0,onChange:o=>{a({...t,title:o.target.value}),c("")},placeholder:"Ex: Go-live remarcado de 28/05 para 04/06"}),n&&e.jsx("span",{className:"v2-field-error",children:n})]}),e.jsxs("div",{className:"v2-grid-2",children:[e.jsxs("div",{className:"v2-field",children:[e.jsx("label",{className:"v2-field-label",children:"Projeto"}),e.jsxs("select",{className:"v2-select",value:t.projectId,onChange:o=>a({...t,projectId:o.target.value}),children:[e.jsx("option",{value:"",children:"Sem projeto"}),s.map(o=>e.jsx("option",{value:o.id,children:R(o)},o.id))]})]}),e.jsxs("div",{className:"v2-field",children:[e.jsx("label",{className:"v2-field-label",children:"Data da decisão"}),e.jsx("input",{className:"v2-input",type:"date",value:t.decidedAt,onChange:o=>a({...t,decidedAt:o.target.value})})]})]}),e.jsxs("div",{className:"v2-field",children:[e.jsx("label",{className:"v2-field-label",children:"Contexto"}),e.jsx("textarea",{className:"v2-input",style:{minHeight:80,resize:"vertical"},value:t.body,onChange:o=>a({...t,body:o.target.value}),placeholder:"Motivação, alternativas consideradas e consequências…"})]})]}),e.jsxs("div",{className:"v2-mt-6",style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(u,{variant:"ghost",onClick:l,children:"Cancelar"}),e.jsx(u,{onClick:h,disabled:m||!t.title.trim(),children:"Registrar decisão"})]})]})}export{Te as default};
2//# sourceMappingURL=decisoes-B3siZqje.js.map

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.