обновил дизайн, добавил дашборд
This commit is contained in:
@@ -68,13 +68,6 @@ const CELL_PARITY_LAYOUT = [
|
||||
{ parity: 'EVEN', label: 'Чётная' }
|
||||
];
|
||||
|
||||
const CAPACITY_BUCKETS = [
|
||||
{ id: 'small', name: 'До 30 мест', match: capacity => Number(capacity || 0) < 30 },
|
||||
{ id: 'medium', name: '30 - 60 мест', match: capacity => Number(capacity || 0) >= 30 && Number(capacity || 0) <= 60 },
|
||||
{ id: 'large', name: '61 - 100 мест', match: capacity => Number(capacity || 0) > 60 && Number(capacity || 0) <= 100 },
|
||||
{ id: 'xlarge', name: 'Более 100 мест', match: capacity => Number(capacity || 0) > 100 }
|
||||
];
|
||||
|
||||
export async function initAuditoriumWorkload() {
|
||||
const dateInput = document.getElementById('workload-date');
|
||||
const refreshButton = document.getElementById('workload-refresh');
|
||||
@@ -89,6 +82,7 @@ export async function initAuditoriumWorkload() {
|
||||
const roomTables = document.getElementById('room-workload-tables');
|
||||
const overviewFilters = Array.from(document.querySelectorAll('.workload-overview-filter'));
|
||||
const dateLabel = dateInput?.closest('.form-group')?.querySelector('label');
|
||||
const minCapacityInput = document.getElementById('workload-min-capacity');
|
||||
|
||||
let classrooms = [];
|
||||
let teachers = [];
|
||||
@@ -117,7 +111,6 @@ export async function initAuditoriumWorkload() {
|
||||
|
||||
function initFilters() {
|
||||
initMultiSelect('building-box', 'building-menu', 'building-text', 'building-checkboxes');
|
||||
initMultiSelect('capacity-box', 'capacity-menu', 'capacity-text', 'capacity-checkboxes');
|
||||
initMultiSelect('equipment-box', 'equipment-menu', 'equipment-text', 'equipment-checkboxes');
|
||||
}
|
||||
|
||||
@@ -142,7 +135,6 @@ export async function initAuditoriumWorkload() {
|
||||
|
||||
[
|
||||
['building-checkboxes', 'building-text', 'Все корпуса'],
|
||||
['capacity-checkboxes', 'capacity-text', 'Любая вместимость'],
|
||||
['equipment-checkboxes', 'equipment-text', 'Любое оборудование']
|
||||
].forEach(([containerId, textId, emptyText]) => {
|
||||
const container = document.getElementById(containerId);
|
||||
@@ -153,6 +145,12 @@ export async function initAuditoriumWorkload() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
minCapacityInput?.addEventListener('input', () => {
|
||||
if (currentView === DISPLAY_ALL) {
|
||||
renderGrid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function loadInitialData() {
|
||||
@@ -345,12 +343,6 @@ export async function initAuditoriumWorkload() {
|
||||
item => item.value,
|
||||
item => item.label
|
||||
);
|
||||
renderCheckboxes(
|
||||
'capacity-checkboxes',
|
||||
CAPACITY_BUCKETS,
|
||||
item => item.id,
|
||||
item => item.name
|
||||
);
|
||||
renderCheckboxes(
|
||||
'equipment-checkboxes',
|
||||
equipmentOptions(),
|
||||
@@ -359,7 +351,6 @@ export async function initAuditoriumWorkload() {
|
||||
);
|
||||
|
||||
updateFilterText('building-checkboxes', 'building-text', 'Все корпуса');
|
||||
updateFilterText('capacity-checkboxes', 'capacity-text', 'Любая вместимость');
|
||||
updateFilterText('equipment-checkboxes', 'equipment-text', 'Любое оборудование');
|
||||
}
|
||||
|
||||
@@ -934,14 +925,12 @@ export async function initAuditoriumWorkload() {
|
||||
|
||||
function filteredClassrooms() {
|
||||
const selectedBuildings = selectedValues('building-checkboxes');
|
||||
const selectedCapacities = selectedValues('capacity-checkboxes');
|
||||
const minCapacity = parseInt(minCapacityInput?.value || '0', 10) || 0;
|
||||
const selectedEquipment = selectedValues('equipment-checkboxes');
|
||||
|
||||
return classrooms.filter(room => {
|
||||
const buildingMatches = !selectedBuildings.length || selectedBuildings.includes(buildingKey(room));
|
||||
const capacityMatches = !selectedCapacities.length || CAPACITY_BUCKETS
|
||||
.filter(bucket => selectedCapacities.includes(bucket.id))
|
||||
.some(bucket => bucket.match(room.capacity));
|
||||
const capacityMatches = !minCapacity || Number(room.capacity || 0) >= minCapacity;
|
||||
const equipmentMatches = !selectedEquipment.length || selectedEquipment.every(id =>
|
||||
(room.equipments || []).some(item => String(item.id) === String(id))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user