[57e58a3] | 1 | <!DOCTYPE html>
|
---|
| 2 | <html lang="en">
|
---|
| 3 | <head>
|
---|
| 4 | <meta charset="UTF-8">
|
---|
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
| 6 | <title>Wishlist</title>
|
---|
| 7 | <link rel="stylesheet" href="/css/main.css">
|
---|
| 8 | <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
|
---|
| 9 | </head>
|
---|
| 10 | <body>
|
---|
| 11 |
|
---|
| 12 | <div id="app" class="wishlist-page">
|
---|
| 13 | <header class="app-header">
|
---|
| 14 | <button class="logout-btn" @click="logout">Log Out</button>
|
---|
| 15 | </header>
|
---|
| 16 |
|
---|
| 17 | <div class="main-content">
|
---|
| 18 | <div class="wishlist-container">
|
---|
| 19 | <h1>Your Wishlist</h1>
|
---|
| 20 |
|
---|
| 21 | <div class="wishlist-list">
|
---|
| 22 | <div class="wishlist-item"
|
---|
| 23 | v-for="flight in wishlistedFlights"
|
---|
| 24 | :key="flight.id">
|
---|
| 25 | <input type="checkbox"
|
---|
| 26 | v-model="flight.selected"
|
---|
| 27 | :id="'flight-' + flight.id" />
|
---|
| 28 | <span>{{ flight.destination }} - {{ flight.date }} - ${{ flight.price }}</span>
|
---|
| 29 |
|
---|
| 30 | <button @click="showReviews(flight)" class="show-reviews-btn">
|
---|
| 31 | Show Reviews
|
---|
| 32 | </button>
|
---|
| 33 | </div>
|
---|
| 34 | </div>
|
---|
| 35 |
|
---|
| 36 | <button v-if="selectedFlights.length" @click="showBookingModal" class="book-btn">
|
---|
| 37 | Book Selected Flights
|
---|
| 38 | </button>
|
---|
| 39 | </div>
|
---|
| 40 | </div>
|
---|
| 41 |
|
---|
| 42 | <div v-if="showModal" class="modal-overlay">
|
---|
| 43 | <div class="modal">
|
---|
| 44 | <h3>Are you sure you want to book the selected flights?</h3>
|
---|
| 45 | <div class="modal-actions">
|
---|
| 46 | <button @click="confirmBooking" class="confirm-btn">Confirm</button>
|
---|
| 47 | <button @click="cancelBooking" class="cancel-btn">Cancel</button>
|
---|
| 48 | </div>
|
---|
| 49 | </div>
|
---|
| 50 | </div>
|
---|
| 51 | </div>
|
---|
| 52 |
|
---|
| 53 | <script>
|
---|
| 54 | new Vue({
|
---|
| 55 | el: '#app',
|
---|
| 56 | data: {
|
---|
| 57 | flights: [
|
---|
| 58 | { id: 1, destination: 'New York', date: '2025-03-01', price: 200, selected: false, wishlisted: true },
|
---|
| 59 | { id: 2, destination: 'London', date: '2025-03-10', price: 250, selected: false, wishlisted: true },
|
---|
| 60 | { id: 3, destination: 'Paris', date: '2025-03-15', price: 300, selected: false, wishlisted: true },
|
---|
| 61 | ],
|
---|
| 62 | showModal: false
|
---|
| 63 | },
|
---|
| 64 | computed: {
|
---|
| 65 | wishlistedFlights() {
|
---|
| 66 | return this.flights.filter(flight => flight.wishlisted);
|
---|
| 67 | },
|
---|
| 68 | selectedFlights() {
|
---|
| 69 | return this.wishlistedFlights.filter(flight => flight.selected);
|
---|
| 70 | }
|
---|
| 71 | },
|
---|
| 72 | methods: {
|
---|
| 73 | showBookingModal() {
|
---|
| 74 | this.showModal = true;
|
---|
| 75 | },
|
---|
| 76 | confirmBooking() {
|
---|
| 77 | window.location.href = '/transaction';
|
---|
| 78 | },
|
---|
| 79 | cancelBooking() {
|
---|
| 80 | this.showModal = false;
|
---|
| 81 | },
|
---|
| 82 | showReviews(flight) {
|
---|
[a70b5a4] | 83 | window.location.href = `/reviews?flightId=${flight.id}`;
|
---|
[57e58a3] | 84 | },
|
---|
| 85 | logout() {
|
---|
| 86 | window.location.href = '/';
|
---|
| 87 | }
|
---|
| 88 | }
|
---|
| 89 | });
|
---|
| 90 | </script>
|
---|
| 91 |
|
---|
| 92 | </body>
|
---|
| 93 | </html>
|
---|