80 lines
2.9 KiB
HTML
80 lines
2.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
|
|
<div class="container py-4">
|
|
|
|
<div class="card bg-dark bg-opacity-75 p-3 mb-4">
|
|
<form method="post" action="/submit" class="row g-2 align-items-center justify-content-start">
|
|
|
|
<div class="col-md-4">
|
|
<input
|
|
type="text"
|
|
name="query"
|
|
class="form-control bg-dark text-white"
|
|
placeholder="Nom de la machine">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-check text-white">
|
|
<input class="form-check-input" type="checkbox" name="noshutdown" id="noshutdown">
|
|
<label class="form-check-label" for="noshutdown">
|
|
Whitelist shutdown
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<select name="time" class="form-select bg-dark text-white" id="time-select">
|
|
{% for hour in range(0, 24) %}
|
|
<option value="{{ '%02d:00'|format(hour) }}">{{ '%02d:00'|format(hour) }}</option>
|
|
<option value="{{ '%02d:30'|format(hour) }}">{{ '%02d:30'|format(hour) }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
<button type="submit" class="btn btn-secondary">
|
|
Ajouter
|
|
</button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
|
|
<div class="card bg-dark bg-opacity-75 p-3">
|
|
<h5 class="text-white mb-3">Liste des éléments</h5>
|
|
<div class="table-items">
|
|
{% for item in items %}
|
|
<div class="d-flex justify-content-between align-items-center py-2">
|
|
<span class="text-white">{{ item.name }}</span>
|
|
{% if item.noshutdown %}
|
|
<span class="text-green">OUI</span>
|
|
{% else %}
|
|
<span class="text-red">NON</span>
|
|
<span class="text-white">{{ item.time }}</span>
|
|
{% endif %}
|
|
<form method="post" action="/delete" class="m-0 p-0">
|
|
<input type="hidden" name="item_name" value="{{ item.name }}">
|
|
<button type="submit" class="btn btn-sm btn-danger">×</button>
|
|
</form>
|
|
</div>
|
|
{% if not loop.last %}
|
|
<hr class="border-secondary my-1">
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
const tickCheckbox = document.getElementById('tick'); // script pr desactiver la selection de l'heure si whitelist
|
|
const timeSelect = document.getElementById('time-select');
|
|
|
|
timeSelect.disabled = tickCheckbox.checked;
|
|
|
|
tickCheckbox.addEventListener('change', function() {
|
|
timeSelect.disabled = this.checked;
|
|
});
|
|
</script>
|
|
|
|
{% endblock %}
|