<div class="row">
    <div class="col-xs-12">
        <div class="box box-danger" style="height: 83vh; overflow-y: hidden; margin-bottom: 0px;">
            <div class="box-body" style="height: 100%" id="GrafikBoxBody">

                <!-- TAB NAVIGATION -->
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active">
                        <a href="#tab1" role="tab" data-toggle="tab" data-value="czas">Mój czas pracy</a>
                    </li>
                    <?php if ($uprawnienia['ModulRejestruCzasuPracyWspolpracownikow']['bCzyUruchamianie'] == 'true') : ?>
                        <li>
                            <a href="#tab2" role="tab" data-toggle="tab" id="wspolpracownicy"
                               data-value="wspolpracownicy">Współpracownicy</a>
                        </li>
                    <?php endif ?>
                    <?php if ($appconfig['ListaKartRcp'] == 'true') : ?>
                        <li>
                            <a href="#tab3" role="tab" data-toggle="tab" id="lista_kart_rcp"
                               data-value="lista_kart_rcp">Lista kart RCP</a>
                        </li>
                    <?php endif ?>
                </ul>


                <!-- TAB CONTENT -->
                <div class="tab-content">
                    <div class="active tab-pane fade in" id="tab1">
                        <div class="">
                            <div class="col-xs-12">
                                <div class="loader-overlapping loader-holder" id="table-loading"
                                     style="display: block;">
                                    <div class="loader"></div>
                                </div>
                                <div id="calendar" data-events-url="<?php echo $local_url; ?>calendar_feed_ajax"></div>
                                <div class="row">
                                    <div class="col-md-6" id="informacjaDodatkowa" style="margin-top: 20px;">
                                    </div>
                                    <div class="col-md-6">
                                        <div id="print_report"
                                             style="text-align: right; margin-top: 20px; display: none;">
                                            <a rel="tooltip" data-placement="left" data-run="operation" title="Drukuj"
                                               class="btn btn-info" href="ajax/oceny/drukuj_raport/MOJ_CZAS_PRACY"
                                               target="_blank">
                                                <i class="fa fa-print"></i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php if ($uprawnienia['ModulRejestruCzasuPracyWspolpracownikow']['bCzyUruchamianie'] == 'true') : ?>
                        <div class="tab-pane fade" id="tab2"
                             style="max-height: 70vh; overflow: auto; padding-bottom: 50px;">
                            <div class="">
                                <div class="col-xs-12">
                                    <div class="loader-overlapping custom-loader" id="table-loading"
                                         style="display: block;">
                                        <div class="loader"></div>
                                    </div>
                                    <div id="ModalContentEmployee" class="mt5" style="padding-bottom: 0;"></div>
                                    <div id="print_report_employee"
                                         style="text-align: right; margin-top: 20px; display: none;">
                                        <a rel="tooltip" data-placement="left" data-run="operation" title="Drukuj"
                                           class="btn btn-info" href="ajax/oceny/drukuj_raport/CZAS_PRACY_PODLEGLYCH"
                                           target="_blank">
                                            <i class="fa fa-print"></i>
                                        </a>
                                    </div>
                                </div>
                            </div>
                            <span class="pull-left" style="margin-top: 20px;"><sup style="font-size: 12px;">*</sup> Najedź na symbol, aby poznać jego znaczenie</span>
                        </div>
                    <?php endif ?>
                    <?php if ($appconfig['ListaKartRcp'] == 'true') : ?>
                        <div class="tab-pane fade" id="tab3"
                             style="max-height: 70vh; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 0px 10px;">
                            <div class="">
                                <div class="col-xs-12">
                                    <div class="loader-overlapping custom-loader" id="table-loading"
                                         style="display: block;">
                                        <div class="loader"></div>
                                    </div>
                                    <?php echo $this->element('karta_rcp_panel', array('nrewid' => $user_contexts['cPracownik']['cNumerEwidencyjny'])); ?>
                                    <div class="box-body table-responsive" id="ModalContentRcp"
                                         style="position: relative; width: 100%;">
                                        <div class="no-data">
                                            <p>Brak danych</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>

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

<script>
    $(function () {
        initiateFullCalendar();
        calendarInit();

        var getCalendar = (function () {
            $(document).find('.custom-loader').css('display', 'block');
            $.ajax({
                url: local_url + 'calendar_feed_ajax_employee/<?php echo isset($current_user['cNumerEwidencyjny']) ? $current_user['cNumerEwidencyjny'] : ''; ?>',
                method: 'POST',
                dataType: 'html'
            }).done(function (response) {
                $('#ModalContentEmployee').html(response);
                $(document).find('.custom-loader').css('display', 'none');
                $('#tab2').css('padding-bottom', '0px');
            });
        });


        $('#wspolpracownicy').on("click", function () {
            setTimeout(getCalendar, 0);
        });

        <?php if($appconfig['ListaKartRcp'] == 'true') : ?>

        var getRpcCard = (function () {
            $(document).find('.custom-loader').css('display', 'block');
            $.ajax({
                url: local_url + 'ajax/api/daj_karty_rcp/<?php echo isset($current_user['cNumerEwidencyjny']) ? $current_user['cNumerEwidencyjny'] : ''; ?>',
                method: 'POST',
                dataType: 'html'
            }).done(function (response) {
                $('#ModalContentRcp').html(response);
                $(document).find('.custom-loader').css('display', 'none');
                $('#tab3').css('padding-bottom', '0px');
            });
        });

        $('#lista_kart_rcp').on("click", function () {
            setTimeout(getRpcCard, 0);
        });
        <?php endif; ?>
    });
</script>

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