import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Card, CardContent } from "@/components/ui/card"; import { Calculator, Info } from "lucide-react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; interface SalaryBreakdown { grossSalary: number; vsaoi: number; iin: number; netSalary: number; } export const SalaryCalculator = () => { const [grossSalary, setGrossSalary] = useState(""); const [breakdown, setBreakdown] = useState(null); const [isCalculating, setIsCalculating] = useState(false); const calculateSalary = () => { const gross = parseFloat(grossSalary); if (isNaN(gross) || gross <= 0) return; setIsCalculating(true); // Simulate calculation delay for smooth animation setTimeout(() => { // 2025 Latvian tax calculations // VSAOI (Social Security) - 11% employee contribution const vsaoi = gross * 0.11; // Taxable income after VSAOI const taxableIncome = gross - vsaoi; // Non-taxable minimum (monthly) - approximately €500 in 2025 const nonTaxableMinimum = 500; const taxableAfterMinimum = Math.max(0, taxableIncome - nonTaxableMinimum); // IIN (Income Tax) - 20% on amount above non-taxable minimum const iin = taxableAfterMinimum * 0.20; // Net salary const netSalary = gross - vsaoi - iin; setBreakdown({ grossSalary: gross, vsaoi: Math.round(vsaoi * 100) / 100, iin: Math.round(iin * 100) / 100, netSalary: Math.round(netSalary * 100) / 100, }); setIsCalculating(false); }, 300); }; const handleKeyPress = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { calculateSalary(); } }; const reset = () => { setGrossSalary(""); setBreakdown(null); }; return (
{/* Header */}

Salary Calculator

Calculate your net salary in Latvia

{/* Block 1: Input Section */}
setGrossSalary(e.target.value)} onKeyPress={handleKeyPress} className="text-lg h-14 text-center bg-background border-2 focus:border-primary transition-all duration-200" disabled={isCalculating} />

Based on 2025 Latvian tax rates

{/* Block 2: Results Section */} {breakdown && (

Salary Breakdown

{/* VSAOI */}
VSAOI (Social Security Contributions)

11% employee contribution to social security

-€{breakdown.vsaoi}
{/* Not applicable with tax */}
Non-taxable minimum

Monthly non-taxable minimum (~€500)

€500
{/* IIN */}
IIN (Income Tax)

20% tax on income above non-taxable minimum

-€{breakdown.iin}
{/* Net Salary - Highlighted */}
Net Salary (after tax) €{breakdown.netSalary}
)}
); };
Built on Unicorn Platform