Semaine 11

This commit is contained in:
gauvainboiche
2026-07-11 21:38:00 +02:00
parent d3d2416dea
commit 0d071d2843
281 changed files with 54412 additions and 0 deletions
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Gestion du parc{% endblock %}</title>
<style>
body { font-family: system-ui, sans-serif; margin: 2rem; background: #f8f9fa; }
nav { margin-bottom: 1.5rem; }
nav a { margin-right: 1rem; text-decoration: none; color: #0d6efd; }
.container { background: #fff; padding: 1.5rem; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; border-bottom: 1px solid #dee2e6; text-align: left; }
.btn { display: inline-block; padding: 0.4rem 0.8rem; border-radius: 0.25rem; text-decoration: none; color: #fff; background: #0d6efd; }
.btn-danger { background: #dc3545; }
.btn-secondary { background: #6c757d; }
.status-active { color: green; font-weight: bold; }
.status-inactive { color: red; font-weight: bold; }
</style>
</head>
<body>
<nav>
<a href="{% url 'equipment_list' %}">Accueil</a>
{% if user.is_authenticated %}
<a href="{% url 'equipment_create' %}">Ajouter un équipement</a>
<a href="{% url 'logout' %}">Déconnexion ({{ user.username }})</a>
{% else %}
<a href="{% url 'login' %}">Connexion</a>
{% endif %}
</nav>
<div class="container">
{% block content %}{% endblock %}
</div>
</body>
</html>
@@ -0,0 +1,13 @@
{% extends "parc/base.html" %}
{% block title %}Supprimer {{ equipment.hostname }}{% endblock %}
{% block content %}
<h1>Confirmer la suppression</h1>
<p>Êtes-vous certain de vouloir supprimer <strong>{{ equipment.hostname }}</strong> ?</p>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger">Supprimer</button>
<a class="btn btn-secondary" href="{% url 'equipment_list' %}">Annuler</a>
</form>
{% endblock %}
@@ -0,0 +1,18 @@
{% extends "parc/base.html" %}
{% block title %}{{ equipment.hostname }}{% endblock %}
{% block content %}
<h1>{{ equipment.hostname }}</h1>
<p><strong>Adresse IP :</strong> {{ equipment.ip }}</p>
<p><strong>État :</strong>
{% if equipment.is_active %}
<span class="status-active">Actif</span>
{% else %}
<span class="status-inactive">Inactif</span>
{% endif %}
</p>
<a class="btn btn-secondary" href="{% url 'equipment_update' equipment.pk %}">Modifier</a>
<a class="btn btn-danger" href="{% url 'equipment_delete' equipment.pk %}">Supprimer</a>
<a class="btn" href="{% url 'equipment_list' %}">Retour</a>
{% endblock %}
@@ -0,0 +1,13 @@
{% extends "parc/base.html" %}
{% block title %}{% if object %}Modifier{% else %}Ajouter{% endif %} un équipement{% endblock %}
{% block content %}
<h1>{% if object %}Modifier{% else %}Ajouter{% endif %} un équipement</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn">Enregistrer</button>
<a class="btn btn-secondary" href="{% url 'equipment_list' %}">Annuler</a>
</form>
{% endblock %}
@@ -0,0 +1,43 @@
{% extends "parc/base.html" %}
{% block title %}Équipements actifs{% endblock %}
{% block content %}
<h1>Équipements actifs</h1>
<a class="btn" href="{% url 'equipment_create' %}">Ajouter</a>
{% if equipments %}
<table>
<thead>
<tr>
<th>Hôte</th>
<th>Adresse IP</th>
<th>État</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for equipment in equipments %}
<tr>
<td>{{ equipment.hostname }}</td>
<td>{{ equipment.ip }}</td>
<td>
{% if equipment.is_active %}
<span class="status-active">Actif</span>
{% else %}
<span class="status-inactive">Inactif</span>
{% endif %}
</td>
<td>
<a class="btn" href="{% url 'equipment_detail' equipment.pk %}">Voir</a>
<a class="btn btn-secondary" href="{% url 'equipment_update' equipment.pk %}">Modifier</a>
<a class="btn btn-danger" href="{% url 'equipment_delete' equipment.pk %}">Supprimer</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>Aucun équipement actif enregistré.</p>
{% endif %}
{% endblock %}