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

{% block title %}{% trans "Bulk copy" %}{% endblock %}
{% block smallheader %}{% trans "copy" %}{% endblock %}
{% block largeheader %}{% trans "objects" %}{% endblock %}
{% block nav1 %}{% trans "Object Browser" %}{% endblock %}
{% block toolbar %}{% endblock %}
{% block footer %}
    <script>
        $('table#many').dataTable( {
                    "sPaginationType": "bootstrap",
                    "sScrollY": "260px",
                    "bAutoWidth": false,
                    "bScrollCollapse": true,
                    "bPaginate": false,
                    "sDom": 'rtp'
                }
        );
    </script>
{% endblock %}
{%  block content %}
    {% if objects %}
        <div class="alert alert-info">
            <p>
            {% trans "You are about to copy multiple objects" %}
            <p>
            {% trans "Fill in Attribue Name and New Value and they will be changed on all selected items. If object does not currently have this value defined it will be added anyway." %}
            <p>
        </div>
        <form action="#" method="post" class="form-horizontal">{% csrf_token %}
            <div>
        {% include "bootstrap_fields.html" with fields=form %}
            <table id="many">
                <thead>
                <tr>
                    <th></th>
                    <th>{% trans "Object Type" %}</th>
                    <th>{% trans "Description" %}</th>
                    <th>{% trans "Filename" %}</th>
                </tr>
                </thead>
                <tbody>
                {% for obj in objects %}
                    <tr>
                        <td>
                            <input type="hidden" name="hidden_{{ obj.id }}" value="{{ obj.id }}" />
                            <input type="checkbox" checked="checked" name="change_{{ obj.id }}" id="id_{{ obj.id }}" />
                        </td>
                        <td>{{ obj.object_type }}</td>
                        <td>{{ obj.description }}</td>
                        <td>{{ obj.filename }}</td>
                    </tr>

                {% endfor %}
                </tbody>
            </table>
            <br/>
            </div>
            <div class="form-actions">
                <button class="btn btn-primary" type="submit">Submit</button>
            </div>
        </form>
    {% else %}
        <div class="alert alert-warning">{% trans "Hey we didn't find any objects that match what you were looking for :(" %}</div>
    {% endif %}
{%  endblock %}
