|
@ -11,30 +11,36 @@ |
|
|
</select> |
|
|
</select> |
|
|
</p> |
|
|
</p> |
|
|
|
|
|
|
|
|
|
|
|
<v-date-picker v-model="departureDate" :min-date="new Date()" /> |
|
|
|
|
|
|
|
|
<p> |
|
|
<p> |
|
|
<label for="inputPersonCount">Počet cestujících</label><br> |
|
|
<label for="inputPersonCount">Počet cestujících</label><br> |
|
|
<input v-model="personCount" type="number" id="inputPersonCount" min="1" max="10"> |
|
|
|
|
|
|
|
|
<input v-on:change="personCountChange()" v-model="personCount" type="number" id="inputPersonCount" min="1" max="10"> |
|
|
</p> |
|
|
</p> |
|
|
|
|
|
|
|
|
<p> |
|
|
<p> |
|
|
<label for="inputClassType">Volba třídy</label><br> |
|
|
|
|
|
<select v-model="classType" id="inputClassType"> |
|
|
|
|
|
|
|
|
<label for="inputClassType">Volba třídy</label><br> |
|
|
|
|
|
<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.text }}</option> |
|
|
<option v-for="(option, index) in classTypes" :key="index" :value="option">{{ option.text }}</option> |
|
|
</select> |
|
|
</select> |
|
|
</p> |
|
|
</p> |
|
|
|
|
|
|
|
|
<div class="seatWrap"> |
|
|
<div class="seatWrap"> |
|
|
<div v-on:click="chosenSeats.push(seat)" class="seat" v-for="(seat, index) in seats" :key="index"> |
|
|
|
|
|
<div v-if="chosenSeats.indexOf(seat) >=0" class="chosen"> |
|
|
|
|
|
|
|
|
<div class="seat" v-for="(seat, index) in seats" :key="index"> |
|
|
|
|
|
<div v-if="chosenSeats.indexOf(seat) >=0" v-on:click="chosenSeats.splice(chosenSeats.indexOf(seat), 1)" class="chosen"> |
|
|
|
|
|
{{ seat }} |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else-if="seat.startsWith(classType.value)" v-on:click="addSeatClick(seat)"> |
|
|
{{ seat }} |
|
|
{{ seat }} |
|
|
</div> |
|
|
</div> |
|
|
<div v-else> |
|
|
|
|
|
|
|
|
<div v-else class="disabled"> |
|
|
{{ seat }} |
|
|
{{ seat }} |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<button v-on:click="chosenSeats=[]">Odebrat všechna sedadla</button> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
@ -69,6 +75,11 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
import Vue from 'vue'; |
|
|
|
|
|
import VCalendar from 'v-calendar'; |
|
|
|
|
|
Vue.use(VCalendar, {}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'App', |
|
|
name: 'App', |
|
@ -83,14 +94,35 @@ export default { |
|
|
classType: "", |
|
|
classType: "", |
|
|
classTypes: [ |
|
|
classTypes: [ |
|
|
{value: "E", text: "Ekonomická"}, |
|
|
{value: "E", text: "Ekonomická"}, |
|
|
{válue: "B", text: "Byznys"} |
|
|
|
|
|
|
|
|
{value: "B", text: "Byznys"} |
|
|
], |
|
|
], |
|
|
seats: [ |
|
|
seats: [ |
|
|
"B1", "B2", "B3", |
|
|
"B1", "B2", "B3", |
|
|
"E1", "E2", "E3", "E4", "E5" |
|
|
"E1", "E2", "E3", "E4", "E5" |
|
|
], |
|
|
], |
|
|
chosenSeats: [] |
|
|
|
|
|
|
|
|
chosenSeats: [], |
|
|
|
|
|
departureDate: new Date() |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
addSeatClick: function(seat) { |
|
|
|
|
|
if (this.chosenSeats.length < this.personCount) { |
|
|
|
|
|
this.chosenSeats.push(seat); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
alert("Všichni cestující již sedí!") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
personCountChange() { |
|
|
|
|
|
let diff = this.personCount - this.chosenSeats.length |
|
|
|
|
|
if (diff < 0) { |
|
|
|
|
|
for (let i = diff; i < 0 ; i++) { |
|
|
|
|
|
this.chosenSeats.pop() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
@ -109,10 +141,23 @@ export default { |
|
|
border: 1px solid grey; |
|
|
border: 1px solid grey; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.seat:hover{ |
|
|
|
|
|
|
|
|
.seat div:hover{ |
|
|
cursor: pointer; |
|
|
cursor: pointer; |
|
|
background-color: lightgray; |
|
|
background-color: lightgray; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.seat .disabled{ |
|
|
|
|
|
color: lightgray; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.seat .disabled:hover{ |
|
|
|
|
|
cursor: default; |
|
|
|
|
|
background-color: transparent; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.seat .chosen{ |
|
|
|
|
|
background-color: lightgreen; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
</style> |
|
|