forked from Londeka-Zikalala/dom-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
237 lines (212 loc) · 8.84 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="twelve columns box">
<h1>Total phone bill</h1>
<div class="">
During the codeX bootcamp you had to create the function below.
</div>
<br>
<div class="">
<i>Write a function called <code>totalPhoneBill</code> that takes in a string parameter that contains calls made and sms's sent seperated with commas. Calculate the total bill for the data provided.
<br><br>
In the string <code>call, sms, call, sms, sms</code> there are 2 calls and 3 sms's.
<br>
<br>
The cost is:
<ul>
<li>R2.75 per call</li>
<li>R0.65 per sms</li>
</ul>
</i>
</div>
<div class="">
We will now use this scenario to learn how to use JavaScript in the browser to create interactive screen widgets using the DOM.
</div>
</div>
</div>
<div class="row">
<div class="six columns box">
<h3>Calculate bill</h3>
Enter a string with 'call' or 'sms' seperated by commas. When the Calculate button is pressed show the total phone bill for the string entered.
<div class="">
<i>Calls costs R2.75 and a SMS R0.75</i>
</div>
<br>
<div class="">
<i>If the total cost exceed R20.00 show the total cost in orange, if over R30 show it in red.</i>
</div>
<hr>
<!-- billString calculateBtn billTotal -->
<div class="row">
<div class="eight columns">
<h5>Enter bill string</h5>
<textarea id="billString" rows="20" cols="40" class="billString" ></textarea>
<button class="button-primary calculateBtn" on type="button" name="button">Calculate</button>
</div>
<div class="four columns">
<strong>Total amount:</strong>
<span class="total normal">R<span class="billTotal">0.00</span></span>
</div>
</div>
</div>
<div class="six columns box">
<h3>Text input bill</h3>
<div class="">
<i>Enter call or sms in the textbox. Update the appropriate total and the global total when the ADD button in pressed.</i>
</div>
<div class="">
<i>Calls costs R2.75 and a SMS R0.75</i>
</div>
<div class="">
<i>If the total cost exceed R30.00 show the total cost in orange, if over R50 show it in red.</i>
</div>
<hr>
<div class="row">
<div class="six columns">
<label for="">Bill type</label>
<input type="text" name="" value="" placeholder="enter 'call' or 'sms' " class="billTypeText">
<button class="button-primary addToBillBtn" type="button" name="button" >Add</button>
</div>
<div class="six columns">
<h5>Totals</h5>
<table>
<tr>
<td>Call total</td>
<td>R<span class="callTotalOne">0.00</span></td>
</tr>
<tr>
<td>SMS total</td>
<td>R<span class="smsTotalOne">0.00</span></td>
</tr>
<tr>
<td>Total</td>
<td class="normal warning danger">R<span class="totalOne">0.00</span></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="six columns box">
<h3>Radio button bill</h3>
<div class="">
Select the call or sms radio button. Update the appropriate total and the global total when the ADD button in pressed.
</div>
<br>
<div class="">
<i>Calls costs R2.75 and a SMS R0.75</i>
</div>
<div class="">
<i>If the total cost exceed R30.00 show the total cost in orange, if over R50 show it in red.</i>
</div>
<br>
<div class="">
What is the benefit of using radio buttons?
</div>
<hr>
<div class="row">
<div class="six columns">
<h5>Bill type</h5>
<label class="">
<input type="radio" name="billItemType" class="billItemTypeRadio" value="call">
<span class="label-body">Call</span>
</label>
<label class="">
<input type="radio" name="billItemType" class="billItemTypeRadio" value="sms">
<span class="label-body" >SMS</span>
</label>
<button class="button-primary radioBillAddBtn textTotalAddBtn" type="button" name="button">Add</button>
</div>
<div class="six columns">
<h5>Totals</h5>
<table>
<tr>
<td>Call total</td>
<td>R<span class="callTotalTwo">0.00</span></td>
</tr>
<tr>
<td>SMS total</td>
<td>R<span class="smsTotalTwo">0.00</span></td>
</tr>
<tr >
<td>Total</td>
<td class="normal warning danger" >R<span class="totalTwo">0.00</span></td>
</tr>
</table>
</div>
</div>
</div>
<div class="six columns box">
<h3>Bill with settings</h3>
<div class="">
Select the call or sms radio button. Update the appropriate total and the overall total when the ADD button in pressed.
</div>
<br>
<div class="">
<i>Calls costs should now be configurable using the settings section.</i>
</div>
<br>
<div class="">
<i>If the total cost exceed the warning level show the total cost in orange, if it exceeds the critical level show it in red and prevent any new costs from being added. The warning and critical level should both be configurable now.</i>
</div>
<hr>
<div class="row">
<div class="six columns">
<h5>Bill type</h5>
<label class="">
<input type="radio" name="billItemTypeWithSettings" class="billItemTypeWithSettings" value="call" >
<span class="label-body">Call</span>
</label>
<label class="">
<input type="radio" name="billItemTypeWithSettings" class="billItemTypeWithSettings" value="sms" >
<span class="label-body" >SMS</span>
</label>
<button class="button-primary billWithSettingsAddBtn " type="button" name="button">Add</button>
<h5>Totals</h5>
<table>
<tr>
<td>Call total</td>
<td>R<span class="callTotalSettings">0.00</span> </td>
</tr>
<tr>
<td>SMS total</td>
<td>R<span class="smsTotalSettings">0.00</span> </td>
</tr>
<tr>
<td>Total</td>
<td class="normal warning danger"> R<span class="totalSettings">0.00</span> </td>
</tr>
</table>
</div>
<div class="six columns">
<h5>Settings</h5>
<label for="exampleEmailInput">Call cost</label>
<input class="u-full-width callCostSetting" type="number" placeholder="eg. 2.55">
<label for="exampleEmailInput">SMS cost</label>
<input class="u-full-width smsCostSetting" type="number" placeholder="eg. 0.65" >
<label for="">Warning level</label>
<input class="u-full-width warningLevelSetting " type="number" placeholder="eg. 30.00" class="warningLevel" >
<label for="">Critical level</label>
<input class="u-full-width criticalLevelSetting" type="number" placeholder="eg. 65.00" >
<button class="button-primary updateSettings" type="button" name="button">Update settings</button>
</div>
</div>
</div>
</div>
</div>
<script src="js/calculate-bill.js" charset="utf-8"></script>
<script src="js/text-bill.js" charset="utf-8"></script>
<script src="js/radio-bill.js" charset="utf-8"></script>
<script src="js/settings-bill.js" charset="utf-8"></script>
</body>
</html>