Changeset 8a947b9 for src/main/resources/static/FlightSearch.html
- Timestamp:
- 03/16/25 20:56:44 (3 months ago)
- Branches:
- master
- Children:
- 3a74959
- Parents:
- c064a42
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/resources/static/FlightSearch.html
rc064a42 r8a947b9 10 10 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> 11 11 <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css'> 12 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"> 12 13 <style> 13 14 body { … … 212 213 color:white; 213 214 } 215 216 .notification-badge { 217 position: absolute; 218 top: 0; 219 right: 0; 220 background-color: red; 221 color: white; 222 border-radius: 50%; 223 padding: 0.3em; 224 font-size: 0.8em; 225 } 226 227 button i { 228 font-size: 24px; 229 color: #333; 230 position: relative; 231 } 232 233 .notifications-popup { 234 position: absolute; 235 top: 50px; 236 right: 0; 237 background: white; 238 border: 1px solid #ddd; 239 box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); 240 width: 300px; 241 max-height: 400px; 242 overflow-y: auto; 243 padding: 10px; 244 z-index: 9999; 245 } 246 247 .notifications-popup ul { 248 list-style-type: none; 249 padding: 0; 250 } 251 252 .notifications-popup li { 253 padding: 10px; 254 border-bottom: 1px solid #ddd; 255 } 256 257 .notifications-popup button { 258 background-color: #4CAF50; /* Green */ 259 color: white; 260 padding: 10px; 261 border: none; 262 cursor: pointer; 263 margin-top: 10px; 264 } 265 266 .notifications-popup button:hover { 267 background-color: #45a049; 268 } 214 269 </style> 215 270 </head> … … 223 278 <button @click="goToReports">Monthly Report</button> 224 279 <button @click="home">Log Out</button> 280 281 <button @click="toggleNotifications"> 282 <i class="fas fa-bell"></i> 283 <span v-if="unreadNotifications > 0" class="notification-badge">{{ unreadNotifications }}</span> 284 </button> 225 285 </header> 226 286 … … 291 351 </div> 292 352 </div> 353 354 <div v-if="notificationsVisible" class="notifications-popup"> 355 <ul> 356 <li v-for="notification in notifications" :key="notification.message"> 357 {{ notification.message }} 358 </li> 359 </ul> 360 <button @click="markAllAsRead">Mark All as Read</button> 361 </div> 293 362 </div> 294 363 … … 310 379 issueDescription: '', 311 380 userId:'', 312 wishlisted:false 381 wishlisted:false, 382 unreadNotifications: 0, 383 notifications: [], 384 notificationsVisible: false, 313 385 }, 314 386 computed: { … … 319 391 320 392 methods: { 393 toggleNotifications() { 394 this.notificationsVisible = !this.notificationsVisible; 395 }, 396 fetchNotifications() { 397 console.log('Fetching notifications for userId:', this.userId); 398 axios.get(`/api/notifications/${this.userId}`) 399 .then(response => { 400 this.notifications = response.data; 401 this.unreadNotifications = this.notifications.filter(n => !n.read).length; 402 }) 403 .catch(error => { 404 console.error('Error fetching notifications:', error); 405 }); 406 }, 321 407 async searchFlights() { 322 408 this.isContainerVisible = !this.isContainerVisible; … … 455 541 console.error("Error fetching flights", error); 456 542 }); 457 543 this.fetchNotifications(); 458 544 } 459 545 });
Note:
See TracChangeset
for help on using the changeset viewer.