Spaces:
Running
Running
for the calendar visualization populate the dates for 2025 and 2026
Browse files
script.js
CHANGED
|
@@ -1,33 +1,190 @@
|
|
| 1 |
|
| 2 |
-
// Course data -
|
| 3 |
const coursesData = [
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
];
|
| 32 |
// Calendar functionality
|
| 33 |
let currentMonth = new Date().getMonth();
|
|
@@ -101,9 +258,13 @@ document.addEventListener('click', function(event) {
|
|
| 101 |
});
|
| 102 |
}
|
| 103 |
});
|
| 104 |
-
|
| 105 |
// Initialize the page
|
| 106 |
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
renderCalendar();
|
| 108 |
// Month navigation
|
| 109 |
document.getElementById('prev-month').addEventListener('click', () => {
|
|
@@ -126,93 +287,93 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 126 |
feather.replace();
|
| 127 |
});
|
| 128 |
});
|
| 129 |
-
//
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
const
|
| 144 |
-
const
|
| 145 |
-
const currentYear = now.getFullYear();
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
} else if (courseMonth === currentMonth + 1) {
|
| 162 |
-
grouped.next.push(course);
|
| 163 |
-
} else if (courseMonth === currentMonth + 2) {
|
| 164 |
-
grouped.following.push(course);
|
| 165 |
-
}
|
| 166 |
}
|
| 167 |
-
});
|
| 168 |
-
|
| 169 |
-
return grouped;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
// Render courses to the DOM
|
| 173 |
-
function renderCourses(courses, containerId) {
|
| 174 |
-
const container = document.getElementById(containerId);
|
| 175 |
-
container.innerHTML = '';
|
| 176 |
-
|
| 177 |
-
if (courses.length === 0) {
|
| 178 |
-
container.innerHTML = '<p class="text-gray-600">No courses scheduled for this period.</p>';
|
| 179 |
-
return;
|
| 180 |
}
|
| 181 |
-
|
| 182 |
-
courses.forEach(course => {
|
| 183 |
-
const card = document.createElement('custom-course-card');
|
| 184 |
-
card.setAttribute('title', course.title);
|
| 185 |
-
card.setAttribute('date', new Date(course.startDate).toLocaleDateString('en-US', {
|
| 186 |
-
month: 'short',
|
| 187 |
-
day: 'numeric',
|
| 188 |
-
year: 'numeric'
|
| 189 |
-
}));
|
| 190 |
-
card.setAttribute('time', course.time);
|
| 191 |
-
card.setAttribute('location', course.location);
|
| 192 |
-
card.setAttribute('link', course.link);
|
| 193 |
-
container.appendChild(card);
|
| 194 |
-
});
|
| 195 |
-
}
|
| 196 |
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
const now = new Date();
|
| 208 |
-
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June',
|
| 209 |
-
'July', 'August', 'September', 'October', 'November', 'December'];
|
| 210 |
-
|
| 211 |
-
const buttons = document.querySelectorAll('.month-btn');
|
| 212 |
-
buttons[0].textContent = monthNames[now.getMonth()];
|
| 213 |
-
buttons[1].textContent = monthNames[(now.getMonth() + 1) % 12];
|
| 214 |
-
buttons[2].textContent = monthNames[(now.getMonth() + 2) % 12];
|
| 215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
-
|
| 218 |
-
});
|
|
|
|
| 1 |
|
| 2 |
+
// Course data for 2025-2026
|
| 3 |
const coursesData = [
|
| 4 |
+
// Q1 2025
|
| 5 |
+
{
|
| 6 |
+
"Course": "MDB100: MongoDB Database and Security",
|
| 7 |
+
"Start Date": "15-Jan-25",
|
| 8 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 9 |
+
"Instructor": "John Smith",
|
| 10 |
+
"Location": "Online"
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"Course": "DEV400: MongoDB Developer Extension",
|
| 14 |
+
"Start Date": "22-Jan-25",
|
| 15 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 16 |
+
"Instructor": "Sarah Johnson",
|
| 17 |
+
"Location": "Online"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"Course": "OFA400: Atlas Admin",
|
| 21 |
+
"Start Date": "05-Feb-25",
|
| 22 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 23 |
+
"Instructor": "Michael Brown",
|
| 24 |
+
"Location": "Online"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"Course": "DA610: MongoDB Adv. Queries",
|
| 28 |
+
"Start Date": "19-Feb-25",
|
| 29 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 30 |
+
"Instructor": "Emily Davis",
|
| 31 |
+
"Location": "Online"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"Course": "OA620: Ops Manager Sizing",
|
| 35 |
+
"Start Date": "05-Mar-25",
|
| 36 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 37 |
+
"Instructor": "Robert Wilson",
|
| 38 |
+
"Location": "Online"
|
| 39 |
+
},
|
| 40 |
+
|
| 41 |
+
// Q2 2025
|
| 42 |
+
{
|
| 43 |
+
"Course": "MDB200: MongoDB Optimization",
|
| 44 |
+
"Start Date": "02-Apr-25",
|
| 45 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 46 |
+
"Instructor": "John Smith",
|
| 47 |
+
"Location": "Online"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"Course": "DEV500: Data Modeling",
|
| 51 |
+
"Start Date": "16-Apr-25",
|
| 52 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 53 |
+
"Instructor": "Sarah Johnson",
|
| 54 |
+
"Location": "Online"
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"Course": "OFS400: Ops Manager Admin",
|
| 58 |
+
"Start Date": "07-May-25",
|
| 59 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 60 |
+
"Instructor": "Michael Brown",
|
| 61 |
+
"Location": "Online"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"Course": "DA620: Languages Drivers",
|
| 65 |
+
"Start Date": "21-May-25",
|
| 66 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 67 |
+
"Instructor": "Emily Davis",
|
| 68 |
+
"Location": "Online"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"Course": "OA630: Self-Hosted Security",
|
| 72 |
+
"Start Date": "04-Jun-25",
|
| 73 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 74 |
+
"Instructor": "Robert Wilson",
|
| 75 |
+
"Location": "Online"
|
| 76 |
+
},
|
| 77 |
+
|
| 78 |
+
// Q3 2025
|
| 79 |
+
{
|
| 80 |
+
"Course": "MDB300: Production Readiness",
|
| 81 |
+
"Start Date": "09-Jul-25",
|
| 82 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 83 |
+
"Instructor": "John Smith",
|
| 84 |
+
"Location": "Online"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"Course": "DS110: Atlas Search",
|
| 88 |
+
"Start Date": "23-Jul-25",
|
| 89 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 90 |
+
"Instructor": "Sarah Johnson",
|
| 91 |
+
"Location": "Online"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"Course": "OFA500: Atlas API",
|
| 95 |
+
"Start Date": "06-Aug-25",
|
| 96 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 97 |
+
"Instructor": "Michael Brown",
|
| 98 |
+
"Location": "Online"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"Course": "DA630: Distributed Systems",
|
| 102 |
+
"Start Date": "20-Aug-25",
|
| 103 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 104 |
+
"Instructor": "Emily Davis",
|
| 105 |
+
"Location": "Online"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"Course": "OA640: Atlas Security",
|
| 109 |
+
"Start Date": "03-Sep-25",
|
| 110 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 111 |
+
"Instructor": "Robert Wilson",
|
| 112 |
+
"Location": "Online"
|
| 113 |
+
},
|
| 114 |
+
|
| 115 |
+
// Q4 2025
|
| 116 |
+
{
|
| 117 |
+
"Course": "DS120: Atlas Data Lake",
|
| 118 |
+
"Start Date": "08-Oct-25",
|
| 119 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 120 |
+
"Instructor": "John Smith",
|
| 121 |
+
"Location": "Online"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"Course": "DA640: App Optimization",
|
| 125 |
+
"Start Date": "22-Oct-25",
|
| 126 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 127 |
+
"Instructor": "Sarah Johnson",
|
| 128 |
+
"Location": "Online"
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"Course": "OFS500: Ops Manager API",
|
| 132 |
+
"Start Date": "05-Nov-25",
|
| 133 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 134 |
+
"Instructor": "Michael Brown",
|
| 135 |
+
"Location": "Online"
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"Course": "DA650: Advanced Aggregation",
|
| 139 |
+
"Start Date": "19-Nov-25",
|
| 140 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 141 |
+
"Instructor": "Emily Davis",
|
| 142 |
+
"Location": "Online"
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"Course": "DS130: CSFLE",
|
| 146 |
+
"Start Date": "03-Dec-25",
|
| 147 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 148 |
+
"Instructor": "Robert Wilson",
|
| 149 |
+
"Location": "Online"
|
| 150 |
+
},
|
| 151 |
+
|
| 152 |
+
// Q1 2026
|
| 153 |
+
{
|
| 154 |
+
"Course": "MDB100: MongoDB Database and Security",
|
| 155 |
+
"Start Date": "14-Jan-26",
|
| 156 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 157 |
+
"Instructor": "John Smith",
|
| 158 |
+
"Location": "Online"
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"Course": "DEV400: MongoDB Developer Extension",
|
| 162 |
+
"Start Date": "28-Jan-26",
|
| 163 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 164 |
+
"Instructor": "Sarah Johnson",
|
| 165 |
+
"Location": "Online"
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"Course": "DA660: AI Integration",
|
| 169 |
+
"Start Date": "11-Feb-26",
|
| 170 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 171 |
+
"Instructor": "Michael Brown",
|
| 172 |
+
"Location": "Online"
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"Course": "DA670: Vector Search",
|
| 176 |
+
"Start Date": "25-Feb-26",
|
| 177 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 178 |
+
"Instructor": "Emily Davis",
|
| 179 |
+
"Location": "Online"
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
"Course": "OA620: Ops Manager Sizing",
|
| 183 |
+
"Start Date": "11-Mar-26",
|
| 184 |
+
"Time": "09:00 AM - 05:00 PM",
|
| 185 |
+
"Instructor": "Robert Wilson",
|
| 186 |
+
"Location": "Online"
|
| 187 |
+
}
|
| 188 |
];
|
| 189 |
// Calendar functionality
|
| 190 |
let currentMonth = new Date().getMonth();
|
|
|
|
| 258 |
});
|
| 259 |
}
|
| 260 |
});
|
|
|
|
| 261 |
// Initialize the page
|
| 262 |
document.addEventListener('DOMContentLoaded', () => {
|
| 263 |
+
// Set initial view to current month
|
| 264 |
+
const now = new Date();
|
| 265 |
+
currentMonth = now.getMonth();
|
| 266 |
+
currentYear = now.getFullYear();
|
| 267 |
+
|
| 268 |
renderCalendar();
|
| 269 |
// Month navigation
|
| 270 |
document.getElementById('prev-month').addEventListener('click', () => {
|
|
|
|
| 287 |
feather.replace();
|
| 288 |
});
|
| 289 |
});
|
| 290 |
+
// Helper function to parse date strings
|
| 291 |
+
function parseDate(dateStr) {
|
| 292 |
+
const parts = dateStr.split('-');
|
| 293 |
+
const day = parseInt(parts[0]);
|
| 294 |
+
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
| 295 |
+
const month = monthNames.indexOf(parts[1]);
|
| 296 |
+
const year = parseInt(parts[2]) + 2000;
|
| 297 |
+
return new Date(year, month, day);
|
| 298 |
+
}
|
| 299 |
+
// Group courses by month
|
| 300 |
+
function groupCoursesByMonth(courses) {
|
| 301 |
+
const now = new Date();
|
| 302 |
+
const currentMonth = now.getMonth();
|
| 303 |
+
const currentYear = now.getFullYear();
|
| 304 |
+
|
| 305 |
+
const grouped = {
|
| 306 |
+
current: [],
|
| 307 |
+
next: [],
|
| 308 |
+
following: []
|
| 309 |
+
};
|
| 310 |
|
| 311 |
+
courses.forEach(course => {
|
| 312 |
+
const courseDate = parseDate(course['Start Date']);
|
| 313 |
+
const courseMonth = courseDate.getMonth();
|
| 314 |
+
const courseYear = courseDate.getFullYear();
|
|
|
|
| 315 |
|
| 316 |
+
if (courseYear === currentYear || courseYear === currentYear + 1) {
|
| 317 |
+
if (courseMonth === currentMonth && courseYear === currentYear) {
|
| 318 |
+
grouped.current.push(course);
|
| 319 |
+
} else if (
|
| 320 |
+
(courseMonth === currentMonth + 1 && courseYear === currentYear) ||
|
| 321 |
+
(currentMonth === 11 && courseMonth === 0 && courseYear === currentYear + 1)
|
| 322 |
+
) {
|
| 323 |
+
grouped.next.push(course);
|
| 324 |
+
} else if (
|
| 325 |
+
(courseMonth === currentMonth + 2 && courseYear === currentYear) ||
|
| 326 |
+
(currentMonth === 10 && courseMonth === 0 && courseYear === currentYear + 1) ||
|
| 327 |
+
(currentMonth === 11 && courseMonth === 1 && courseYear === currentYear + 1)
|
| 328 |
+
) {
|
| 329 |
+
grouped.following.push(course);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
}
|
| 332 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
+
return grouped;
|
| 335 |
+
}
|
| 336 |
+
// Render courses to the DOM
|
| 337 |
+
function renderCourses(courses, containerId) {
|
| 338 |
+
const container = document.getElementById(containerId);
|
| 339 |
+
container.innerHTML = '';
|
| 340 |
+
|
| 341 |
+
if (courses.length === 0) {
|
| 342 |
+
container.innerHTML = '<p class="text-gray-600">No courses scheduled for this period.</p>';
|
| 343 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
}
|
| 345 |
+
|
| 346 |
+
courses.forEach(course => {
|
| 347 |
+
const card = document.createElement('custom-course-card');
|
| 348 |
+
card.setAttribute('title', course.Course);
|
| 349 |
+
card.setAttribute('date', parseDate(course['Start Date']).toLocaleDateString('en-US', {
|
| 350 |
+
month: 'short',
|
| 351 |
+
day: 'numeric',
|
| 352 |
+
year: 'numeric'
|
| 353 |
+
}));
|
| 354 |
+
card.setAttribute('time', course.Time);
|
| 355 |
+
card.setAttribute('location', course.Location);
|
| 356 |
+
card.setAttribute('link', '#');
|
| 357 |
+
container.appendChild(card);
|
| 358 |
+
});
|
| 359 |
+
}
|
| 360 |
+
// Initialize the page
|
| 361 |
+
function init() {
|
| 362 |
+
const groupedCourses = groupCoursesByMonth(coursesData);
|
| 363 |
+
|
| 364 |
+
renderCourses(groupedCourses.current, 'current-month-courses');
|
| 365 |
+
renderCourses(groupedCourses.next, 'next-month-courses');
|
| 366 |
+
renderCourses(groupedCourses.following, 'following-month-courses');
|
| 367 |
+
|
| 368 |
+
// Update month selector labels with actual month names
|
| 369 |
+
const now = new Date();
|
| 370 |
+
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June',
|
| 371 |
+
'July', 'August', 'September', 'October', 'November', 'December'];
|
| 372 |
+
|
| 373 |
+
const buttons = document.querySelectorAll('.month-btn');
|
| 374 |
+
buttons[0].textContent = monthNames[now.getMonth()];
|
| 375 |
+
buttons[1].textContent = monthNames[(now.getMonth() + 1) % 12];
|
| 376 |
+
buttons[2].textContent = monthNames[(now.getMonth() + 2) % 12];
|
| 377 |
+
}
|
| 378 |
|
| 379 |
+
init();
|
|
|