Skip to content

Commit cc3348b

Browse files
committed
Update khdh.html
1 parent bd91420 commit cc3348b

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

web/khdh.html

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,13 @@ <h1 class="text-3xl md:text-4xl font-bold text-slate-900">Kế Hoạch Dạy H
7575
<p class="text-slate-500 mt-1">Giáo viên: Phong Do</p>
7676
</header>
7777

78-
<!-- Grade Navigation Tabs and Global Controls -->
79-
<div class="flex flex-col sm:flex-row justify-between items-center mb-8 gap-4">
80-
<div class="flex-1 hidden sm:block"></div>
78+
<!-- Grade Navigation Tabs -->
79+
<div class="flex justify-center mb-8">
8180
<div id="grade-nav" class="flex space-x-2 bg-slate-200 p-1.5 rounded-full">
8281
<button data-grade="3" class="nav-button py-2 px-6 rounded-full font-semibold transition-all duration-300">Khối 3</button>
8382
<button data-grade="4" class="nav-button py-2 px-6 rounded-full font-semibold transition-all duration-300">Khối 4</button>
8483
<button data-grade="5" class="nav-button py-2 px-6 rounded-full font-semibold transition-all duration-300">Khối 5</button>
8584
</div>
86-
<div class="flex-1 flex justify-center sm:justify-end w-full sm:w-auto">
87-
<button id="expand-all-btn" class="bg-sky-100 text-sky-700 text-sm font-semibold px-4 py-2 rounded-full hover:bg-sky-200 transition w-full sm:w-auto">Xem tất cả</button>
88-
</div>
8985
</div>
9086

9187
<main id="main-content">
@@ -103,6 +99,7 @@ <h2 class="text-2xl font-bold mb-4 text-slate-800">Phân bổ thời lượng (K
10399
<section class="lg:col-span-2">
104100
<div class="flex justify-between items-center mb-4">
105101
<h2 class="text-2xl font-bold text-slate-800">Kế hoạch chi tiết khối 3</h2>
102+
<button class="expand-all-btn bg-sky-100 text-sky-700 text-sm font-semibold px-4 py-1.5 rounded-full hover:bg-sky-200 transition">Xem tất cả</button>
106103
</div>
107104
<div id="lesson-plan-container-3" class="space-y-3"></div>
108105
</section>
@@ -122,6 +119,7 @@ <h2 class="text-2xl font-bold mb-4 text-slate-800">Phân bổ thời lượng (K
122119
<section class="lg:col-span-2">
123120
<div class="flex justify-between items-center mb-4">
124121
<h2 class="text-2xl font-bold text-slate-800">Kế hoạch chi tiết khối 4</h2>
122+
<button class="expand-all-btn bg-sky-100 text-sky-700 text-sm font-semibold px-4 py-1.5 rounded-full hover:bg-sky-200 transition">Xem tất cả</button>
125123
</div>
126124
<div id="lesson-plan-container-4" class="space-y-3"></div>
127125
</section>
@@ -141,6 +139,7 @@ <h2 class="text-2xl font-bold mb-4 text-slate-800">Phân bổ thời lượng (K
141139
<section class="lg:col-span-2">
142140
<div class="flex justify-between items-center mb-4">
143141
<h2 class="text-2xl font-bold text-slate-800">Kế hoạch chi tiết khối 5</h2>
142+
<button class="expand-all-btn bg-sky-100 text-sky-700 text-sm font-semibold px-4 py-1.5 rounded-full hover:bg-sky-200 transition">Xem tất cả</button>
144143
</div>
145144
<div id="lesson-plan-container-5" class="space-y-3"></div>
146145
</section>
@@ -450,22 +449,25 @@ <h4 class="font-bold text-slate-800 mt-1">${lesson.name}</h4>
450449
}
451450

452451
/**
453-
* Initializes the global "Expand/Collapse All" button.
452+
* Initializes the "Expand/Collapse All" buttons.
454453
*/
455-
function initializeExpandAllButton() {
456-
const button = document.getElementById('expand-all-btn');
457-
button.addEventListener('click', () => {
458-
const isExpanded = button.dataset.expanded === 'true';
459-
const newExpandedState = !isExpanded;
460-
461-
// UPDATED: Select all details across all tabs
462-
const allDetails = document.querySelectorAll(`#main-content .details`);
463-
allDetails.forEach(detail => {
464-
detail.classList.toggle('open', newExpandedState);
465-
});
454+
function initializeExpandAllButtons() {
455+
const buttons = document.querySelectorAll('.expand-all-btn');
456+
let isAllExpanded = false;
466457

467-
button.textContent = newExpandedState ? 'Thu gọn' : 'Xem tất cả';
468-
button.dataset.expanded = newExpandedState;
458+
buttons.forEach(button => {
459+
button.addEventListener('click', () => {
460+
isAllExpanded = !isAllExpanded;
461+
462+
const allDetails = document.querySelectorAll(`#main-content .details`);
463+
allDetails.forEach(detail => {
464+
detail.classList.toggle('open', isAllExpanded);
465+
});
466+
467+
buttons.forEach(btn => {
468+
btn.textContent = isAllExpanded ? 'Thu gọn' : 'Xem tất cả';
469+
});
470+
});
469471
});
470472
}
471473

@@ -478,7 +480,7 @@ <h4 class="font-bold text-slate-800 mt-1">${lesson.name}</h4>
478480
renderChart(grade);
479481
});
480482
setActiveGrade('3'); // Set grade 3 as the default
481-
initializeExpandAllButton(); // Use the new global function
483+
initializeExpandAllButtons();
482484
}
483485

484486
// Event listener for grade navigation

0 commit comments

Comments
 (0)