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

<div id="page-content-wrapper">
    <?php
    $is_invest = is_open("invest");
    if ($is_invest["error"]) {
        echo flash_show();
    } else {
        ?>
        <div class="avatar-body shadow border_20 withdrawal_block wow bounceIn">
            <div class="row">
                <div class="col-sm-12 col-xs-12 col-md-12 col-lg-3">
                    <p class="hidden-xs wow bounceIn" data-wow-delay="0.05s"><?php echo T('Сумма'); ?></p>
                    <div class="row">
                        <div class="col-md-12 wow bounceIn" data-wow-delay="0.4s">
                            <div class="wallet_block" data-value="1">
                                <input
                                        type="text"
                                        id="summa"
                                        placeholder="- <?php echo T("Введите сумму"); ?> -"
                                        class="inpts" value="">
                                <span><?php echo html($valu); ?></span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-sm-12 col-xs-12 col-md-12 col-lg-9">
                    <p class="hidden-xs wow bounceIn" data-wow-delay="0.1s"><?php echo T('Платежная система'); ?></p>

                    <div class="row">
                        <?php $delay = 0.20;
                        $list = get_payment_system('invest');
                        $count_list = count($list);
                        if ($count_list <= 3) {
                            $count_list = 4;
                        } elseif ($count_list == 4) {
                            $count_list = 3;
                        } else {
                            $count_list = 2;
                        }
                        foreach ($list as $item) { ?>
                            <div class="col-md-<?php echo (int)$count_list; ?> col-xs-6 wow bounceIn"
                                 data-wow-delay="0.<?php echo (float)$delay; ?>s" style="margin-bottom: 15px;">
                                <div class="wallet_block systems" data-value="<?php echo escape($item['value']); ?>">
                                    <svg width="60" height="60" role="img"> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#bm_icon_mini_logos_colored_<?php echo strtolower(escape($item['value'])); ?>"></use> </svg>
                                </div>
                            </div>
                            <?php $delay = $delay + 0.05;
                        } ?>
                    </div>
                </div>
            </div>

            <div class="col-sm-12 col-xs-12 col-md-12 col-lg-12">
                <p class="hidden-xs wow bounceIn" data-wow-delay="0.15s"><?php echo T('План'); ?></p>

                <div class="row">
                    <center>
                        <?php echo flash_show('invest'); ?>
                    </center>
                    <?php if ($settings_define_show_get_plans) { ?>
                        <div class="row robots_row">
                            <?php $i = 0;
                            $bots = ['bot-sad', 'bot-sliding', 'bot-happy', 'bot-surprised'];
                            foreach (get_plans() as $item) { ?>
                                <div class="col-md-6 plans" data-value="<?php echo (int)$item['id']; ?>">
                                    <div class="cab_block shadow robot_block text-center wow bounceIn"
                                         style="z-index: 0" data-wow-delay="0.<?php echo (int)$i + 1; ?>s">
                                        <div class="row">
                                            <div class="col-lg-4 col-md-12">
                                                <h2 class="robot_<?php echo (int)$i % 4 + 2; ?> wow bounceIn"
                                                    data-wow-delay="0.<?php echo (int)$i + 2; ?>5s"><?php echo T(escape($item['description'])); ?></h2>
                                                <div class="page <?php echo escape($bots[$i % 4]); ?>">

                                                    <?php require(THEME_ROOT . '/blocks/bot.php'); ?>

                                                </div>
                                            </div>
                                            <div class="col-lg-8 col-md-12 text-left">
                                                <table class="hide_on_small" style="margin-bottom: 20px;">
                                                    <td class="text-left wow bounceIn"
                                                        data-wow-delay="0.<?php echo (int)$i + 2; ?>7s">
                                                        <div style="margin-left:10px;" class="icons-list">
                                                            <img src="/theme/demo108/assets/common/Assets/images/percent.svg">
                                                        </div>
                                                        <div class="text">
                                                            <?php echo T('Прибыль:'); ?>
                                                            <h4>
                                                                <?php if ($item['count']) {
                                                                    echo escape($item['percent'] * $item['count'] - !$item['return'] * 100);
                                                                } else {
                                                                    echo escape($item['percent']);
                                                                } ?>% /
                                                                <?php if ($item['count']) {
                                                                    echo val_seconds($item['count'] * $item['seconds']);
                                                                } else {
                                                                    echo val_seconds($item['seconds']);
                                                                } ?>
                                                            </h4>
                                                        </div>
                                                    </td>
                                                    <td class="text-right wow bounceIn"
                                                        data-wow-delay="0.<?php echo (int)$i + 2; ?>9s">
                                                        <div class="text">
                                                            <?php echo T('Начисления:'); ?>
                                                            <h4>
                                                                <?php if ($item['count']) {
                                                                    echo T('раз в ') . val_seconds($item['seconds']);
                                                                } else {
                                                                    echo T('бессрочно');
                                                                } ?>
                                                            </h4>
                                                        </div>
                                                        <div style="margin-left:10px;" class="icons-list">
                                                            <img src="/theme/demo108/assets/common/Assets/images/clock-tariff.svg">
                                                        </div>
                                                    </td>
                                                </table>
                                                <div class="display_on_small">
                                                    <table>
                                                        <td class="text-center">
                                                            <div style="margin-left:10px;" class="icons-list">
                                                                <img src="/theme/demo108/assets/common/Assets/images/percent.svg">
                                                            </div>
                                                            <div class="text">
                                                                <h4>
                                                                    <?php echo T('Прибыль:'); ?>
                                                                    <?php if ($item['count']) {
                                                                        echo escape($item['percent'] * $item['count'] - !$item['return'] * 100);
                                                                    } else {
                                                                        echo escape($item['percent']);
                                                                    } ?>% /
                                                                    <?php if ($item['count']) {
                                                                        echo val_seconds($item['count'] * $item['seconds']);
                                                                    } else {
                                                                        echo val_seconds($item['seconds']);
                                                                    } ?>
                                                                </h4>
                                                            </div>
                                                        </td>
                                                    </table>
                                                    <table>
                                                        <td class="text-center">
                                                            <div style="margin-left:10px;" class="icons-list">
                                                                <img src="/theme/demo108/assets/common/Assets/images/clock-tariff.svg">
                                                            </div>
                                                            <div class="text">
                                                                <h4>
                                                                    <?php echo T('Начисления:'); ?>
                                                                    <?php if ($item['count']) {
                                                                        echo T('раз в ') . val_seconds($item['seconds']);
                                                                    } else {
                                                                        echo T('бессрочно');
                                                                    } ?>
                                                                </h4>
                                                            </div>
                                                        </td>
                                                    </table>
                                                </div>
                                                <div class="row">
                                                    <div class="col-xs-8">
                                                        <div data-target="#submit_window"
                                                             class="input_block wow bounceIn"
                                                             data-wow-delay="0.<?php echo (int)$i + 3; ?>s">
                                                            <p>
                                                                <?php echo T('Минимальная сумма:'); ?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                    <div class="col-xs-4">
                                                        <div data-target="#submit_window"
                                                             class="input_block wow bounceIn"
                                                             data-wow-delay="0.<?php echo (int)$i + 3; ?>s">
                                                            <p>
                                                                <?php echo format_currency($item['min'], $val) . ' ' . html($valu); ?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-xs-8">
                                                        <div data-target="#submit_window"
                                                             class="input_block wow bounceIn"
                                                             data-wow-delay="0.<?php echo (int)$i + 3; ?>s">
                                                            <p>
                                                                <?php echo T('Максимальная сумма:'); ?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                    <div class="col-xs-4">
                                                        <div data-target="#submit_window"
                                                             class="input_block wow bounceIn"
                                                             data-wow-delay="0.<?php echo (int)$i + 3; ?>s">
                                                            <p>
                                                                <?php echo format_currency($item['max'], $val) . ' ' . html($valu); ?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-xs-12">
                                                        <div data-target="#submit_window"
                                                             class="input_block wow bounceIn"
                                                             data-wow-delay="0.<?php echo (int)$i + 3; ?>s">
                                                            <p>
                                                                <?php if ($item['return']) {
                                                                    echo T('Возврат тела депозита в конце срока');
                                                                } else {
                                                                    echo T('Тело депозита включено в выплаты');
                                                                } ?>
                                                            </p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <?php $i++;
                            } ?>
                        </div>
                    <?php } ?>
                </div>
            </div>

            <form action="/pay/index.php" method="POST" class="text-center" style="margin-top: 10px;">
                <?php echo form_init(); ?>
                <?php if ($settings_define_show_get_plans) { ?>
                    <input type="hidden" name="plan" value="<?php echo escape(post('plan')); ?>">
                <?php } ?>
                <input type="hidden" name="system" value="<?php echo escape(post('system')); ?>">
                <input type="hidden" name="summa" value="<?php echo escape(post('summa')); ?>">
                <button type="submit" class="btn btn-success btn-lg wow fadeInUp" data-wow-delay="0.2s"
                        style="margin-top: 10px;">
                    <?php echo T('Пополнить'); ?>
                </button>
            </form>
        </div>
    <?php } ?>

</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
    });

    $(document).ready(function () {
        if ($('input[name="summa"]').val() != '') {
            $('#summa').val($('input[name="summa"]').val());
            $('#summa').parent('.wallet_block').addClass('shadow');
            $('#summa').parent('.wallet_block').css('opacity', '1');
        }

        if ($('input[name="system"]').val() != '') {
            $('.systems').css('opacity', '0.6');
            $('.systems').removeClass('shadow');
            $('.systems[data-value="' + $('input[name="system"]').val() + '"]').addClass('shadow');
            $('.systems[data-value="' + $('input[name="system"]').val() + '"]').css('opacity', '1');
        }

        if ($('input[name="plan"]').val() != '') {
            $('.plans .robot_block').css('opacity', '0.6');
            $('.plans[data-value="' + $('input[name="plan"]').val() + '"] .robot_block').css('opacity', '1');
        }
    });

    $('#summa').on('keyup', function () {
        $('input[name="summa"]').val($(this).val());
    });

    $('#summa').parent('.wallet_block').on('click', function () {
        $(this).addClass('shadow');
        $(this).css('opacity', '1');
    });

    $(".systems").on("click", function () {
        $(".systems").css("opacity", "0.6");
        $(".systems").removeClass("shadow");
        if ($('#summa').val() == '') {
            $('#summa').parent('.wallet_block').removeClass('shadow');
            $('#summa').parent('.wallet_block').css('opacity', '0.6');
        }
        $(this).addClass("shadow");
        $(this).css("opacity", "1");
        $('input[name="system"]').val($(this).data('value'));
        ion.sound.play("wuf-1");
    });

    $('.plans').on('click', function () {
        $('.plans .robot_block').css('opacity', '0.6');
        $(this).find('.robot_block').css('opacity', '1');
        $('input[name="plan"]').val($(this).data('value'));
        ion.sound.play("wuf-1");
    });

    $(".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>
