Поправил графики
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { api, getSession } from '../api.js';
|
||||
import { escapeHtml, formatLocalDate, showAlert, hideAlert } from '../utils.js';
|
||||
import { defaultSchedulePeriod } from '../schedule-period.js';
|
||||
|
||||
const ROLE_DEPARTMENT = 'DEPARTMENT';
|
||||
|
||||
@@ -72,6 +73,7 @@ export async function initDepartmentWorkspace() {
|
||||
departmentField.hidden = true;
|
||||
departmentSelect.value = userDepartmentId || '';
|
||||
}
|
||||
await selectDefaultWorkloadPeriod(startInput, endInput);
|
||||
await loadAllTeachers();
|
||||
renderImportRows([{ code: '', name: '' }]);
|
||||
await loadWorkspace();
|
||||
@@ -475,6 +477,20 @@ export async function initDepartmentWorkspace() {
|
||||
}
|
||||
}
|
||||
|
||||
async function selectDefaultWorkloadPeriod(startInput, endInput) {
|
||||
try {
|
||||
const semesters = await api.get('/api/schedule/semesters');
|
||||
const period = defaultSchedulePeriod(
|
||||
semesters,
|
||||
formatLocalDate(new Date())
|
||||
);
|
||||
startInput.value = period.startDate;
|
||||
endInput.value = period.endDate;
|
||||
} catch (_error) {
|
||||
// Текущий диапазон остаётся безопасным fallback, если справочник семестров недоступен.
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDepartments(role, userDepartmentId) {
|
||||
const departments = await api.get('/api/departments');
|
||||
fillSelect('department-workspace-department', departments, item => item.id, item => item.departmentName, 'Выберите кафедру');
|
||||
|
||||
Reference in New Issue
Block a user