!isLocked && handleDragOver(e, key)}
onDragLeave={handleDragLeave}
onDrop={(e) => !isLocked && handleDrop(e, r, c)}
onClick={() => isEditingStructure && handleToggleCellLock(r, c)}
className={cellCls}
draggable={!!student && !isEditingStructure}
onDragStart={(e) => student && handleDragStart(e, `cell:${key}`)}
>
{isLocked ? (
Khóa
) : student ? (
{ if (!isEditingStructure && onStudentClick) onStudentClick(student.rkId); }}
>
{!isEditingStructure && (
)}
{student.fullName}
{student.studentCode}
{!isEditingStructure && }
{student.paperTitle && (
{student.paperTitle}
)}
) : (
H{r + 1}-C{c + 1}
Trống
)}
);
}
}
return (
{layout.boardPosition === 'top' &&
}
{layout.boardPosition === 'left' &&
}
{gridItems}
{layout.boardPosition === 'right' &&
}
{layout.boardPosition === 'bottom' &&
}
);
};
// ── Render ────────────────────────────────────────────────────────────────────
return (
{/* ── Empty / Setup state ─────────────────────────────────────────────── */}
{!layout ? (
Chưa thiết lập sơ đồ chỗ ngồi
Thiết lập nhanh từ mẫu lớp học có sẵn hoặc tạo tự do kích thước mong muốn để xếp vị trí cho sinh viên.
{/* Mode switcher */}
{/* Setup panels */}
{setupMode === 'template' ? (
) : (
)}
) : (
/* ── Active workspace ──────────────────────────────────────────────── */
{/* Left: main content */}
{/* Toolbar */}
{/* View-mode segmented control */}
{viewMode === 'grid' && (
<>
>
)}
{viewMode === 'grid' && (
)}
{/* Edit-structure banner */}
{viewMode === 'grid' && isEditingStructure && (
)}
{/* Grid or list content */}
{viewMode === 'grid' ? (
{renderSeatingGrid()}
) : (
setListSearchQuery(e.target.value)}
/>
{filteredListStudents.length === 0 ? (
Không tìm thấy sinh viên nào.
) : (
| Sinh viên |
Mã SV |
{hasPaperColumn && Gói đề | }
Vị trí |
Trạng thái |
Thao tác |
{filteredListStudents.map((s) => {
const isOnline = onlineIds.includes(s.rkId);
const seatLabel = studentSeats[s.rkId] || 'Chưa xếp chỗ';
return (
|
{s.fullName}
|
{s.studentCode} |
{hasPaperColumn && {s.paperTitle || '—'} | }
{seatLabel}
|
|
|
);
})}
)}
)}
{/* Right: unseated sidebar */}
{viewMode === 'grid' && (
Chưa vào chỗ
{unseatedStudents.length} SV
Kéo thả vào vị trí trống trên sơ đồ.
setSearchQuery(e.target.value)}
/>
{filteredUnseatedStudents.length === 0 ? (
Không tìm thấy sinh viên.
) : (
filteredUnseatedStudents.map((s) => {
const isOnline = onlineIds.includes(s.rkId);
return (
handleDragStart(e, `unseated:${s.rkId}`)}
onClick={() => onStudentClick && onStudentClick(s.rkId)}
className="wsc-unseated-card"
>
{s.fullName}
{s.studentCode}{s.paperTitle && <> · {s.paperTitle}>}
);
})
)}
)}
)}
{/* ── Save toast ──────────────────────────────────────────────────────── */}
{saveNotice && (
{saveNoticeKind === 'error'
?
: }
{saveNotice}
)}
{/* ── Scoped styles ───────────────────────────────────────────────────── */}
);
};