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


<?php
$login_inv = format_currency(login_invest($login), $val);
$login_pay = format_currency(login_payment($login), $val);
$login_active_dep = format_currency(login_activ_depozit($login), $val);
$login_profit = format_currency(login_profit($login), $val);
$login_dep = format_currency(login_depozit($login), $val);
$login_ref = format_currency(login_refer($login), $val);
$login_dep_plus_profit = format_currency(login_profit($login) + login_refer($login), $val);
?>
<div id="page-content-wrapper">
    <div class="row">
        <div class="col-lg-8 col-md-9">
            <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('Сумма') . ' (' . html($valu) . ')'; ?></th>
                            <th><?php echo T('Дата'); ?></th>
                            <th><?php echo T('Система'); ?></th>
                            <th><?php echo T('Статус'); ?></th>
                            <th><?php echo T('Операция'); ?></th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                        $list = login_list_operations($login);
                        if ($list) {
                            foreach ($list as $item) { ?>
                                <tr style="text-align: center;">
                                    <td><?php echo format_currency($item['summa'], $val); ?></td>
                                    <td><?php echo format_date($item['date']); ?></td>
                                    <td><?php echo escape($item['system']); ?></td>
                                    <td><?php echo $item['status'] ? T('Успешно') : T('Ожидает'); ?></td>
                                    <td><?php echo T(escape($item['operation'])); ?></td>
                                </tr>
                            <?php }
                        } else { ?>
                            <tr>
                                <td colspan="5" align="center"><?php echo T('Записей не обнаружено'); ?></td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="history_blocks  wow fadeIn">

            </div>
        </div>
        <div class="col-lg-4 col-md-3 hidden-sm hidden-xs">
            <div class="history_chart shadow">
                <div class="chart_visible" id="history0" style="height: 300px"></div>

                <div class="history0 chart_visible">
                    <div>
                        <table>
                            <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 escape($login_inv) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td><span class="line_history" style="background: #ec594e"></span></td>
                                <td><p style="color: #ec594e"><?php echo T('Вывод средств'); ?></p></td>
                                <td align="right"><p
                                            style="color: #ec594e"><?php echo escape($login_pay) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td><span class="line_history" style="background: #2b19af"></span></td>
                                <td><p style="color: #2b19af"><?php echo T('Открытые депозиты'); ?></p></td>
                                <td align="right"><p
                                            style="color: #2b19af"><?php echo escape($login_active_dep) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <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 escape($login_profit) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td><span class="line_history" style="background: #009688"></span></td>
                                <td><p style="color: #009688"><?php echo T('Тело депозита'); ?></p></td>
                                <td align="right"><p
                                            style="color: #009688"><?php echo escape($login_dep) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td><span class="line_history" style="background: #FFCA28"></span></td>
                                <td><p style="color: #FFCA28"><?php echo T('Партнерское вознаграждение'); ?></p></td>
                                <td align="right"><p
                                            style="color: #FFCA28"><?php echo escape($login_ref) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <table>
                            <tr>
                                <td><span class="line_history" style="background: #E0E0E0"></span></td>
                                <td><p style="color: #E0E0E0"><?php echo T('Профит'); ?></p></td>
                                <td align="right"><p
                                            style="color: #E0E0E0"><?php echo escape($login_dep_plus_profit) . ' ' . html($valu); ?></p>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </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: 'history0',
        data: [
            {label: '+', value: <?php echo escape($login_inv); ?>},
            {label: '-', value: <?php echo escape($login_pay); ?>},
            {label: '-', value: <?php echo escape($login_active_dep); ?>},
            {label: '+', value: <?php echo escape($login_profit); ?>},
            {label: '+', value: <?php echo escape($login_dep); ?>},
            {label: '+', value: <?php echo escape($login_ref); ?>},
            {label: '+-', value: <?php echo escape($login_dep_plus_profit); ?>}
        ],
        colors: [
            '#3ab44c',
            '#ec594e',
            '#2b19af',
            '#0099de',
            '#009688',
            '#FFCA28',
            '#E0E0E0'
        ],
        formatter: function (y) {
            return y;
        }
    });


    $(".select_currency").on("click", function () {
        $(".select_currency").removeClass("active_currency");
        $(this).addClass("active_currency");
        val = $(this).data("val");
        Values(val);
        ion.sound.play("bip-1");
    });

    $(".history_blocks a").on("click", function () {

        if ($(this).hasClass("collapsed")) {
            ion.sound.play("wuf-4");
        } else {
            ion.sound.play("wuf-1");
        }
    });

    function Values(val) {

        if (val != '0') {
            $('.panel.show_history').removeClass('show_history');
            $('.panel[data-currency="' + val + '"]').addClass('show_history');
        } else {
            $('.panel').addClass('show_history');
        }

        $(".chart_visible").css("display", "none");
        $("#history" + val).css("display", "block");
        $(".history" + val).css("display", "block");

    }


    $(document).ready(function () {
        Values(0);
        $(".history_chart").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>
