import React from 'react'; import { useAuth } from '../contexts/AuthContext'; import { useOrg } from '../contexts/OrgContext'; import { Card } from '../components/UiKit'; const DebugEmployee: React.FC = () => { const { user } = useAuth(); const { employees, org } = useOrg(); return (

Employee Debug Information

{/* Current User Info */}

Current User

Email: {user?.email || 'Not logged in'}
Display Name: {user?.displayName || 'N/A'}
UID: {user?.uid || 'N/A'}
{/* Organization Info */}

Organization

Name: {org?.name || 'Not set'}
Org ID: {org?.orgId || 'N/A'}
Onboarding Complete: {org?.onboardingCompleted ? 'Yes' : 'No'}
{/* Employee Matching Analysis */}

Employee Matching Analysis

Total Employees: {employees.length}
{user?.email && (

Matching Results:

{/* Exact match */}
Exact Email Match: {employees.find(emp => emp.email === user.email) ? '✅ Found' : '❌ Not found'}
{/* Case insensitive match */}
Case-Insensitive Match: {employees.find(emp => emp.email?.toLowerCase() === user.email?.toLowerCase()) ? '✅ Found' : '❌ Not found'}
{/* Domain match */}
Same Domain Match: {(() => { const userDomain = user.email?.split('@')[1]; const domainMatch = employees.find(emp => emp.email?.split('@')[1] === userDomain); return domainMatch ? `✅ Found: ${domainMatch.name} (${domainMatch.email})` : '❌ Not found'; })()}
{/* Username partial match */}
Username Partial Match: {(() => { const username = user.email?.split('@')[0]; const partialMatch = employees.find(emp => emp.email?.toLowerCase().includes(username?.toLowerCase() || '') ); return partialMatch ? `✅ Found: ${partialMatch.name} (${partialMatch.email})` : '❌ Not found'; })()}
)}
{/* All Employees List */}

All Employees ({employees.length})

{employees.length === 0 ? (

No employees found

) : ( employees.map((employee, index) => (
Name: {employee.name}
Email: {employee.email || 'Not set'}
Role: {employee.role || 'Not set'}
ID: {employee.id}
{user?.email && employee.email && (
Match Analysis: {employee.email === user.email && ( Exact )} {employee.email?.toLowerCase() === user.email?.toLowerCase() && employee.email !== user.email && ( Case Diff )} {employee.email?.split('@')[1] === user.email?.split('@')[1] && ( Same Domain )} {employee.email?.toLowerCase().includes(user.email?.split('@')[0]?.toLowerCase() || '') && ( Username Match )}
)}
)) )}
{/* Quick Actions */}

Quick Actions

Try Traditional Questionnaire Try Stepped Questionnaire Go to Reports
); }; export default DebugEmployee;