diff --git a/management/src/components/ExamsTab.tsx b/management/src/components/ExamsTab.tsx index 4df98e1..da1e116 100644 --- a/management/src/components/ExamsTab.tsx +++ b/management/src/components/ExamsTab.tsx @@ -148,26 +148,48 @@ export const ExamsTab: React.FC = () => { {showCreate && ( -
-

Phòng thi mới

-
- - - -
-
-
-
- +
+
+ +
+ + +
+
+
+ + +
)} + + setAppPoolOpen(false)} + onSelect={addAppKeyword} + allowedApps={allowedApps} + /> + setTemplatePickerOpen(false)} + onSelect={applyTemplate} + allowedApps={allowedApps} + /> ); }; diff --git a/management/src/components/ScheduleEditor.tsx b/management/src/components/ScheduleEditor.tsx index 59affde..5e813ca 100644 --- a/management/src/components/ScheduleEditor.tsx +++ b/management/src/components/ScheduleEditor.tsx @@ -111,6 +111,40 @@ export const ScheduleEditor: React.FC = ({ classId, schedul } }; + const handleQuickCreateLocal = () => { + const nextLocal = [...local]; + const standardTimes = [ + { period: 1, start: '07:00', end: '09:00' }, + { period: 2, start: '09:10', end: '11:10' }, + { period: 3, start: '12:10', end: '14:10' }, + { period: 4, start: '14:20', end: '16:20' }, + ]; + let added = 0; + for (let day = 0; day <= 4; day++) { + for (const slot of standardTimes) { + const exists = nextLocal.some(s => s.dayOfWeek === day && s.period === slot.period); + if (!exists) { + nextLocal.push({ + dayOfWeek: day, + period: slot.period, + startTime: slot.start, + endTime: slot.end, + courseId: 0, + courseName: '', + isActive: false, // status is tắt (false) + }); + added++; + } + } + } + if (added === 0) { + alert('Tất cả các ca học từ T2 đến T6 đã tồn tại.'); + return; + } + setLocal(nextLocal); + alert(`Đã tạo nhanh ${added} ca học nháp (trạng thái Tắt) cho Thứ 2–6. Vui lòng chọn môn học và bấm "Lưu lịch học".`); + }; + const handleSave = async () => { const payload = local.filter(s => s.startTime?.trim() && s.endTime?.trim()); try { @@ -127,7 +161,10 @@ export const ScheduleEditor: React.FC = ({ classId, schedul return (
-
+
+