Rework forms

This commit is contained in:
William Bouzourène 2025-01-12 17:14:39 +01:00
parent aa6d89aac8
commit efafb845f3
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
14 changed files with 1539 additions and 679 deletions

View file

@ -34,73 +34,81 @@
<form id="field" method="post">
<div class="mb-3">
<label for="name" class="form-label">
<div class="row mb-3">
<label for="name" class="form-label col-md-2">
Nom du champ
</label>
<input
id="name"
class="form-control"
type="text"
name="name"
required
value="{{ Field.Name }}"
>
<div class="col-md-10">
<input
id="name"
class="form-control"
type="text"
name="name"
required
value="{{ Field.Name }}"
>
</div>
</div>
{% if !Field.ID %}
<div class="mb-3">
<label for="person_type" class="form-label">
<div class="row mb-3">
<label for="person_type" class="form-label col-md-2">
Population
</label>
<select
name="person_type"
id="person_type"
class="form-control"
required
>
{% for Key, Value in PersonTypes %}
<option value="{{ Key }}">{{ Value }}</option>
{% endfor %}
</select>
<div class="col-md-10">
<select
name="person_type"
id="person_type"
class="form-control"
required
>
{% for Key, Value in PersonTypes %}
<option value="{{ Key }}">{{ Value }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="mb-3">
<label for="field_type" class="form-label">
<div class="row mb-3">
<label for="field_type" class="form-label col-md-2">
Type de champ
</label>
<select
name="field_type"
id="field_type"
class="form-control"
required
>
{% for Key, Value in FieldTypes %}
<option value="{{ Key }}">{{ Value }}</option>
{% endfor %}
</select>
<div class="col-md-10">
<select
name="field_type"
id="field_type"
class="form-control"
required
>
{% for Key, Value in FieldTypes %}
<option value="{{ Key }}">{{ Value }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="mb-3">
<label for="list" class="form-label">
<div class="row mb-3">
<label for="list" class="form-label col-md-2">
Liste
</label>
<select
name="list"
id="list"
class="form-control"
required
>
{% for List in Lists %}
<option value="{{ List.ID }}">
{{ List.Name }}
</option>
{% endfor %}
</select>
<div class="col-md-10">
<select
name="list"
id="list"
class="form-control"
required
>
{% for List in Lists %}
<option value="{{ List.ID }}">
{{ List.Name }}
</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
<div class="mt-4">
<div class="my-4">
<button class="btn btn-primary" type="submit">
<i class="me-1 bi-floppy"></i>
Enregistrer
@ -118,6 +126,10 @@
var enable = false;
if ($(this).val() == "list") {
enable = true;
$("#list-disabled").remove();
} else {
$("#list").append("<option id=\"list-disabled\" selected></option>");
}
$("#list").prop("disabled", !enable);