-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
152 lines (147 loc) · 7.82 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="https://xkool-eshop-backend.onrender.com/Media/logo.jpg">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" />
<link href='https://fonts.googleapis.com/css?family=Comfortaa' rel='stylesheet'>
<link rel="stylesheet" href="Styles/styles.css">
<script src="https://unpkg.com/vue@2.7.8/dist/vue.js"></script>
<title>Xkool eShop</title>
</head>
<body>
<div id="xkool-webstore">
<header>
<div class="logo">
<img :src="`${appUrl}/Media/logo.jpg`" alt="eShop Logo">
</div>
<div class="title">
Xkool eShop
</div>
<!-- <nav>
<a href="#">Home</a>
<div>|</div>
<a href="#">About Us</a>
<div>|</div>
<a href="#">Contact Us</a>
</nav> -->
<div class="cart">
<button @click="showCheckOut" v-if="cart.length >= 1">
Cart
<span class="fa-solid fa-cart-plus"></span>
<span id="cartCount"><strong> {{ count1 }} </strong></span>
</button>
<button v-else>
Cart <span class="fa-solid fa-cart-plus"></span>
</button>
</div>
</header>
<main>
<div class="filSor" v-if="showPage">
<div class="search">
<input type="search" name="search" id="search" v-model="searchTxt" @input="searchPrograms" placeholder="Search for programs">
</div>
<div class="filter">
<label for="filters">Select Filter</label>
<select name="filters" id="filters" v-model="selectedFilter">
<option value="">Default</option>
<option value="sports">Sports</option>
<option value="music">Music</option>
<option value="art">Arts</option>
<option value="education">Education</option>
</select>
</div>
<div class="sort">
<label for="sorts">Select Sort</label>
<select name="sorts" id="sorts" v-model="selectedSort">
<option value="">Default</option>
<option value="name">Names</option>
<option value="price">Price</option>
<option value="rating">Rating</option>
</select>
</div>
<div class="sortOption">
<label for="sortOptions">Sorting Option</label>
<select name="sortOptions" id="sortOptions" v-model="sortOption">
<option value="">Default</option>
<option value="asc">Ascending</option>
<option value="des">Descending</option>
</select>
</div>
</div>
<!-- Product Grid -->
<div class="program-container" v-if="showPage">
<div class="program-card" v-for="program in filteredAndSorted">
<img :src="`${appUrl}/${program.image}`" alt="Program Image">
<h3>{{ program.title }}</h3>
<p>{{ program.description }}</p>
<p>Price: £ {{ program.price }}</p>
<p>Location: {{ program.location }}</p>
<button v-if="canAddtoCart(program)" @click="addItemtoCart(program)">Enroll</button>
<button v-else :disabled="true">Enroll</button>
<button v-if="canRemovefromCart(program)" @click="removeFromCart(program)">Disenroll</button>
<button v-else :disabled="true">Disenroll</button>
<div>
<span v-for="n in program.rating">★</span>
<span v-for="n in 5 - program.rating">☆</span>
</div>
<span v-if="itemsLeft(program) === 0" id="allout">All out!</span>
<span v-else-if="itemsLeft(program) <= 3" id="items3-left">Only {{ itemsLeft(program) }} spots left!</span>
<span v-else id="items-left">Only {{ itemsLeft(program) }} Spots Available!</span>
</div>
</div>
<!-- Checkout Section -->
<div v-else id="checkout">
<div class="cartSum">
<h2>Cart Summary</h2>
<ul>
<!-- Loop through cart items and display details -->
<li v-for="program in cartDetails" :key="program.id">
<div class="cartImg"><img :src="`${appUrl}/` + program.image" alt="Program Image"></div>
<div>
<p><strong>{{ program.title }}</strong></p>
<p>Location: {{ program.location }} </p>
<p>Price: £ {{ program.price }}</p>
<!-- <p v-if="program.count > 1">Spaces: {{ program.count }}</p> -->
<p>Spaces: {{ program.count }}</p>
<button @click="removeFromCart(program)">Remove</button>
</div>
</li>
</ul>
<!-- <p v-if="cartDetails.length === 0">Your cart is empty!</p> -->
<hr>
<h3>Total: £ {{ totalPrice }}</h3>
</div>
<form>
<h1>Checkout</h1>
<p><strong>Name</strong> <input v-model.trim="order.name"></p>
<p><strong>Phone</strong> <input v-model.trim="order.phone" type="tel"></p>
<p><strong>Address</strong> <input v-model="order.address" type="address"></p>
<p><strong>City</strong> <input v-model="order.city"></p>
</form>
<div class="detail">
<div class="details">
<h1>Your Details</h1>
<p>Name: <strong> {{ order.name }} </strong></p>
<p>Phone: <strong> {{ order.phone }} </strong></p>
<p>Address: <strong> {{ order.address }}</strong></p>
<p>City: <strong> {{ order.city }} </strong></p>
<p>Total Price:<strong> £ {{ totalPrice }}</strong></p>
</div>
<button @click="submitCheckOut">Checkout</button>
</div>
</div>
</main>
<!-- Popup Section -->
<div v-if="popup.visible" class="popup-overlay">
<div class="popup">
<h2>{{ popup.title }}</h2>
<p>{{ popup.message }}</p>
<button @click="hidePopup">OK</button>
</div>
</div>
</div>
<script src="Scripts/script.js"></script>
</body>
</html>