/** * Track & Trace Page * * Allows users to track their shipments by entering tracking numbers * and selecting the carrier. Redirects to carrier's tracking page. */ 'use client'; import { useState } from 'react'; import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; // Carrier tracking URLs - the tracking number will be appended const carriers = [ { id: 'maersk', name: 'Maersk', logo: '🚢', trackingUrl: 'https://www.maersk.com/tracking/', placeholder: 'Ex: MSKU1234567', description: 'Container or B/L number', }, { id: 'msc', name: 'MSC', logo: '🛳️', trackingUrl: 'https://www.msc.com/track-a-shipment?query=', placeholder: 'Ex: MSCU1234567', description: 'Container, B/L or Booking number', }, { id: 'cma-cgm', name: 'CMA CGM', logo: '⚓', trackingUrl: 'https://www.cma-cgm.com/ebusiness/tracking/search?SearchBy=Container&Reference=', placeholder: 'Ex: CMAU1234567', description: 'Container or B/L number', }, { id: 'hapag-lloyd', name: 'Hapag-Lloyd', logo: '🔷', trackingUrl: 'https://www.hapag-lloyd.com/en/online-business/track/track-by-container-solution.html?container=', placeholder: 'Ex: HLCU1234567', description: 'Container number', }, { id: 'cosco', name: 'COSCO', logo: '🌊', trackingUrl: 'https://elines.coscoshipping.com/ebusiness/cargoTracking?trackingNumber=', placeholder: 'Ex: COSU1234567', description: 'Container or B/L number', }, { id: 'one', name: 'ONE (Ocean Network Express)', logo: '🟣', trackingUrl: 'https://ecomm.one-line.com/one-ecom/manage-shipment/cargo-tracking?trkNoParam=', placeholder: 'Ex: ONEU1234567', description: 'Container or B/L number', }, { id: 'evergreen', name: 'Evergreen', logo: '🌲', trackingUrl: 'https://www.shipmentlink.com/servlet/TDB1_CargoTracking.do?BL=', placeholder: 'Ex: EGHU1234567', description: 'Container or B/L number', }, { id: 'yangming', name: 'Yang Ming', logo: '🟡', trackingUrl: 'https://www.yangming.com/e-service/Track_Trace/track_trace_cargo_tracking.aspx?rdolType=CT&str=', placeholder: 'Ex: YMLU1234567', description: 'Container number', }, { id: 'zim', name: 'ZIM', logo: '🔵', trackingUrl: 'https://www.zim.com/tools/track-a-shipment?consnumber=', placeholder: 'Ex: ZIMU1234567', description: 'Container or B/L number', }, { id: 'hmm', name: 'HMM (Hyundai)', logo: '🟠', trackingUrl: 'https://www.hmm21.com/cms/business/ebiz/trackTrace/trackTrace/index.jsp?type=1&number=', placeholder: 'Ex: HDMU1234567', description: 'Container or B/L number', }, ]; export default function TrackTracePage() { const [trackingNumber, setTrackingNumber] = useState(''); const [selectedCarrier, setSelectedCarrier] = useState(''); const [error, setError] = useState(''); const handleTrack = () => { // Validation if (!trackingNumber.trim()) { setError('Veuillez entrer un numéro de tracking'); return; } if (!selectedCarrier) { setError('Veuillez sélectionner un transporteur'); return; } setError(''); // Find the carrier and build the tracking URL const carrier = carriers.find(c => c.id === selectedCarrier); if (carrier) { const trackingUrl = carrier.trackingUrl + encodeURIComponent(trackingNumber.trim()); // Open in new tab window.open(trackingUrl, '_blank', 'noopener,noreferrer'); } }; const handleKeyPress = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { handleTrack(); } }; const selectedCarrierData = carriers.find(c => c.id === selectedCarrier); return (
Suivez vos expéditions en temps réel. Entrez votre numéro de tracking et sélectionnez le transporteur.
{selectedCarrierData.description}
)}{error}
Format standard: 4 lettres + 7 chiffres (ex: MSKU1234567). Le préfixe indique généralement le propriétaire du conteneur.
Le numéro de Bill of Lading est fourni par le transporteur lors de la confirmation de booking. Format variable selon le carrier.
Numéro de réservation attribué par le transporteur lors de la réservation initiale de l'espace sur le navire.
Comment fonctionne le suivi ?
Cette fonctionnalité vous redirige vers le site officiel du transporteur pour obtenir les informations de suivi les plus récentes. Les données affichées proviennent directement du système du transporteur.