Browse Source

first commit

master
Adam Písař 4 years ago
commit
69886c78d5
  1. 23
      .gitignore
  2. 24
      README.md
  3. 5
      babel.config.js
  4. 12035
      package-lock.json
  5. 46
      package.json
  6. BIN
      public/favicon.ico
  7. 17
      public/index.html
  8. 181
      src/App.vue
  9. BIN
      src/assets/logo.png
  10. 58
      src/components/HelloWorld.vue
  11. 9
      src/main.js

23
.gitignore

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
README.md

@ -0,0 +1,24 @@
# letenka
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
babel.config.js

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

12035
package-lock.json

File diff suppressed because it is too large

46
package.json

@ -0,0 +1,46 @@
{
"name": "letenka",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"calendar": "^0.1.1",
"core-js": "^3.6.5",
"v-calendar": "^2.2.3",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

BIN
public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

17
public/index.html

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

181
src/App.vue

@ -0,0 +1,181 @@
<template>
<div id="app">
<h1 style="text-align: center;">Letenka</h1>
<div class="wrapper">
<div class="col">
<h2>Parametry letu</h2>
<div>
<p>Typ letenky:
<select v-model="travelType">
<option value="" disabled>vyberte jednu možnost</option>
<option v-for="(option, index) in travelTypes" :key="index" :value="option">{{ option.text }}</option>
</select>
</p>
</div>
<div>
<p>Destinace:
<select v-model="locationType">
<option value="" disabled>vyberte jednu možnost</option>
<option v-for="(option, index) in locationTypes" :key="index" :value="option">{{ option.text }}</option>
</select>
</p>
</div>
<div>
<p>Třída:
<select v-on:change="chosenSeats = []" v-model="classType">
<option value="" disabled>vyberte jednu možnost</option>
<option v-for="(option, index) in classTypes" :key="index" :value="option">{{ option.text }}</option>
</select>
</p>
</div>
<div>
<p>
<v-date-picker v-model="departureDate" :min-date="new Date()" value="" />
</p>
</div>
<div>
<p>
<label for="inputPersonCount">Počet cestujcích</label>
<input v-on:change="personCountChange()" v-model="personCount" type="number" id="inputPersonCount" min="1" max="10">
</p>
</div>
<div class="seatWrap">
<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 }}
</div>
<div v-else class="disabled">
{{ seat }}
</div>
</div>
</div>
<button v-on:klick="chosenSeats=[]">Odebrat všechna sedadla</button>
</div>
<div class="col">
<h2>Objednavka</h2>
<p v-if="travelType">
Typ cesty: <span style="text-transform: lowercase;">{{ travelType.text }}</span>
</p>
<p v-if="locationType">
Destinace: <span style="text-transform: lowercase;">{{ locationType.text }}</span>
</p>
<p v-if="classType">
Třída: <span style="text-transform: lowercase;">{{ classType.text }}</span>
</p>
<p>
Datum odletu:
{{ departureDate.getDate() }}. {{ departureDate.getMonth() + 1 }}. {{ departureDate.getFullYear() }}
</p>
<p>
Počet cestujcích: {{ personCount }}
</p>
<div v-if="chosenSeats.length">
Vybraná místa:
<div class="seat" v-for="seat in chosenSeats" :key="seat">{{ seat }}</div>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import VCalendar from 'v-calendar';
Vue.use(VCalendar, {});
export default {
name: 'App',
data: function() {
return {
travelType: "",
travelTypes: [
{ value: "R", text: "Zpáteční" },
{ value: "O", text: "Jednosměrná" },
],
locationType: "",
locationTypes: [
{ value: "L", text: "Londýn" },
{ value: "N", text: "NewYork" },
{ value: "D", text: "Dubaj" },
{ value: "L", text: "Los Angeles" },
],
classType: "",
classTypes: [
{ value: "E", text: "Economy" },
{ value: "B", text: "Bussines" },
],
personCount: 1,
seats: [
"B1", "B2", "B3",
"E1", "E2", "E3", "E4", "E5"
],
chosenSeats: [],
departureDate: new Date(),
}
},
methods: {
addSeatClick: function(seat) {
if (this.chosenSeats.length < this.personCount){
this.chosenSeats.push(seat);
}
else {
alert("Všichni cestujcí již sedí!");
}
},
personCountChange: function() {
let diff = this.personCount - this.chosenSeats.length;
//diff je záporné číslo
for (let i = diff; i < 0; i++) {
this.chosenSeats.pop();
}
}
}
}
</script>
<style>
.wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
text-align: center;
}
.seat {
display: inline-block;
width: 30px;
border: 1px solid gray;
margin: 2px;
}
.seat div:hover {
cursor: pointer;
background-color: lightgray;
}
.seat .disabled {
color: lightgray;
}
.seat .disabled:hover {
cursor: default;
background-color: transparent;
}
.seat .chosen {
background-color: lightgreen;
}
@media only screen and (max-width: 1000px;) {
.wrapper {
display: block;
}
}
</style>

BIN
src/assets/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

58
src/components/HelloWorld.vue

@ -0,0 +1,58 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

9
src/main.js

@ -0,0 +1,9 @@
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
Loading…
Cancel
Save