-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
309 lines (274 loc) · 9.96 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
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
crossorigin="anonymous"
/>
<!-- CSS -->
<link rel="stylesheet" href="assets/styles.css" />
<title>Tip Calculator</title>
</head>
<body>
<header>
<p>Tip Calculator</p>
</header>
<!-- Modal -->
<div class="modal" tabindex="-1" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button onclick="refreshPage()" type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Please enter a positive value.</p>
</div>
<div class="modal-footer">
<button onclick="refreshPage()" type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Top Section -->
<!-- Bill Amount Input -->
<section>
<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-8 top-section" id=radioTipSection>
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Bill Amount</p>
</div>
<div class="col-sm-3 input">
<form class="row gy-1 gx-3 align-items-center">
<div class="input-group" >
<span class="input-group-text">$</span>
<input
type="number"
class="form-control billAmountInput"
id="billAmountInput"
placeholder="Amount"
style="text-align: center;"
/>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<!-- Tip % -->
<div class="row" id="tipRadioBtns">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Tip %</p>
</div>
<div class="col-sm-3 input">
<form>
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
<input type="radio" name="tip" value="0.15" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off">
<label class="btn btn-outline-primary" for="btnradio2">15%</label>
<input type="radio" name="tip" value="0.20" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off">
<label class="btn btn-outline-primary" for="btnradio3">20%</label>
<input type="radio" name="tip" value="0.25" class="btn-check" name="btnradio" id="btnradio4" autocomplete="off">
<label class="btn btn-outline-primary" for="btnradio4">25%</label>
</div>
</form>
<div class="col-sm-3"></div>
</div>
</div>
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Number of People</p>
</div>
<div class="col-sm-3 input">
<form class="row gy-1 gx-3 align-items-center">
<div class="input-group" >
<input
type="number"
class="form-control"
id="numPeople"
placeholder="Amount"
style="text-align: center;"
/>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<div class="col-sm-2"></div>
<!-- Buttons -->
<div class="row">
<div class="col-sm-12">
<!-- Custom Tip -->
<button onclick="showCustomTip()" type="button" class="btn btn-outline-danger" id="customBtn" value="Calculate">Custom Tip</button>
<!-- Button trigger calculation -->
<button onclick="calculateTip()" type="button" class="btn btn-outline-danger" id="calculateBtn" value="Calculate">Calculate</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Start Custom Tip Section -->
<!-- Bill Amount Input -->
<section>
<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-8 top-section" id=customTipSection>
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Bill Amount</p>
</div>
<div class="col-sm-3 input">
<form class="row gy-1 gx-3 align-items-center">
<div class="input-group" >
<span class="input-group-text">$</span>
<input
type="number"
class="form-control billAmountInput"
id="billAmountInputTwo"
placeholder="Amount"
style="text-align: center;"
/>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<!-- Tip % -->
<!-- Custom Tip -->
<div class="row" id="customTipInput">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Tip %</p>
</div>
<div class="col-sm-3 input">
<form class="row gy-1 gx-3 align-items-center">
<div class="input-group">
<input type="number"
class="form-control billAmountInput"
id="customPercentInput"
placeholder="Percent"
style="text-align: center;">
<span class="input-group-text">%</span>
</div>
</form>
<div class="col-sm-3"></div>
</div>
</div>
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Number of People</p>
</div>
<div class="col-sm-3 input">
<form class="row gy-1 gx-3 align-items-center">
<div class="input-group" >
<input
type="number"
class="form-control"
id="numPeopleCustom"
placeholder="Amount"
style="text-align: center;"
/>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<div class="col-sm-2"></div>
<!-- Calculate Button -->
<div class="row">
<div class="col-sm-12">
<!-- Custom Tip -->
<button onclick="refreshPage()" type="button" class="btn btn-outline-danger" id="customBtn" value="Calculate">Choose Tip</button>
<!-- Button trigger calculation -->
<button onclick="customTip()" type="button" class="btn btn-outline-danger" id="calculateBtn" value="Calculate">Calculate</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Custom Tip Section -->
<!-- Bottom section -->
<!-- Tip Amount -->
<!-- Total section -->
<!-- Total Tip -->
<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-8 bottom-section" id="totalAmountSection">
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Tip Amount</p>
</div>
<div class="col-sm-3 right-column-dollars">
<div id="tipAmount">$0.00</div>
<div class="col-sm-3"></div>
</div>
</div>
<!-- Bill total -->
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Bill Total</p>
</div>
<div class="col-sm-3 right-column-dollars">
<div id="totalAmount">$0.00</div>
<div class="col-sm-3"></div>
</div>
</div>
<!-- Split tip amount -->
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<!-- Tip Amount -->
<p>Tip Amount</p>
<p class="small-font">per person</p>
</div>
<div class="col-sm-3 right-column-dollars">
<div id="splitTipAmount">$0.00</div>
<div class="col-sm-3"></div>
</div>
</div>
<!-- Split total -->
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3 left-column-align">
<p>Bill Total</p>
<p class="small-font">per person</p>
</div>
<div class="col-sm-3 right-column-dollars">
<div id="splitTotalAmount">$0.00</div>
<div class="col-sm-3"></div>
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-12">
<!-- Buttons -->
<div class="row">
<div class="col-sm-12">
<!-- Reset Button -->
<button onclick="refreshPage()" type="button" class="btn btn-outline-danger" id="reset-btn" value="Calculate">Reset</button>
</div>
</div>
</div>
</div>
</div>
</section>
<br>
<br>
<br>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"
></script>
<script src="assets/script.js"></script>
</body>
</html>