.
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
|
||||
|
||||
</div>
|
||||
<button id="add-new-cids">Add New</button>
|
||||
<button id="add-new-cids">Add New Users</button>
|
||||
<input type="number" id="add-number" value="number to add">
|
||||
</details>
|
||||
|
||||
@@ -77,21 +77,12 @@
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#add-new-cids").click((evt) => {
|
||||
|
||||
function postAjax(data) {
|
||||
|
||||
$.ajax({
|
||||
url: "{% url 'generic:create_cid_users' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
number: $("#add-number").get(0).value,
|
||||
physics_exams: JSON.stringify($("#physics-exams").val()),
|
||||
rapid_exams: JSON.stringify($("#rapid-exams").val()),
|
||||
sba_exams: JSON.stringify($("#sbas-exams").val()),
|
||||
longs_exams: JSON.stringify($("#longs-exams").val()),
|
||||
anatomy_exams: JSON.stringify($("#anatomy-exams").val()),
|
||||
},
|
||||
url: "{% url 'generic:manage_cid_users' %}",
|
||||
data: data,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
@@ -109,6 +100,34 @@
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function getGenericData() {
|
||||
return {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
physics_exams: JSON.stringify($("#physics-exams").val()),
|
||||
rapid_exams: JSON.stringify($("#rapid-exams").val()),
|
||||
sba_exams: JSON.stringify($("#sbas-exams").val()),
|
||||
longs_exams: JSON.stringify($("#longs-exams").val()),
|
||||
anatomy_exams: JSON.stringify($("#anatomy-exams").val()),
|
||||
}
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#add-new-cids").click((evt) => {
|
||||
|
||||
n = $("#add-number").get(0).value
|
||||
|
||||
if (n < 1) {
|
||||
toastr.info("You need to enter how many users to add.")
|
||||
return
|
||||
}
|
||||
|
||||
data = getGenericData()
|
||||
data["number_to_create"] = n
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user