{% extends 'base.html' %}

{% block content %}

<h1>{{table_name}}</h1>

<li><a href="/masina">home</a></li>
<li><a href="/addalim/{{table_name}}">add alim</a></li>
<li><a href="/summary/{{id_car}}/{{table_name}}">car summary</a></li>
========================================================================================================================
<!--Filter-->
<form method="post" action="/details/{{table_name}}">
    <br>
    <div class="container text-center">
        <div class="row">
            <div class="col">
                Date From
            </div>
            <div class="col">
                <input type="date" name="dataFrom"/>
            </div>
            <div class="col">
                Date Bis
            </div>
            <div class="col">
                <input type="date" name="dataBis"/>
            </div>
            <div class="col">
                Type
            </div>
            <div class="col">
                <select id="alim_type" name="type">
                        <option value="all">all</option>
                        {% for tt in types_of_costs %}
                            <option value={{tt}}>{{tt}}</option>
                        {% endfor %}
                </select>
            </div>
            <div class="col">
                Monthly
            </div>
            <div class="col">
                <select id="ffff" name="month">
                    <option value="interval">interval</option>
                    <option value="January">January</option>
                    <option value="February">February</option>
                    <option value="March">March</option>
                    <option value="April">April</option>
                    <option value="May">April</option>
                    <option value="June">June</option>
                    <option value="July">July</option>
                    <option value="August">August</option>
                    <option value="September">September</option>
                    <option value="October">October</option>
                    <option value="November">November</option>
                    <option value="December">December</option>
                </select>
            </div>
            <div class="col">
                Year
            </div>
            <div class="col">
                    <select id="year" name="year">
                        <option value="2024">2024</option>
                        <option value="2020">2020</option>
                        <option value="2021">2021</option>
                        <option value="2022">2022</option>
                        <option value="2023">2023</option>
                        <option value="2025">2025</option>
                        <option value="2026">2026</option>
                    </select>
            </div>
            <div class="col">
                <input type="submit" name="filter"/>
            </div>
        </div>
    </div>
    <br>
</form>
<br>

<!--Date Fraom Date Bis-->
<div class="container text-center">
    <div class="row">
        <div class="col">
            Data From: {{dataFrom}}
        </div>
        <div class="col">
            Data Bis: {{dataBis}}
        </div>
    </div>
</div>
<br>
========================================================================================================================

<br>
<table class="table" id="HyundaiTable" border="1">
    <script src="{{ url_for('static', filename='js/myfile.cs') }}"></script>
    <thead>
        <tr>
            {% for colName in userDetails[0] %}
                <th scope="col" onclick="sortMasinaTable({{ loop.index0 }})">{{colName}}</th>
            {% endfor %}
            <th scope="col">delete</th>
        </tr>
    </thead>
    {% for row in userDetails[1:] %}
    <tr>
        {% for col in row %}
            {% if loop.index0 == 15 %}
                {% if col is none %}
                    <td>
                        <form action="/upload_file/{{table_name}}/{{row[0]}}" method="POST" enctype="multipart/form-data">
                            Project file path: <input type="file" name="myfile"><br>
                            <input type="submit" name="upload_file">
                        </form>
                    </td>
                {% else %}
                    <td>{{col}}</td>
                {% endif %}
            {% else %}
                <td>{{col}}</td>
            {% endif %}
        {% endfor %}
        <td><a href="/deleterow/{{table_name}}/{{row[0]}}">delete</a></td>
    </tr>
    {% endfor %}
</table>
<br>
<form action="/details/{{table_name}}" method="POST" enctype="multipart/form-data">
    Import Car: <input type="file" name="myfile"><br>
    <input type="submit" name="upload_file">
</form>
<br>
<form action="/details/{{table_name}}" method="POST" enctype="multipart/form-data">
    Backup Car: <input type="submit" name="export_detail_table_as_sql">
</form>
<form action="/masina" method="POST" enctype="multipart/form-data">
    Export profile: <input type="submit" name="export_sql_database">
</form>

{% endblock %}
