import React from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { AlertTriangle, UserMinus, TrendingDown, CheckCircle } from "lucide-react"; import { Alert, AlertDescription } from "@/components/ui/alert"; export default function OrderReductionAlert({ originalRequested, newRequested, currentAssigned, onAutoUnassign, onManualUnassign, lowReliabilityStaff = [] }) { const excessStaff = currentAssigned - newRequested; if (excessStaff <= 0) return null; return (
Order Size Reduction Detected

Client reduced headcount from {originalRequested} to {newRequested}

Action Required:

You have {excessStaff} staff member{excessStaff !== 1 ? 's' : ''} assigned that exceed{excessStaff === 1 ? 's' : ''} the new request. You must unassign {excessStaff} worker{excessStaff !== 1 ? 's' : ''} to match the new headcount.

Original Request

{originalRequested}

New Request

{newRequested}

Must Remove

{excessStaff}

{lowReliabilityStaff.length > 0 && ( )}
{lowReliabilityStaff.length > 0 && (

Suggested for Auto-Removal (Lowest Reliability):

{lowReliabilityStaff.slice(0, excessStaff).map((staff, idx) => (
{staff.name} Reliability: {staff.reliability}%
))}
)}
); }