This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/static/js/create_device.js
2022-07-04 11:26:24 +02:00

44 lines
1.1 KiB
JavaScript

$(document).ready(() => {
$("#type").on("change", deviceInputs);
$("#amount").on("change", amountInputs);
deviceInputs();
amountInputs();
})
function deviceInputs() {
if ($("#type").val() == "ComputerMonitor") {
$("#screen").show();
$("#resolution").show();
$("#imei").hide();
$("#meid").hide();
} else if (["Smartphone", "Cellphone", "Tablet"].includes($("#type").val())) {
$("#screen").hide();
$("#resolution").hide();
$("#imei").show();
$("#meid").show();
} else {
$("#screen").hide();
$("#resolution").hide();
$("#imei").hide();
$("#meid").hide();
};
amountInputs();
}
function amountInputs() {
if ($("#amount").val() > 1) {
$("#Phid").hide();
$("#Id_device_supplier").hide();
$("#Serial_number").hide();
$("#Sku").hide();
$("#imei").hide();
$("#meid").hide();
} else {
$("#Phid").show();
$("#Id_device_supplier").show();
$("#Serial_number").show();
$("#Sku").show();
deviceInputs();
};
}