{% extends "base.html" %}
{% load static %}

{% block title %}Container Type Import{% endblock %}

{% block content %}

<div class="container">

  <div class="row">
    <div class="col-sm-12">
        <h2>Container Type Import: {{ import_file }}</h2>
        <form method="post" enctype="multipart/form-data">
            {% csrf_token %}
            {% if not import_file %}
                <input type="file" id="import_file" name="import_file" class="form-control">
            {% endif %}
            {% if import_file %}
                <label for="first_data_row">First data row:</label><input type="number" min="1" max="10" size="3" name="first_data_row" id="first_data_row" value="1"><br />
                <input type="submit" class="btn btn-primary" value="import" name="import-cmd">
            {% else %}
                <input type="submit" class="btn btn-primary" value="show" name="show-cmd">
            {% endif %}
            <div>
                {% if import_file %}
                File to be imported: {{ import_file }}
                {% endif %}
                <br>
                {% for file in FILES %}
                File: {{ file.name }} ({{ file.size }} Bytes)
                {% endfor %}
            </div>
            <div>
                <table class="table">
                    <tr>
                        <td>Row</td>
                        <td>ID</td>
                        <td>Description</td>
                        <td>Width</td>
                        <td>Length</td>
                        <td>Height</td>
                        <td>Cover</td>
                        <td>Inner Width</td>
                        <td>Inner Length</td>
                        <td>Inner Height</td>
                        <td>Available</td>
                        <td>Stores Container</td>
                    </tr>
                    {% for row in excel_data %}
                        <tr>
                        {% for col in row %}
                            <td>{{ col }}<input type="hidden" value="{{ col }}" name="data_{{ row.0 }}_{{ forloop.counter }}"></td>
                        {% endfor %}
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </form>
    </div>
  </div>
</div>

{% endblock content %}