import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { safeFormat } from "@/lib/dateUtils"; import { Phone, Package, User, Store, Calendar, CreditCard, Tag } from "lucide-react"; import type { CustomerOrderWithRelations } from "@shared/schema"; interface CustomerOrderDetailsProps { order: CustomerOrderWithRelations; } export function CustomerOrderDetails({ order }: CustomerOrderDetailsProps) { const getStatusColor = (status: string) => { switch (status) { case "En attente de Commande": return "bg-yellow-50 text-yellow-700 border border-yellow-200"; case "Commande en Cours": return "bg-blue-50 text-blue-700 border border-blue-200"; case "Disponible": return "bg-green-50 text-green-700 border border-green-200"; case "Retiré": return "bg-gray-50 text-gray-700 border border-gray-200"; case "Annulé": return "bg-red-50 text-red-700 border border-red-200"; default: return "bg-gray-50 text-gray-700 border border-gray-200"; } }; // Générer le code-barres simple (représentation textuelle) const renderBarcode = (gencode: string) => { return (
{gencode.split('').map((char, index) => ( ))}
{gencode}
); }; return (
{/* En-tête avec statut */}

Commande #{order.id}

Créée le {safeFormat(order.createdAt, 'dd MMMM yyyy à HH:mm')}

{order.status}
{/* Informations client */} Informations Client
Nom: {order.customerName}
Téléphone: {order.customerPhone}
{order.customerNotified && order.status === 'Disponible' && (
Client notifié de la disponibilité
)}
{/* Informations produit */} Informations Produit
Désignation:

{order.productDesignation}

{order.productReference && (
Référence: {order.productReference}
)}
Quantité: {order.quantity || 1}
{order.gencode && (
Code à barres:
Code-barres EAN13 scannable
{order.gencode}
)} {order.isPromotionalPrice && (
Prix publicité appliqué
)}
{/* Informations commande */} Informations Commande
Prise par: {order.orderTaker}
{order.deposit && parseFloat(order.deposit) > 0 && (
💰 Acompte: {parseFloat(order.deposit).toFixed(2)}€
)}
Magasin: {order.group.name}
Fournisseur: {order.supplier.name}
Date de création: {safeFormat(order.createdAt, 'dd/MM/yyyy à HH:mm')}
{/* Actions disponibles selon le statut */} {order.status === 'Disponible' && (

Actions disponibles

• Étiquette imprimable disponible

• Notification client possible

• Prêt pour retrait en magasin

)} {(order.status === 'Retiré' || order.status === 'Annulé') && (

Commande terminée

{order.status === 'Retiré' ? 'Cette commande a été retirée par le client.' : 'Cette commande a été annulée.' }

)}
); }