import React from 'react'; export default function VerifyStep({ currentStep, confirmedData, extractionResults, sanityWarnings, updateConfirmedField, updateOpeningField, renderSourceBadge, hasEstimates, acknowledgedEstimates, setAcknowledgedEstimates, handleConfirmDataSubmit, calcParams, setCalcParams, handleRunCalculation, loading, isArabic }) { const [markupImage, setMarkupImage] = React.useState(null); if (currentStep === 4) { return (
{/* Takeoff Viewer Modal */} {markupImage === 'show' && (

👁️ Auto-Coloring Takeoff Viewer (OpenCV)

{extractionResults && Object.keys(extractionResults).filter(k => extractionResults[k].markup_url).length > 0 ? ( Object.values(extractionResults).filter(res => res.markup_url).map((res, idx) => { let imgUrl = res.markup_url; if (imgUrl.includes('\\') || imgUrl.includes('C:')) { const parts = imgUrl.split(/[\\/]/); imgUrl = '/cache/' + parts[parts.length - 1]; } return (

{res.detected_type || 'Markup'}

Takeoff Markup
); }) ) :
No OpenCV Markups generated for this project.
}
)}

{isArabic ? '4. مراجعة وتأكيد المقاسات المستخرجة' : '4. Confirm & Verify Extracted Parameters'}

{isArabic ? 'يرجى تدقيق القيم التي استخرجها الذكاء الاصطناعي وتعديل أي قيم غير دقيقة قبل حساب جداول الحصر.' : 'Inspect the parameters extracted by AI. Correct any dimensions before running engineering calculations.'}

{/* Failed Extractions Warnings */} {extractionResults && Object.values(extractionResults).filter(res => res._ok === false).length > 0 && (

🚨 {isArabic ? 'تنبيه: انخفاض جودة بعض المخططات' : 'Alert: Low Clarity on Some Pages'}

{isArabic ? 'لم يتمكن الذكاء الاصطناعي من قراءة الجداول من المستندات التالية بوضوح. لا تقلق، سيقوم النظام تلقائياً باستخدام التقديرات الهندسية الافتراضية (Engineering Assumptions) أدناه لتعويض النقص وإتمام الحسابات:' : 'The AI could not clearly read the schedules from the following documents. Don\'t worry, the system will automatically fall back to the safe Engineering Assumptions & Defaults below to complete the calculations:'}

)} {sanityWarnings && sanityWarnings.length > 0 && (

⚠️ {isArabic ? 'تحذيرات هندسية' : 'Engineering Warnings'}

)}
{/* Form Grid */}
updateConfirmedField('longest_length', parseFloat(e.target.value) || 0)} />
updateConfirmedField('longest_width', parseFloat(e.target.value) || 0)} />
updateConfirmedField('plot_area', parseFloat(e.target.value) || 0)} />
updateConfirmedField('gf_area', parseFloat(e.target.value) || 0)} />
updateConfirmedField('gf_height', parseFloat(e.target.value) || 0)} />
{calcParams.num_floors >= 2 && (
updateConfirmedField('f1_height', parseFloat(e.target.value) || 0)} />
)} {calcParams.num_floors >= 3 && (
updateConfirmedField('f2_height', parseFloat(e.target.value) || 0)} />
)}
updateConfirmedField('ext_perimeter', parseFloat(e.target.value) || 0)} />
updateConfirmedField('int_walls_20cm_m', parseFloat(e.target.value) || 0)} />
updateConfirmedField('int_walls_10cm_m', parseFloat(e.target.value) || 0)} />
updateConfirmedField('roof_perimeter', parseFloat(e.target.value) || 0)} />
updateConfirmedField('roof_slab_area', parseFloat(e.target.value) || 0)} />
updateConfirmedField('compound_length', parseFloat(e.target.value) || 0)} style={confirmedData.compound_length_is_estimated ? { borderColor: '#f59e0b', backgroundColor: '#fffbeb' } : {}} />
updateOpeningField('door_count', parseInt(e.target.value) || 0)} style={confirmedData.openings?.totals?.door_count_is_estimated ? { borderColor: '#f59e0b', backgroundColor: '#fffbeb' } : {}} />
updateOpeningField('window_area', parseFloat(e.target.value) || 0)} style={confirmedData.openings?.totals?.window_area_is_estimated ? { borderColor: '#f59e0b', backgroundColor: '#fffbeb' } : {}} />
{/* Engineering Assumptions Section */}

⚙️ {isArabic ? 'الافتراضات الهندسية (أبعاد ونسب تقديرية قابلة للتعديل)' : 'Engineering Assumptions & Estimators (Editable)'}

updateConfirmedField('excavation_depth', parseFloat(e.target.value) || 0)} />
updateConfirmedField('sog_thickness', parseFloat(e.target.value) || 0)} />
updateConfirmedField('total_villa_height', parseFloat(e.target.value) || 0)} />
updateConfirmedField('neck_column_height', parseFloat(e.target.value) || 0)} />
updateConfirmedField('solid_block_height', parseFloat(e.target.value) || 0)} />
updateConfirmedField('staircase_volume_per_level', parseFloat(e.target.value) || 0)} />
updateConfirmedField('default_col_length', parseFloat(e.target.value) || 0)} />
updateConfirmedField('default_col_width', parseFloat(e.target.value) || 0)} />
{hasEstimates ? (
⚠️ {isArabic ? 'تم تقدير بعض القيم المميزة باللون الأصفر تلقائياً بناءً على قواعد هندسية تقريبية لعدم توفرها بالملفات. يرجى مراجعتها وتأكيدها.' : 'Some values highlighted in yellow have been estimated using standard QS heuristic rules because they were not found in the uploaded documents. Please review and confirm.'}
setAcknowledgedEstimates(e.target.checked)} style={{ width: '18px', height: '18px', cursor: 'pointer' }} />
) : null}
); } if (currentStep === 5) { return (

{isArabic ? '5. إعدادات حساب كميات الهيكل الإنشائي والتشطيبات' : '5. Structural & Finishes Calculation Settings'}

{isArabic ? 'اضبط إعدادات الارتفاع وعدد الأدوار لتشغيل محرك الحسابات الهندسية.' : 'Adjust the height values, floor layers, and excavation depths to compute the takeoff sheet.'}

setCalcParams({ ...calcParams, excavation_depth: parseFloat(e.target.value) || 1.25 })} />
setCalcParams({ ...calcParams, gf_height: parseFloat(e.target.value) || 4.0 })} />
{calcParams.num_floors >= 2 && (
setCalcParams({ ...calcParams, f1_height: parseFloat(e.target.value) || 4.0 })} />
)}
); } return null; }