This repository has been archived on 2022-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
dedibox_prices/lib/dedibox_prices_web/templates/page/index.html.heex

60 lines
1.6 KiB
Plaintext

<section class="phx-hero">
<h1>Dedibox Prices</h1>
<p>
Surveillance des changements de prix des dedibox online.
<a href="https://console.online.net/fr/order/server">console.online.net</a>
</p>
</section>
<script>
function api_refresh () {
const xhttp = new XMLHttpRequest();
xhttp.onloadend = function() {
if (xhttp.status >= 200 && xhttp.status < 400)
document.getElementById("api-refresh-status").innerHTML = "refreshed";
else
document.getElementById("api-refresh-status").innerHTML = "error";
}
xhttp.open("POST", "/api/refresh", true);
xhttp.send();
}
</script>
<section class="row">
<!-- <form method="POST" action="/api/refresh"> -->
<!-- <input id="api-refresh-button" type="submit" value="Refresh data"> -->
<!-- </form> -->
<button id="api-refresh-button" onclick="api_refresh()">
Refresh data
</button>
<p id="api-refresh-status"></p>
</section>
<section class="row">
<article>
<h2>Last data</h2>
<table>
<thead>
<tr>
<th>name</th>
<th>price</th>
<th>memory</th>
<th>dispo</th>
<th>last_update</th>
</tr>
</thead>
<tbody>
<%= for recent <- @recents do %>
<tr>
<th><%= recent.name %></th>
<td><%= recent.price %></td>
<td><%= recent.memory %></td>
<td><%= recent.disponibility %></td>
<td><%= recent.inserted_at %></td>
</tr>
<% end %>
</tbody>
</table>
</article>
</section>