-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
239 lines (225 loc) · 12.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
<link rel="manifest" href="./site.webmanifest">
<meta name="description"
content="Record and save your daily costs. See the average daily cost over a number of days. Reorder entries if they get out of synch. Save entries to local storage.">
<title>Costs Calculator</title>
<link rel="stylesheet" href="./css/index.css">
<script src="./js/index.js" type="module"></script>
</head>
<body id="top">
<div id="loader" class="loader"><span class="visually-hidden">The page is loading...</span></div>
<p class="visually-hidden" aria-hidden="true" id="page-loaded"></p>
<a href="#main-content" class="element-invisible element-focusable skip-link">Skip to main content</a>
<form id="theme-picker" class="theme-picker">
<button type="button" id="btn-theme-toggle" class="btn-theme-toggle" aria-pressed>
<svg role="img" class="theme-icon" id="theme-darkmode">
<use href="./img/sprite.svg#moon"></use>
</svg>
<svg role="img" class="theme-icon hide" id="theme-lightmode">
<use href="./img/sprite.svg#sun"></use>
</svg>
<span>Dark Mode:</span> <span id="mode" class="mode"></span>
<span class="btn-theme-state" aria-hidden="true"></span>
</button>
</form>
<div class="page-layout">
<header class="page-header">
<svg role="img" class="icon-logo">
<use href="./img/sprite.svg#icon-logo"></use>
</svg>
<h1>Costs Calculator</h1>
<p class="intro">Record your daily spend and see the average over a number of days.</p>
<details id="details" class="details">
<summary aria-controls="#details" id="summary" class="summary" aria-expanded="false">
<span id="summary-status" class="visually-hidden">Open</span> Usage
</summary>
<div class="details-content flow">
<h2>Form</h2>
<ul role="list" class="flow">
<li><b>Currency</b>: Optional. The app supports a limited number of currencies, represented by
symbols. However, any
decimal-based currency is compatible.</li>
<li><b>Date</b>: Required. An accurate average over a period requires an entry for every day of
that period.</li>
<li><b>Item(s)</b>: Required. This field cannot be left blank, but the form can be submitted
without changing the
default value 'Shopping'.</li>
<li><b>Amount</b>: Required. If nothing is spent on a day, leave it as '0 - 0'.</li>
</ul>
<h2>Daily Spend</h2>
<p>The 'Reorder entries?' button next to the 'Date' heading is disabled until 2 or more entries have
been made. Its
function is to sort the entries in ascending order if the date sequence gets out of sync. This
might occur if a day
is missed and added later or if an earlier entry is deleted due to inaccuracy and needs
re-insertion.</p>
<h2>'Expand / Contract table' button</h2>
<p>This button is disabled until 8 entries have been made. Clicking 'Expand table' will remove
vertical scrollbars and display all entries; clicking 'Contract table' will reinstate
scrollbars. Note: this behaviour is not saved.</p>
<h2>'Delete all entries' button</h2>
<p>This button is disabled until 1 entry has been made. Clicking it will launch a 'confirm' dialog.
If 'yes' is clicked, local storage for the following will be erased:
</p>
<ul class="flow">
<li>Entries for all dates in the 'Daily Spend' table.</li>
<li>The 'Reorder entries?' button state value.</li>
</ul>
<p><b>Note</b>: Local storage will be cleared for only this specific pair of keys in the app; local
storage for other apps will not be affected.</p>
<div class="close-button"><button id="close-details" type="button">Close</button></div>
</div>
</details>
</header>
<main class="main" id="main-content">
<div class="costs-form-wrapper">
<form id="costs-form" class="costs-form">
<div>
<label for="currency-select">Currency:</label>
<select id="currency-select" name="currency-select">
<option value="GBP">GBP</option>
<option value="EUR">EUR</option>
<option value="USD">USD</option>
<option value="AUD">AUD</option>
<option value="JPY">JPY</option>
<option value="CNY">CNY</option>
<option value="INR">INR</option>
</select>
</div>
<div>
<label for="date">Date <span class="required">*</span></label>
<input type="date" name="date" id="date" required data-input-date>
</div>
<div>
<label for="items">Item(s) <span class="required">*</span></label>
<input type="text" id="items" required data-input-items value="Shopping">
</div>
<fieldset>
<legend class="visually-hidden">Daily spend</legend>
<div class="number">
<label for="pounds"><span data-selected-currency
class="currency-symbol">£</span>*</label>
<input type="number" name="pounds" id="pounds" class="input-number" data-input-pounds
data-input-number min="0" value="0">
</div>
<div class="number">
<label for="pence"><span class="visually-hidden"> Pence, cents etc.</span>*</label>
<input type="number" name="pence" id="pence" class="input-number" data-input-pence
data-input-number min="0" max="99" value="0">
</div>
</fieldset>
<div>
<button>Submit</button>
</div>
</form>
</div>
<h2>Average Spend</h2>
<div role="region" aria-labelledby="captionDailySpend" tabindex="0" class="table-scroller">
<table>
<caption id="captionDailySpend" class="visually-hidden">
Average spend
</caption>
<thead>
<tr class="table-headings">
<th>No. of days</th>
<th>
Total (<span data-selected-currency class="currency-symbol">£</span>)
</th>
<th>
Average (<span data-selected-currency class="currency-symbol">£</span>)
</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td class="centred" data-total-days>0</td>
<td class="centred">
<span data-total-costs>0.00</span>
</td>
<td class="centred">
<span data-average-spend>0.00</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="toolbar">
<button class="delete-all-entries" data-delete-all-entries disabled>Delete all entries</button>
<h2>Daily Spend</h2>
<button data-expand-table class="expand-table" disabled>Expand table</button>
</div>
<div role="region" aria-labelledby="captionEntries" tabindex="0"
class="table-scroller table-entries-max-height" data-table-entries-scroller data-costs-table-container>
<table id="costs-table" class="costs-table">
<caption id="captionEntries" class="visually-hidden">
Daily spend
</caption>
<thead class="sticky" data-costs-table-header>
<tr data-table-headings data-table-heading-daily-spend class="table-headings">
<th>
<div class="date">
<div class="date-heading">Date</div>
<button data-sort-button class="sort-button" disabled
title="Reorder (if required): Oldest first">
<span class="visually-hidden">If entries get out of synch, pressing this button
will restore them in ascending order.</span>
<span>Reorder</span>
<span>entries?</span>
</button>
</div>
</th>
<th>
Spend (<span data-selected-currency class="currency-symbol">£</span>)
</th>
<th>Item(s)</th>
<th>
<div class="delete">
<span class="visually-hidden">Delete</span>
<svg role="img" class="icon-delete">
<use href="./img/sprite.svg#icon-delete"></use>
</svg>
</div>
</th>
</tr>
</thead>
<tbody data-rows class="tbody"></tbody>
</table>
</div>
<!-- <button class="delete-all-entries" data-delete-all-entries disabled>
Delete all entries
</button> -->
<template id="costs-template">
<tr class="costs-row">
<td data-date></td>
<td class="centred">
<span class="daily-cost"><span data-daily-cost>0.00</span></span>
</td>
<td>
<div class="items-container">
<p data-item-type class="type">Shopping</p>
<button data-button-type-edit>Edit</button>
</div>
</td>
<td class="centred">
<button data-button-delete class="remove-button">Delete</button>
</td>
</tr>
</template>
</main>
<footer class="page-footer">
<ul role="list">
<li><a href="https://github.com/chrisnajman/costs-calculator-v2" target="_blank"
rel="noopener noreferrer">GitHub
Repository</a></li>
</ul>
</footer>
</div>
</body>
</html>