This commit is contained in:
Ross
2021-12-12 11:05:13 +00:00
parent 95adacf265
commit 3acdf04667
3 changed files with 91 additions and 6 deletions
+22 -6
View File
@@ -20,7 +20,11 @@
<details>
<summary><h3>Add/Edit CID users</h3></summary>
<button id="add-selected-cids">Add to selected</button>
<button id="add-exams-selected-cids">Add exams to selected</button>
<button id="clear-exams-selected-cids">Clear selected exams</button>
<button id="activate-selected-cids">Activate selected</button>
<button id="deactivate-selected-cids">Deactivate selected</button>
<button id="delete-selected-cids">Delete selected</button>
<p>Select exams below to add user to.</p>
<div class="exam-selectors">
<span>
@@ -106,6 +110,10 @@
}
function getGenericData() {
selected_cids = []
$("#manage-span input:checked").each((n, el) => {
selected_cids.push(el.value)
})
return {
csrfmiddlewaretoken: "{{ csrf_token }}",
physics_exams: JSON.stringify($("#physics-exams").val()),
@@ -113,17 +121,26 @@
sba_exams: JSON.stringify($("#sbas-exams").val()),
longs_exams: JSON.stringify($("#longs-exams").val()),
anatomy_exams: JSON.stringify($("#anatomy-exams").val()),
delete: false,
number_to_create: 0,
activate: false,
deactivate: false,
add_exams: false,
clear_exams: false,
selected_cids: JSON.stringify(selected_cids),
}
}
$(document).ready(function () {
$("#add-exams-selected-cids").click((evt) => {
data = getGenericData();
data["add_exams"] = true;
postAjax(data);
});
$("#add-new-cids").click((evt) => {
n = $("#add-number").get(0).value;
selected_cids = []
$("#manage-span input:checked").each((n, el) => {
selected_cids.push(el.value)
})
if (n < 1) {
toastr.info("You need to enter how many users to add.");
@@ -132,7 +149,6 @@
data = getGenericData();
data["number_to_create"] = n;
data["selected_cids"] = selected_cids;
postAjax(data);