-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
113 lines (105 loc) · 3.69 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fish Cost Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 50px;
}
.calculator-container {
width: 300px;
margin: 0 auto;
}
label {
display: block;
margin: 15px 0 5px;
font-weight: bold;
}
input, select {
width: 100%;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#result {
font-size: 18px;
font-weight: bold;
margin-top: 20px;
text-align: center;
}
</style>
</head>
<body>
<h1>Fish Cost Calculator</h1>
<div class="calculator-container">
<!-- Species and Product Selection -->
<label for="species">Species:</label>
<select id="species" onchange="updateFields()">
<option value="salmon">Salmon</option>
<option value="tuna">Tuna</option>
<option value="cod">Cod</option>
<option value="Rockfish">Black Rockfish</option>
<option value="Dusky Rockfish">Dusky Rockfish</option>
<!-- Add more options here -->
</select>
<label for="product">Final Product:</label>
<select id="product" onchange="updateFields()">
<option value="fillet">Fillet</option>
<option value="whole">Whole</option>
<!-- Add more options here -->
</select>
<!-- Cost per Pound and Yield Percentage -->
<label for="cost">Cost per Pound to boat:</label>
<input type="number" id="cost" placeholder="$1">
<label for="yield">Yield Percentage:</label>
<input type="number" id="yield" placeholder="70">
<!-- Processing Cost and Weight Selection -->
<label for="processing_cost">Processing Cost:</label>
<input type="number" id="processing_cost" placeholder="$1">
<label for="weight_type">Apply Processing Cost to:</label>
<select id="weight_type">
<option value="incoming">Incoming Weight</option>
<option value="outgoing">Outgoing Weight</option>
</select>
<!-- Calculate Button and Result -->
<button onclick="calculate()">Calculate</button>
<p id="result"></p>
</div>
<script>
function updateFields() {
// Existing code to populate cost and yield based on species and product
}
function calculate() {
var cost = parseFloat(document.getElementById("cost").value);
var yieldPercent = parseFloat(document.getElementById("yield").value) / 100;
var processingCost = parseFloat(document.getElementById("processing_cost").value);
var weightType = document.getElementById("weight_type").value;
var result = cost / yieldPercent;
if (weightType === "incoming") {
result += processingCost;
} else {
result += processingCost / yieldPercent;
}
document.getElementById("result").innerHTML = "Cost per Sellable Pound: $" + result.toFixed(2);
}
// Call updateFields on page load to set initial values
window.onload = updateFields;
</script>
</body>
</html>