Start to build edit user form
This commit is contained in:
@ -66,34 +66,49 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Granted services -->
|
||||
<!-- Granted clients -->
|
||||
<fieldset class="form-group">
|
||||
<legend class="mt-4">Granted services</legend>
|
||||
<legend class="mt-4">Granted clients</legend>
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="granted_services"
|
||||
value="all_services" {% if u.authorized_services== None %} checked="" {% endif %}>
|
||||
Grant all services
|
||||
<input type="radio" class="form-check-input" name="granted_clients"
|
||||
value="all_clients" {% if u.authorized_clients== None %} checked="" {% endif %}>
|
||||
Grant all clients
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="granted_services"
|
||||
value="custom_services" {% if u.authorized_services !=None %} checked="checked" {% endif %}>
|
||||
Manually specify allowed services
|
||||
<input type="radio" class="form-check-input" name="granted_clients"
|
||||
value="custom_clients" {% if u.authorized_clients !=None %} checked="checked" {% endif %}>
|
||||
Manually specify allowed clients
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{% for c in clients %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" class="authorize_client" data-id="{{ c.id.0 }}"
|
||||
{% if u.can_access_app(c.id) %} checked="" {% endif %}>
|
||||
<label class="form-check-label" for="admin">
|
||||
{{ c.name }}
|
||||
</label>
|
||||
<div id="clients_target">
|
||||
{% for c in clients %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" class="authorize_client" data-id="{{ c.id.0 }}"
|
||||
{% if u.can_access_app(c.id) %} checked="" {% endif %}>
|
||||
<label class="form-check-label" for="admin">
|
||||
{{ c.name }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// Clients granted
|
||||
function refreshDisplayAuthorizedClients() {
|
||||
const clientsSelectorEl = document.getElementById("clients_target");
|
||||
const radioBtn = document.querySelector("input[name=granted_clients][value=custom_clients]");
|
||||
clientsSelectorEl.style.display = radioBtn.checked ? "block" : "none";
|
||||
}
|
||||
refreshDisplayAuthorizedClients();
|
||||
document.querySelectorAll("input[name=granted_clients]").forEach(el=> {
|
||||
el.addEventListener("change", refreshDisplayAuthorizedClients)
|
||||
})
|
||||
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
Reference in New Issue
Block a user