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/main_inventory.js
Cayo Puigdefabregas 5eb8a5a4b9 allocate formulary
2022-01-10 15:53:11 +01:00

49 lines
1.6 KiB
JavaScript

$(document) .ready(function() {
$(".deviceSelect").on("change", deviceSelect);
// $('#selectLot').selectpicker();
})
function deviceSelect() {
var devices = $(".deviceSelect").filter(':checked');
var devices_id = $.map(devices, function(x) { return $(x).attr('data')}).join(",");
if (devices_id == "") {
$("#addingLotModal .text-danger").show();
$("#addingLotModal .btn-primary").hide();
$("#removeLotModal .text-danger").show();
$("#removeLotModal .btn-primary").hide();
$("#actionModal .text-danger").show();
$("#actionModal .btn-primary").hide();
} else {
$("#addingLotModal .text-danger").hide();
$("#addingLotModal .btn-primary").removeClass('d-none');
$("#addingLotModal .btn-primary").show();
$("#removeLotModal .text-danger").hide();
$("#removeLotModal .btn-primary").removeClass('d-none');
$("#removeLotModal .btn-primary").show();
$("#actionModal .text-danger").hide();
$("#actionModal .btn-primary").removeClass('d-none');
$("#actionModal .btn-primary").show();
$("#allocateModal .text-danger").hide();
$("#allocateModal .btn-primary").removeClass('d-none');
$("#allocateModal .btn-primary").show();
}
$.map($(".devicesList"), function(x) {
$(x).val(devices_id);
});
}
function newAction(action) {
$("#actionModal #type").val(action);
$("#activeActionModal").click();
}
function newAllocate(action) {
$("#allocateModal #type").val(action);
$("#activeAllocateModal").click();
}