Ignore:
Timestamp:
02/17/25 21:52:11 (4 months ago)
Author:
ste08 <sjovanoska@…>
Branches:
master
Children:
62bba0c
Parents:
9868304
Message:

Signup,Login,FlightSearch,Booking and Payment working!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/resources/static/FlightSearch.html

    r9868304 rde83113  
    252252            <h2>Available Flights</h2>
    253253            <div class="flights-list">
    254                 <div class="flight-item" v-for="flight in flights" :key="flight.flightId">
     254                <div class="flight-item" v-for="flight in flights" :key="flight.flightID">
    255255                    <input type="checkbox" v-model="flight.selected" />
    256256                    <span>{{ flight.departureTime }} | {{ flight.arrivalTime }} | ${{ flight.price }} | {{ flight.availableSeats }}</span>
     
    295295            showReturnDate: false,
    296296            showPopup: false,
    297             issueDescription: ""
     297            issueDescription: '',
     298            userId:''
    298299        },
    299300        computed: {
     
    302303            }
    303304        },
     305
    304306        methods: {
    305307            async searchFlights() {
     
    337339
    338340                const flight = this.selectedFlights[0];
     341                console.log(flight);
    339342                const totalCost = flight.price;
     343
    340344                const bookingData = {
    341                     flightId: flight.flightId,
     345                    flightId: flight.flightID,
    342346                    bookingDate: new Date().toISOString().split('T')[0],
    343347                    status: 'PENDING',
    344                     totalCost: totalCost
     348                    totalCost: totalCost,
     349                    userId:this.userId
    345350                };
    346 
    347351                axios.post('/api/bookings', bookingData)
    348352                    .then(response => {
    349                         const bookingID = response.data.bookingID;
     353                        const bookingID = response.data.bookingId;
    350354                        alert("Booked successfully!");
    351                         window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)}&bookingId=${encodeURIComponent(bookingID)}&flightId=${encodeURIComponent(flight.flightId)}`;
     355                        window.location.href = `/transaction?amount=${encodeURIComponent(totalCost)}&bookingId=${encodeURIComponent(bookingID)}&flightId=${encodeURIComponent(flight.flightID)}&userId=${encodeURIComponent(this.userId)}`;
    352356                    })
    353357                    .catch(error => {
     
    383387                if (this.issueDescription.trim()) {
    384388                    const reviewData = {
    385                         userID: 1,
     389                        userID: this.userId,
    386390                        subject: "Issue Report",
    387391                        description: this.issueDescription
     
    413417        mounted() {
    414418            this.fetchFlights();
     419            const params = new URLSearchParams(window.location.search);
     420            this.userId = params.get("userId");
    415421            axios.get('api/flights')
    416422                .then(response => {
     
    420426                    console.error("Error fetching flights", error);
    421427                });
     428
    422429        }
    423430    });
Note: See TracChangeset for help on using the changeset viewer.