From 4d22c07151a5a8866cab3ef4f101a1a6032f5c84 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Sousa Martins" Date: Tue, 15 Jul 2025 19:46:14 -0300 Subject: [PATCH] dashboard: reimaginacao Signed-off-by: Rodrigo B. de Sousa Martins --- src/components/dashboard/WorkflowTarefas.tsx | 36 ++++++++++++++++++++ src/components/tarefas/TarefaModal.tsx | 12 +++++++ 2 files changed, 48 insertions(+) diff --git a/src/components/dashboard/WorkflowTarefas.tsx b/src/components/dashboard/WorkflowTarefas.tsx index 7641c7d..bfe8816 100644 --- a/src/components/dashboard/WorkflowTarefas.tsx +++ b/src/components/dashboard/WorkflowTarefas.tsx @@ -2,11 +2,29 @@ import React from 'react'; import { useAuth } from '../../contexts/AuthContext'; import { useTarefas } from '../../hooks/useTarefas'; import { Tarefa } from '../../types/entities'; +import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; export const WorkflowTarefas: React.FC = () => { const { user } = useAuth(); const { tarefas, isLoading, deleteTarefa } = useTarefas(); + const canDelete = user && ['ADVOGADO_ADMIN', 'ADVOGADO'].includes(user.perfil); + + const handleEdit = (tarefa: Tarefa) => { + // Implemente a lógica de edição conforme necessário + alert(`Editar tarefa: ${tarefa.titulo}`); + }; + + const handleDelete = async (id: string) => { + if (!window.confirm('Tem certeza que deseja excluir esta tarefa?')) return; + try { + await deleteTarefa.mutateAsync(id); + } catch (error) { + console.error('Erro ao excluir tarefa:', error); + alert('Erro ao excluir tarefa'); + } + }; + if (isLoading) { return (
@@ -33,6 +51,24 @@ export const WorkflowTarefas: React.FC = () => { }`}> {tarefa.status.replace('_', ' ')} +
+ + {canDelete && ( + + )} +
))} diff --git a/src/components/tarefas/TarefaModal.tsx b/src/components/tarefas/TarefaModal.tsx index 4d60374..3439e3a 100644 --- a/src/components/tarefas/TarefaModal.tsx +++ b/src/components/tarefas/TarefaModal.tsx @@ -168,6 +168,18 @@ export const TarefaModal: React.FC = ({ isOpen, onClose, taref + {/* Campo para alterar o status da tarefa conforme banco de dados */} + +