'use client' import { useTranslations } from 'next-intl' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { TaxTableStatus } from '@/components/salary/TaxTableStatus' import { formatCurrency } from '@/lib/utils' import type { SalaryRunEmployee } from '@/types' type SreWithEmployee = SalaryRunEmployee & { employee?: { first_name: string; last_name: string } } interface RunCalculationDetailsProps { periodYear: number employees: SalaryRunEmployee[] } export function RunCalculationDetails({ periodYear, employees }: RunCalculationDetailsProps) { const t = useTranslations('salary_run') const withBreakdown = employees.filter(e => e.calculation_breakdown) if (withBreakdown.length === 0) return null return ( {t('calculation_details_title')} {withBreakdown.map(sre => { const breakdown = sre.calculation_breakdown as { steps?: Array<{ label: string; formula: string; output: number | null }> } const employee = (sre as SreWithEmployee).employee return (

{employee ? `${employee.first_name} ${employee.last_name}` : sre.employee_id.slice(0, 8)}

{(breakdown?.steps || []).map((step, i) => (
{step.label}: {step.formula} {step.output !== null && ( {formatCurrency(step.output)} )}
))}
) })}
) }