{% extends 'up_squelette.html' %}


{% block main %}

<br>
      <div class="row">
        <div class="col-md-12">
	  <h2> Fichiers privés (Seul les personnes connectées et l'administrateur de l'ordinateur peuvent les voirs) </h2>
	  {% if listFilesPrivate %}
          <table class="table">
            <thead>
              <tr>
		  <th></th>
                  <th>Fichier(s)   <span class="badge">{{ nb_pv }}</span></th>
                  <th>Taille (en Megaoctect)</th>
                  <th></th>
              </tr>
            </thead>
            <tbody>
                
                {% for file in listFilesPrivate %}
              <tr>
                  <td>{{ file[0] }}</td>
                  <td><a href="/myfiles/{{ username }}/{{ file[1] }}">{{ file[1] }}</a></td>
                  <td>{{ file[2] }}</td>
                  <td><a href="{{ url_for('filesupload.remove_privateFile', filename=file[1]) }}"><button type="button" class="btn btn-sm btn-danger">Supprimer</button></a></td>
		  <td><a href="{{ url_for('filesupload.move_public', filename=file[1]) }}"><button type="button" class="btn btn-sm btn-success"> Rendre Publique </button></a></td>
	      </tr>
              {% endfor %}
	    </tbody>
          </table>
	  {% else %}
	  <p> Vous n'avez aucun fichiers privés </p>
	  {% endif %}
	  <br />
	  <hr />
	  <br />
	  <h2> Fichiers publics (Tout le monde peut les voirs) </h2>
	  {% if listFilesPublic %}
          <table class="table">
            <thead>
              <tr>
		  <th></th>
                  <th>Fichier(s) <span class="badge">{{ nb_pu }}</span></th>
                  <th>Taille (en Megaoctets)</th>
                  <th></th>
              </tr>
            </thead>
            <tbody>
                
                {% for file in listFilesPublic %}
              <tr>
                  <td>{{ file[0] }}</td>
                  <td><a href="/public/{{ username }}/{{ file[1] }}">{{ file[1] }}</a></td>
                  <td>{{ file[2] }}</td>
                  <td><a href="{{ url_for('filesupload.remove_publicFile', filename=file[1]) }}"><button type="button" class="btn btn-sm btn-danger">Supprimer</button></a></td>
		   <td><a href="{{ url_for('filesupload.move_private', filename=file[1]) }}"><button type="button" class="btn btn-sm btn-success"> Rendre Privée </button></a></td>
	      </tr>
              {% endfor %}
	    </tbody>
          </table>
	  {% else %}
	  <p> Vous n'avez aucun fichiers publics </p>
	  {% endif %}
          
        </div>

{% endblock %}