-
Notifications
You must be signed in to change notification settings - Fork 0
/
ramesh_canteen.html
272 lines (246 loc) · 8.46 KB
/
ramesh_canteen.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!DOCTYPE html>
<html>
<head>
<link href="shop_style.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display" rel="stylesheet">
<title>DeliciousMenu.com</title>
</head>
<body>
<div id="body">
<div id = "navbar" class="navbar">
<nav class="font">
<a href="index_change.html"><strong>Home</strong></a>
<a href="login_change.html"><strong>Login</strong></a>
<a href="#about_us"><strong>About us!</strong></a>
</nav>
</div>
<br><br><br><br><br><br><br><br>
<div id='heading'>
<h2><strong>Ramesh Canteen!</strong></h2><br>
Click on the shop you want to order from!
</div>
<br>
<table id='head_img'>
<tr>
<th><pre> </pre></th>
<th class="shop_image">
<h4>Ramesh Canteen</h4>
<a href="ramesh_canteen.html"><img src="food1.jpg" alt="shop1"></a>
<p class="shop_text">
text about shop
</p>
</th>
</tr>
</table>
<br>
<p id="menu">Food Point</p>
<section class="shop_items">
<img class="shop_items_img" src="food1.jpg" width="200px" height="200px">
<p class="item_description"><strong>Samosa</strong><br>Description</p>
<span class="price">price : 30</span>
<p><button id="rc1" onclick="addToCart(this.id)" class="price_button">+</button><button id='but1' class='price_button'>Add</button><button id="rc1" onclick="removeFromCart(this.id)" class="price_button">-</button></p>
</section>
<section class="shop_items">
<img class="shop_items_img" src="food1.jpg" width="200px" height="200px">
<p class="item_description"><strong>Samosa</strong><br>Description</p>
<span class="price">price : 30</span>
<p><button id="rc2" onclick="addToCart(this.id)" class="price_button">+</button><button id='but2' class='price_button'>Add</button><button id="rc2" onclick="removeFromCart(this.id)" class="price_button">-</button></p>
</section>
<section class="shop_items">
<img class="shop_items_img" src="food1.jpg" width="200px" height="200px">
<p class="item_description"><strong>Samosa</strong><br>Description</p>
<span class="price">price : 30</span>
<p><button id="rc3" onclick="addToCart(this.id)" class="price_button">+</button><button id='but3' class='price_button'>Add</button><button id="rc3" onclick="removeFromCart(this.id)" class="price_button">-</button></p>
</section>
<section class="shop_items">
<img class="shop_items_img" src="food1.jpg" width="200px" height="200px">
<p class="item_description"><strong>Samosa</strong><br>Description</p>
<span class="price">price : 30</span>
<p><button id="rc4" onclick="addToCart(this.id)" class="price_button">+</button><button id='but4' class='price_button'>Add</button><button id="rc4" onclick="removeFromCart(this.id)" class="price_button">-</button></p>
</section>
<a id="payment" href="payment.html"><strong>PROCEED TO PAY.</strong></a>
<br><br>
<div id="about_us">
<h2><strong>About Us</strong></h2>
<div id="some_data">
<div class="some_thing">
<strong>Address</strong>:Outer Ring Rd, Banashankari 3rd Stage, Banashankari, Bengaluru, Karnataka 560085
</div>
<div class="some_thing">
<strong>Campus</strong>:Urban
</div>
<div class="some_thing">
<strong>Terms Of Use.</strong>
</div>
<div class="some_thing">
<strong>License</strong>:All rights reserved.
</div>
</div>
</div>
</div>
<div id="social_media">
<ul>
<li><a href="#index_change.html"><img src="facebook.jpg" height="30" width="30"></a></li>
<li><a href="#index_change.html"><img src="pintrest.jpg" height="30" width="30"></a></li>
<li><a href="#index_change.html"><img src="instagram.jpg" height="30" width="30"></a></li>
<li><a href="#index_change.html"><img src="google+.jpg" height="30" width="30"></a></li>
<li><a href="#index_change.html"><img src="twitter.jpg" height="30" width="30"></a></li>
<li><a href="#index_change.html"><img src="whatsapp.jpg" height="30" width="30"></a></li>
</ul>
</div>
<script type="text/javascript">
//All changes to javascript
var button1=document.getElementById('but1');
var button2=document.getElementById('but2');
var button3=document.getElementById('but3');
var button4=document.getElementById('but4');
var num1=0,num2=0,num3=0,num4=0;
const price1=30,price2=40,price3=50,price4=60;
//add to cart stores the variable in session storage if it is not selected any time
//then it add the number of times it is clicked to store the item
function addToCart(id)
{
if(id=='rc1')
{
if(sessionStorage.getItem('list_of_food_selected_rc_1')!=null)
{
num1=num1+1;
sessionStorage.setItem('list_of_food_selected_rc_1',id+','+num1+','+price1+','+'food1.jpg');
}
else
{
num1=1;
sessionStorage.setItem('list_of_food_selected_rc_1',id+','+num1+','+price1+','+'food1.jpg');
}
button1.innerHTML=num1;
}
else if(id=='rc2')
{
if(sessionStorage.getItem('list_of_food_selected_rc_2')!=null)
{
num2+=1;
sessionStorage.setItem('list_of_food_selected_rc_2',id+','+num2+','+price2+','+'food1.jpg');
}
else
{
num2=1;
sessionStorage.setItem('list_of_food_selected_rc_2',id+','+num2+','+price2+','+'food1.jpg');
}
button2.innerHTML=num2;
}
else if(id=='rc3')
{
if(sessionStorage.getItem('list_of_food_selected_rc_3')!=null)
{
num3+=1;
sessionStorage.setItem('list_of_food_selected_rc_3',id+','+num3+','+price2+','+'food1.jpg');
}
else
{
num3=1;
sessionStorage.setItem('list_of_food_selected_rc_3',id+','+num3+','+price3+','+'food1.jpg');
}
button3.innerHTML=num3;
}
else
{
if(sessionStorage.getItem('list_of_food_selected_rc_4')!=null)
{
num4+=1;
sessionStorage.setItem('list_of_food_selected_rc_4',id+','+num4+','+price4+','+'food1.jpg');
}
else
{
num4=1;
sessionStorage.setItem('list_of_food_selected_rc_4',id+','+num4+','+price4+','+'food1.jpg');
}
button4.innerHTML=num4;
}
}
//when clicked on removeFromCart the number of food items ordered is decreased by 1.
function removeFromCart(id)
{
if(id=='rc1'&& num1>0)
{
if(num1==0)
{ //console.log('working');
alert("No item added to the cart");
return;
}
if(sessionStorage.getItem('list_of_food_selected_rc_1')!=null)
{
num1=num1-1;
if(num1==0)
{ //console.log('working');
sessionStorage.removeItem('list_of_food_selected_rc_1');
button1.innerHTML='Add';
return;
}
sessionStorage.setItem('list_of_food_selected_rc_1',id+','+num1+','+price1+','+'food1.jpg');
button1.innerHTML=num1;
}
}
else if(id=='rc2'&& num1>0)
{
if(num2==0)
{ //console.log('working');
alert("No item added to the cart");
return;
}
if(sessionStorage.getItem('list_of_food_selected_rc_2')!=null)
{
num2=num2-1;
if(num2==0)
{ //console.log('working');
sessionStorage.removeItem('list_of_food_selected_rc_2');
button2.innerHTML='Add';
return;
}
sessionStorage.setItem('list_of_food_selected_rc_2',id+','+num2+','+price2+','+'food1.jpg');
button2.innerHTML=num2;
}
}
else if(id=='rc3'&& num1>0)
{
if(num3==0)
{ //console.log('working');
alert("No item added to the cart");
return;
}
if(sessionStorage.getItem('list_of_food_selected_rc_3')!=null && num3>0)
{
num3-=1;
if(num3==0)
{
button3.innerHTML='Add';
sessionStorage.removeItem('list_of_food_selected_rc_3');
return;
}
sessionStorage.setItem('list_of_food_selected_rc_3',id+','+num3+','+price2+','+'food1.jpg');
button3.innerHTML=num3;
}
}
else
{
if(num4==0)
{ //console.log('working');
alert("No item added to the cart");
return;
}
if(sessionStorage.getItem('list_of_food_selected_rc_4')!=null && num4>0)
{
num4-=1;
if(num4==0)
{ //console.log('working');
sessionStorage.removeItem('list_of_food_selected_rc_4');
button4.innerHTML='Add';
return;
}
sessionStorage.setItem('list_of_food_selected_rc_4',id+','+num4+','+price4+','+'food1.jpg');
button4.innerHTML=num4;
}
}
}
</script>
</body>
</html>