diff --git a/client/src/components/CalendarGrid.tsx b/client/src/components/CalendarGrid.tsx
index 69f8005..be66b5e 100644
--- a/client/src/components/CalendarGrid.tsx
+++ b/client/src/components/CalendarGrid.tsx
@@ -1,10 +1,33 @@
import { format, startOfMonth, endOfMonth, eachDayOfInterval, isSameDay, isSameMonth, isToday } from "date-fns";
import { fr } from "date-fns/locale";
import { safeDate } from "@/lib/dateUtils";
-import { Plus, Check, MoreHorizontal, Package, Link } from "lucide-react";
+import { Plus, Check, MoreHorizontal, Package, Link, MessageSquare } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
import { useState } from "react";
+
+// Composant modal pour afficher les commentaires
+function CommentModal({ isOpen, onClose, comment }: { isOpen: boolean, onClose: () => void, comment: string }) {
+ if (!isOpen) return null;
+
+ return (
+
+ );
+}
import type { OrderWithRelations, DeliveryWithRelations } from "@shared/schema";
interface CalendarGridProps {
@@ -20,6 +43,8 @@ interface CalendarGridProps {
// Composant pour afficher un élément (commande ou livraison)
function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' | 'delivery', onItemClick: (item: any, type: 'order' | 'delivery') => void }) {
+ const [showCommentModal, setShowCommentModal] = useState(false);
+
const formatQuantity = (quantity: number, unit: string) => {
return `${quantity}${unit === 'palettes' ? 'P' : 'C'}`;
};
@@ -94,6 +119,19 @@ function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' |
{item.supplier?.name || 'Livraison'} - {formatQuantity(item.quantity, item.unit)}
+ {/* Icône commentaire pour les livraisons avec notes */}
+ {item.notes && item.notes.trim() && (
+
{
+ e.stopPropagation();
+ setShowCommentModal(true);
+ }}
+ >
+
+
+ )}
{/* Badge pour livraison liée à une commande */}
{item.orderId && (
@@ -108,6 +146,13 @@ function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' |
)}
+
+ {/* Modal pour afficher le commentaire */}
+ setShowCommentModal(false)}
+ comment={item.notes || ''}
+ />
);
}
@@ -115,6 +160,8 @@ function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' |
// Composant pour gérer l'overflow avec modal - DEV = PRODUCTION
function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrders: any[], dayDeliveries: any[], onItemClick: (item: any, type: 'order' | 'delivery') => void }) {
const [isOpen, setIsOpen] = useState(false);
+ const [showCommentModal, setShowCommentModal] = useState(false);
+ const [selectedComment, setSelectedComment] = useState('');
const MAX_VISIBLE_ITEMS = 2; // FORCÉ : 2 éléments en dev ET production
const totalItems = dayOrders.length + dayDeliveries.length;
@@ -211,6 +258,20 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder
{isOrder ? 'COMMANDE' : 'LIVRAISON'}
+ {/* Icône commentaire pour les livraisons avec notes */}
+ {!isOrder && item.notes && item.notes.trim() && (
+ {
+ e.stopPropagation();
+ setSelectedComment(item.notes);
+ setShowCommentModal(true);
+ }}
+ >
+
+
+ )}
{/* Badge pour liaison - commandes avec livraisons ou livraisons avec commandes */}
{((isOrder && item.deliveries && item.deliveries.length > 0) ||
(!isOrder && item.orderId)) && (
@@ -252,6 +313,13 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder
+
+ {/* Modal pour afficher le commentaire depuis la modal des éléments du jour */}
+ setShowCommentModal(false)}
+ comment={selectedComment}
+ />
)}