.
This commit is contained in:
@@ -15,11 +15,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id="manage-span">
|
<span id="manage-span">
|
||||||
{% render_table table %}
|
{% render_table table %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><h3>Add/Edit CID users</h3></summary>
|
<summary>
|
||||||
|
<h3>Add/Edit CID users</h3>
|
||||||
|
</summary>
|
||||||
<button id="add-exams-selected-cids">Change selected exams</button>
|
<button id="add-exams-selected-cids">Change selected exams</button>
|
||||||
<button id="clear-exams-selected-cids">Clear selected exams</button>
|
<button id="clear-exams-selected-cids">Clear selected exams</button>
|
||||||
<button id="activate-selected-cids">Activate selected</button>
|
<button id="activate-selected-cids">Activate selected</button>
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
<p>Select exams below to add user to.</p>
|
<p>Select exams below to add user to.</p>
|
||||||
<div class="exam-selectors">
|
<div class="exam-selectors">
|
||||||
<span>
|
<span>
|
||||||
Physics Exams<br/>
|
Physics Exams<br />
|
||||||
<select id="physics-exams" multiple="multiple">
|
<select id="physics-exams" multiple="multiple">
|
||||||
{% for name, id in physics_exams %}
|
{% for name, id in physics_exams %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Rapid Exams<br/>
|
Rapid Exams<br />
|
||||||
<select id="rapid-exams" multiple="multiple">
|
<select id="rapid-exams" multiple="multiple">
|
||||||
{% for name, id in rapid_exams %}
|
{% for name, id in rapid_exams %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
@@ -47,7 +49,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Sba Exams<br/>
|
Sba Exams<br />
|
||||||
<select id="sbas-exams" multiple="multiple">
|
<select id="sbas-exams" multiple="multiple">
|
||||||
{% for name, id in sba_exams %}
|
{% for name, id in sba_exams %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Long Exams<br/>
|
Long Exams<br />
|
||||||
<select id="longs-exams" multiple="multiple">
|
<select id="longs-exams" multiple="multiple">
|
||||||
{% for name, id in longs_exams %}
|
{% for name, id in longs_exams %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Anatomy Exams<br/>
|
Anatomy Exams<br />
|
||||||
<select id="anatomy-exams" multiple="multiple">
|
<select id="anatomy-exams" multiple="multiple">
|
||||||
{% for name, id in anatomy_exams %}
|
{% for name, id in anatomy_exams %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
@@ -77,22 +79,20 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Groups<br/>
|
Groups<br />
|
||||||
<select id="cid-groups">
|
<select id="cid-groups">
|
||||||
<option value="">----</option>
|
<option value="">----</option>
|
||||||
{% for name, id in cid_user_groups %}
|
{% for name, id in cid_user_groups %}
|
||||||
<option value="{{id}}">{{name}}</option>
|
<option value="{{id}}">{{name}}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<button id="add-group">Add Group to users</button>
|
<button id="add-group">Add Group to users</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="add-new-cids">Add New (Blank) Users</button>
|
<button id="add-new-cids">Add New (Blank) Users</button>
|
||||||
<input type="number" id="add-number" value="number to add"><br/>
|
<input type="number" id="add-number" value="number to add"><br />
|
||||||
<button id="add-new-emails">Add New Users From Email</button>
|
<button id="add-new-emails">Add New Users From Email</button>
|
||||||
<textarea id="emails-input" name="emails" rows="4" cols="50">
|
<textarea id="emails-input" name="emails" rows="4" cols="50">Enter emails here</textarea>
|
||||||
Enter emails here
|
|
||||||
</textarea>
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -100,54 +100,54 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function postAjax(data) {
|
function postAjax(data) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'generic:manage_cid_users' %}",
|
url: "{% url 'generic:manage_cid_users' %}",
|
||||||
data: data,
|
data: data,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
toastr.info('Added/Updated');
|
toastr.info('Added/Updated');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
// show some message according to the response.
|
// show some message according to the response.
|
||||||
// For eg. A message box showing that the status has been changed
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
console.log('[Done]');
|
console.log('[Done]');
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGenericData() {
|
function getGenericData() {
|
||||||
selected_cids = []
|
selected_cids = []
|
||||||
$("#manage-span tbody input:checked").each((n, el) => {
|
$("#manage-span tbody input:checked").each((n, el) => {
|
||||||
selected_cids.push(parseInt(el.value));
|
selected_cids.push(parseInt(el.value));
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
physics_exams: JSON.stringify($("#physics-exams").val()),
|
physics_exams: JSON.stringify($("#physics-exams").val()),
|
||||||
rapid_exams: JSON.stringify($("#rapid-exams").val()),
|
rapid_exams: JSON.stringify($("#rapid-exams").val()),
|
||||||
sba_exams: JSON.stringify($("#sbas-exams").val()),
|
sba_exams: JSON.stringify($("#sbas-exams").val()),
|
||||||
longs_exams: JSON.stringify($("#longs-exams").val()),
|
longs_exams: JSON.stringify($("#longs-exams").val()),
|
||||||
anatomy_exams: JSON.stringify($("#anatomy-exams").val()),
|
anatomy_exams: JSON.stringify($("#anatomy-exams").val()),
|
||||||
cid_groups: JSON.stringify($("#cid-groups").val()),
|
cid_groups: JSON.stringify($("#cid-groups").val()),
|
||||||
delete: false,
|
delete: false,
|
||||||
emails: JSON.stringify(false),
|
emails: JSON.stringify(false),
|
||||||
number_to_create: 0,
|
number_to_create: 0,
|
||||||
activate: false,
|
activate: false,
|
||||||
deactivate: false,
|
deactivate: false,
|
||||||
add_exams: false,
|
add_exams: false,
|
||||||
clear_exams: false,
|
clear_exams: false,
|
||||||
toggle_internal: false,
|
toggle_internal: false,
|
||||||
selected_cids: JSON.stringify(selected_cids),
|
selected_cids: JSON.stringify(selected_cids),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
n = $("#add-number").get(0).value;
|
n = $("#add-number").get(0).value;
|
||||||
|
|
||||||
if (n < 1) {
|
if (n < 1) {
|
||||||
toastr.info("You need to enter how many users to add.");
|
toastr.info("You need to enter how many users to add.");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -214,9 +214,10 @@
|
|||||||
.exam-selectors {
|
.exam-selectors {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exam-selectors select {
|
.exam-selectors select {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user