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 (