import React, { useState, useEffect } from 'react'; import { Search, Package, Truck, MapPin, Clock, CheckCircle, AlertCircle, Plane, Ship, Phone, Mail, Globe, User, Calendar, Weight, DollarSign, Upload, Home, Plus, Eye, Container, Users, FileText, Send } from 'lucide-react'; const GPTrackingPlatform = () => { const [activeTab, setActiveTab] = useState('tracking'); const [trackingNumber, setTrackingNumber] = useState(''); const [trackingData, setTrackingData] = useState(null); const [isLoading, setIsLoading] = useState(false); const [shipmentForm, setShipmentForm] = useState({ senderName: '', senderPhone: '', senderAddress: '', receiverName: '', receiverPhone: '', receiverAddress: '', packageDescription: '', weight: '', needPickup: false, pickupDate: '', destination: 'abidjan' }); // Données simulées pour GP et conteneurs const mockData = { // Colis GP individuels 'GP2024001': { id: 'GP2024001', type: 'GP', description: 'Vêtements + Électronique', weight: '18kg', price: '1260 DH', sender: 'Ahmed Benali', receiver: 'Fatou Koné', origin: 'Casablanca, Maroc', destination: 'Abidjan, Côte d\'Ivoire', status: 'En cours de voyage', traveler: 'Vol AT 542 - Amina K.', currentLocation: 'Aéroport Mohammed V, Casablanca', estimatedDelivery: '11 Juin 2025', timeline: [ { date: '2025-06-09', status: 'Colis réceptionné', location: 'Bureau Bandjo Casablanca', completed: true }, { date: '2025-06-10', status: 'Remis au voyageur', location: 'Aéroport Mohammed V', completed: true }, { date: '2025-06-10', status: 'Vol en cours', location: 'En vol vers Abidjan', completed: true, current: true }, { date: '2025-06-11', status: 'Arrivée Abidjan', location: 'Aéroport Félix Houphouët-Boigny', completed: false }, { date: '2025-06-11', status: 'Livraison prévue', location: 'Abidjan, Côte d\'Ivoire', completed: false } ] }, 'GP2024002': { id: 'GP2024002', type: 'GP', description: 'Médicaments + Documents', weight: '8kg', price: '560 DH', sender: 'Karim Tazi', receiver: 'Dr. Kouame', origin: 'Casablanca, Maroc', destination: 'Abidjan, Côte d\'Ivoire', status: 'Livré', traveler: 'Vol RAM 548 - Mohamed B.', currentLocation: 'Livré', estimatedDelivery: 'Livré le 08 Juin 2025', timeline: [ { date: '2025-06-06', status: 'Colis réceptionné', location: 'Bureau Bandjo Casablanca', completed: true }, { date: '2025-06-07', status: 'Remis au voyageur', location: 'Aéroport Mohammed V', completed: true }, { date: '2025-06-07', status: 'Vol effectué', location: 'Abidjan', completed: true }, { date: '2025-06-08', status: 'Récupéré par Bandjo', location: 'Aéroport Abidjan', completed: true }, { date: '2025-06-08', status: 'Livré au destinataire', location: 'Cocody, Abidjan', completed: true, current: true } ] }, // Conteneurs 'CONT2024001': { id: 'CONT2024001', type: 'CONTENEUR', description: 'Conteneur 40 pieds - Mixed cargo', totalWeight: '18.5 tonnes', clientPackages: 42, bandjoGoods: '12 palettes électronique', origin: 'Le Havre, France', destination: 'Port d\'Abidjan, Côte d\'Ivoire', status: 'En transit maritime', currentLocation: 'Océan Atlantique', estimatedDelivery: '18 Juin 2025', vessel: 'MSC CLAIRE - IMO: 9876543', timeline: [ { date: '2025-05-28', status: 'Conteneur chargé', location: 'Port du Havre, France', completed: true }, { date: '2025-05-29', status: 'Départ maritime', location: 'Le Havre, France', completed: true }, { date: '2025-06-10', status: 'Transit océanique', location: 'Océan Atlantique', completed: true, current: true }, { date: '2025-06-16', status: 'Arrivée prévue', location: 'Port d\'Abidjan', completed: false }, { date: '2025-06-18', status: 'Dédouanement', location: 'Port d\'Abidjan', completed: false }, { date: '2025-06-20', status: 'Distribution colis', location: 'Abidjan', completed: false } ], packages: [ { id: 'PKG001', client: 'Diabaté S.', weight: '25kg', status: 'En transit' }, { id: 'PKG002', client: 'Kouadio A.', weight: '15kg', status: 'En transit' }, { id: 'PKG003', client: 'Bamba K.', weight: '30kg', status: 'En transit' } ] } }; const handleSearch = () => { if (!trackingNumber.trim()) return; setIsLoading(true); setTimeout(() => { const data = mockData[trackingNumber.toUpperCase()]; setTrackingData(data || null); setIsLoading(false); }, 1500); }; const handleFormSubmit = (e) => { e.preventDefault(); const trackingId = 'GP' + Date.now().toString().slice(-6); alert(`Demande d'expédition créée !\nNuméro de suivi: ${trackingId}\nTarif estimé: ${calculatePrice()} DH`); }; const calculatePrice = () => { const weight = parseFloat(shipmentForm.weight) || 0; const basePrice = shipmentForm.destination === 'abidjan' ? 70 : 80; return Math.round(weight * basePrice); }; const getStatusColor = (status) => { switch (status) { case 'Livré': case 'Livré au destinataire': return 'text-green-600 bg-green-100'; case 'En cours de voyage': case 'En transit maritime': case 'Vol en cours': return 'text-blue-600 bg-blue-100'; case 'Colis réceptionné': return 'text-yellow-600 bg-yellow-100'; default: return 'text-gray-600 bg-gray-100'; } }; const TrackingTab = () => (
Suivez vos colis GP ou conteneurs en temps réel
Exemples de suivi :
Recherche en cours...
{trackingData.description}
Poids
{trackingData.weight}
Prix
{trackingData.price}
Voyageur
{trackingData.traveler}
Livraison
{trackingData.estimatedDelivery}
Poids total
{trackingData.totalWeight}
Colis clients
{trackingData.clientPackages}
Navire
{trackingData.vessel}
Arrivée
{trackingData.estimatedDelivery}
{event.status}
{event.location}
{event.date}
{event.current && ( Position actuelle )}{pkg.client}
{pkg.status}Aucune expédition trouvée avec le numéro {trackingNumber}
Remplissez le formulaire pour programmer l'envoi de votre colis
Transport de colis par voyageurs • Conteneurs internationaux
Optimisation des bagages voyageurs
70-80 DH/kg
Transport maritime groupé
France → Abidjan
Partenaires de confiance
Livraison rapide