import React from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'; import L from 'leaflet'; import 'leaflet/dist/leaflet.css'; import { MapPin } from 'lucide-react'; // Perbaikan issue icon marker Leaflet di React import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png'; import markerIcon from 'leaflet/dist/images/marker-icon.png'; import markerShadow from 'leaflet/dist/images/marker-shadow.png'; delete (L.Icon.Default.prototype as any)._getIconUrl; L.Icon.Default.mergeOptions({ iconUrl: markerIcon, iconRetinaUrl: markerIcon2x, shadowUrl: markerShadow, }); interface AttendanceMapModalProps { latitudeIn?: string | null; longitudeIn?: string | null; latitudeOut?: string | null; longitudeOut?: string | null; employeeName: string; date: string; } export function AttendanceMapModal({ latitudeIn, longitudeIn, latitudeOut, longitudeOut, employeeName, date }: AttendanceMapModalProps) { const hasIn = latitudeIn && longitudeIn; const hasOut = latitudeOut && longitudeOut; const hasData = hasIn || hasOut; if (!hasData) { return ( Tidak ada data lokasi ); } const posIn: [number, number] | null = hasIn ? [parseFloat(latitudeIn as string), parseFloat(longitudeIn as string)] : null; const posOut: [number, number] | null = hasOut ? [parseFloat(latitudeOut as string), parseFloat(longitudeOut as string)] : null; // Default center ke check in, atau check out const center = posIn || posOut || [-6.200000, 106.816666]; return ( Detail Lokasi Absensi

{employeeName} — {date}

{posIn && (
📍 Lokasi Clock In
Lat: {posIn[0]}
Lng: {posIn[1]}
)} {posOut && (
📍 Lokasi Clock Out
Lat: {posOut[0]}
Lng: {posOut[1]}
)}
); }