-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (72 loc) · 2.25 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<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
href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="style.css" />
<title>Self Service Order</title>
</head>
<body>
<main id="app">
<section class="items">
<h4>Pick your items</h4>
<div
v-for="product in products"
class="product"
@click="product.active = !product.active"
v-bind:class="{ selected : product.active }"
>
<div class="photo">
<img v-bind:src="product.photo" />
</div>
<div class="description">
<span class="name">{{product.name}}</span>
<span class="price">$ {{product.price}}</span>
<div class="quantity-area" v-if="product.active">
<button
@click.stop="product.quantity--"
:disabled="product.quantity <= 1"
>-</button>
<span class="quantity">{{product.quantity}}</span>
<button @click.stop="product.quantity++">+</button>
</div>
</div>
</div>
</section>
<section class="summary" v-if="total()>0">
<strong>Order Details</strong>
<table>
<thead>
<tr>
<th>Item</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr v-for="product in products">
<template v-if="product.active">
<td>
{{ product.quantity + ' x ' + product.name }}
</td>
<td>
$ {{ (product.quantity*product.price).toFixed(2) }}
</td>
</template>
</tr>
<tr>
<th>Total</th>
<th>$ {{ total() }}</th>
</tr>
</tbody>
</table>
</section>
</main>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="scripts.js"></script>
</body>
</html>