feat: Add basic cage selector logic

This commit is contained in:
moanos [he/him] 2024-07-20 08:20:43 +02:00
parent b17f21a04f
commit fb83a94d4b

View File

@ -89,6 +89,35 @@
</div> </div>
<script> <script>
const inputWidth = document.getElementById("width");
const inputDepth = document.getElementById("depth");
const inputHeight = document.getElementById("height");
const selectSavicSuiteRoyleXL = document.getElementById("selectSavicSuiteRoyleXL");
const selectSavicSuiteRoyle95Double = document.getElementById("selectSavicSuiteRoyle95Double");
const selectTiakiKleintierkäfigEtagere = document.getElementById("selectTiakiKleintierkäfigEtagere");
function updateCage(selectedCage) {
selectSavicSuiteRoyleXL.checked = false;
selectSavicSuiteRoyle95Double.checked = false;
selectTiakiKleintierkäfigEtagere.checked = false;
selectedCage.checked = true;
const cageName = selectedCage.id;
const dim = getCageDimensions(cageName);
inputWidth.value = dim.width;
inputDepth.value = dim.depth;
inputHeight.value = dim.height;
}
selectSavicSuiteRoyleXL.onselect = updateCage;
selectSavicSuiteRoyle95Double.onselect = updateCage;
selectTiakiKleintierkäfigEtagere.onselect = updateCage;
var labelNumRats = document.getElementById("labelNumRats"); var labelNumRats = document.getElementById("labelNumRats");
var ratSlider = document.getElementById("numRats"); var ratSlider = document.getElementById("numRats");
@ -103,8 +132,17 @@
// Full floor functions // Full floor functions
var fullFloorNum = document.getElementById("numFullFloors"); var fullFloorNum = document.getElementById("numFullFloors");
function getCageDimensions(cageName) {
var savicSuiteRoyaleDim = new Dimensions(1, 0.5, 1); if (cageName == "SavicSuiteRoyaleXL") {
return new Dimensions(1, 0.5, 1);
}
if (cageName == "SavicSuiteRoyale95Double") {
return new Dimensions(1, 0.5, 1);
}
if (cageName == "TiakiKleintierkäfigEtagere") {
return new Dimensions(1, 0.5, 1);
}
}
function getResultFromChecks(checks) { function getResultFromChecks(checks) {
console.log(checks.length) console.log(checks.length)