Changeset ff72ad2 for src/main/resources/static/ReviewPage.html
- Timestamp:
- 04/01/25 22:58:15 (2 months ago)
- Branches:
- master
- Children:
- 8ae59d6
- Parents:
- 3a74959
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/resources/static/ReviewPage.html
r3a74959 rff72ad2 11 11 <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css'> 12 12 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"> 13 </head>14 13 <style> 15 14 .popup-overlay { … … 71 70 72 71 </style> 72 </head> 73 73 <body> 74 74 … … 76 76 <header class="app-header"> 77 77 <button class="logout-btn" @click="logout">Log Out</button> 78 <button class=" logout-btn" @click="leaveReview">Leave a review</button>78 <button class="show-popup" @click="leaveReview">Leave a review</button> 79 79 </header> 80 80 … … 92 92 </div> 93 93 </div> 94 </div> 94 <div v-if="showPopup" class="popup-overlay"> 95 <div class="popup"> 96 <h3>Leave a review</h3> 95 97 96 <div v-if="showPopup" class="popup-overlay"> 97 <div class="popup"> 98 <h3>Leave a review</h3> 98 <select v-model="selectedFlightId" id="flightNumbers"> 99 <option value="" disabled selected>Select a flight</option> 100 <option v-for="flight in flights" :key="flight.flightId" :value="flight.flightId"> 101 {{ flight.flightNumber }} 102 </option> 103 </select> 99 104 100 <select v-model="selectedFlightNumber" id="flights">101 <option value="" disabled selected>Select a flight</option>102 <option v-for="flight in flights" :key="flight.flightNumber" :value="flight.flightNumber">103 {{ flight.flightNumber }}104 </option>105 </select>106 105 107 <textarea v-model="reviewComment" placeholder="Leave a comment here..." rows="5"></textarea>108 106 109 <textarea v-model="rating" placeholder="Rate 1-5" rows="1"></textarea>107 <textarea v-model="reviewComment" placeholder="Leave a comment here..." rows="5"></textarea> 110 108 111 <div class="popup-actions"> 112 <button @click="submitReview" class="submit-btn">Submit</button> 113 <button @click="closePopup" class="cancel-btn">Cancel</button> 109 <textarea v-model="rating" placeholder="Rate 1-5" rows="1"></textarea> 110 111 <div class="popup-actions"> 112 <button @click="submitReview" class="submit-btn">Submit</button> 113 <button @click="closePopup" class="cancel-btn">Cancel</button> 114 </div> 114 115 </div> 115 116 </div> 116 117 </div> 118 117 119 118 120 <script> … … 126 128 rating: '', 127 129 flights: [], 128 selectedFlightNumber: '' 130 selectedFlightId: '', 131 flightNumbers:'' 129 132 }, 130 133 methods: { … … 142 145 leaveReview() { 143 146 this.showPopup = true; 147 this.selectedFlightNumber = ''; 144 148 }, 145 149 closePopup() { … … 147 151 }, 148 152 submitReview() { 149 if (this.reviewComment.trim() && this.selectedFlight Number) {153 if (this.reviewComment.trim() && this.selectedFlightId) { 150 154 const reviewData = { 151 userI d: this.userId,152 flightNumber: this.selectedFlightNumber,155 userID: this.userId, 156 targetID: this.selectedFlightId, 153 157 reviewComment: this.reviewComment, 154 158 rating: this.rating 155 159 }; 160 console.log(reviewData); 156 161 157 162 axios.post('/api/reviews', reviewData) … … 169 174 try { 170 175 const response = await axios.get('/api/flights'); 171 this.flights = response.data; 176 this.flights = response.data.map(flight => ({ 177 flightId: flight.flightID, 178 flightNumber: flight.flightNumber 179 })); 172 180 console.log(this.flights); 173 181 } catch (error) { … … 181 189 this.fetchReviews(); 182 190 this.fetchFlights(); 191 this.showPopup = false; 183 192 } 184 193 });
Note:
See TracChangeset
for help on using the changeset viewer.