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

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-04-20 10:04:53 +00:00
$(document).ready(() => {
2022-01-19 12:40:40 +00:00
$("#type").on("change", deviceInputs);
2022-06-29 11:40:00 +00:00
$("#amount").on("change", amountInputs);
deviceInputs();
2022-06-29 11:40:00 +00:00
amountInputs();
2022-01-19 12:40:40 +00:00
})
function deviceInputs() {
2022-05-16 10:40:14 +00:00
if ($("#type").val() == "ComputerMonitor") {
2022-01-19 12:40:40 +00:00
$("#screen").show();
$("#resolution").show();
$("#imei").hide();
$("#meid").hide();
2022-04-20 10:04:53 +00:00
} else if (["Smartphone", "Cellphone", "Tablet"].includes($("#type").val())) {
2022-01-19 12:40:40 +00:00
$("#screen").hide();
$("#resolution").hide();
$("#imei").show();
$("#meid").show();
} else {
$("#screen").hide();
$("#resolution").hide();
$("#imei").hide();
$("#meid").hide();
2022-06-29 11:40:00 +00:00
};
amountInputs();
}
function amountInputs() {
if ($("#amount").val() > 1) {
$("#Phid").hide();
2022-06-29 15:31:54 +00:00
$("#Id_device_supplier").hide();
$("#Serial_number").hide();
$("#Sku").hide();
$("#imei").hide();
$("#meid").hide();
2022-06-29 11:40:00 +00:00
} else {
$("#Phid").show();
2022-06-29 15:31:54 +00:00
$("#Id_device_supplier").show();
$("#Serial_number").show();
$("#Sku").show();
$("#imei").show();
$("#meid").show();
2022-06-29 11:40:00 +00:00
};
2022-01-19 12:40:40 +00:00
}