{% extends "partials/base.html" %}
{% block title %}Failed files{% endblock %}
{% block content %}
    <p>Unmatched Files:</p>
    <ul class="list-group mt-1">
        {% for file in files %}
            <li class="list-group-item list-group-item-danger d-flex justify-content-between align-items-center">
                {{ file }}
                <button type="button" class="btn btn-primary float-end match" data-bs-toggle="modal" data-bs-target="#searchForm" data-file="{{ file }}">Manual match</button>
            </li>
        {% endfor %}
    </ul>
    {% for file in files %}
        <div class="modal fade" id="searchForm" tabindex="-1" aria-labelledby="searchFormLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="searchFormLabel">Search</h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <label for="queryInput" class="form-label">Search query</label>
                        <input type="text" class="form-control" id="queryInput" value="{{ file }}">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary search" data-bs-target="#searchResults" data-bs-toggle="modal" data-bs-dismiss="modal">Submit</button>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
    <div class="modal fade" id="searchResults" tabindex="-1" aria-labelledby="modalSearchResultsLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-xl">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="modalSearchResultsLabel">Search Result</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="progress"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
