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

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-01-11 10:21:17 +00:00
$(document).ready(function() {
var show_action_form = $("#allocateModal").data('show-action-form');
if (show_action_form != "None") {
$("#allocateModal .btn-primary").show();
newAllocate(show_action_form);
} else {
$(".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();
2022-01-03 10:32:12 +00:00
$("#removeLotModal .text-danger").show();
$("#removeLotModal .btn-primary").hide();
$("#actionModal .text-danger").show();
$("#actionModal .btn-primary").hide();
} else {
$("#addingLotModal .text-danger").hide();
$("#addingLotModal .btn-primary").show();
2022-01-03 10:32:12 +00:00
$("#removeLotModal .text-danger").hide();
$("#removeLotModal .btn-primary").show();
$("#actionModal .text-danger").hide();
$("#actionModal .btn-primary").show();
2022-01-10 14:53:11 +00:00
$("#allocateModal .text-danger").hide();
$("#allocateModal .btn-primary").show();
}
$.map($(".devicesList"), function(x) {
$(x).val(devices_id);
});
}
2022-01-03 12:40:30 +00:00
function newAction(action) {
$("#actionModal #type").val(action);
$("#activeActionModal").click();
2022-01-03 12:40:30 +00:00
}
2022-01-10 14:53:11 +00:00
function newAllocate(action) {
$("#allocateModal #type").val(action);
$("#activeAllocateModal").click();
}