diff --git a/src/app/(app)/collection-map/page.tsx b/src/app/(app)/collection-map/page.tsx index e486730..783fcf6 100644 --- a/src/app/(app)/collection-map/page.tsx +++ b/src/app/(app)/collection-map/page.tsx @@ -35,7 +35,7 @@ import { useMap, useMapEvents, } from "react-leaflet"; -import { Calendar, ExternalLink, MapPin, RefreshCw, Search, Truck, User as UserIcon, Users, X, Layers } from "lucide-react"; +import { Calendar, ExternalLink, MapPin, RefreshCw, Truck, User as UserIcon, Users, X, Layers } from "lucide-react"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; @@ -80,14 +80,6 @@ const DARK_TILE_ATTRIBUTION = '© = [ - { value: "all", label: "All" }, - { value: "assigned", label: "Assigned" }, - { value: "unassigned", label: "Unassigned" }, -]; - /* ============================================================================ * Types * ========================================================================= */ @@ -309,12 +301,6 @@ export default function CollectionMapPage() { const [suppliersWithoutCoords, setSuppliersWithoutCoords] = useState([]); const [date, setDate] = useState(ymdToday()); - const [statusFilter, setStatusFilter] = useState("all"); - // Ready-filter — narrows the visible map stops to ready/unready/all. - // Default `all` to keep behaviour compatible with existing dashboard - // data (every existing pool row is `ready=true` post-migration). - const [readyFilter, setReadyFilter] = useState<"all" | "ready" | "unready">("all"); - const [search, setSearch] = useState(""); // Traffic overlay toggle — default OFF to conserve the TomTom // freemium 2,500-tile/day budget. Operators can flip it on for a // single planning session; Leaflet caches tiles client-side so @@ -448,28 +434,7 @@ export default function CollectionMapPage() { return m; }, [allUsers]); - const filteredItems = useMemo(() => { - const query = search.trim().toLowerCase(); - return items.filter((it) => { - if (statusFilter === "assigned" && it.item_status !== "assigned") return false; - if (statusFilter === "unassigned" && it.item_status !== "collection_pool") return false; - // Ready-filter sits after the status filter so "ready + assigned" - // and "unassigned + ready" remain combinable — same logic as the - // collection-pool page. - if (readyFilter !== "all") { - const want = readyFilter === "ready"; - if (Boolean(it.ready_for_collection) !== want) return false; - } - if (enabledDriverIds.size > 0) { - if (!it.drv_id || !enabledDriverIds.has(it.drv_id)) return false; - } - if (query) { - const hay = `${it.description} ${it.po_number || ""} ${it.supplier_name} ${it.order_number || ""}`.toLowerCase(); - if (!hay.includes(query)) return false; - } - return true; - }); - }, [items, statusFilter, readyFilter, enabledDriverIds, search]); + const filteredItems = useMemo(() => items, [items]); /* -- grouping by supplier ------------------------------------------------ */ const supplierStops = useMemo(() => { @@ -752,64 +717,9 @@ export default function CollectionMapPage() { ); })} - {/* Status filter — labelled so it doesn't read as a second copy - of the Ready filter that also starts with "All". */} -
- Status -
- {STATUS_FILTERS.map((opt) => ( - - ))} -
-
- {/* Ready filter — supplier-confirmed gate. Sits next to the - status filter so operators can layer them ("assigned + not - yet ready" is the most useful debug combo). */} -
- Readiness -
- {(["all", "ready", "unready"] as const).map((opt) => ( - - ))} -
-
-
- - setSearch(event.target.value)} - placeholder="Search PO, supplier, item..." - className="h-9 pl-9 text-sm" - /> -