import React, { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Progress } from '@/components/ui/progress'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Target, TrendingUp, Calendar, CheckCircle, Clock, DollarSign, Home, Car, Plane, GraduationCap, Heart, Trophy, Star, IndianRupee, Plus, AlertCircle } from 'lucide-react'; const GoalPlanning: React.FC = () => { const financialGoals = [ { id: 1, title: 'Emergency Fund', description: '6-12 months of living expenses', category: 'Security', icon: , targetAmount: 600000, currentAmount: 450000, monthlyContribution: 15000, targetDate: '2024-12-31', priority: 'high', status: 'on-track', milestones: [ { amount: 200000, completed: true, date: '2023-06-01' }, { amount: 400000, completed: true, date: '2023-12-01' }, { amount: 600000, completed: false, date: '2024-12-31' } ] }, { id: 2, title: 'Home Down Payment', description: '20% down payment for ₹85L home', category: 'Investment', icon: , targetAmount: 1700000, currentAmount: 850000, monthlyContribution: 25000, targetDate: '2025-08-31', priority: 'high', status: 'behind', milestones: [ { amount: 500000, completed: true, date: '2023-08-01' }, { amount: 1000000, completed: false, date: '2024-06-01' }, { amount: 1700000, completed: false, date: '2025-08-31' } ] }, { id: 3, title: 'Europe Vacation', description: '15-day Europe trip for family', category: 'Lifestyle', icon: , targetAmount: 350000, currentAmount: 185000, monthlyContribution: 12000, targetDate: '2024-09-30', priority: 'medium', status: 'on-track', milestones: [ { amount: 150000, completed: true, date: '2023-12-01' }, { amount: 250000, completed: false, date: '2024-05-01' }, { amount: 350000, completed: false, date: '2024-09-30' } ] }, { id: 4, title: 'Child Education Fund', description: 'Higher education fund for children', category: 'Education', icon: , targetAmount: 2500000, currentAmount: 280000, monthlyContribution: 18000, targetDate: '2035-06-30', priority: 'medium', status: 'on-track', milestones: [ { amount: 500000, completed: false, date: '2026-06-30' }, { amount: 1500000, completed: false, date: '2030-06-30' }, { amount: 2500000, completed: false, date: '2035-06-30' } ] }, { id: 5, title: 'Car Upgrade', description: 'Premium SUV purchase', category: 'Lifestyle', icon: , targetAmount: 1200000, currentAmount: 620000, monthlyContribution: 20000, targetDate: '2025-03-31', priority: 'low', status: 'ahead', milestones: [ { amount: 400000, completed: true, date: '2023-09-01' }, { amount: 800000, completed: false, date: '2024-08-01' }, { amount: 1200000, completed: false, date: '2025-03-31' } ] } ]; const goalStrategies = [ { goalId: 1, strategies: [ 'Automate ₹15K monthly transfer to high-yield savings', 'Use liquid funds for better returns (6-7%)', 'Keep 3 months in savings, rest in liquid funds', 'Review and adjust monthly as expenses change' ], tips: [ 'Keep emergency fund separate from other savings', 'Consider laddered FDs for higher returns', 'Review target amount annually based on lifestyle' ] }, { goalId: 2, strategies: [ 'Increase SIP allocation to equity funds', 'Use step-up SIPs with salary increments', 'Consider ELSS for tax benefits', 'Time market entry closer to purchase date' ], tips: [ 'Start researching locations 2 years before', 'Factor in registration and other costs (8-10%)', 'Consider pre-approved home loans for negotiation' ] }, { goalId: 3, strategies: [ 'Use conservative investments (debt funds)', 'Book travel during off-season for savings', 'Consider travel credit cards for rewards', 'Track flight prices for best deals' ], tips: [ 'Book flights 3-4 months in advance', 'Consider travel insurance costs', 'Plan forex needs 2 months ahead' ] } ]; const progressInsights = { totalGoals: financialGoals.length, onTrack: financialGoals.filter(g => g.status === 'on-track' || g.status === 'ahead').length, totalTargetAmount: financialGoals.reduce((sum, goal) => sum + goal.targetAmount, 0), totalCurrentAmount: financialGoals.reduce((sum, goal) => sum + goal.currentAmount, 0), monthlyCommitment: financialGoals.reduce((sum, goal) => sum + goal.monthlyContribution, 0), averageProgress: Math.round(financialGoals.reduce((sum, goal) => sum + (goal.currentAmount / goal.targetAmount * 100), 0) / financialGoals.length) }; const getStatusColor = (status: string) => { switch (status) { case 'ahead': return 'text-green-600 bg-green-50 border-green-200'; case 'on-track': return 'text-blue-600 bg-blue-50 border-blue-200'; case 'behind': return 'text-red-600 bg-red-50 border-red-200'; default: return 'text-gray-600 bg-gray-50 border-gray-200'; } }; const getPriorityColor = (priority: string) => { switch (priority) { case 'high': return 'text-red-600 bg-red-50 border-red-200'; case 'medium': return 'text-yellow-600 bg-yellow-50 border-yellow-200'; case 'low': return 'text-green-600 bg-green-50 border-green-200'; default: return 'text-gray-600 bg-gray-50 border-gray-200'; } }; const getCategoryColor = (category: string) => { switch (category) { case 'Security': return 'from-green-400 to-green-600'; case 'Investment': return 'from-blue-400 to-blue-600'; case 'Lifestyle': return 'from-purple-400 to-purple-600'; case 'Education': return 'from-orange-400 to-orange-600'; default: return 'from-gray-400 to-gray-600'; } }; const getTimeRemaining = (targetDate: string) => { const target = new Date(targetDate); const now = new Date(); const diffTime = target.getTime() - now.getTime(); const diffMonths = Math.ceil(diffTime / (1000 * 60 * 60 * 24 * 30)); if (diffMonths < 0) return 'Overdue'; if (diffMonths === 0) return 'This month'; if (diffMonths < 12) return `${diffMonths} months`; const years = Math.floor(diffMonths / 12); const months = diffMonths % 12; return months > 0 ? `${years}y ${months}m` : `${years} years`; }; return (

AI Jar - Goal Planning

Smart goal setting, tracking, and achievement with step-by-step plans

{/* Progress Overview */}

Total Goals

{progressInsights.totalGoals}

{progressInsights.onTrack} on track

Average Progress

{progressInsights.averageProgress}%

Across all goals

Target Amount

₹{(progressInsights.totalTargetAmount / 100000).toFixed(1)}L

Total across goals

Monthly SIP

₹{(progressInsights.monthlyCommitment / 1000).toFixed(0)}K

Total commitment

My Goals Progress Tracking AI Strategies Milestones

Active Financial Goals

{financialGoals.map((goal) => (
{goal.icon}
{goal.title} {goal.description}
{goal.status.replace('-', ' ')} {goal.priority}
Progress ₹{(goal.currentAmount / 100000).toFixed(1)}L / ₹{(goal.targetAmount / 100000).toFixed(1)}L

{Math.round((goal.currentAmount / goal.targetAmount) * 100)}% completed

Monthly SIP

₹{(goal.monthlyContribution / 1000).toFixed(0)}K

Time Remaining

{getTimeRemaining(goal.targetDate)}

Target: {new Date(goal.targetDate).toLocaleDateString()} {goal.category}
))}
Goal Progress Overview Track your progress across all financial goals
{financialGoals.map((goal) => (
{goal.icon}

{goal.title}

Target: {new Date(goal.targetDate).toLocaleDateString()}

{Math.round((goal.currentAmount / goal.targetAmount) * 100)}%

{goal.status.replace('-', ' ')}

Current

₹{(goal.currentAmount / 100000).toFixed(1)}L

Monthly SIP

₹{(goal.monthlyContribution / 1000).toFixed(0)}K

Remaining

₹{((goal.targetAmount - goal.currentAmount) / 100000).toFixed(1)}L

))}
AI-Powered Goal Strategies Personalized strategies to achieve your financial goals faster
{goalStrategies.map((strategy) => { const goal = financialGoals.find(g => g.id === strategy.goalId); if (!goal) return null; return (
{goal.icon}

{goal.title}

AI-optimized strategy

Recommended Strategies
    {strategy.strategies.map((item, index) => (
  • {item}
  • ))}
Pro Tips
    {strategy.tips.map((tip, index) => (
  • {tip}
  • ))}
); })}
Milestone Tracking Celebrate achievements and track progress milestones
{financialGoals.map((goal) => (
{goal.icon}

{goal.title}

{goal.milestones.filter(m => m.completed).length} of {goal.milestones.length} milestones completed

{goal.milestones.map((milestone, index) => (
{milestone.completed ? ( ) : ( )}

₹{(milestone.amount / 100000).toFixed(1)}L

Target: {new Date(milestone.date).toLocaleDateString()}

{milestone.completed ? ( Completed ) : ( Pending )}
))}
))}
); }; export default GoalPlanning;