-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
102 lines (91 loc) · 3.79 KB
/
index.html
File metadata and controls
102 lines (91 loc) · 3.79 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Paycheck Calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.container {
max-width: 600px;
margin: auto;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
}
label {
display: block;
margin: 10px 0 5px;
}
input[type="number"] {
width: 100%;
padding: 8px;
margin-bottom: 10px;
}
button {
padding: 10px 20px;
font-size: 16px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.result {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>Paycheck Calculator</h1>
<form id="paycheckForm">
<label for="startMonth">Start Month (mm):</label>
<input type="number" id="startMonth" name="startMonth" min="1" max="12" required>
<label for="startDay">Start Day (dd):</label>
<input type="number" id="startDay" name="startDay" min="1" max="31" required>
<label for="endMonth">End Month (mm):</label>
<input type="number" id="endMonth" name="endMonth" min="1" max="12" required>
<label for="endDay">End Day (dd):</label>
<input type="number" id="endDay" name="endDay" min="1" max="31" required>
<label for="totalHours">Total Hours Worked:</label>
<input type="number" id="totalHours" name="totalHours" step="0.1" required>
<label for="hourlyRate">Hourly Rate:</label>
<input type="number" id="hourlyRate" name="hourlyRate" step="0.01" required>
<label for="bonus">Bonus (if any):</label>
<input type="number" id="bonus" name="bonus" step="0.01" value="0">
<button type="button" onclick="calculatePay()">Calculate Pay</button>
</form>
<div class="result" id="result"></div>
</div>
<script src="payroll.js"></script>
<script>
Module.onRuntimeInitialized = function() {
console.log('WebAssembly module is loaded');
};
function calculatePay() {
const startMonth = parseInt(document.getElementById('startMonth').value);
const startDay = parseInt(document.getElementById('startDay').value);
const endMonth = parseInt(document.getElementById('endMonth').value);
const endDay = parseInt(document.getElementById('endDay').value);
const totalHours = parseFloat(document.getElementById('totalHours').value);
const hourlyRate = parseFloat(document.getElementById('hourlyRate').value);
const bonus = parseFloat(document.getElementById('bonus').value);
if (typeof Module._processInput === 'function') {
const resultPointer = Module._processInput(startMonth, startDay, endMonth, endDay, totalHours, hourlyRate, bonus);
const result = Module.UTF8ToString(resultPointer);
document.getElementById('result').innerText = `Your earnings: ${result}`;
} else {
console.error('processInput function not found in WebAssembly module');
}
}
</script>
</body>
</html>