Browse Source

uprava vyberu tridy

master
petr 4 years ago
parent
commit
284719205d
  1. 19
      src/App.vue

19
src/App.vue

@ -27,7 +27,7 @@
<!-- volba třídy E, B --> <!-- volba třídy E, B -->
<p> <p>
<label for="inputClassType">Volba třídy</label><br> <label for="inputClassType">Volba třídy</label><br>
<select v-model="classType" id="inputClassType">
<select v-on:change="chosenSeats = []" v-model="classType" id="inputClassType">
<option value="" disabled>Vyberte jednu možnost</option> <option value="" disabled>Vyberte jednu možnost</option>
<option v-for="(option, index) in classTypes" :key="index" :value="option"> <option v-for="(option, index) in classTypes" :key="index" :value="option">
{{ option.text }} {{ option.text }}
@ -40,7 +40,10 @@
<div v-if="chosenSeats.indexOf(seat) >= 0" v-on:click="chosenSeats.splice(chosenSeats.indexOf(seat), 1)" class="chosen"> <div v-if="chosenSeats.indexOf(seat) >= 0" v-on:click="chosenSeats.splice(chosenSeats.indexOf(seat), 1)" class="chosen">
{{ seat }} {{ seat }}
</div> </div>
<div v-else v-on:click="addSeatClick(seat)">
<div v-else-if="seat.startsWith(classType.value)" v-on:click="addSeatClick(seat)">
{{ seat }}
</div>
<div v-else class="disabled">
{{ seat }} {{ seat }}
</div> </div>
@ -114,12 +117,11 @@ export default {
}, },
personCountChange: function() { personCountChange: function() {
let diff = this.personCount - this.chosenSeats.length; let diff = this.personCount - this.chosenSeats.length;
if (diff < 0) {
// diff je záporné číslo // diff je záporné číslo
for (let i = diff; i < 0; i++) { for (let i = diff; i < 0; i++) {
this.chosenSeats.pop(); this.chosenSeats.pop();
} }
}
} }
} }
} }
@ -144,6 +146,15 @@ export default {
background-color: lightgray; background-color: lightgray;
} }
.seat .disabled {
color: brown;
}
.seat .disabled:hover {
cursor: default;
background-color: transparent;
}
.seat .chosen { .seat .chosen {
background-color: lightgreen; background-color: lightgreen;
} }

Loading…
Cancel
Save