<?php require_once(THEME_ROOT . '/blocks/user_head.php'); ?>
<?php require_once(THEME_ROOT . '/blocks/user_top.php'); ?>

<?php
$transitions = (int)user_count_transits($login);
$login_refer_count = (int)login_refer_count($login);
?>

<div id="page-content-wrapper">
    <div class="row">
        <div class="col-lg-8 col-md-9 wow fadeIn" data-wow-delay="0.1s">
            <div class=" shadow border_20">
                <div class="table_head">
                    <?php echo T('Рефералы'); ?>
                </div>
                <div class="table-responsive">
                    <table class="table table_body">
                        <thead>
                        <tr>
                            <th><?php echo T('Логин'); ?></th>
                            <th><?php echo T('Дата'); ?></th>
                            <th><?php echo T('Пополнение') . ' (' . html($valu) . ')'; ?></th>
                            <th><?php echo T('Реферальные') . ' (' . html($valu) . ')'; ?></th>
                        </tr>
                        </thead>
                        <tbody>
                            <?php echo login_refer_list_table($login, 'text-align:center;'); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-lg-4 col-md-3 col-xs-12 col-sm-12 wow fadeIn" data-wow-delay="0.2s">
            <div class="shadow border_20" id="righter">
                <div class="avatar-head">
                    <div class="avatar">
                        <div class="empty_avatar" style="left: -2px">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24">
                                <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" fill="none" stroke="#000"
                                      stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
                                <circle cx="9" cy="7" r="4" fill="none" stroke="#000" stroke-linecap="round"
                                        stroke-linejoin="round" stroke-width="2"></circle>
                                <path d="M23 21v-2a4 4 0 0 0-3-3.87" fill="none" stroke="#000"
                                      stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
                                <path d="M16 3.13a4 4 0 0 1 0 7.75" fill="none" stroke="#000" stroke-linecap="round"
                                      stroke-linejoin="round" stroke-width="2"></path>
                            </svg>
                        </div>
                    </div>
                    <p class="under_avatar"><?php echo T('Ссылка для приглашения'); ?></p>
                </div>
                <div class="avatar-body">
                    <input type="text" value="<?php echo get_referal_link($login); ?>" readonly class="form-control"
                           style="margin-bottom: 10px" onclick="$(this).select();">
                    <div class="chart_visible visible-lg visible-md" id="Ref" style="height: 300px"></div>
                    <div class="history0 chart_visible" style="padding: 0px">
                        <div>
                            <table>
                                <tr>
                                    <td><span class="line_history" style="background: #0099de"></span></td>
                                    <td><p style="color: #0099de"><?php echo T('Переходов'); ?></p></td>
                                    <td align="right">
                                        <p style="color: #0099de"><?php echo (int)$transitions; ?></p>
                                    </td>
                                </tr>
                                <tr>
                                    <td><span class="line_history" style="background: #3ab44c"></span></td>
                                    <td><p style="color: #3ab44c"><?php echo T('Регистраций'); ?></p></td>
                                    <td align="right">
                                        <p style="color: #3ab44c"><?php echo (int)$login_refer_count; ?></p>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-8 col-md-9 col-xs-12 col-sm-12 wow fadeIn" data-wow-delay="0.3s">
            <div class="shadow border_20" style="margin-top: 20px; padding: 15px;">
                <?php echo get_banners_list(); ?>
            </div>
        </div>
    </div>
</div>
</div>


<script src="//cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
<script src="/theme/demo108/assets/common/Assets/js/sidebar_menu.js" type="text/javascript"></script>
<script src="/theme/demo108/assets/common/Assets/sound/ion.sound.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<script>

    ion.sound({
        sounds: [
            {
                name: "bip-2"
            },
            {
                name: "wuf-3"
            },
            {
                name: "wuf-1"
            },
            {
                name: "wuf-4"
            },
            {
                name: "bip-1"
            },
            {
                name: "welcome_ru"
            },
            {
                name: "withdrawal_ru"
            },
        ],
        path: "/theme/demo108/assets/common/Assets/sound/sounds/",
        preload: true,
        volume: 1.0,
        multiplay: true
    });

    Morris.Donut({
        element: 'Ref',
        data: [
            {
                label: '<?php echo (int)$transitions; ?>', value: <?php if ($transitions + $login_refer_count != 0) {
                echo (int)($transitions / ($transitions + $login_refer_count) * 100);
            } else {
                echo '0';
            } ?>},
            {
                label: '<?php echo (int)$login_refer_count; ?>',
                value: <?php if ($transitions + $login_refer_count != 0) {
                echo (int)($login_refer_count / ($transitions + $login_refer_count) * 100);
            } else {
                echo '0';
            } ?>}
        ],
        colors: [
            '#0099de',
            '#3ab44c'
        ],
        formatter: function (y) {
            return y + "%"
        }
    });


    $(document).ready(function () {
        $("#righter").css("position", "fixed");

    });


    $(".sidebar-nav li, .btn").on("mouseenter", function () {
        ion.sound.play("bip-2");
    });

    $(".sidebar-nav li, .btn").on("click", function () {
        ion.sound.play("bip-1");
    });

    $(".form-control").on("click", function () {
        ion.sound.play("wuf-1");
    });
    if ($(".wow").is(':visible')) {
        ion.sound.play("wuf-1");
    }
</script>
</body>
</html>
