{#-
 This file is part of Supysonic.
 Supysonic is a Python implementation of the Subsonic server API.

 Copyright (C) 2013-2019 Alban 'spl0k' Féron
                    2017 Óscar García Amor

 Distributed under terms of the GNU AGPLv3 license.
-#}
{% extends "layout.html" %}
{% block navbar_folders %}
<li class="active"><a href="{{ url_for('frontend.folder_index') }}">Folders <span
                      class="sr-only">(current)</span></a></li>
{% endblock %}
{% block body %}
<div class="page-header first-header">
  <h2>Music folders</h2>
</div>
<table class="table table-striped table-hover">
  <thead>
    <tr><th>Name</th><th>Path</th><th></th>{% if allow_scan %}<th></th>{% endif %}</tr>
  </thead>
  <tbody>
    {% for folder in folders %}
    <tr>
      <td>{{ folder.name }}</td><td>{{ folder.path }}</td><td>
        <button class="btn btn-danger btn-xs" data-href="{{ url_for('frontend.del_folder', id = folder.id) }}" data-toggle="modal" data-target="#confirm-delete" aria-label="Delete folder">
          <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="Delete folder"></span></button></td>
      {%if allow_scan %}<td><a class="btn btn-default btn-xs" href="{{ url_for('frontend.scan_folder', id = folder.id) }}" aria-label="Scan folder">
          <span class="glyphicon glyphicon-search" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="Scan folder"></span></a></td>{% endif %}
    </tr>
    {% endfor %}
  </tbody>
</table>
<div class="btn-toolbar" role="toolbar">
  <a href="{{ url_for('frontend.add_folder_form') }}" class="btn btn-default">Add</a>
  {% if allow_scan %}<a href="{{ url_for('frontend.scan_folder') }}" class="btn btn-default">Scan all</a>{% endif %}
</div>
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Are you sure?</h4>
      </div>
      <div class="modal-body">
        <p>Are you sure that you want to delete folder?</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Nope</button>
        <a type="button" class="btn btn-danger btn-ok">Yes, delete!</a>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endblock %}
