This commit is contained in:
Ross
2021-10-31 21:45:57 +00:00
parent 8a840c7680
commit e9a2072c29
+29 -12
View File
@@ -28,23 +28,40 @@
document.addEventListener('drop', function (e) { e.preventDefault(); }, false); document.addEventListener('drop', function (e) { e.preventDefault(); }, false);
function getUnusedInputs(inputs) {
new_inputs = [];
for (let i = 0; i < inputs.length; i++) {
input = inputs.get(i);
if (input.value) {
new_inputs.push(input);
}
}
return $(new_inputs);
}
function extendInputs(n) { function extendInputs(n) {
// Makes sure we have n inputs available // Makes sure we have n inputs available
inputs = $("#rapid-form input[type=file][id^=id_images-]"); // returns available inputs
//fileInput = document.getElementById("id_images-0-image"); inputs = getUnusedInputs($("#rapid-form input[type=file][id^=id_images-]"));
//fileInput = document.getElementById("id_images-0-image");
// Make sure we have enough input targets
input_diff = (n - inputs.length)
console.log("diff", input_diff)
if (input_diff > 0) { // Make sure we have enough input targets
for (let j = 0; j < input_diff; j++) { input_diff = (n - inputs.length)
add_input_form() console.log("diff", input_diff)
}
// Need to make sure we include the new ones... if (input_diff > 0) {
inputs = $("#rapid-form input[type=file][id^=id_images-]"); for (let j = 0; j < input_diff; j++) {
add_input_form()
} }
// Need to make sure we include the new ones...
inputs = getUnusedInputs($("#rapid-form input[type=file][id^=id_images-]"));
}
return inputs; return inputs;
} }
@@ -451,7 +468,7 @@
option.appendTo($("#id_examination_to")); option.appendTo($("#id_examination_to"));
toastr.success(`Examination set to ${option.attr('title')} from dicom data`); toastr.success(`Examination set to ${option.attr('title')} from dicom data`);
} else { } else {
toastr.warning(`Unable to set examination ${option.attr('title')} from dicom data (it needs creating)`); toastr.warning(`Unable to set examination ${study_description} from dicom data (it needs creating)`);
} }