Permissions: If no sections, do not show list

This commit is contained in:
William Bouzourène 2025-01-21 16:25:22 +01:00
parent 2592577e55
commit 60476a260e
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww

View file

@ -25,51 +25,57 @@
</div>
{% endif %}
<form id="user" method="post">
{% if Sections %}
<form id="user" method="post">
{% for Section in Sections %}
<div class="row mb-3">
<div class="col-md-2">
{{ Section.Name }}
</div>
<div class="col-md-10">
<div class="input-group">
<span class="input-group-text">
<i class="bi-key"></i>
</span>
<select
class="form-select"
name="section-{{ Section.ID }}"
id="section-{{ Section.ID }}"
autocomplete="off"
>
<option value="0">--- Aucun ---</option>
{% for Role in Roles %}
<option
value="{{ Role.ID }}"
{% for Section in Sections %}
<div class="row mb-3">
<div class="col-md-2">
{{ Section.Name }}
</div>
<div class="col-md-10">
<div class="input-group">
<span class="input-group-text">
<i class="bi-key"></i>
</span>
<select
class="form-select"
name="section-{{ Section.ID }}"
id="section-{{ Section.ID }}"
autocomplete="off"
>
<option value="0">--- Aucun ---</option>
{% for Role in Roles %}
<option
value="{{ Role.ID }}"
{% for UserRole in UserRoles %}
{% if Section.ID == UserRole.SectionID and Role.ID == UserRole.RoleID %}
selected
{% endif %}
{% endfor %}
>
{{ Role.Name }}
</option>
{% endfor %}
</select>
{% for UserRole in UserRoles %}
{% if Section.ID == UserRole.SectionID and Role.ID == UserRole.RoleID %}
selected
{% endif %}
{% endfor %}
>
{{ Role.Name }}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
<div class="my-4">
<button class="btn btn-primary" type="submit">
<i class="me-1 bi-floppy"></i>
Enregistrer
</button>
</div>
</form>
{% else %}
<div class="my-4">
<button class="btn btn-primary" type="submit">
<i class="me-1 bi-floppy"></i>
Enregistrer
</button>
Pas de section pour le moment
</div>
</form>
{% endif %}
</div>
{% endblock %}