{% extends "layout.html" %}
{% block body %}

<p><b>Please confirm the disk to erase:</b></p>

{% for disk in blockdevs["blockdevices"] if disk["name"] != "zram0" and "loop" not in disk["name"] and disk["name"] != "sr0" %}

<div style="padding-top: 20px;"> <!-- partition bars -->
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
        <b>{{ disk['name'] }}: &nbsp; </b>  {{ disk['model'] }} - {{ disk['tran'] }} disk ({{(disk['size']/1024000000)|round(0)|int }} GB) - Serial: {{ disk['serial'] }} </p>
    <center style="padding: 5px; padding-bottom: 5px;">
     <td><a hx-get="/disks/choose_disk_erase_disk/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Select Disk  </span></a></td>
    </center>

  {% if disk['maj:min'] == "252:0" %}
  <div class="column">
    <div class="box" style="width: 100%; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px; right: 0px;">
    <span class="tag is-link">swap</span>
    </p>
    </div>
    </div>
  {% endif %}

{% set colors = ['teal', '#E69F00', '#56B4E9', '#009E73', '#0072B2', '#D55E00', '#CC79A7'] %}

<div id="percentagebar" style="width: 100%; height: 50px; background-color: transparent; display: inline-block; margin: 5; padding: 5; overflow: hidden; display: flex;">
        {% for child in disk['children'] %}
        <a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML">
        <div style="min-width: 100px; width: {{ (((child['size'] / disk['size'])*100)|round(0)|int) }}%; height: 100%; background-color: {{ colors[loop.index0 % colors|length] }}; display: inline-block; margin: 1; padding: 1; border-radius: 8px;">
                &nbsp; <a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"> <font color="white">{{ child['name'] }} </font>
        </div></a>
        {% endfor %}
</div>

<table width="100%">
        <th>Partition</th>
        <th>Type</th>
        <th>Mount Point</th>
        <th>Label</th>
        <th>Size</th>
        <th>Used</th>
{% for child in disk['children'] %}
<tr>
    <td><a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"><span class="tag is-link">{{ child['name'] }}</span></a></td>
    <td>{{ child['fstype'] }}</td>
    <td>{{ child['mountpoint'] }}</td>
    <td>{{ child['label'] }} </td>
    <td>{{ (child['size']/1024000000)|round(2) }} GiB </td>
</tr>
{% endfor %}
</table>
</div>
</div>

{% endfor %}

{% endblock %}
