Spaces:
Runtime error
Runtime error
Download src/components/DocumentPreview.tsx from Vignesh5656/transformation-ui: direct link, hf CLI and curl.
- Browser
- Download file 60 kB
-
https://huggingface.co/spaces/Vignesh5656/transformation-ui/resolve/main/src/components/DocumentPreview.tsx
- Command line
-
hf download hf://spaces/Vignesh5656/transformation-ui/src/components/DocumentPreview.tsx
-
curl -L -o DocumentPreview.tsx https://huggingface.co/spaces/Vignesh5656/transformation-ui/resolve/main/src/components/DocumentPreview.tsx
60 kB
import React from 'react';
import { useDocument } from '../contexts/DocumentContext';
interface DocumentPreviewProps {
showTitle?: boolean;
compact?: boolean;
className?: string;
}
const DocumentPreview: React.FC<DocumentPreviewProps> = ({
showTitle = true,
compact = false,
className = ''
}) => {
const { documentState } = useDocument();
const {
clientInformation,
benefitConfiguration,
reviewData,
generatedDocuments,
currentStep,
deductibleDetails,
outOfPocketDetails,
mentalHealthBenefits,
inpatientBenefits,
outpatientBenefits,
claimsSpecialHandling,
otherBenefits,
msagRecords,
dxSupplementalRecords
} = documentState;
const formatDate = (dateString: string) => {
if (!dateString) return 'Not specified';
try {
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
} catch {
return dateString;
}
};
// Helper function to format arrays safely
const formatArray = (arr: string[] | undefined | null) => {
if (!Array.isArray(arr)) return 'None';
const filtered = arr.filter(item => item && item.trim() !== '');
return filtered.length > 0 ? filtered.join(', ') : 'None';
};
// Helper function to safely format values
const formatValue = (value: any) => {
if (value === null || value === undefined || value === '') return 'Not specified';
if (typeof value === 'boolean') return value ? 'Yes' : 'No';
return String(value);
};
// Helper to check if section has meaningful data
const hasData = (obj: any): boolean => {
if (!obj) return false;
if (typeof obj === 'object') {
return Object.values(obj).some((value: any): boolean => {
if (Array.isArray(value)) return value.length > 0;
if (typeof value === 'object' && value !== null) return hasData(value);
return value !== null && value !== undefined && value !== '';
});
}
return obj !== null && obj !== undefined && obj !== '';
};
const previewStyles = {
container: {
background: 'linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)',
borderRadius: compact ? '12px' : '20px',
boxShadow: '0 20px 60px rgba(0, 0, 0, 0.08), 0 8px 25px rgba(0, 0, 0, 0.05)',
border: '1px solid #e2e8f0',
fontFamily: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
maxHeight: compact ? '500px' : 'none',
overflow: compact ? 'auto' : 'visible'
} as React.CSSProperties,
header: {
background: 'linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%)',
color: 'white',
padding: compact ? '20px 24px' : '32px 40px',
borderRadius: `${compact ? '12px' : '20px'} ${compact ? '12px' : '20px'} 0 0`,
position: 'relative',
overflow: 'hidden'
} as React.CSSProperties,
headerPattern: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundImage: `
radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.08) 0%, transparent 50%)
`,
pointerEvents: 'none'
} as React.CSSProperties,
headerContent: {
position: 'relative',
zIndex: 1
} as React.CSSProperties,
title: {
fontSize: compact ? '1.6rem' : '2.2rem',
fontWeight: '700',
margin: 0,
textShadow: '0 4px 15px rgba(0, 0, 0, 0.2)',
letterSpacing: '-0.025em'
} as React.CSSProperties,
subtitle: {
fontSize: compact ? '1rem' : '1.1rem',
opacity: 0.9,
margin: '8px 0 0 0',
fontWeight: '400'
} as React.CSSProperties,
content: {
padding: compact ? '20px 24px' : '40px',
lineHeight: '1.6',
background: 'white'
} as React.CSSProperties,
section: {
marginBottom: compact ? '24px' : '32px',
paddingBottom: compact ? '20px' : '24px',
borderBottom: '2px solid #f1f5f9',
background: 'white',
borderRadius: '12px',
padding: compact ? '16px 20px' : '24px 28px',
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.04)'
} as React.CSSProperties,
sectionTitle: {
fontSize: compact ? '1.2rem' : '1.4rem',
fontWeight: '700',
color: '#1e293b',
marginBottom: compact ? '16px' : '20px',
display: 'flex',
alignItems: 'center',
gap: '12px',
borderBottom: '2px solid #e2e8f0',
paddingBottom: '8px'
} as React.CSSProperties,
fieldGrid: {
display: 'grid',
gridTemplateColumns: compact ? '1fr' : 'repeat(auto-fit, minmax(280px, 1fr))',
gap: compact ? '12px' : '16px',
marginBottom: '16px'
} as React.CSSProperties,
field: {
padding: compact ? '12px 16px' : '16px 20px',
background: 'linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)',
borderRadius: '10px',
border: '1px solid #e2e8f0',
transition: 'all 0.2s ease'
} as React.CSSProperties,
fieldLabel: {
fontSize: compact ? '0.85rem' : '0.95rem',
fontWeight: '700',
color: '#475569',
marginBottom: '6px',
textTransform: 'uppercase' as const,
letterSpacing: '0.05em'
} as React.CSSProperties,
fieldValue: {
fontSize: compact ? '0.95rem' : '1.05rem',
color: '#1e293b',
fontWeight: '500',
lineHeight: '1.5'
} as React.CSSProperties,
emptyState: {
color: '#94a3b8',
fontStyle: 'italic',
fontSize: compact ? '0.9rem' : '1rem',
padding: '24px',
textAlign: 'center' as const,
background: '#f8fafc',
borderRadius: '8px',
border: '2px dashed #cbd5e1'
} as React.CSSProperties,
statusBadge: {
display: 'inline-flex',
alignItems: 'center',
padding: '6px 16px',
borderRadius: '25px',
fontSize: '0.8rem',
fontWeight: '700',
textTransform: 'uppercase' as const,
letterSpacing: '0.5px',
boxShadow: '0 2px 6px rgba(0, 0, 0, 0.1)'
} as React.CSSProperties,
listItem: {
padding: compact ? '8px 14px' : '10px 18px',
background: 'linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%)',
border: '1px solid #a78bfa',
borderRadius: '8px',
margin: '6px 4px',
fontSize: compact ? '0.85rem' : '0.9rem',
fontWeight: '600',
color: '#581c87',
display: 'inline-block',
boxShadow: '0 2px 4px rgba(139, 92, 246, 0.1)'
} as React.CSSProperties,
detailCard: {
background: 'white',
border: '1px solid #e2e8f0',
borderRadius: '8px',
padding: '16px',
margin: '8px 0',
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.05)'
} as React.CSSProperties,
metricCard: {
background: 'linear-gradient(135deg, #fef3c7 0%, #fde68a 100%)',
border: '1px solid #f59e0b',
borderRadius: '12px',
padding: '16px 20px',
textAlign: 'center' as const,
boxShadow: '0 4px 12px rgba(245, 158, 11, 0.15)'
} as React.CSSProperties,
metricValue: {
fontSize: '1.8rem',
fontWeight: '800',
color: '#92400e',
display: 'block'
} as React.CSSProperties,
metricLabel: {
fontSize: '0.9rem',
fontWeight: '600',
color: '#78350f',
textTransform: 'uppercase' as const,
letterSpacing: '0.05em'
} as React.CSSProperties
};
const getStatusBadgeStyle = (status: string) => {
const baseStyle = previewStyles.statusBadge;
switch (status) {
case 'completed':
return { ...baseStyle, background: 'linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%)', color: '#166534' };
case 'processing':
return { ...baseStyle, background: 'linear-gradient(135deg, #fef3c7 0%, #fde68a 100%)', color: '#92400e' };
case 'error':
return { ...baseStyle, background: 'linear-gradient(135deg, #fee2e2 0%, #fecaca 100%)', color: '#991b1b' };
default:
return { ...baseStyle, background: 'linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%)', color: '#374151' };
}
};
// Calculate completion metrics
const getCompletionMetrics = () => {
const totalSections = 7;
let completedSections = 0;
let totalFields = 0;
let completedFields = 0;
// Client Information
if (clientInformation.clientName) {
completedSections++;
totalFields += 6;
if (clientInformation.clientName) completedFields++;
if (clientInformation.clientType) completedFields++;
if (clientInformation.lineOfBusiness) completedFields++;
if (clientInformation.effectiveDate) completedFields++;
if (clientInformation.termDate) completedFields++;
if (clientInformation.exportTargets.length > 0) completedFields++;
}
// Add other sections to metrics
if (deductibleDetails?.appliesForBenefit || outOfPocketDetails?.appliesForBenefit) completedSections++;
if (mentalHealthBenefits && hasData(mentalHealthBenefits)) completedSections++;
if (inpatientBenefits && hasData(inpatientBenefits)) completedSections++;
if (outpatientBenefits && hasData(outpatientBenefits)) completedSections++;
if (claimsSpecialHandling && hasData(claimsSpecialHandling)) completedSections++;
if (otherBenefits && hasData(otherBenefits)) completedSections++;
return {
completedSections,
totalSections,
completedFields,
totalFields: Math.max(totalFields, 1),
sectionProgress: (completedSections / totalSections) * 100,
fieldProgress: totalFields > 0 ? (completedFields / totalFields) * 100 : 0
};
};
const metrics = getCompletionMetrics();
return (
<div className={className} style={previewStyles.container}>
{/* Enhanced Header */}
<div style={previewStyles.header}>
<div style={previewStyles.headerPattern} />
<div style={previewStyles.headerContent}>
{showTitle && (
<>
<h2 style={previewStyles.title}>
π Document Configuration Preview
</h2>
<p style={previewStyles.subtitle}>
Step {currentStep} of 7 β’ {clientInformation.clientName || 'New Benefit Document'}
</p>
<div style={{ display: 'flex', gap: '20px', marginTop: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<div style={{ fontSize: '0.9rem', opacity: 0.9 }}>
π {Math.round(metrics.sectionProgress)}% Complete
</div>
<div style={{ fontSize: '0.9rem', opacity: 0.9 }}>
π {metrics.completedFields} of {metrics.totalFields} fields
</div>
<div style={{ fontSize: '0.9rem', opacity: 0.9 }}>
ποΈ {metrics.completedSections} of {metrics.totalSections} sections
</div>
</div>
</>
)}
</div>
</div>
<div style={previewStyles.content}>
{/* Quick Overview Metrics */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px', marginBottom: '32px' }}>
<div style={previewStyles.metricCard}>
<span style={previewStyles.metricValue}>{currentStep}</span>
<span style={previewStyles.metricLabel}>Current Step</span>
</div>
<div style={previewStyles.metricCard}>
<span style={previewStyles.metricValue}>{metrics.completedSections}</span>
<span style={previewStyles.metricLabel}>Completed Sections</span>
</div>
<div style={previewStyles.metricCard}>
<span style={previewStyles.metricValue}>{generatedDocuments.length}</span>
<span style={previewStyles.metricLabel}>Generated Documents</span>
</div>
<div style={previewStyles.metricCard}>
<span style={previewStyles.metricValue}>{(msagRecords?.length || 0) + (dxSupplementalRecords?.length || 0)}</span>
<span style={previewStyles.metricLabel}>Data Records</span>
</div>
</div>
{/* Client Information Section */}
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π’ Client Information & Setup
</h3>
{clientInformation.clientName ? (
<>
<div style={previewStyles.fieldGrid}>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Client Name</div>
<div style={previewStyles.fieldValue}>{clientInformation.clientName}</div>
</div>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Client Type</div>
<div style={previewStyles.fieldValue}>
{formatValue(clientInformation.clientType)}
</div>
</div>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Line of Business</div>
<div style={previewStyles.fieldValue}>
{formatValue(clientInformation.lineOfBusiness)}
</div>
</div>
{clientInformation.parentCode && (
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Parent Code</div>
<div style={previewStyles.fieldValue}>{clientInformation.parentCode}</div>
</div>
)}
</div>
<div style={previewStyles.fieldGrid}>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Effective Date</div>
<div style={previewStyles.fieldValue}>{formatDate(clientInformation.effectiveDate)}</div>
</div>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Term Date</div>
<div style={previewStyles.fieldValue}>{formatDate(clientInformation.termDate)}</div>
</div>
</div>
{/* Export Targets */}
{clientInformation.exportTargets && clientInformation.exportTargets.length > 0 && (
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Export Targets ({clientInformation.exportTargets.length})</div>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '8px' }}>
{clientInformation.exportTargets.map((target, index) => (
<span key={`export-${index}`} style={previewStyles.listItem}>
π€ {target}
</span>
))}
</div>
</div>
)}
{/* Approver Emails */}
{clientInformation.approverEmails && clientInformation.approverEmails.some(email => email.trim() !== '') && (
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>
Approver Emails ({clientInformation.approverEmails.filter(email => email.trim() !== '').length})
</div>
<div style={{ marginTop: '8px' }}>
{clientInformation.approverEmails
.filter(email => email.trim() !== '')
.map((email, index) => (
<div key={`email-${index}`} style={previewStyles.detailCard}>
π§ {email}
</div>
))}
</div>
</div>
)}
</>
) : (
<div style={previewStyles.emptyState}>
β οΈ No client information provided yet. Please complete Step 1 to see preview data.
</div>
)}
</div>
{/* Financial Maximums Section */}
{(deductibleDetails?.appliesForBenefit || outOfPocketDetails?.appliesForBenefit) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π° Financial Maximums & Deductibles
</h3>
{deductibleDetails?.appliesForBenefit && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Deductible Configuration</div>
<div style={previewStyles.fieldValue}>
{deductibleDetails.inNetwork?.enabled && "β
In-Network Enabled"}
{deductibleDetails.inNetwork?.enabled && deductibleDetails.outOfNetwork?.enabled && " β’ "}
{deductibleDetails.outOfNetwork?.enabled && "β
Out-of-Network Enabled"}
</div>
{deductibleDetails.inNetwork?.enabled && (
<div style={{ marginTop: '12px', padding: '12px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>In-Network Details:</strong>
{deductibleDetails.inNetwork.appliesTo && (
<div>Applies to: {formatArray(deductibleDetails.inNetwork.appliesTo)}</div>
)}
{deductibleDetails.inNetwork.embeddedBenefit && (
<div>
Individual: {formatValue(deductibleDetails.inNetwork.embeddedBenefit.individual)} β’
Family: {formatValue(deductibleDetails.inNetwork.embeddedBenefit.family)}
</div>
)}
</div>
)}
</div>
)}
{outOfPocketDetails?.appliesForBenefit && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Out-of-Pocket Maximums</div>
<div style={previewStyles.fieldValue}>
{outOfPocketDetails.inNetwork?.enabled && "β
In-Network Enabled"}
{outOfPocketDetails.inNetwork?.enabled && outOfPocketDetails.outOfNetwork?.enabled && " β’ "}
{outOfPocketDetails.outOfNetwork?.enabled && "β
Out-of-Network Enabled"}
</div>
</div>
)}
</div>
)}
{/* Mental Health Benefits Section */}
{mentalHealthBenefits && hasData(mentalHealthBenefits) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π§ Mental Health & Substance Abuse Benefits
</h3>
{mentalHealthBenefits.eap?.covered && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Employee Assistance Program (EAP)</div>
<div style={previewStyles.fieldValue}>
β
Covered β’ Visit Limit: {formatValue(mentalHealthBenefits.eap.visitLimit)}
{mentalHealthBenefits.eap.limits && (
<div style={{ marginTop: '8px', color: '#6b7280' }}>
Limits: {mentalHealthBenefits.eap.limits}
</div>
)}
</div>
</div>
)}
{mentalHealthBenefits.outpatientTherapies?.rows && mentalHealthBenefits.outpatientTherapies.rows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Outpatient Therapy Services ({mentalHealthBenefits.outpatientTherapies.rows.length} configured)
</div>
<div style={{ marginTop: '12px' }}>
{mentalHealthBenefits.outpatientTherapies.rows.slice(0, compact ? 2 : 4).map((row, index) => (
<div key={`therapy-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#f0f9ff'
}}>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>
<div>
<strong>In-Network:</strong>
<div>Covered: {formatValue(row.inNetwork.coveredOrRtm)}</div>
<div>Auth Required: {formatValue(row.inNetwork.authRequirement)}</div>
{row.inNetwork.maxVisit && <div>Max Visits: {row.inNetwork.maxVisit}</div>}
</div>
<div>
<strong>Out-of-Network:</strong>
<div>Covered: {formatValue(row.outOfNetwork.coveredOrRtm)}</div>
<div>Auth Required: {formatValue(row.outOfNetwork.authRequirement)}</div>
{row.outOfNetwork.maxVisit && <div>Max Visits: {row.outOfNetwork.maxVisit}</div>}
</div>
</div>
</div>
))}
{mentalHealthBenefits.outpatientTherapies.rows.length > (compact ? 2 : 4) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{mentalHealthBenefits.outpatientTherapies.rows.length - (compact ? 2 : 4)} more therapy configurations...
</div>
)}
</div>
</div>
)}
</div>
)}
{/* Inpatient Benefits Section */}
{inpatientBenefits && hasData(inpatientBenefits) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π¨ Inpatient Benefits
</h3>
{inpatientBenefits.selectedOptions && inpatientBenefits.selectedOptions.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Selected Benefit Categories ({inpatientBenefits.selectedOptions.length})</div>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '8px' }}>
{inpatientBenefits.selectedOptions.map((option, index) => (
<span key={`inpatient-option-${index}`} style={previewStyles.listItem}>
{option.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase())}
</span>
))}
</div>
</div>
)}
{/* Pre-Certification Penalty Details */}
{inpatientBenefits.preCertPenalty && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Pre-Certification Penalty Configuration</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px', marginTop: '12px' }}>
<div style={{ padding: '12px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>In-Network:</strong>
<div>Applies: {inpatientBenefits.preCertPenalty.inNetwork.applies ? 'β
Yes' : 'β No'}</div>
{inpatientBenefits.preCertPenalty.inNetwork.applies && (
<div>Definition: {formatValue(inpatientBenefits.preCertPenalty.inNetwork.definePenalty)}</div>
)}
</div>
<div style={{ padding: '12px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Out-of-Network:</strong>
<div>Applies: {inpatientBenefits.preCertPenalty.outNetwork.applies ? 'β
Yes' : 'β No'}</div>
{inpatientBenefits.preCertPenalty.outNetwork.applies && (
<div>Definition: {formatValue(inpatientBenefits.preCertPenalty.outNetwork.definePenalty)}</div>
)}
</div>
</div>
</div>
)}
{/* Facility Services */}
{inpatientBenefits.facilityRows && inpatientBenefits.facilityRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Facility Services Configuration ({inpatientBenefits.facilityRows.length} services)
</div>
<div style={{ marginTop: '12px' }}>
{inpatientBenefits.facilityRows.slice(0, compact ? 2 : 6).map((row, index) => (
<div key={`facility-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#f0f9ff'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.coveredOrRTM)}</div>
<div><strong>Psych/SA:</strong> {formatValue(row.psychOrSA)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
<div><strong>Copay:</strong> {formatValue(row.copay)}</div>
<div><strong>Coinsurance:</strong> {formatValue(row.coinsurance)}</div>
</div>
{row.exceptions && (
<div style={{ marginTop: '8px', fontSize: '0.85rem', color: '#6b7280' }}>
<strong>Exceptions:</strong> {row.exceptions}
</div>
)}
</div>
))}
{inpatientBenefits.facilityRows.length > (compact ? 2 : 6) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{inpatientBenefits.facilityRows.length - (compact ? 2 : 6)} more facility service configurations...
</div>
)}
</div>
</div>
)}
{/* Professional Services */}
{inpatientBenefits.professionalRows && inpatientBenefits.professionalRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Professional Services Configuration ({inpatientBenefits.professionalRows.length} services)
</div>
<div style={{ marginTop: '12px' }}>
{inpatientBenefits.professionalRows.slice(0, compact ? 2 : 4).map((row, index) => (
<div key={`professional-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#f0fdf4'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.coveredOrRTM)}</div>
<div><strong>Psych/SA:</strong> {formatValue(row.psychOrSA)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
<div><strong>Copay:</strong> {formatValue(row.copay)}</div>
<div><strong>Coinsurance:</strong> {formatValue(row.coinsurance)}</div>
</div>
{row.exceptions && (
<div style={{ marginTop: '8px', fontSize: '0.85rem', color: '#6b7280' }}>
<strong>Exceptions:</strong> {row.exceptions}
</div>
)}
</div>
))}
{inpatientBenefits.professionalRows.length > (compact ? 2 : 4) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{inpatientBenefits.professionalRows.length - (compact ? 2 : 4)} more professional service configurations...
</div>
)}
</div>
</div>
)}
{/* Alternative Care Services */}
{inpatientBenefits.alternativeCareRows && inpatientBenefits.alternativeCareRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Alternative Care Services ({inpatientBenefits.alternativeCareRows.length} services)
</div>
<div style={{ marginTop: '12px' }}>
{inpatientBenefits.alternativeCareRows.slice(0, compact ? 2 : 3).map((row, index) => (
<div key={`alt-care-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#fefbf3'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.coveredOrRTM)}</div>
<div><strong>Psych/SA:</strong> {formatValue(row.psychOrSA)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
<div><strong>Copay:</strong> {formatValue(row.copay)}</div>
<div><strong>Coinsurance:</strong> {formatValue(row.coinsurance)}</div>
</div>
{row.exceptions && (
<div style={{ marginTop: '8px', fontSize: '0.85rem', color: '#6b7280' }}>
<strong>Exceptions:</strong> {row.exceptions}
</div>
)}
</div>
))}
{inpatientBenefits.alternativeCareRows.length > (compact ? 2 : 3) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{inpatientBenefits.alternativeCareRows.length - (compact ? 2 : 3)} more alternative care configurations...
</div>
)}
</div>
</div>
)}
</div>
)}
{/* Outpatient Benefits Section */}
{outpatientBenefits && hasData(outpatientBenefits) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π₯ Outpatient Benefits
</h3>
{outpatientBenefits.selectedOptions && outpatientBenefits.selectedOptions.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Selected Benefit Categories ({outpatientBenefits.selectedOptions.length})</div>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '8px' }}>
{outpatientBenefits.selectedOptions.map((option, index) => (
<span key={`outpatient-option-${index}`} style={previewStyles.listItem}>
{option.toUpperCase()}
</span>
))}
</div>
</div>
)}
{/* EAP Configuration */}
{outpatientBenefits.eapConfig?.covered && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Employee Assistance Program (EAP) Configuration</div>
<div style={previewStyles.fieldValue}>
β
Covered β’ Visit Limit: {formatValue(outpatientBenefits.eapConfig.visitLimit)}
{outpatientBenefits.eapConfig.limits && (
<div style={{ marginTop: '8px', color: '#6b7280' }}>
Additional Limits: {outpatientBenefits.eapConfig.limits}
</div>
)}
{outpatientBenefits.eapConfig.exceptions && (
<div style={{ marginTop: '8px', fontSize: '0.9rem', color: '#6b7280' }}>
Exceptions: {outpatientBenefits.eapConfig.exceptions}
</div>
)}
</div>
</div>
)}
{/* ABA Configuration */}
{(outpatientBenefits.abaConfig?.inNetwork.covered || outpatientBenefits.abaConfig?.outNetwork.covered) && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Applied Behavior Analysis (ABA) Configuration</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px', marginTop: '12px' }}>
<div style={{ padding: '12px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>In-Network:</strong>
<div>Covered: {outpatientBenefits.abaConfig?.inNetwork.covered ? 'β
Yes' : 'β No'}</div>
<div>Auth Required: {outpatientBenefits.abaConfig?.inNetwork.authRequired ? 'β
Yes' : 'β No'}</div>
{outpatientBenefits.abaConfig?.inNetwork.exceptions && (
<div>Exceptions: {outpatientBenefits.abaConfig.inNetwork.exceptions}</div>
)}
</div>
<div style={{ padding: '12px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Out-of-Network:</strong>
<div>Covered: {outpatientBenefits.abaConfig?.outNetwork.covered ? 'β
Yes' : 'β No'}</div>
<div>Auth Required: {outpatientBenefits.abaConfig?.outNetwork.authRequired ? 'β
Yes' : 'β No'}</div>
{outpatientBenefits.abaConfig?.outNetwork.exceptions && (
<div>Exceptions: {outpatientBenefits.abaConfig.outNetwork.exceptions}</div>
)}
</div>
</div>
</div>
)}
{/* Therapy Services */}
{outpatientBenefits.therapyRows && outpatientBenefits.therapyRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Therapy Services Configuration ({outpatientBenefits.therapyRows.length} services)
</div>
<div style={{ marginTop: '12px' }}>
{outpatientBenefits.therapyRows.slice(0, compact ? 2 : 5).map((row, index) => (
<div key={`therapy-service-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#f8fafc'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.covered)}</div>
<div><strong>Psych/SA:</strong> {formatValue(row.psychOrSA)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
</div>
{row.exceptions && (
<div style={{ marginTop: '8px', fontSize: '0.85rem', color: '#6b7280' }}>
<strong>Exceptions:</strong> {row.exceptions}
</div>
)}
</div>
))}
{outpatientBenefits.therapyRows.length > (compact ? 2 : 5) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{outpatientBenefits.therapyRows.length - (compact ? 2 : 5)} more therapy service configurations...
</div>
)}
</div>
</div>
)}
{/* Benefit Configurations */}
{((outpatientBenefits.inNetworkConfig?.length || 0) + (outpatientBenefits.outNetworkConfig?.length || 0)) > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Additional Benefit Configurations</div>
<div style={{ display: 'grid', gridTemplateColumns: compact ? '1fr' : '1fr 1fr', gap: '16px', marginTop: '12px' }}>
{outpatientBenefits.inNetworkConfig && outpatientBenefits.inNetworkConfig.length > 0 && (
<div style={{ padding: '12px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>In-Network Configurations ({outpatientBenefits.inNetworkConfig.length}):</strong>
{outpatientBenefits.inNetworkConfig.slice(0, 3).map((config, index) => (
<div key={`in-config-${index}`} style={{ marginTop: '4px', fontSize: '0.9rem' }}>
β’ {typeof config === 'string' ? config : JSON.stringify(config).substring(0, 50) + '...'}
</div>
))}
{outpatientBenefits.inNetworkConfig.length > 3 && (
<div style={{ marginTop: '4px', fontSize: '0.85rem', color: '#6b7280' }}>
+{outpatientBenefits.inNetworkConfig.length - 3} more...
</div>
)}
</div>
)}
{outpatientBenefits.outNetworkConfig && outpatientBenefits.outNetworkConfig.length > 0 && (
<div style={{ padding: '12px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Out-of-Network Configurations ({outpatientBenefits.outNetworkConfig.length}):</strong>
{outpatientBenefits.outNetworkConfig.slice(0, 3).map((config, index) => (
<div key={`out-config-${index}`} style={{ marginTop: '4px', fontSize: '0.9rem' }}>
β’ {typeof config === 'string' ? config : JSON.stringify(config).substring(0, 50) + '...'}
</div>
))}
{outpatientBenefits.outNetworkConfig.length > 3 && (
<div style={{ marginTop: '4px', fontSize: '0.85rem', color: '#6b7280' }}>
+{outpatientBenefits.outNetworkConfig.length - 3} more...
</div>
)}
</div>
)}
</div>
</div>
)}
</div>
)}
{/* Claims Special Handling Section */}
{claimsSpecialHandling && hasData(claimsSpecialHandling) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π Claims Special Handling
</h3>
{/* Coversheeted Information */}
{claimsSpecialHandling.coversheeted?.carrier && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Coversheeted Claims Information</div>
<div style={previewStyles.fieldValue}>
<strong>Carrier:</strong> {claimsSpecialHandling.coversheeted.carrier}
{claimsSpecialHandling.coversheeted.customerServicePhone && (
<div style={{ marginTop: '4px' }}>
<strong>Customer Service Phone:</strong> {claimsSpecialHandling.coversheeted.customerServicePhone}
</div>
)}
</div>
</div>
)}
{/* Comments */}
{claimsSpecialHandling.comments && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Special Handling Comments</div>
<div style={previewStyles.fieldValue}>
{claimsSpecialHandling.comments}
</div>
</div>
)}
{/* Break in Treatment */}
{claimsSpecialHandling.breakInTreatment && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Break in Treatment Definition</div>
<div style={previewStyles.fieldValue}>
{claimsSpecialHandling.breakInTreatment}
</div>
</div>
)}
{/* Special Requirements */}
{(claimsSpecialHandling.expatriatesCovered || claimsSpecialHandling.medicareAuthRequired) && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Special Requirements & Flags</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '12px', marginTop: '8px' }}>
{claimsSpecialHandling.expatriatesCovered && (
<div style={{ padding: '8px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>Expatriates Coverage:</strong> {claimsSpecialHandling.expatriatesCovered.toUpperCase()}
</div>
)}
{claimsSpecialHandling.medicareAuthRequired && (
<div style={{ padding: '8px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Medicare Auth Required:</strong> {claimsSpecialHandling.medicareAuthRequired.toUpperCase()}
</div>
)}
</div>
</div>
)}
{/* Additional Information */}
{claimsSpecialHandling.miscellaneous && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Miscellaneous Information</div>
<div style={previewStyles.fieldValue}>
{claimsSpecialHandling.miscellaneous}
</div>
</div>
)}
</div>
)}
{/* Other Benefits Section */}
{otherBenefits && hasData(otherBenefits) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π§ Other Benefits & Special Services
</h3>
{otherBenefits.selectedOptions && otherBenefits.selectedOptions.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Selected Other Benefit Types ({otherBenefits.selectedOptions.length})</div>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '8px' }}>
{otherBenefits.selectedOptions.map((option, index) => (
<span key={`other-option-${index}`} style={previewStyles.listItem}>
{option.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase())}
</span>
))}
</div>
</div>
)}
{/* Emergency Services */}
{otherBenefits.emergencyRows && otherBenefits.emergencyRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Emergency Services ({otherBenefits.emergencyRows.length} configurations)
</div>
<div style={{ marginTop: '12px' }}>
{otherBenefits.emergencyRows.slice(0, compact ? 2 : 4).map((row, index) => (
<div key={`emergency-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#fee2e2'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.coveredOrRTM)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
<div><strong>Copay:</strong> {formatValue(row.copay)}</div>
<div><strong>Coinsurance:</strong> {formatValue(row.coinsurance)}</div>
</div>
</div>
))}
{otherBenefits.emergencyRows.length > (compact ? 2 : 4) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{otherBenefits.emergencyRows.length - (compact ? 2 : 4)} more emergency service configurations...
</div>
)}
</div>
</div>
)}
{/* ECT Services */}
{otherBenefits.ectRows && otherBenefits.ectRows.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Electroconvulsive Therapy (ECT) Services ({otherBenefits.ectRows.length} configurations)
</div>
<div style={{ marginTop: '12px' }}>
{otherBenefits.ectRows.slice(0, compact ? 1 : 3).map((row, index) => (
<div key={`ect-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: '#fef3c7'
}}>
<div style={{ marginBottom: '8px' }}>
<strong>Service:</strong> {formatValue(row.service)} β’
<strong> Network:</strong> {row.networkType === 'in' ? 'In-Network' : 'Out-of-Network'}
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))', gap: '8px' }}>
<div><strong>Coverage:</strong> {formatValue(row.coveredOrRTM)}</div>
<div><strong>Auth Required:</strong> {formatValue(row.authRequirement)}</div>
<div><strong>Copay:</strong> {formatValue(row.copay)}</div>
<div><strong>Coinsurance:</strong> {formatValue(row.coinsurance)}</div>
</div>
</div>
))}
{otherBenefits.ectRows.length > (compact ? 1 : 3) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{otherBenefits.ectRows.length - (compact ? 1 : 3)} more ECT configurations...
</div>
)}
</div>
</div>
)}
{/* Out of Country Benefits */}
{otherBenefits.outOfCountry?.coveredBenefit && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Out-of-Country Benefits</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '12px', marginTop: '8px' }}>
<div style={{ padding: '8px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>Coverage Status:</strong> β
Covered
</div>
<div style={{ padding: '8px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Emergency Only:</strong> {otherBenefits.outOfCountry.emergencyServicesOnly ? 'β
Yes' : 'β No'}
</div>
<div style={{ padding: '8px', background: '#f0fdf4', borderRadius: '6px' }}>
<strong>Payment to Member:</strong> {otherBenefits.outOfCountry.paymentToMember ? 'β
Yes' : 'β No'}
</div>
<div style={{ padding: '8px', background: '#fdf2f8', borderRadius: '6px' }}>
<strong>Claim Paid at INN:</strong> {otherBenefits.outOfCountry.claimPaidAtINN ? 'β
Yes' : 'β No'}
</div>
</div>
</div>
)}
{/* Transition Benefits */}
{otherBenefits.transitionBenefitsConfig?.coveredBenefit && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Transition Benefits Configuration</div>
<div style={{ marginTop: '8px' }}>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px' }}>
<div style={{ padding: '8px', background: '#f0f9ff', borderRadius: '6px' }}>
<strong>Applies to Types:</strong>
<div>{formatArray(otherBenefits.transitionBenefitsConfig.appliesTo.type)}</div>
</div>
<div style={{ padding: '8px', background: '#fef3c7', borderRadius: '6px' }}>
<strong>Applies to Settings:</strong>
<div>{formatArray(otherBenefits.transitionBenefitsConfig.appliesTo.setting)}</div>
</div>
</div>
<div style={{ marginTop: '8px', padding: '8px', background: '#f0fdf4', borderRadius: '6px' }}>
<strong>Auth Required:</strong> {formatValue(otherBenefits.transitionBenefitsConfig.authRequired)}
</div>
<div style={{ marginTop: '8px', padding: '8px', background: '#fdf2f8', borderRadius: '6px' }}>
<strong>Start Date:</strong> {formatValue(otherBenefits.transitionBenefitsConfig.startDate)} β’
<strong> End Date:</strong> {formatValue(otherBenefits.transitionBenefitsConfig.endDate)}
</div>
{otherBenefits.transitionBenefitsConfig.exceptions && (
<div style={{ marginTop: '8px', padding: '8px', background: '#fef7f7', borderRadius: '6px' }}>
<strong>Exceptions:</strong> {otherBenefits.transitionBenefitsConfig.exceptions}
</div>
)}
</div>
</div>
)}
{/* Other Services Summary */}
{((otherBenefits.otherOutpatientRows?.length || 0) + (otherBenefits.otherServicesRows?.length || 0)) > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Additional Services Summary</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px', marginTop: '8px' }}>
<div style={{ padding: '12px', background: '#f8fafc', borderRadius: '6px' }}>
<strong>Other Outpatient Services:</strong>
<div>{otherBenefits.otherOutpatientRows?.length || 0} configurations</div>
</div>
<div style={{ padding: '12px', background: '#f1f5f9', borderRadius: '6px' }}>
<strong>Other Services:</strong>
<div>{otherBenefits.otherServicesRows?.length || 0} configurations</div>
</div>
</div>
</div>
)}
</div>
)}
{/* Benefit Configuration Summary */}
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π₯ Comprehensive Benefit Configuration Summary
</h3>
{benefitConfiguration.benefitTypes.length > 0 ? (
<>
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Primary Benefit Types ({benefitConfiguration.benefitTypes.length})</div>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '8px' }}>
{benefitConfiguration.benefitTypes.map((type, index) => (
<span key={`benefit-type-${index}`} style={previewStyles.listItem}>
{type}
</span>
))}
</div>
</div>
{Object.keys(benefitConfiguration.coverageDetails).length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>
Detailed Coverage Configurations ({Object.keys(benefitConfiguration.coverageDetails).length} items)
</div>
<div style={{ marginTop: '12px' }}>
{Object.entries(benefitConfiguration.coverageDetails).slice(0, compact ? 3 : 8).map(([key, value], index) => (
<div key={`coverage-${index}`} style={{
...previewStyles.field,
margin: '8px 0',
background: index % 2 === 0 ? '#f8fafc' : '#f1f5f9'
}}>
<div style={previewStyles.fieldLabel}>{key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase())}</div>
<div style={previewStyles.fieldValue}>
{typeof value === 'object' ? (
<div style={{ fontSize: '0.9rem' }}>
{JSON.stringify(value, null, 2).substring(0, 200)}
{JSON.stringify(value).length > 200 && '...'}
</div>
) : (
formatValue(value)
)}
</div>
</div>
))}
{Object.keys(benefitConfiguration.coverageDetails).length > (compact ? 3 : 8) && (
<div style={{ ...previewStyles.emptyState, margin: '8px 0', padding: '12px' }}>
+{Object.keys(benefitConfiguration.coverageDetails).length - (compact ? 3 : 8)} more coverage detail configurations...
</div>
)}
</div>
</div>
)}
</>
) : (
<div style={previewStyles.emptyState}>
No benefit configuration set up yet. Complete Steps 2-6 to configure comprehensive benefit details.
</div>
)}
</div>
{/* Data Records Section */}
{((msagRecords && msagRecords.length > 0) || (dxSupplementalRecords && dxSupplementalRecords.length > 0)) && (
<div style={previewStyles.section}>
<h3 style={previewStyles.sectionTitle}>
π Configuration Data Records
</h3>
{msagRecords && msagRecords.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>MSAG Records ({msagRecords.length})</div>
<div style={previewStyles.fieldValue}>
Service authorization and billing configurations defined
</div>
<div style={{ marginTop: '8px', fontSize: '0.9rem', color: '#6b7280' }}>
Latest: {msagRecords[0]?.serviceType || 'Unknown'} β’
Auth Class: {msagRecords[0]?.authClass || 'Not specified'}
</div>
</div>
)}
{dxSupplementalRecords && dxSupplementalRecords.length > 0 && (
<div style={previewStyles.detailCard}>
<div style={previewStyles.fieldLabel}>Diagnosis Supplemental Records ({dxSupplementalRecords.length})</div>
<div style={previewStyles.fieldValue}>
Diagnosis-specific coverage rules defined
</div>
</div>
)}
</div>
)}
{/* Enhanced Progress Summary */}
<div style={{ ...previewStyles.section, borderBottom: 'none', marginBottom: 0 }}>
<h3 style={previewStyles.sectionTitle}>
π Configuration Progress & Summary
</h3>
<div style={{ display: 'grid', gridTemplateColumns: compact ? '1fr' : '1fr 1fr', gap: '20px' }}>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Current Progress</div>
<div style={previewStyles.fieldValue}>
Step {currentStep} of 7 ({Math.round((currentStep / 7) * 100)}% Complete)
</div>
<div style={{
marginTop: '16px',
background: '#e2e8f0',
borderRadius: '12px',
overflow: 'hidden',
height: '12px'
}}>
<div style={{
width: `${(currentStep / 7) * 100}%`,
height: '100%',
background: 'linear-gradient(90deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%)',
transition: 'width 0.3s ease',
borderRadius: '12px'
}} />
</div>
</div>
<div style={previewStyles.field}>
<div style={previewStyles.fieldLabel}>Document Status</div>
<div style={previewStyles.fieldValue}>
{clientInformation.clientName ? (
<span style={{ color: '#059669' }}>β
Configuration in Progress</span>
) : (
<span style={{ color: '#dc2626' }}>β οΈ Not Started</span>
)}
</div>
<div style={{ marginTop: '8px', fontSize: '0.9rem', color: '#6b7280' }}>
Last updated: {new Date().toLocaleDateString()}
</div>
</div>
</div>
{/* Quick Actions */}
{currentStep < 7 && (
<div style={{
marginTop: '20px',
padding: '16px',
background: 'linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%)',
borderRadius: '10px',
border: '1px solid #a78bfa'
}}>
<div style={{ fontWeight: '600', color: '#581c87', marginBottom: '8px' }}>
π Next Steps
</div>
<div style={{ color: '#6d28d9', fontSize: '0.9rem' }}>
Continue with Step {currentStep + 1} to complete the benefit configuration
</div>
</div>
)}
</div>
</div>
</div>
);
};
export default DocumentPreview;
import React from 'react';
import { useDocument } from '../contexts/DocumentContext';
interface DocumentPreviewProps {
showTitle?: boolean;
compact?: boolean;
className?: string;
}
const DocumentPreview: React.FC<DocumentPreviewProps> = ({
showTitle = true,
compact = false,
className = ''
}) => {
const { documentState } = useDocument();
const {
clientInformation,
benefitConfiguration,
reviewData,
generatedDocuments,
currentStep,
deductibleDetails,
outOfPocketDetails,
mentalHealthBenefits,
inpatientBenefits,
outpatientBenefits,
claimsSpecialHandling,
otherBenefits,
msagRecords,
dxSupplementalRecords
} = documentState;
const formatDate = (dateString: string) => {
if (!dateString) return 'Not specified';
try {
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
} catch {
return dateString;
}
};
// Helper function to format arrays safely
const formatArray = (arr: string[] | undefined | null) => {
if (!Array.isArray(arr)) return 'None';
const filtered = arr.filter(item => item && item.trim() !== '');
return filtered.length > 0 ? filtered.join(', ') : 'None';
};
// Helper function to safely format values
const formatValue = (value: any) => {
if (value === null || value === undefined || value === '') return 'Not specified';
if (typeof value === 'boolean') return value ? 'Yes' : 'No';
return String(value);
};
// Helper to check if section has meaningful data
const hasData = (obj: any): boolean => {
if (!obj) return false;
if (typeof obj === 'object') {
return Object.values(obj).some((value: any): boolean => {
if (Array.isArray(value)) return value.length > 0;
if (typeof value === 'object' && value !== null) return hasData(value);
return value !== null && value !== undefined && value !== '';
});
}
return obj !== null && obj !== undefined && obj !== '';
};
const previewStyles = {
container: {
background: 'linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)',
borderRadius: compact ? '12px' : '20px',
boxShadow: '0 20px 60px rgba(0, 0, 0, 0.08), 0 8px 25px rgba(0, 0, 0, 0.05)',
border: '1px solid #e2e8f0',
fontFamily: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
maxHeight: compact ? '500px' : 'none',
overflow: compact ? 'auto' : 'visible'
} as React.CSSProperties,
header: {
background: 'linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%)',
color: 'white',
padding: compact ? '20px 24px' : '32px 40px',
borderRadius: `${compact ? '12px' : '20px'} ${compact ? '12px' : '20px'} 0 0`,
position: 'relative',
overflow: 'hidden'
} as React.CSSProperties,
headerPattern: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundImage: `
radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),