<div class="row">
    <div class="col-xs-12">
        <div class="box box-danger mb0">
            <div class="row">
                <div class="col-xs-12">
                    <div class="pull-right">
                        <a class="btn btn-danger btn-flat hidden-messages-toggle">
                            <span style="margin-right: 10px;">Tylko ten rok</span>
                            <label class="switch switch-current-year">
                                <input type="checkbox" name="CurrentYear" id="CurrentYear" <?php if(isset($_GET['tylko-ten-rok'])) echo 'checked="checked"'; ?> />
                            </label>
                        </a>
                    </div>
                </div>
            </div>
            <div class="box-body table-responsive table-fixed-height" style="max-height: 85vh!important;">
                <table id="UmowyTable" class="table hover-rows custom-table FullTable" data-start-sort="2" data-start-sort-direction="desc" data-start-height="50vh">
                    <thead>
                    <tr class="text-uppercase">
                        <th>Typ umowy</th>
                        <th>Forma umowy</th>
                        <th>od</th>
                        <th>do</th>
                        <th>Komórka</th>
                        <th>Stanowisko</th>
                        <th>Etat</th>
                        <th>Stawka</th>
                        <?php if($contracts['bCzyKolumnaInformacjaODodatkach'] == 'true'): ?>
                        <th>Dodatki</th>
                        <?php endif; ?>
                        <th>Kat Zaszeregowania</th>
                        <?php if($contracts['bCzyOpisyStanowskowe'] == 'true'): ?>
                            <th>Opis stanowiska</th>
                        <?php endif; ?>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($contracts['bUmowyOPrace']['bUmowaOPrace'] as $k => $contract): ?>
                        <tr
                            <?php if (!empty($contract['bInformacjeDodatkowe'])): ?>
                                style="cursor: pointer;"
                            <?php endif; ?>
                        >
                            <td <?php if (!empty($contract['bInformacjeDodatkowe'])): ?>
                                data-append-to="#more-info-container"
                                data-more-info="<?php echo $contract['bInformacjeDodatkowe']; ?>"
                            <?php endif; ?>
                                class="more-info-append info-addon"><?php echo $contract['bTypUmowyOpisKodu']; ?>
                            <?php if (!empty($contract['bInformacjeDodatkowe'])): ?>
                                <br><span style="text-transform: none; color: #0173c7; font-size: 12px; clear: both;">Dodatkowe informacje</span></td>
                            <?php endif; ?>
                            <td><?php echo $contract['bFormaUmowyOpisKodu']; ?></td>
                            <td><span class="span-date"><?php echo $contract['bDataOd']; ?></span></td>
                            <td><span class="span-date"><?php echo $contract['bDataDo']; ?></span></td>
                            <td><?php echo $contract['bKomorkaOpisKodu']; ?></td>
                            <td><?php echo $contract['bStanowiskoOpisKodu']; ?></td>
                            <td><?php echo $contract['bEtat']; ?></td>
                            <td><?php echo str_replace('.', ',', $contract['bStawka']); ?></td>
                            <?php if($contracts['bCzyKolumnaInformacjaODodatkach'] == 'true'): ?>
                            <td><?php echo htmlspecialchars_decode($contract['bInformacjaODodatkach']); ?></td>
                            <?php endif; ?>
                            <td><?= ($contract['bKategoriaZaszeregowanaUI'] ?: ''); ?></td>
                            <?php if($contracts['bCzyOpisyStanowskowe'] == 'true'): ?>
                                <td>
                                    <?php if ($contract['bPlik']): ?>
                                        <a style="text-transform: none; color: #0173c7;"
                                       href="<?php echo $local_url; ?>/umowa_otworz_zalacznik/<?php echo $contract['bStanowiskoKod']; ?>"
                                       target="_blank"><?php echo ucfirst(strtolower('Wyświetl')); ?></a>
                                    <?php endif; ?>
                                </td>
                            <?php endif; ?>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<div class="row more-info-container">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h2 class="box-title">Informacje dodatkowe</h2>
            </div>
            <div class="box-body" id="more-info-container">

            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.page-name:first-of-type').html('<?php echo $pageName; ?>');

        initiateDataTable();
    })
</script>

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