'use client'
import * as React from 'react'
import Link from 'next/link'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Progress } from '@/components/ui/progress'
import { Avatar, AvatarFallback } from '@/components/ui/avatar'
import { ScrollArea } from '@/components/ui/scroll-area'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import {
BarChart,
Bar,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
PieChart,
Pie,
Cell,
LineChart,
Line,
Legend,
AreaChart,
Area,
} from 'recharts'
import {
FileText,
Clock,
CheckCircle2,
AlertTriangle,
TrendingUp,
TrendingDown,
Users,
ArrowRight,
Calendar,
Target,
Activity,
Timer,
AlertCircle,
} from 'lucide-react'
import { cn } from '@/lib/utils'
import {
requisitions,
countries,
recruiterCapacity,
getDashboardStats
} from '@/lib/mock-data'
import { STATUS_CONFIG, type Requisition } from '@/lib/types'
// Chart data
const statusDistribution = [
{ name: 'Reclutando', value: 4, color: '#6ec1e4' },
{ name: 'Pendiente RR.HH.', value: 1, color: '#f59e0b' },
{ name: 'Pendiente Admin', value: 1, color: '#8b5cf6' },
{ name: 'Corrección', value: 1, color: '#f97316' },
{ name: 'Cerrado', value: 1, color: '#22c55e' },
{ name: 'Cancelado', value: 1, color: '#ef4444' },
]
const requisitionsByCountry = [
{ country: 'México', abiertas: 3, cerradas: 0, canceladas: 0 },
{ country: 'Colombia', abiertas: 2, cerradas: 0, canceladas: 0 },
{ country: 'Perú', abiertas: 1, cerradas: 0, canceladas: 0 },
{ country: 'Chile', abiertas: 0, cerradas: 1, canceladas: 0 },
{ country: 'Rep. Dom.', abiertas: 1, cerradas: 0, canceladas: 0 },
{ country: 'Argentina', abiertas: 1, cerradas: 0, canceladas: 0 },
{ country: 'Guatemala', abiertas: 0, cerradas: 0, canceladas: 1 },
]
const ttfTrend = [
{ mes: 'Sep', dias: 28 },
{ mes: 'Oct', dias: 25 },
{ mes: 'Nov', dias: 22 },
{ mes: 'Dic', dias: 20 },
{ mes: 'Ene', dias: 18 },
]
const stageVelocity = [
{ stage: 'Búsqueda', promedio: 5 },
{ stage: '1era Entrev.', promedio: 3 },
{ stage: '2da Entrev.', promedio: 4 },
{ stage: 'Referencias', promedio: 3 },
{ stage: 'Exámenes', promedio: 2 },
{ stage: 'Selección', promedio: 1 },
]
function getInitials(name: string): string {
return name
.split(' ')
.map(n => n[0])
.join('')
.toUpperCase()
.slice(0, 2)
}
function getDaysUntilDeadline(deadline: string): number {
const now = new Date()
const deadlineDate = new Date(deadline)
return Math.ceil((deadlineDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24))
}
function getCapacityStatus(score: number, max: number): { label: string; color: string; bgColor: string } {
const percentage = (score / max) * 100
if (percentage < 60) return { label: 'Disponible', color: 'text-emerald-700 dark:text-emerald-400', bgColor: 'bg-emerald-100 dark:bg-emerald-900/30' }
if (percentage < 90) return { label: 'A capacidad', color: 'text-amber-700 dark:text-amber-400', bgColor: 'bg-amber-100 dark:bg-amber-900/30' }
return { label: 'Sobrecargado', color: 'text-red-700 dark:text-red-400', bgColor: 'bg-red-100 dark:bg-red-900/30' }
}
interface StatCardProps {
title: string
value: string | number
subtitle?: string
icon: React.ElementType
trend?: { value: number; positive: boolean }
iconColor?: string
iconBgColor?: string
}
function StatCard({ title, value, subtitle, icon: Icon, trend, iconColor = 'text-primary', iconBgColor = 'bg-primary/10' }: StatCardProps) {
return (
{title} {value} {subtitle}
{requisition.positionName} - {requisition.cityName}, {requisition.countryName}
Resumen ejecutivo de requisiciones y reclutamiento
Sin casos urgentes
Todas las requisiciones están dentro del SLA
{recruiter.recruiterName}
{recruiter.countryFocus.join(', ')}