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

64 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2022-04-20 10:04:53 +00:00
$(document).ready(() => {
2023-06-09 16:17:06 +00:00
$("#type").on("change", deviceInputs2);
$("#amount").on("change", deviceInputs2);
deviceInputs2()
})
function deviceInputs2() {
deviceInputs();
2022-06-29 11:40:00 +00:00
amountInputs();
2023-06-09 16:17:06 +00:00
}
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();
2023-06-09 16:17:06 +00:00
$("#components2").hide();
2022-01-19 12:40:40 +00:00
$("#imei").hide();
$("#meid").hide();
2023-06-09 16:17:06 +00:00
$("#data_storage_size").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();
2023-06-09 16:17:06 +00:00
$("#components2").hide();
2022-01-19 12:40:40 +00:00
$("#imei").show();
$("#meid").show();
2023-06-09 16:17:06 +00:00
$("#data_storage_size").show();
} else if (["HardDrive", "SolidStateDrive"].includes($("#type").val())) {
$("#screen").hide();
$("#resolution").hide();
$("#components2").hide();
$("#imei").hide();
$("#meid").hide();
$("#data_storage_size").show();
2022-01-19 12:40:40 +00:00
} else {
$("#screen").hide();
$("#resolution").hide();
$("#imei").hide();
$("#meid").hide();
2023-06-09 16:17:06 +00:00
$("#data_storage_size").hide();
$("#components2").show();
2022-06-29 11:40:00 +00:00
};
}
function amountInputs() {
if ($("#amount").val() > 1) {
$("#Phid").hide();
2022-06-29 15:31:54 +00:00
$("#Id_device_supplier").hide();
$("#Id_device_internal").hide();
2022-06-29 15:31:54 +00:00
$("#Serial_number").hide();
$("#Part_number").hide();
2022-06-29 15:31:54 +00:00
$("#Sku").hide();
$("#imei").hide();
$("#meid").hide();
2023-06-09 16:17:06 +00:00
$("#data_storage_size").hide();
2022-06-29 11:40:00 +00:00
} else {
$("#Phid").show();
2022-06-29 15:31:54 +00:00
$("#Id_device_supplier").show();
$("#Id_device_internal").show();
2022-06-29 15:31:54 +00:00
$("#Serial_number").show();
$("#Part_number").show();
2022-06-29 15:31:54 +00:00
$("#Sku").show();
2022-06-29 11:40:00 +00:00
};
2022-01-19 12:40:40 +00:00
}