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

<div class="row">
    <div class="col-xs-12">
        <div class="loader-overlapping loader-holder" id="table-loading" style="min-height: 140px;">
            <div class="loader"></div>
        </div>
        <div data-container="table">

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

<script>
    $(function () {
        $('.zfs-tiles .btn-tile').click(function () {
            if (counter > 0) $('#table-loading').css('min-height', '0');
            counter++;

            $('.zfs-tiles .btn-tile').attr('data-active', 0);
            $('#table-loading').css('visibility', 'visible');
            $('#table-loading').css('opacity', '1');
            $('#table-loading').css('display', 'block');

            $(this).attr('data-active', 1);

            var url = $(this).data('action');
            localStorage.setItem('zfs_url', url);

            $.ajax({
                method: 'GET',
                url: local_url + url
            }).done(function (response) {
                if (trim(response) == 'login') window.location = local_url + 'login';

                $('#table-loading').css('visibility', 'hidden');
                $('#table-loading').css('opacity', '0');
                $('#table-loading').css('display', 'none');
                $('[data-container="table"]').html(response);
            });
        });

        if (localStorage.getItem('zfs_url') !== null) {
            var url = localStorage.getItem('zfs_url');
            $('.zfs-tiles .btn-tile[data-action="' + url + '"]').trigger('click');
        } else {
            $('.zfs-tiles .btn-tile:first-of-type').trigger('click');
        }

    });
</script>

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

<style>
    #table-loading {
        opacity: 1;
        display: block;
        visibility: visible;
        width: calc(100% - 30px);
        left: 15px;
    }

    .hidden-messages-toggle {
        position: relative;
    }

    label.switch-current-year {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        text-align: right;
    }

    label.switch-current-year input {
        margin: 10px 5px 0 0;
    }
</style>

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