/** * CSV Rate Search Page * * Complete rate search page with: * - Volume/Weight/Pallet input * - Advanced filters panel * - Results table with CSV/API source badges */ 'use client'; import { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { Loader2, Search } from 'lucide-react'; import { VolumeWeightInput } from '@/components/rate-search/VolumeWeightInput'; import { RateFiltersPanel } from '@/components/rate-search/RateFiltersPanel'; import { RateResultsTable } from '@/components/rate-search/RateResultsTable'; import { useCsvRateSearch } from '@/hooks/useCsvRateSearch'; import type { RateSearchFilters } from '@/types/rate-filters'; export default function CsvRateSearchPage() { // Search parameters const [origin, setOrigin] = useState('NLRTM'); const [destination, setDestination] = useState('USNYC'); const [volumeCBM, setVolumeCBM] = useState(25.5); const [weightKG, setWeightKG] = useState(3500); const [palletCount, setPalletCount] = useState(10); const [filters, setFilters] = useState({}); const [currency, setCurrency] = useState<'USD' | 'EUR'>('USD'); const { data, loading, error, search } = useCsvRateSearch(); const handleSearch = async () => { await search({ origin, destination, volumeCBM, weightKG, palletCount, containerType: 'LCL', filters, }); }; const handleResetFilters = () => { setFilters({}); }; const handleBooking = (result: any) => { alert(`Booking pour ${result.companyName}: ${result.origin} → ${result.destination}`); // TODO: Implement actual booking flow }; return (
{/* Page Header */}

Recherche de tarifs CSV

Recherchez des tarifs de transport maritime avec filtres avancés

{/* Left Column: Filters */}
{/* Right Column: Search Form + Results */}
{/* Search Form */} Paramètres de recherche Indiquez votre trajet et les dimensions de votre envoi {/* Origin and Destination */}
setOrigin(e.target.value.toUpperCase())} placeholder="NLRTM" maxLength={5} required />

Code UN/LOCODE (5 caractères)

setDestination(e.target.value.toUpperCase())} placeholder="USNYC" maxLength={5} required />

Code UN/LOCODE (5 caractères)

{/* Volume, Weight, Pallets */} {/* Currency Selection */}
{/* Search Button */}
{/* Error Alert */} {error && ( {error} )} {/* Search Info */} {data && ( Recherche effectuée le {new Date(data.searchedAt).toLocaleString('fr-FR')} •{' '} {data.searchedFiles.length} fichier(s) CSV analysé(s) • {data.totalResults} tarif(s) trouvé(s) )} {/* Results Table */} {data && data.results.length > 0 && ( Résultats de recherche {data.totalResults} tarif{data.totalResults > 1 ? 's' : ''} correspondant à vos critères )} {/* No Results */} {data && data.results.length === 0 && (

Aucun tarif trouvé pour cette recherche.

Essayez d'ajuster vos critères de recherche ou vos filtres.

)}
); }