Members: show & add

This commit is contained in:
William Bouzourène 2025-01-13 12:38:19 +01:00
parent 40999506c8
commit 2a7d446f98
5 changed files with 605 additions and 5 deletions

216
views/person_form.html Normal file
View file

@ -0,0 +1,216 @@
{% extends "layouts/main.html" %}
{% block main %}
<div class="container mt-4">
<div class="mb-4">
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
{% if Person.IsMember %}
<li class="breadcrumb-item"><a href="/members">Membres</a></li>
{% else %}
<li class="breadcrumb-item"><a href="/contacts">Contacts</a></li>
{% endif %}
{% if Person.ID %}
{% if Person.IsMember %}
<li class="breadcrumb-item">
<a href="/admin/members/{{ Person.ID }}">
{{ Person.LastName }} {{ Person.FirstName }}
</a>
</li>
{% else %}
<li class="breadcrumb-item">
<a href="/admin/contacts/{{ Person.ID }}">
{{ Person.LastName }} {{ Person.FirstName }}
</a>
</li>
{% endif %}
<li class="breadcrumb-item active">Modifier</li>
{% else %}
<li class="breadcrumb-item active">Ajouter</li>
{% endif %}
</ol>
</nav>
<hr>
</div>
{% if Errors %}
<div class="alert alert-danger">
<ul class="m-0">
{% for Error in Errors %}
<li>{{ Error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<form id="section" method="post">
<div class="row mb-3">
<label for="last_name" class="form-label col-md-2">
Nom de famille
</label>
<div class="col-md-10">
<input
id="name"
class="form-control"
type="text"
name="last_name"
required
value="{{ Person.LastName }}"
autofocus
>
</div>
</div>
<div class="row mb-3">
<label for="first_name" class="form-label col-md-2">
Prénom
</label>
<div class="col-md-10">
<input
id="first_name"
class="form-control"
type="text"
name="first_name"
required
value="{{ Person.FirstName }}"
>
</div>
</div>
<div class="row mb-3">
<label for="email" class="form-label col-md-2">
Email
</label>
<div class="col-md-10">
<input
id="email"
class="form-control"
type="email"
name="email"
value="{{ Person.Email }}"
>
</div>
</div>
<div class="row mb-3">
<label for="phone" class="form-label col-md-2">
Téléphone fixe
</label>
<div class="col-md-10">
<input
id="phone"
class="form-control"
type="text"
name="phone"
value="{{ Person.Phone }}"
>
</div>
</div>
<div class="row mb-5">
<label for="mobile" class="form-label col-md-2">
Téléphone mobile
</label>
<div class="col-md-10">
<input
id="mobile"
class="form-control"
type="text"
name="mobile"
value="{{ Person.Mobile }}"
>
</div>
</div>
<div class="row mb-2">
<label for="address1" class="form-label col-md-2">
Adresse
</label>
<div class="col-md-10">
<input
id="address1"
class="form-control"
type="text"
name="address1"
value="{{ Person.Address1 }}"
placeholder="Ligne 1"
>
</div>
</div>
<div class="row mb-2">
<div class="col-md-10 offset-md-2">
<input
id="address2"
class="form-control"
type="text"
name="address2"
value="{{ Person.Address2 }}"
placeholder="Ligne 2"
>
</div>
</div>
<div class="row mb-5">
<div class="col-md-3 col-lg-2 offset-md-2 mb-2 mb-md-0">
<input
id="postal_code"
class="form-control"
type="text"
name="postal_code"
placeholder="Code postal"
pattern="[0-9]{4}"
>
</div>
<div class="col-md-7 col-lg-8">
<input
id="city"
class="form-control"
type="text"
name="city"
value="{{ Person.City }}"
placeholder="Lieu"
>
</div>
</div>
<div class="row mb-3">
<label for="section" class="form-label col-md-2">
Section
</label>
<div class="col-md-10">
<select
class="form-control"
name="section"
id="section"
required
>
{% for Section in Sections %}
<option
value="{{ Section.ID }}"
{% if Section.ID == Person.Section %}
selected
{% endif %}
>
{{ Section.Name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="my-4">
<button class="btn btn-primary" type="submit">
<i class="me-1 bi-floppy"></i>
Enregistrer
</button>
</div>
</form>
</div>
{% endblock %}