{% if success is defined %}
    <div class="ui large success message center aligned">
        <i class="close icon"></i>
        <div  class="ui header center aligned">{{ success }}</div>
    </div>
{% endif %}
{% if error is defined %}
    <div class="ui large error message center aligned">
        <i class="close icon"></i>
        <div  class="ui header center aligned">{{ error }}</div>
    </div>
{% endif %}
{% if filters.renderTable == 1 %}
<form class="ui form" method="post" action="csv.php?action=generateCsv">
    <button style="margin-bottom: 10px" class="ui primary button" type="submit">Generuj plik .csv</button>
    <div class="sixteen wide field">
        <label>Przyjęcia zewnętrzne</label>
        <select style="width: 100%;" data-placeholder="Wybierz przyjęcia zewnętrzne" name="pzs[]" id="pzs"
                multiple class="chosen">
            <option value="0"></option>
            {% for pz in pzs %}
                <option value="{{ pz.dok_Id }}" {% if pz.dok_Id in selectedPzs %}selected{% endif %}>{{ pz.dok_NrPelny }}</option>
            {% endfor %}
        </select>
    </div>
    <table class="ui celled table" id="dataTable" >
        <thead>
            <tr>
                <th>Numer zamówienia</th>
                <th>Klient</th>
                <th>Data dodania</th>
                <th style="text-align: center; padding-left: 20px;"><div class="ui checkbox">
                        <input type="checkbox" name="checkAll" id="checkAll" value="1">
                        <label></label>
                    </div></th>
            </tr>
        </thead>
        <tbody>
        {% for order in orders %}
            <tr>
                <td>{{ order.dok_NrPelny }}</td>
                <td>{{ order.kh_Symbol }}</td>
                <td>{{ order.kh_DataDodania | date('Y-m-d') }}</td>
                <td style="text-align: center;">
                    <div class="ui checkbox">
                        <input class="ordersCh" type="checkbox" name="orders[]" value="{{ order.dok_Id }}">
                        <label></label>
                    </div>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <input type="hidden" name="magazine" value="{{ filters.magazine }}"/>
    <input type="hidden" name="client" value="{{ filters.client }}"/>
    <input type="hidden" name="renderTable" value="{{ filters.renderTable }}"/>
    <button style="margin-top: 10px" class="ui primary button" type="submit">Generuj plik .csv</button>
</form>
{% endif %}
