<table id="DokumentyTable" class="table hover-rows custom-table HalfTable" data-start-sort="1"
       data-start-sort-direction="desc" data-start-height="25vh">
    <thead>
    <tr class="text-uppercase">
        <th>Nazwa dokumentu</th>
        <th>Data publikacji</th>
        <th>Kategoria dokumentu</th>
        <th class="no-sortable"></th>
    </tr>
    </thead>
    <tbody>
    <?php if (!empty($documents['bDokumenty']['bDokument'])): ?>
        <?php foreach ($documents['bDokumenty']['bDokument'] as $k => $document): ?>
            <tr
                <?php if (!empty($document['bInformacjeDodatkowe'])): ?>
                    class="more-info-append" data-append-to="#more-info-container"
                    data-more-info="<?php echo $document['bInformacjeDodatkowe']; ?>"
                <?php endif; ?>
            >
                <td class="info-addon"><?php echo $document['bNazwa']; ?></td>
                <td><span class="span-date"><?php echo $document['bDataPublikacji']; ?></span></td>
                <td><?php echo($document['bKategoriaKodOpis'] ?: 'INNE'); ?></td>
                <td class="text-right">
                    <div class="btn-group mr5">
                        <a data-open-tab="true"
                           data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>"
                           class="btn btn-primary">
                            <i class="fa fa-eye"></i>
                        </a>
                        <a data-open-tab="true"
                           data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>/download"
                           class="btn btn-warning">
                            <i class="fa fa-download"></i>
                            <span><?php echo strtoupper($document['bRozszerzenie']); ?></span>
                        </a>
                    </div>
                    <div class="btn-group">
                        <?php if ($document['bCzyTrescUPO'] == 'true') : ?>
                            <a data-open-tab="true"
                               data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>?format=upo"
                               class="btn btn-primary">
                                <i class="fa fa-eye"></i>
                            </a>
                            <a data-open-tab="true"
                               data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>/download?format=upo"
                               class="btn btn-warning">
                                <i class="fa fa-download"></i> <span>UPO</span>
                            </a>
                        <?php endif; ?>

                        <?php if ($document['bCzyTrescXADES'] == 'true') : ?>
                            <a data-open-tab="true"
                               data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>/download?format=xades"
                               class="btn btn-warning">
                                <i class="fa fa-download"></i> <span>XADES</span>
                            </a>
                        <?php endif; ?>

                        <?php if ($document['bCzyTrescXML'] == 'true') : ?>
                            <a data-open-tab="true"
                               data-href="<?php echo $local_url; ?>dokument/<?php echo $document['bGid']; ?>/download?format=xml"
                               class="btn btn-warning">
                                <i class="fa fa-download"></i> <span>XML</span>
                            </a>
                        <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>
    </tbody>
</table>

<?php echo $this->element('alert_close'); ?>

<script>
    $(function () {
        initiateDataTable(2);
    });
</script>
