diff --git a/client/src/components/CalendarGrid.tsx b/client/src/components/CalendarGrid.tsx index c688cb6..4a34c45 100644 --- a/client/src/components/CalendarGrid.tsx +++ b/client/src/components/CalendarGrid.tsx @@ -38,20 +38,20 @@ function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' | return (
{ e.stopPropagation(); onItemClick(item, 'order'); }} - style={{marginBottom: '2px', display: 'block', width: '100%'}} + style={{marginBottom: '3px', display: 'block', width: '100%', minHeight: '24px'}} >
- + {item.supplier?.name || 'Commande'} -
+
{item.status === 'planned' && ( -
+
)} {item.status === 'delivered' && ( @@ -76,20 +76,20 @@ function CalendarItem({ item, type, onItemClick }: { item: any, type: 'order' | return (
{ e.stopPropagation(); onItemClick(item, 'delivery'); }} - style={{marginBottom: '2px', display: 'block', width: '100%'}} + style={{marginBottom: '3px', display: 'block', width: '100%', minHeight: '24px'}} >
- + {item.supplier?.name || 'Livraison'} - {formatQuantity(item.quantity, item.unit)} -
+
{item.status === 'pending' && ( -
+
)} {item.status === 'delivered' && ( @@ -118,7 +118,7 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder const hiddenCount = Math.max(0, totalItems - MAX_VISIBLE_ITEMS); return ( -
+
{/* Éléments visibles - IDENTIQUE DEV/PROD */} {visibleItems.map((item, index) => ( { e.preventDefault(); @@ -150,51 +150,92 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder +{hiddenCount} autres - - - - - Éléments du jour ({totalItems}) + + + + + Éléments du jour - {totalItems} élément{totalItems > 1 ? 's' : ''} -
-
- {allItems.map((item, index) => ( -
{ - e.preventDefault(); - e.stopPropagation(); - onItemClick(item, item.itemType); - setIsOpen(false); - }} - > -
-
- {item.supplier?.name || (item.itemType === 'order' ? 'Commande' : 'Livraison')} -
- {item.itemType === 'delivery' && ( -
- Quantité: {item.quantity}{item.unit === 'palettes' ? 'P' : 'C'} + +
+
+ {allItems.map((item, index) => { + const isOrder = item.itemType === 'order'; + const statusColor = item.status === 'delivered' + ? 'bg-gray-100 border-gray-300' + : item.status === 'planned' + ? 'bg-yellow-50 border-yellow-300' + : isOrder + ? 'bg-blue-50 border-blue-300' + : 'bg-green-50 border-green-300'; + + const statusText = item.status === 'delivered' ? 'Livré' : + item.status === 'planned' ? 'Planifié' : 'En attente'; + + const statusIcon = item.status === 'delivered' + ? + : item.status === 'planned' + ?
+ : isOrder + ?
+ :
; + + return ( +
{ + e.preventDefault(); + e.stopPropagation(); + onItemClick(item, item.itemType); + setIsOpen(false); + }} + > +
+
+
+ {statusIcon} + + {isOrder ? 'Commande' : 'Livraison'} + + + {statusText} + +
+ +

+ {item.supplier?.name || (isOrder ? 'Commande sans fournisseur' : 'Livraison sans fournisseur')} +

+ + {!isOrder && ( +
+ Quantité: {item.quantity} {item.unit === 'palettes' ? 'palette(s)' : 'colis'} +
+ )} + +
+ Date: { + item.scheduledDate ? new Date(item.scheduledDate).toLocaleDateString('fr-FR') : + item.deliveredDate ? new Date(item.deliveredDate).toLocaleDateString('fr-FR') : + new Date(item.createdAt).toLocaleDateString('fr-FR') + } +
+ + {item.notes && ( +
+ Notes: {item.notes} +
+ )}
- )} -
- Statut: {item.status === 'delivered' ? 'Livré' : item.status === 'planned' ? 'Planifié' : 'En attente'}
-
- ))} + ); + })}
@@ -474,7 +515,7 @@ export default function CalendarGrid({
{/* Orders and Deliveries - DEV = PRODUCTION */} -
+