This commit is contained in:
cangui 2025-05-11 19:50:22 +02:00
parent 4ef3dcaf08
commit d1364f9cdb

View File

@ -30,27 +30,68 @@
<a class="button is-info is-light" href="/admin/consumption">🔁 Tout</a> <a class="button is-info is-light" href="/admin/consumption">🔁 Tout</a>
</div> </div>
<table class="table is-striped is-fullwidth"> {{ if not .Summaries }}
<thead> <p>Aucune consommation trouvée pour cette période.</p>
<tr> {{ else }}
<th>Date</th> <div class="box">
<th>Type</th> <table class="table is-striped is-fullwidth">
<th>Description</th> <thead>
<th>Crédits utilisés</th> <tr>
</tr> <th>Date</th>
</thead> <th>Total crédits utilisés</th>
<tbody> <th>Détails</th>
{{ range .Consumptions }} </tr>
<tr> </thead>
<td>{{ .CreatedAt.Format "02/01/2006 15:04" }}</td> <tbody>
<td>{{ .MessageType }}</td> {{ range .Summaries }}
<td>{{ .Description }}</td> <tr>
<td>{{ .CreditsUsed }}</td> <td>{{ .Date.Format "02/01/2006" }}</td>
</tr> <td>{{ .TotalCredits }}</td>
{{ end }} <td>
</tbody> <button class="button is-small is-link" onclick="toggleDetail('{{ .Date.Format "2006-01-02" }}')">🔽 Voir détails</button>
</table> </td>
</tr>
<tr id="detail-{{ .Date.Format "2006-01-02" }}" style="display: none;">
<td colspan="3">
<table class="table is-narrow is-fullwidth">
<thead>
<tr>
<th>Heure</th>
<th>Type</th>
<th>Description</th>
<th>Crédits</th>
</tr>
</thead>
<tbody>
{{ range (index $.DetailsByDate (.Date.Format "2006-01-02")) }}
<tr>
<td>{{ .CreatedAt.Format "15:04:05" }}</td>
<td>{{ .MessageType }}</td>
<td>{{ .Description }}</td>
<td>{{ .CreditsUsed }}</td>
</tr>
{{ end }}
</tbody>
</table>
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }}
</section> </section>
</div> </div>
</div> </div>
<script>
function toggleDetail(id) {
const row = document.getElementById("detail-" + id);
if (row.style.display === "none") {
row.style.display = "";
} else {
row.style.display = "none";
}
}
</script>
{{ end }} {{ end }}