diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 05b99a6..9516c49 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -1,6 +1,6 @@ import { useState, useEffect } from "react"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; -import { Plus, Search, FileText, CheckCircle, AlertCircle, Clock, Edit, Trash2, UserCheck, Send, Upload, XCircle } from "lucide-react"; +import { Plus, Search, FileText, CheckCircle, AlertCircle, Clock, Edit, Trash2, UserCheck, Send, Upload, XCircle, MessageSquare } from "lucide-react"; import { useStore } from "@/components/Layout"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -131,6 +131,10 @@ export default function Avoirs() { // ✅ État local pour le champ montant d'édition pour éviter les conflits avec React Hook Form const [editAmountValue, setEditAmountValue] = useState(""); + + // État pour le modal de commentaire + const [showCommentModal, setShowCommentModal] = useState(false); + const [selectedComment, setSelectedComment] = useState(""); // Utiliser le contexte global du magasin const { selectedStoreId } = useStore(); const { toast } = useToast(); @@ -432,6 +436,12 @@ export default function Avoirs() { setIsDeleteDialogOpen(true); }; + // Handle comment view + const handleViewComment = (comment: string) => { + setSelectedComment(comment); + setShowCommentModal(true); + }; + // Handle status change const handleStatusChange = (avoirId: number, newStatus: string) => { const avoir = avoirs?.find(a => a?.id === avoirId); @@ -1275,6 +1285,19 @@ export default function Avoirs() { )} + {/* Bouton Commentaire - apparaît seulement s'il y a un commentaire */} + {avoir.comment && avoir.comment.trim() !== '' && ( + + )} + {canEditDelete && ( <> + + + ); } \ No newline at end of file