import React from 'react'; import { Trash2, Plus, Info } from 'lucide-react'; import { cacheUrl } from '../../cacheUrl'; const ScheduleTableEditorModal = ({ isArabic, schedules, onSave, onClose }) => { const [footings, setFootings] = React.useState(schedules?.foundation?.footings || []); const [columns, setColumns] = React.useState(schedules?.superstructure?.columns || []); const handleUpdate = (state, setter, index, field, val) => { const updated = [...state]; updated[index] = { ...updated[index], [field]: val }; setter(updated); }; const handleRemove = (state, setter, index) => { setter(state.filter((_, i) => i !== index)); }; const handleAdd = (setter, state, defaultPrefix) => { setter([...state, { type: `${defaultPrefix}${state.length + 1}`, length: 1.0, width: 1.0, count: 1 }]); }; const renderTable = (title, state, setter, prefix) => (
{isArabic ? 'لا توجد بيانات مستخرجة.' : 'No data extracted.'}
) : (| {isArabic ? 'النوع' : 'Type'} | {isArabic ? 'الطول (م)' : 'Length (m)'} | {isArabic ? 'العرض (م)' : 'Width (m)'} | {isArabic ? 'العدد' : 'Count'} | |
|---|---|---|---|---|
| handleUpdate(state, setter, i, 'type', e.target.value)} style={{ width: '100%', background: '#0f172a', border: '1px solid #334155', color: 'white', padding: '4px', borderRadius: '4px' }} /> | handleUpdate(state, setter, i, 'length', parseFloat(e.target.value) || 0)} style={{ width: '100%', background: '#0f172a', border: '1px solid #334155', color: 'white', padding: '4px', borderRadius: '4px' }} /> | handleUpdate(state, setter, i, 'width', parseFloat(e.target.value) || 0)} style={{ width: '100%', background: '#0f172a', border: '1px solid #334155', color: 'white', padding: '4px', borderRadius: '4px' }} /> | handleUpdate(state, setter, i, 'count', parseInt(e.target.value) || 0)} style={{ width: '100%', background: '#0f172a', border: '1px solid #334155', color: 'white', padding: '4px', borderRadius: '4px' }} /> |
{isArabic ? 'يمكنك هنا مراجعة وإضافة وتعديل بيانات القواعد والأعمدة يدوياً.' : 'Review, add, or edit footings and columns data directly from the schedules.'}
{isArabic ? 'يرجى تدقيق القيم التي استخرجها الذكاء الاصطناعي وتعديل أي قيم غير دقيقة قبل حساب جداول الحصر النهائي. إذا كانت هناك قيم مفقودة يمكنك إضافتها يدوياً عبر محرر الجداول.' : 'Inspect the parameters extracted by AI. Correct any dimensions before running engineering calculations. If there are missing values, you can use the Schedules Editor to add them manually.'}
{isArabic ? 'لم يتمكن الذكاء الاصطناعي من قراءة الجداول من بعض المستندات. يمكنك الآن استخدام "محرر الجداول الهندسية" بالأسفل لإدخالها يدوياً بسهولة كبديل للبرامج المعقدة.' : 'The AI could not clearly read the schedules from some documents. You can now use the "Schedules Editor" below to easily input them manually instead of relying on external software.'}
{isArabic ? 'اضبط إعدادات الارتفاع وعدد الأدوار لتشغيل محرك الحسابات الهندسية.' : 'Adjust the height values, floor layers, and excavation depths to compute the takeoff sheet.'}