T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/backups/lavocat.quebec/backup-20250730-021618/src/pages/judge/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/backups/lavocat.quebec/backup-20250730-021618/src/pages/judge/dashboard.tsx
import React, { useEffect, useState } from 'react';
import { useSession } from 'next-auth/react';
import { useRouter } from 'next/router';
import LayoutWithSidebar from '@/components/LayoutWithSidebar';
import { toast } from 'react-hot-toast';
import { 
  Scale, 
  Gavel, 
  FileText, 
  Users, 
  BookOpen, 
  BarChart3, 
  Calendar,
  Clock,
  AlertTriangle,
  CheckCircle,
  UserCheck,
  Award,
  Shield,
  Building
} from 'lucide-react';

const navCards = [
  {
    title: 'Case Oversight',
    description: 'Monitor active cases, review proceedings, and manage judicial decisions.',
    icon: <Scale className="h-8 w-8 text-red-600" />,
    href: '/judge/cases',
    color: 'from-red-500 to-red-600',
  },
  {
    title: 'Court Administration',
    description: 'Manage court calendar, hearing schedules, and administrative tasks.',
    icon: <Building className="h-8 w-8 text-blue-600" />,
    href: '/judge/administration',
    color: 'from-blue-500 to-blue-600',
  },
  {
    title: 'Judicial Tools',
    description: 'Access legal research, precedent search, and decision templates.',
    icon: <Gavel className="h-8 w-8 text-purple-600" />,
    href: '/judge/tools',
    color: 'from-purple-500 to-purple-600',
  },
  {
    title: 'Case Notes',
    description: 'Private case notes, decision rationale, and legal reasoning.',
    icon: <FileText className="h-8 w-8 text-green-600" />,
    href: '/judge/notes',
    color: 'from-green-500 to-green-600',
  },
  {
    title: 'Court Staff Management',
    description: 'Manage clerk assignments, administrative tasks, and team coordination.',
    icon: <Users className="h-8 w-8 text-indigo-600" />,
    href: '/judge/staff',
    color: 'from-indigo-500 to-indigo-600',
  },
  {
    title: 'Legal Opinions',
    description: 'Draft, review, and publish judicial opinions and decisions.',
    icon: <BookOpen className="h-8 w-8 text-yellow-600" />,
    href: '/judge/opinions',
    color: 'from-yellow-500 to-yellow-600',
  },
  {
    title: 'Judicial Education',
    description: 'Continuing education, training materials, and professional development.',
    icon: <Award className="h-8 w-8 text-teal-600" />,
    href: '/judge/education',
    color: 'from-teal-500 to-teal-600',
  },
  {
    title: 'Performance Metrics',
    description: 'Case disposition times, decision quality, and judicial performance analytics.',
    icon: <BarChart3 className="h-8 w-8 text-pink-600" />,
    href: '/judge/metrics',
    color: 'from-pink-500 to-pink-600',
  },
  {
    title: 'Profile',
    description: 'Manage your judicial profile and credentials.',
    icon: <UserCheck className="h-8 w-8 text-orange-600" />,
    href: '/judge/profile',
    color: 'from-orange-500 to-orange-600',
  },
];

const JudgeDashboard: React.FC = () => {
  const { data: session, status } = useSession();
  const router = useRouter();
  const [loading, setLoading] = useState(true);
  const [stats, setStats] = useState<any>(null);

  useEffect(() => {
    if (status === 'loading') return;
    if (!session || !['JUDGE', 'ADMIN', 'SUPERADMIN'].includes(session.user.role)) {
      router.push('/');
      return;
    }
    fetchStats();
  }, [session, status, router]);

  const fetchStats = async () => {
    try {
      // Placeholder: Replace with real API call
      setStats({
        activeCases: 18,
        pendingDecisions: 6,
        hearingsToday: 4,
        staffMembers: 8,
        opinionsDrafted: 12,
        educationHours: 24,
        avgDispositionTime: 45,
        caseLoad: 85,
      });
    } catch (e) {
      toast.error('Failed to load judicial statistics');
    } finally {
      setLoading(false);
    }
  };

  if (status === 'loading' || loading) {
    return (
      <LayoutWithSidebar>
        <div className="flex items-center justify-center min-h-screen">
          <div className="animate-spin rounded-full h-12 w-12 border-b-2 border-red-600"></div>
        </div>
      </LayoutWithSidebar>
    );
  }

  return (
    <LayoutWithSidebar>
      <div className="max-w-7xl mx-auto px-4 py-8">
        {/* Welcome Section */}
        <div className="mb-8">
          <h1 className="text-3xl font-bold text-gray-900 mb-2">
            Welcome, Honorable {session?.user?.name || 'Judge'}
          </h1>
          <p className="text-gray-600">
            Your judicial command center for case oversight, court administration, and legal decision-making.
          </p>
        </div>

        {/* Judicial Stats */}
        <div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-8 gap-4 mb-10">
          <div className="bg-gradient-to-r from-red-500 to-red-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Active Cases</div>
            <div className="text-2xl font-bold">{stats?.activeCases ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Pending Decisions</div>
            <div className="text-2xl font-bold">{stats?.pendingDecisions ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Hearings Today</div>
            <div className="text-2xl font-bold">{stats?.hearingsToday ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-green-500 to-green-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Staff Members</div>
            <div className="text-2xl font-bold">{stats?.staffMembers ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-yellow-500 to-yellow-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Opinions Drafted</div>
            <div className="text-2xl font-bold">{stats?.opinionsDrafted ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-indigo-500 to-indigo-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Education Hours</div>
            <div className="text-2xl font-bold">{stats?.educationHours ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-teal-500 to-teal-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Avg Disposition (Days)</div>
            <div className="text-2xl font-bold">{stats?.avgDispositionTime ?? '-'}</div>
          </div>
          <div className="bg-gradient-to-r from-pink-500 to-pink-600 text-white rounded-lg p-4 shadow">
            <div className="text-xs">Case Load %</div>
            <div className="text-2xl font-bold">{stats?.caseLoad ?? '-'}%</div>
          </div>
        </div>

        {/* Quick Actions */}
        <div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6 mb-8">
          <h2 className="text-xl font-semibold text-gray-900 mb-4">Quick Actions</h2>
          <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
            <button
              onClick={() => router.push('/judge/cases')}
              className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
            >
              <Scale className="h-6 w-6 text-red-600 mr-3" />
              <div className="text-left">
                <div className="font-medium text-gray-900">Review Cases</div>
                <div className="text-sm text-gray-500">Active case oversight</div>
              </div>
            </button>
            <button
              onClick={() => router.push('/judge/administration')}
              className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
            >
              <Calendar className="h-6 w-6 text-blue-600 mr-3" />
              <div className="text-left">
                <div className="font-medium text-gray-900">Court Calendar</div>
                <div className="text-sm text-gray-500">Manage hearings</div>
              </div>
            </button>
            <button
              onClick={() => router.push('/judge/opinions')}
              className="flex items-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors"
            >
              <FileText className="h-6 w-6 text-green-600 mr-3" />
              <div className="text-left">
                <div className="font-medium text-gray-900">Draft Opinion</div>
                <div className="text-sm text-gray-500">Legal decision writing</div>
              </div>
            </button>
          </div>
        </div>

        {/* Navigation Cards */}
        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
          {navCards.map((card) => (
            <button
              key={card.title}
              onClick={() => router.push(card.href)}
              className={`bg-gradient-to-r ${card.color} rounded-xl p-6 shadow-lg hover:scale-105 transition-transform text-left focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500`}
            >
              <div className="flex items-center mb-4">{card.icon}</div>
              <h2 className="text-xl font-semibold text-white mb-1">{card.title}</h2>
              <p className="text-white text-sm opacity-90">{card.description}</p>
            </button>
          ))}
        </div>

        {/* Today's Schedule */}
        <div className="mt-8 bg-white rounded-lg shadow-sm border border-gray-200 p-6">
          <h2 className="text-xl font-semibold text-gray-900 mb-4">Today's Judicial Schedule</h2>
          <div className="space-y-4">
            <div className="flex items-center p-3 bg-red-50 rounded-lg">
              <Clock className="h-5 w-5 text-red-600 mr-3" />
              <div className="flex-1">
                <div className="font-medium text-gray-900">9:00 AM - Smith v. Johnson</div>
                <div className="text-sm text-gray-500">Civil Case - Motion Hearing</div>
              </div>
              <div className="text-sm text-gray-500">Courtroom 3A</div>
            </div>
            <div className="flex items-center p-3 bg-blue-50 rounded-lg">
              <Clock className="h-5 w-5 text-blue-600 mr-3" />
              <div className="flex-1">
                <div className="font-medium text-gray-900">11:00 AM - State v. Davis</div>
                <div className="text-sm text-gray-500">Criminal Case - Sentencing</div>
              </div>
              <div className="text-sm text-gray-500">Courtroom 3A</div>
            </div>
            <div className="flex items-center p-3 bg-green-50 rounded-lg">
              <Clock className="h-5 w-5 text-green-600 mr-3" />
              <div className="flex-1">
                <div className="font-medium text-gray-900">2:00 PM - Chambers Meeting</div>
                <div className="text-sm text-gray-500">Staff Review & Planning</div>
              </div>
              <div className="text-sm text-gray-500">Chambers</div>
            </div>
            <div className="flex items-center p-3 bg-purple-50 rounded-lg">
              <Clock className="h-5 w-5 text-purple-600 mr-3" />
              <div className="flex-1">
                <div className="font-medium text-gray-900">4:00 PM - Wilson v. Corporation</div>
                <div className="text-sm text-gray-500">Civil Case - Settlement Conference</div>
              </div>
              <div className="text-sm text-gray-500">Conference Room</div>
            </div>
          </div>
        </div>

        {/* Priority Alerts */}
        <div className="mt-8 bg-white rounded-lg shadow-sm border border-gray-200 p-6">
          <h2 className="text-xl font-semibold text-gray-900 mb-4">Priority Alerts</h2>
          <div className="space-y-4">
            <div className="flex items-center p-3 bg-yellow-50 rounded-lg">
              <AlertTriangle className="h-5 w-5 text-yellow-600 mr-3" />
              <div>
                <div className="font-medium text-gray-900">Urgent: Johnson Case Decision Due</div>
                <div className="text-sm text-gray-500">Decision deadline: Tomorrow 5:00 PM</div>
              </div>
            </div>
            <div className="flex items-center p-3 bg-green-50 rounded-lg">
              <CheckCircle className="h-5 w-5 text-green-600 mr-3" />
              <div>
                <div className="font-medium text-gray-900">Opinion Published Successfully</div>
                <div className="text-sm text-gray-500">"State v. Rodriguez" - Appellate Court</div>
              </div>
            </div>
            <div className="flex items-center p-3 bg-blue-50 rounded-lg">
              <UserCheck className="h-5 w-5 text-blue-600 mr-3" />
              <div>
                <div className="font-medium text-gray-900">New Law Clerk Assignment</div>
                <div className="text-sm text-gray-500">Sarah Johnson - Criminal Division</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </LayoutWithSidebar>
  );
};

export default JudgeDashboard; 

CasperSecurity Mini