import React from "react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Progress } from "@/components/ui/progress"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Users, DollarSign, Clock, TrendingUp, TrendingDown, Building2, MapPin, Briefcase, AlertTriangle, CheckCircle } from "lucide-react"; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend } from "recharts"; export default function LaborSpendAnalysis({ assignments, workforce, orders, metrics, userRole }) { // Generate channel breakdown const channelData = [ { channel: "Preferred Vendors", spend: metrics.contractedSpend * 0.6, workers: Math.floor(workforce.length * 0.4), efficiency: 94 }, { channel: "Approved Vendors", spend: metrics.contractedSpend * 0.4, workers: Math.floor(workforce.length * 0.25), efficiency: 88 }, { channel: "Gig Platforms", spend: metrics.nonContractedSpend * 0.5, workers: Math.floor(workforce.length * 0.2), efficiency: 72 }, { channel: "Agency Labor", spend: metrics.nonContractedSpend * 0.3, workers: Math.floor(workforce.length * 0.1), efficiency: 68 }, { channel: "Internal Pool", spend: metrics.nonContractedSpend * 0.2, workers: Math.floor(workforce.length * 0.05), efficiency: 91 }, ]; const utilizationData = [ { category: "Culinary Staff", utilized: 85, available: 100, cost: 45000 }, { category: "Event Staff", utilized: 78, available: 100, cost: 32000 }, { category: "Bartenders", utilized: 92, available: 100, cost: 28000 }, { category: "Security", utilized: 65, available: 100, cost: 18000 }, { category: "Facilities", utilized: 71, available: 100, cost: 15000 }, ]; const benchmarkData = [ { metric: "Cost per Hour", yours: metrics.avgNonContractedRate, benchmark: 42.50, industry: 48.00 }, { metric: "Fill Rate", yours: metrics.fillRate, benchmark: 95, industry: 88 }, { metric: "No-Show Rate", yours: metrics.noShowRate, benchmark: 2, industry: 5 }, { metric: "OT Percentage", yours: 12, benchmark: 8, industry: 15 }, ]; return (
{item.category}
{item.utilized}% utilized
${item.cost.toLocaleString()}
monthly spend
{item.metric}
{metrics.contractedRatio.toFixed(1)}% of total spend
{(100 - metrics.contractedRatio).toFixed(1)}% of total spend