|
12 | 12 | <th>Year</th>
|
13 | 13 | <th>Link</th>
|
14 | 14 | </tr>
|
15 |
| - <tr v-for="movie in movies" v-on:click="selectedMovieID=movie.id"> |
| 15 | + <tr |
| 16 | + :class="{selected: movie.id == selectedMovieID}" |
| 17 | + class="option" v-for="movie in movies" v-on:click="selectedMovieID=movie.id"> |
16 | 18 | <td>{{movie.title}}</td>
|
17 | 19 | <td>{{movie.producer}}</td>
|
18 | 20 | <td>{{movie.year}}</td>
|
|
30 | 32 | <th>City</th>
|
31 | 33 | <th>Address</th>
|
32 | 34 | </tr>
|
33 |
| - <tr v-for="location in locations" v-on:click="selectedLocationID=location.id"> |
| 35 | + <tr |
| 36 | + :class="{selected: location.id == selectedLocationID}" |
| 37 | + class="option" v-for="location in locations" v-on:click="selectedLocationID=location.id"> |
34 | 38 | <td>{{location.country}}</td>
|
35 | 39 | <td>{{location.city}}</td>
|
36 | 40 | <td>{{location.address}}</td>
|
|
50 | 54 | <th>Location ID</th>
|
51 | 55 | <th>Canceled</th>
|
52 | 56 | </tr>
|
53 |
| - <tr v-for="order in orders" v-on:click="selectedOrderID=order.id"> |
| 57 | + <tr |
| 58 | + :class="{selected: order.id == selectedOrderID}" |
| 59 | + class="option" v-for="order in orders" v-on:click="selectedOrderID=order.id"> |
54 | 60 | <td>{{order.id}}</td>
|
55 | 61 | <td>{{order.movieID}}</td>
|
56 | 62 | <td>{{order.locationID}}</td>
|
57 | 63 | <td>{{order.canceled}}</td>
|
58 | 64 | </tr>
|
59 | 65 | </tbody>
|
60 | 66 | </table>
|
| 67 | + <button v-on:click="cancelOrder">Cancel</button> |
61 | 68 |
|
62 | 69 | </div>
|
63 | 70 | </template>
|
@@ -86,12 +93,19 @@ export default {
|
86 | 93 | this.refreshHistory();
|
87 | 94 | },
|
88 | 95 | refreshHistory: function(){
|
89 |
| - console.log(this.userKey); |
90 | 96 | this.$http.get('http://localhost/History/key=' + this.userKey)
|
91 | 97 | .then(function(response){
|
92 | 98 | if (response.body.status == "success")
|
93 | 99 | this.orders = response.body.orders;
|
94 | 100 | })
|
| 101 | + }, |
| 102 | + cancelOrder: function(){ |
| 103 | + console.log(this.selectedOrderID,this.userKey); |
| 104 | +
|
| 105 | + // Here should request @ localhost/Cancel/ |
| 106 | +
|
| 107 | + //And then: |
| 108 | + this.refreshHistory(); |
95 | 109 | }
|
96 | 110 | },
|
97 | 111 | created: function(){
|
@@ -119,5 +133,17 @@ export default {
|
119 | 133 |
|
120 | 134 | <!-- Add "scoped" attribute to limit CSS to this component only -->
|
121 | 135 | <style scoped>
|
| 136 | + .option{ |
| 137 | + cursor:pointer; |
| 138 | + } |
| 139 | + |
| 140 | + .option:hover{ |
| 141 | + background-color:red; |
| 142 | + color:white; |
| 143 | + } |
122 | 144 |
|
| 145 | + .selected{ |
| 146 | + background-color:green; |
| 147 | + color:white; |
| 148 | + } |
123 | 149 | </style>
|
0 commit comments