Changeset de83113 for src/main/resources/static/FlightSearch.html
- Timestamp:
- 02/17/25 21:52:11 (4 months ago)
- Branches:
- master
- Children:
- 62bba0c
- Parents:
- 9868304
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/resources/static/FlightSearch.html
r9868304 rde83113 252 252 <h2>Available Flights</h2> 253 253 <div class="flights-list"> 254 <div class="flight-item" v-for="flight in flights" :key="flight.flightI d">254 <div class="flight-item" v-for="flight in flights" :key="flight.flightID"> 255 255 <input type="checkbox" v-model="flight.selected" /> 256 256 <span>{{ flight.departureTime }} | {{ flight.arrivalTime }} | ${{ flight.price }} | {{ flight.availableSeats }}</span> … … 295 295 showReturnDate: false, 296 296 showPopup: false, 297 issueDescription: "" 297 issueDescription: '', 298 userId:'' 298 299 }, 299 300 computed: { … … 302 303 } 303 304 }, 305 304 306 methods: { 305 307 async searchFlights() { … … 337 339 338 340 const flight = this.selectedFlights[0]; 341 console.log(flight); 339 342 const totalCost = flight.price; 343 340 344 const bookingData = { 341 flightId: flight.flightI d,345 flightId: flight.flightID, 342 346 bookingDate: new Date().toISOString().split('T')[0], 343 347 status: 'PENDING', 344 totalCost: totalCost 348 totalCost: totalCost, 349 userId:this.userId 345 350 }; 346 347 351 axios.post('/api/bookings', bookingData) 348 352 .then(response => { 349 const bookingID = response.data.bookingI D;353 const bookingID = response.data.bookingId; 350 354 alert("Booked successfully!"); 351 window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)}&bookingId=${encodeURIComponent(bookingID)}&flightId=${encodeURIComponent(flight.flightI d)}`;355 window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)}&bookingId=${encodeURIComponent(bookingID)}&flightId=${encodeURIComponent(flight.flightID)}&userId=${encodeURIComponent(this.userId)}`; 352 356 }) 353 357 .catch(error => { … … 383 387 if (this.issueDescription.trim()) { 384 388 const reviewData = { 385 userID: 1,389 userID: this.userId, 386 390 subject: "Issue Report", 387 391 description: this.issueDescription … … 413 417 mounted() { 414 418 this.fetchFlights(); 419 const params = new URLSearchParams(window.location.search); 420 this.userId = params.get("userId"); 415 421 axios.get('api/flights') 416 422 .then(response => { … … 420 426 console.error("Error fetching flights", error); 421 427 }); 428 422 429 } 423 430 });
Note:
See TracChangeset
for help on using the changeset viewer.