Spaces:
Sleeping
Sleeping
calcs prototype final
Browse files- database.db +0 -0
- main.py +4 -2
- static/app.js +22 -6
- static/cg.js +48 -10
- static/cg.png +0 -0
- static/styles.css +58 -21
- templates/cg.html +20 -17
- templates/index.html +1 -1
database.db
CHANGED
Binary files a/database.db and b/database.db differ
|
|
main.py
CHANGED
@@ -36,6 +36,8 @@ def get_db():
|
|
36 |
def calculate_voltage_drop(voltage, load, length, resistance):
|
37 |
voltage_drop = load * length * resistance
|
38 |
final_voltage = voltage - voltage_drop
|
|
|
|
|
39 |
return final_voltage
|
40 |
|
41 |
@app.get("/", response_class=HTMLResponse)
|
@@ -50,8 +52,8 @@ async def calculate(request: MultipleCablesRequest, db: Session = Depends(get_db
|
|
50 |
cable = db.query(Cable).filter(Cable.type == cable_request.cable_type).first()
|
51 |
if not cable:
|
52 |
raise HTTPException(status_code=400, detail="Invalid cable type")
|
53 |
-
|
54 |
-
results.append({"voltage_drop":
|
55 |
return results
|
56 |
|
57 |
@app.get("/edit_cables", response_class=HTMLResponse)
|
|
|
36 |
def calculate_voltage_drop(voltage, load, length, resistance):
|
37 |
voltage_drop = load * length * resistance
|
38 |
final_voltage = voltage - voltage_drop
|
39 |
+
if final_voltage < 0:
|
40 |
+
final_voltage = 0
|
41 |
return final_voltage
|
42 |
|
43 |
@app.get("/", response_class=HTMLResponse)
|
|
|
52 |
cable = db.query(Cable).filter(Cable.type == cable_request.cable_type).first()
|
53 |
if not cable:
|
54 |
raise HTTPException(status_code=400, detail="Invalid cable type")
|
55 |
+
final_voltage = calculate_voltage_drop(cable_request.voltage, cable_request.load, cable_request.length, cable.resistance)
|
56 |
+
results.append({"voltage_drop": cable_request.voltage - final_voltage})
|
57 |
return results
|
58 |
|
59 |
@app.get("/edit_cables", response_class=HTMLResponse)
|
static/app.js
CHANGED
@@ -25,11 +25,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
25 |
const cableGroups = document.querySelectorAll('.cable-group');
|
26 |
cableGroups.forEach((group, index) => {
|
27 |
group.querySelectorAll('input, select').forEach(input => {
|
28 |
-
// Update the id and name attributes to include the index
|
29 |
const baseName = input.name.split('[')[0]; // Get the base name without the index
|
30 |
input.name = `${baseName}[${index}]`;
|
31 |
input.id = `${baseName}-${index}`; // Update the id as well for accessibility
|
32 |
});
|
|
|
33 |
});
|
34 |
}
|
35 |
|
@@ -67,7 +67,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
67 |
// Append the new cable group to the container
|
68 |
cableContainer.appendChild(newCableGroup);
|
69 |
cableCount++;
|
70 |
-
updateCableGroupInputs();
|
71 |
updateRemoveButtons();
|
72 |
checkFormValidity();
|
73 |
}
|
@@ -76,13 +76,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
76 |
}
|
77 |
});
|
78 |
|
|
|
79 |
// Remove a cable section
|
80 |
cableContainer.addEventListener('click', function(event) {
|
81 |
if (event.target.classList.contains('btn-remove-cable')) {
|
82 |
if (cableCount > 1) {
|
83 |
event.target.closest('.cable-group').remove();
|
84 |
cableCount--;
|
85 |
-
updateCableGroupInputs();
|
86 |
addCableButton.disabled = false;
|
87 |
updateRemoveButtons();
|
88 |
checkFormValidity();
|
@@ -124,7 +125,24 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
124 |
// Display the results
|
125 |
let resultsHtml = '';
|
126 |
results.forEach((result, index) => {
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
});
|
129 |
document.getElementById('result').innerHTML = resultsHtml;
|
130 |
} else {
|
@@ -132,8 +150,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
132 |
}
|
133 |
});
|
134 |
|
135 |
-
|
136 |
-
|
137 |
// Helper function to calculate voltage drop
|
138 |
function calculateVoltageDrop(voltage, current, length, resistance) {
|
139 |
return current * length * resistance;
|
|
|
25 |
const cableGroups = document.querySelectorAll('.cable-group');
|
26 |
cableGroups.forEach((group, index) => {
|
27 |
group.querySelectorAll('input, select').forEach(input => {
|
|
|
28 |
const baseName = input.name.split('[')[0]; // Get the base name without the index
|
29 |
input.name = `${baseName}[${index}]`;
|
30 |
input.id = `${baseName}-${index}`; // Update the id as well for accessibility
|
31 |
});
|
32 |
+
group.querySelector('h2').textContent = `Cable ${index + 1}`; // Update the cable group title
|
33 |
});
|
34 |
}
|
35 |
|
|
|
67 |
// Append the new cable group to the container
|
68 |
cableContainer.appendChild(newCableGroup);
|
69 |
cableCount++;
|
70 |
+
updateCableGroupInputs(); // Update IDs and titles
|
71 |
updateRemoveButtons();
|
72 |
checkFormValidity();
|
73 |
}
|
|
|
76 |
}
|
77 |
});
|
78 |
|
79 |
+
|
80 |
// Remove a cable section
|
81 |
cableContainer.addEventListener('click', function(event) {
|
82 |
if (event.target.classList.contains('btn-remove-cable')) {
|
83 |
if (cableCount > 1) {
|
84 |
event.target.closest('.cable-group').remove();
|
85 |
cableCount--;
|
86 |
+
updateCableGroupInputs(); // Update IDs and titles
|
87 |
addCableButton.disabled = false;
|
88 |
updateRemoveButtons();
|
89 |
checkFormValidity();
|
|
|
125 |
// Display the results
|
126 |
let resultsHtml = '';
|
127 |
results.forEach((result, index) => {
|
128 |
+
let remainingVoltage = cablesData[index].voltage - result.voltage_drop;
|
129 |
+
|
130 |
+
// Ensure voltage doesn't go below 0
|
131 |
+
if (remainingVoltage < 0) remainingVoltage = 0;
|
132 |
+
|
133 |
+
// Calculate the percentage drop
|
134 |
+
const voltageDropPercentage = ((cablesData[index].voltage - remainingVoltage) / cablesData[index].voltage) * 100;
|
135 |
+
|
136 |
+
// Determine the color based on the percentage drop
|
137 |
+
let colorClass = '';
|
138 |
+
if (voltageDropPercentage > 10) {
|
139 |
+
colorClass = 'red-text';
|
140 |
+
} else if (voltageDropPercentage > 5) {
|
141 |
+
colorClass = 'orange-text';
|
142 |
+
}
|
143 |
+
|
144 |
+
resultsHtml += `<p class="${colorClass}">Cable ${index + 1} Voltage: ${remainingVoltage.toFixed(2)} V</p>`;
|
145 |
+
resultsHtml += `<p class="${colorClass}">Voltage Drop: ${voltageDropPercentage.toFixed(2)}%</p>`;
|
146 |
});
|
147 |
document.getElementById('result').innerHTML = resultsHtml;
|
148 |
} else {
|
|
|
150 |
}
|
151 |
});
|
152 |
|
|
|
|
|
153 |
// Helper function to calculate voltage drop
|
154 |
function calculateVoltageDrop(voltage, current, length, resistance) {
|
155 |
return current * length * resistance;
|
static/cg.js
CHANGED
@@ -27,16 +27,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
27 |
event.preventDefault(); // Prevent the default form submission
|
28 |
|
29 |
const formData = new FormData(cgForm);
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
const awg = formData.get('awg') || null;
|
33 |
const fixtureHeight = parseFloat(formData.get('fixture_height')) || null;
|
34 |
const levels = parseInt(formData.get('levels')) || null;
|
35 |
const ledsPerLevel = parseInt(formData.get('leds_per_level')) || 6;
|
36 |
-
const ledPower = parseFloat(formData.get('led_power')) || null;
|
37 |
-
|
38 |
-
const totalLEDs = levels && ledsPerLevel ? levels * ledsPerLevel : null;
|
39 |
-
const levelHeight = fixtureHeight && levels ? fixtureHeight / levels : null;
|
40 |
|
41 |
if (awg && voltage && cableLength) {
|
42 |
try {
|
@@ -45,18 +43,58 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
45 |
const { resistance } = await response.json();
|
46 |
|
47 |
let resultsHtml = '';
|
48 |
-
|
|
|
|
|
|
|
49 |
const totalPower = totalLEDs * ledPower;
|
50 |
const current = totalPower / voltage;
|
51 |
let remainingVoltage = voltage;
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
for (let i = 1; i <= levels; i++) {
|
55 |
const length = i * levelHeight + cableLength;
|
56 |
const voltageDrop = calculateVoltageDrop(current, length, resistance);
|
57 |
remainingVoltage -= voltageDrop;
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
|
|
|
|
60 |
} else {
|
61 |
resultsHtml = `<p>Partial data provided. Calculation incomplete.</p>`;
|
62 |
}
|
@@ -70,7 +108,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
70 |
document.getElementById('result').innerHTML = `<p>Error: An unexpected error occurred.</p>`;
|
71 |
}
|
72 |
} else {
|
73 |
-
document.getElementById('result').innerHTML = `<p>Please provide at least
|
74 |
}
|
75 |
});
|
76 |
}
|
|
|
27 |
event.preventDefault(); // Prevent the default form submission
|
28 |
|
29 |
const formData = new FormData(cgForm);
|
30 |
+
|
31 |
+
// Get the selected LED type, which includes both voltage and power
|
32 |
+
const [voltage, ledPower] = formData.get('led_type').split(',').map(Number);
|
33 |
+
const cableLength = parseFloat(formData.get('cable_length')) || 3;
|
34 |
const awg = formData.get('awg') || null;
|
35 |
const fixtureHeight = parseFloat(formData.get('fixture_height')) || null;
|
36 |
const levels = parseInt(formData.get('levels')) || null;
|
37 |
const ledsPerLevel = parseInt(formData.get('leds_per_level')) || 6;
|
|
|
|
|
|
|
|
|
38 |
|
39 |
if (awg && voltage && cableLength) {
|
40 |
try {
|
|
|
43 |
const { resistance } = await response.json();
|
44 |
|
45 |
let resultsHtml = '';
|
46 |
+
const totalLEDs = levels && ledsPerLevel ? levels * ledsPerLevel : null;
|
47 |
+
const levelHeight = fixtureHeight && levels ? fixtureHeight / levels : null;
|
48 |
+
|
49 |
+
if (totalLEDs !== null && levelHeight !== null) {
|
50 |
const totalPower = totalLEDs * ledPower;
|
51 |
const current = totalPower / voltage;
|
52 |
let remainingVoltage = voltage;
|
53 |
+
const initialVoltage = voltage; // Store the initial voltage for percentage calculation
|
54 |
+
let finalVoltage = voltage; // Track final voltage for drop percentage
|
55 |
+
|
56 |
+
// Total LEDs
|
57 |
+
resultsHtml += `<p>Total LEDs: ${totalLEDs} pcs</p>`;
|
58 |
+
resultsHtml += `<p> </p>`; // non-breaking space,
|
59 |
|
60 |
+
// Calculate and display voltage for each level
|
61 |
for (let i = 1; i <= levels; i++) {
|
62 |
const length = i * levelHeight + cableLength;
|
63 |
const voltageDrop = calculateVoltageDrop(current, length, resistance);
|
64 |
remainingVoltage -= voltageDrop;
|
65 |
+
|
66 |
+
// Ensure voltage doesn't go below 0
|
67 |
+
if (remainingVoltage < 0) remainingVoltage = 0;
|
68 |
+
|
69 |
+
// Determine the color based on the voltage drop percentage
|
70 |
+
let colorClass = '';
|
71 |
+
const currentDropPercentage = ((initialVoltage - remainingVoltage) / initialVoltage) * 100;
|
72 |
+
if (currentDropPercentage > 10) {
|
73 |
+
colorClass = 'red-text';
|
74 |
+
} else if (currentDropPercentage > 5) {
|
75 |
+
colorClass = 'orange-text';
|
76 |
+
}
|
77 |
+
|
78 |
+
resultsHtml += `<p class="${colorClass}">Level ${i} Voltage: ${remainingVoltage.toFixed(2)} V</p>`;
|
79 |
+
finalVoltage = remainingVoltage; // Update final voltage after each level
|
80 |
+
}
|
81 |
+
|
82 |
+
// Calculate the percentage drop from initial voltage to final voltage
|
83 |
+
|
84 |
+
const voltageDropPercentage = ((initialVoltage - finalVoltage) / initialVoltage) * 100;
|
85 |
+
|
86 |
+
// print the voltage drop percentage:
|
87 |
+
//console.log(`Voltage Drop Percentage: ${voltageDropPercentage.toFixed(2)}%`);
|
88 |
+
|
89 |
+
let colorClass = '';
|
90 |
+
|
91 |
+
if (voltageDropPercentage > 10) {
|
92 |
+
colorClass = 'red-text';
|
93 |
+
} else if (voltageDropPercentage > 5) {
|
94 |
+
colorClass = 'orange-text';
|
95 |
}
|
96 |
+
resultsHtml += `<p> </p>`;
|
97 |
+
resultsHtml += `<p class="${colorClass}">Voltage Drop: ${voltageDropPercentage.toFixed(2)}%</p>`;
|
98 |
} else {
|
99 |
resultsHtml = `<p>Partial data provided. Calculation incomplete.</p>`;
|
100 |
}
|
|
|
108 |
document.getElementById('result').innerHTML = `<p>Error: An unexpected error occurred.</p>`;
|
109 |
}
|
110 |
} else {
|
111 |
+
document.getElementById('result').innerHTML = `<p>Please provide at least the Number of Levels.</p>`;
|
112 |
}
|
113 |
});
|
114 |
}
|
static/cg.png
ADDED
![]() |
static/styles.css
CHANGED
@@ -50,7 +50,6 @@ h1 {
|
|
50 |
gap: 10px; /* Spacing between buttons */
|
51 |
}
|
52 |
|
53 |
-
|
54 |
.calculator-main {
|
55 |
flex: 1;
|
56 |
display: flex;
|
@@ -61,15 +60,16 @@ h1 {
|
|
61 |
border-radius: 8px;
|
62 |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
63 |
box-sizing: border-box;
|
|
|
64 |
}
|
65 |
|
66 |
#cable-container {
|
67 |
display: flex;
|
68 |
-
gap:
|
69 |
justify-content: center;
|
70 |
width: 100%;
|
71 |
margin-bottom: 20px;
|
72 |
-
flex-wrap:
|
73 |
}
|
74 |
|
75 |
.cable-group {
|
@@ -79,9 +79,9 @@ h1 {
|
|
79 |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
80 |
box-sizing: border-box;
|
81 |
position: relative;
|
82 |
-
flex:
|
83 |
-
|
84 |
-
|
85 |
}
|
86 |
|
87 |
.cable-group h2 {
|
@@ -168,7 +168,6 @@ h1 {
|
|
168 |
cursor: pointer;
|
169 |
}
|
170 |
|
171 |
-
|
172 |
.btn-cg-calculate {
|
173 |
background-color: #6c757d; /* Disabled state */
|
174 |
cursor: not-allowed;
|
@@ -209,7 +208,6 @@ h1 {
|
|
209 |
background-color: #0056b3;
|
210 |
}
|
211 |
|
212 |
-
|
213 |
.action-buttons {
|
214 |
display: flex;
|
215 |
justify-content: center;
|
@@ -218,19 +216,6 @@ h1 {
|
|
218 |
margin-bottom: 20px;
|
219 |
}
|
220 |
|
221 |
-
.result-display {
|
222 |
-
margin-top: 20px;
|
223 |
-
font-size: 20px;
|
224 |
-
color: #28a745;
|
225 |
-
text-align: center;
|
226 |
-
padding: 20px;
|
227 |
-
border-top: 2px solid #dee2e6;
|
228 |
-
width: 50%;
|
229 |
-
background-color: white;
|
230 |
-
border-radius: 8px;
|
231 |
-
box-sizing: border-box;
|
232 |
-
}
|
233 |
-
|
234 |
.btn-back {
|
235 |
background-color: #007bff;
|
236 |
color: white;
|
@@ -321,3 +306,55 @@ h1 {
|
|
321 |
margin-bottom: 20px;
|
322 |
color: #343a40;
|
323 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
gap: 10px; /* Spacing between buttons */
|
51 |
}
|
52 |
|
|
|
53 |
.calculator-main {
|
54 |
flex: 1;
|
55 |
display: flex;
|
|
|
60 |
border-radius: 8px;
|
61 |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
62 |
box-sizing: border-box;
|
63 |
+
width: 33%;
|
64 |
}
|
65 |
|
66 |
#cable-container {
|
67 |
display: flex;
|
68 |
+
gap: 10px; /* Reduce gap between tiles */
|
69 |
justify-content: center;
|
70 |
width: 100%;
|
71 |
margin-bottom: 20px;
|
72 |
+
flex-wrap: nowrap; /* No wrapping */
|
73 |
}
|
74 |
|
75 |
.cable-group {
|
|
|
79 |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
80 |
box-sizing: border-box;
|
81 |
position: relative;
|
82 |
+
flex: 1 1 40%; /* Each cable group takes up 30% of the container */
|
83 |
+
min-width: 280px; /* Optional minimum width */
|
84 |
+
max-width: 40%; /* Ensure the maximum width is constrained */
|
85 |
}
|
86 |
|
87 |
.cable-group h2 {
|
|
|
168 |
cursor: pointer;
|
169 |
}
|
170 |
|
|
|
171 |
.btn-cg-calculate {
|
172 |
background-color: #6c757d; /* Disabled state */
|
173 |
cursor: not-allowed;
|
|
|
208 |
background-color: #0056b3;
|
209 |
}
|
210 |
|
|
|
211 |
.action-buttons {
|
212 |
display: flex;
|
213 |
justify-content: center;
|
|
|
216 |
margin-bottom: 20px;
|
217 |
}
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
.btn-back {
|
220 |
background-color: #007bff;
|
221 |
color: white;
|
|
|
306 |
margin-bottom: 20px;
|
307 |
color: #343a40;
|
308 |
}
|
309 |
+
|
310 |
+
.result-display {
|
311 |
+
width: 100%; /* Fixed width to ensure consistency */
|
312 |
+
font-size: 20px;
|
313 |
+
color: #28a745;
|
314 |
+
text-align: center;
|
315 |
+
background-color: white;
|
316 |
+
min-height: 300px; /* Ensures the container has a minimum height */
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
/* CG */
|
321 |
+
.result-visual-container {
|
322 |
+
display: flex;
|
323 |
+
justify-content: space-between;
|
324 |
+
align-items: flex-start;
|
325 |
+
width: 100%;
|
326 |
+
margin-top: 20px;
|
327 |
+
gap: 20px;
|
328 |
+
}
|
329 |
+
|
330 |
+
.result-display-cg {
|
331 |
+
|
332 |
+
margin-top: 8px;
|
333 |
+
width: 100%; /* Fixed width to ensure consistency */
|
334 |
+
font-size: 20px;
|
335 |
+
color: #28a745;
|
336 |
+
text-align: right;
|
337 |
+
background-color: white;
|
338 |
+
min-height: 100%; /* Ensures the container has a minimum height */
|
339 |
+
}
|
340 |
+
|
341 |
+
.fixture-visual {
|
342 |
+
width: 100%; /* Fixed width to ensure consistency */
|
343 |
+
text-align: left;
|
344 |
+
margin-right: 20px;
|
345 |
+
display: flex;
|
346 |
+
justify-content: center;
|
347 |
+
align-items: center;
|
348 |
+
}
|
349 |
+
|
350 |
+
.fixture-visual img {
|
351 |
+
width: 75%;
|
352 |
+
}
|
353 |
+
|
354 |
+
.red-text {
|
355 |
+
color: red;
|
356 |
+
}
|
357 |
+
|
358 |
+
.orange-text {
|
359 |
+
color: orange;
|
360 |
+
}
|
templates/cg.html
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
<!-- cg.html -->
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
@@ -14,12 +13,23 @@
|
|
14 |
<main class="calculator-main">
|
15 |
<form id="cg-calculator-form">
|
16 |
<div class="form-row">
|
17 |
-
<label for="
|
18 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</div>
|
20 |
<div class="form-row">
|
21 |
<label for="cable_length">Input Cable Length (m):</label>
|
22 |
-
<input type="number" id="cable_length" name="cable_length">
|
23 |
</div>
|
24 |
<div class="form-row">
|
25 |
<label for="awg">Cable AWG:</label>
|
@@ -29,29 +39,22 @@
|
|
29 |
{% endfor %}
|
30 |
</select>
|
31 |
</div>
|
32 |
-
<div class="form-row">
|
33 |
-
<label for="fixture_height">Fixture Height (m):</label>
|
34 |
-
<input type="number" id="fixture_height" name="fixture_height">
|
35 |
-
</div>
|
36 |
-
<div class="form-row">
|
37 |
-
<label for="levels">Number of Levels:</label>
|
38 |
-
<input type="number" id="levels" name="levels">
|
39 |
-
</div>
|
40 |
<div class="form-row">
|
41 |
<label for="leds_per_level">LEDs per Level:</label>
|
42 |
<input type="number" id="leds_per_level" name="leds_per_level" value="6">
|
43 |
</div>
|
44 |
-
<div class="form-row">
|
45 |
-
<label for="led_power">LED Power (W):</label>
|
46 |
-
<input type="number" id="led_power" name="led_power">
|
47 |
-
</div>
|
48 |
|
49 |
<div class="action-buttons">
|
50 |
<button type="submit" class="btn btn-cg-calculate">Calculate</button>
|
51 |
</div>
|
52 |
</form>
|
53 |
|
54 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
<a href="/" class="btn btn-back">Back to Calculator</a>
|
57 |
</main>
|
|
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
|
|
13 |
<main class="calculator-main">
|
14 |
<form id="cg-calculator-form">
|
15 |
<div class="form-row">
|
16 |
+
<label for="led_type">LED Type:</label>
|
17 |
+
<select id="led_type" name="led_type">
|
18 |
+
<option value="12,1">DMX (12V/1W)</option>
|
19 |
+
<option value="24,2" selected>Static (24V/2W)</option>
|
20 |
+
</select>
|
21 |
+
</div>
|
22 |
+
<div class="form-row">
|
23 |
+
<label for="levels">Number of Levels:</label>
|
24 |
+
<input type="number" id="levels" name="levels" required>
|
25 |
+
</div>
|
26 |
+
<div class="form-row">
|
27 |
+
<label for="fixture_height">Fixture Height (m):</label>
|
28 |
+
<input type="number" id="fixture_height" name="fixture_height">
|
29 |
</div>
|
30 |
<div class="form-row">
|
31 |
<label for="cable_length">Input Cable Length (m):</label>
|
32 |
+
<input type="number" id="cable_length" name="cable_length" value="3">
|
33 |
</div>
|
34 |
<div class="form-row">
|
35 |
<label for="awg">Cable AWG:</label>
|
|
|
39 |
{% endfor %}
|
40 |
</select>
|
41 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<div class="form-row">
|
43 |
<label for="leds_per_level">LEDs per Level:</label>
|
44 |
<input type="number" id="leds_per_level" name="leds_per_level" value="6">
|
45 |
</div>
|
|
|
|
|
|
|
|
|
46 |
|
47 |
<div class="action-buttons">
|
48 |
<button type="submit" class="btn btn-cg-calculate">Calculate</button>
|
49 |
</div>
|
50 |
</form>
|
51 |
|
52 |
+
<div class="result-visual-container">
|
53 |
+
<div id="result" class="result-display-cg"></div>
|
54 |
+
<div class="fixture-visual">
|
55 |
+
<img src="/static/cg.png" alt="Fixture Visual" id="fixture-image">
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
|
59 |
<a href="/" class="btn btn-back">Back to Calculator</a>
|
60 |
</main>
|
templates/index.html
CHANGED
@@ -37,7 +37,7 @@
|
|
37 |
</div>
|
38 |
|
39 |
<div class="form-row">
|
40 |
-
<label for="voltage-0">Voltage:</label>
|
41 |
<input type="number" id="voltage-0" name="voltage[0]" required>
|
42 |
</div>
|
43 |
|
|
|
37 |
</div>
|
38 |
|
39 |
<div class="form-row">
|
40 |
+
<label for="voltage-0">Voltage (V):</label>
|
41 |
<input type="number" id="voltage-0" name="voltage[0]" required>
|
42 |
</div>
|
43 |
|