<!DOCTYPE html>
<?php
    $website = website_header();
?>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <title><?php echo e($website->title); ?></title>
    <link rel="icon" type="image/x-icon" href="<?php echo e(asset('assets/img/' . $website->logo)); ?>">

    <!-- LINK -->
    <link rel="stylesheet" href="<?php echo e(asset('assets/css/styles.css')); ?>" />
    <link rel="stylesheet" href="<?php echo e(asset('assets/css/custom.css')); ?>" />
    <!-- LINK -->
</head>

<body>

    <div class="trend_container">
        <div class="layout-content">
            <div class="inner-content">
                <div class="header van-hairline--bottom" style="z-index: 1">
                    <div class="header__left"></div>
                    <div class="header__title ellipsis"><?php echo e($typeText); ?> Record</div>
                    <div class="header__right"></div>
                </div>
                <div>
                    <div class="single_section">
                        <div class="reservation">
                            <div class="reservation-sub">
                                <div class="reservation-sub-title">Period</div>
                                <div class="reservation-sub-num" id="current_period">
                                    <?php if(isset($last_two_games[0])): ?>
                                        <?php echo e($last_two_games[0]->game_id); ?>

                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="reservation-sub" style="text-align: right">
                                <div class="reservation-sub-title">Count Down</div>
                                <div class="reservation-sub-num">
                                    <!---->

                                    <div class="time">
                                        <div id="clockdiv" class="counter d-flex align-items-center gap-2">
                                            <div>
                                                <div class="count f18 py-1 fw-dark fw-bolder minutes d-flex gap-1">
                                                    <div class="bg1 rounded-2 fw500 px-1 ini f24" id="minutes_html">-
                                                    </div>
                                                </div>
                                            </div>
                                            <div>:</div>
                                            <div>
                                                <div class="count f18 py-1 fw-dark fw-bolder seconds d-flex gap-1">
                                                    <div class="bg1 rounded-2 fw500 px-1 ini f24" id="seconds_html">-
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="single_section">
                        <div class="reservation">
                            <div class="reservation-sub">
                                <div class="reservation-sub-title">PrePeriod</div>
                                <div class="reservation-sub-num" id="pre_period">
                                    <?php if(isset($last_two_games[1])): ?>
                                        <?php echo e($last_two_games[1]->game_id); ?>

                                    <?php else: ?>
                                        -
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="reservation-sub" style="text-align: center">
                                <div class="reservation-sub-title">Result</div>
                                <div class="reservation-sub-num" id="last_result">
                                    <?php if(isset($last_two_games[1])): ?>
                                        <div class="<?php echo e($last_two_games[1]->class); ?>" style="margin: 5px 0px 0px 35px">
                                            <?php echo e($last_two_games[1]->code); ?>

                                        </div>
                                    <?php else: ?>
                                        -
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="reservation-sub" style="text-align: right">
                                <div class="reservation-sub-title">OpenPrice</div>
                                <div class="reservation-sub-num">
                                    <div style="color: rgb(232, 57, 241)">
                                        <?php if(isset($last_two_games[1])): ?>
                                            <?php echo e($last_two_games[1]->open_price); ?>

                                        <?php else: ?>
                                            -
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="single_section">
                        <div class="title">
                            <div class="red" id="total_red">Red:<?php echo e($total_red_count); ?></div>
                            <div class="green" id="total_green">Green:<?php echo e($total_green_count); ?></div>
                            <div class="violet" id="total_violet">Violet:<?php echo e($total_violet_count); ?></div>
                        </div>
                        <div class="switchBox">
                            <button onclick="openCity2(event, 'ShowPeriod')"
                                class="trend-btn trend-btn--small trend-btn--default">
                                <span class="trend-btn__text">ShowPeriod</span>
                            </button>
                            <button onclick="openCity2(event, 'ShowOpenNum')"
                                class="trend-btn trend-btn--small trend-btn--primary">
                                <span class="trend-btn__text">ShowOpenNum</span>
                            </button>
                        </div>

                        <div class="box">
                            <div class="grid" id="all_trends">
                                <?php $__currentLoopData = $columnToRow; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $singleData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="row">
                                        <div class="index"><?php echo e(++$index); ?></div>
                                        <?php $__currentLoopData = $singleData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if(!$item): ?>
                                                <div class="cell border">
                                                    <div class="item-null"></div>
                                                </div>
                                            <?php else: ?>
                                                <div class="cell border">
                                                    <div class="<?php echo e($item['class']); ?> game_code"
                                                        style="display: flex; justify-content: center;">
                                                        <?php echo e($item['code']); ?></div>
                                                    <div class="<?php echo e($item['class']); ?> game_period"
                                                        style="display: none;"><?php echo e(getLastThree($item['game_id'])); ?>

                                                    </div>
                                                </div>
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </div>
                        </div>








                    </div>
                    <div class="single_section">
                        <div class="top-selete pointer">
                            <div onclick="openTrendBox(this.id, 'box3')" id="box3_button" class="top-selete-sub active">
                                Rd.3
                            </div>
                            <div onclick="openTrendBox(this.id, 'box4')" id="box4_button" class="top-selete-sub">
                                Rd.4
                            </div>
                            <div onclick="openTrendBox(this.id, 'box5')" id="box5_button" class="top-selete-sub">
                                Rd.5
                            </div>
                            <div onclick="openTrendBox(this.id, 'box6')" id="box6_button" class="top-selete-sub">
                                Rd.6
                            </div>
                            <div onclick="openTrendBox(this.id, 'box7')" id="box7_button" class="top-selete-sub">
                                Rd.7
                            </div>
                            <div onclick="openTrendBox(this.id, 'box8')" id="box8_button" class="top-selete-sub">
                                Rd.8
                            </div>
                        </div>
                        <div id="trend_box_container">
                            <?php for($i = 3; $i <= 8; $i++): ?> <?php
                                if ($i == 3) {
                                    $display = 'block';
                                } else {
                                    $display = 'none';
                                }
                            ?> <div
                                    class="box" id="box<?php echo e($i); ?>"
                                    style="display: <?php echo e($display); ?>">
                                    <div class="grid">
                                        <?php $__currentLoopData = columnData($i, $plainArray); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $newArrayKey => $mainData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="row">
                                                <div class="index"><?php echo e(++$newArrayKey); ?></div>
                                                <?php $__currentLoopData = $mainData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mainDataKey => $mainDataValue): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <div class="cell border">
                                                        <div class="<?php echo e($mainDataValue['class']); ?> game_code">
                                                            <?php echo e($mainDataValue['code']); ?>

                                                        </div>
                                                        <div class="<?php echo e($mainDataValue['class']); ?> game_period"
                                                            style="display: none;">
                                                            <?php echo e(getLastThree($mainDataValue['game_id'])); ?>

                                                        </div>
                                                    </div>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                </div>
                            <?php endfor; ?>
                        </div>
                    </div>
                    <div class="single_section">
                        <div class="box">
                            <div class="van-cell-group van-hairline--top-bottom">
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '0,2,4,6,8', 'join');
                                            ?>
                                            <span id="van_cell1" class="van-progress__portion"
                                                style="text-align:center;background: rgb(245, 40, 39); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell1_count"
                                                    style=" background: rgb(245, 40, 39)">Red:<?php echo e($total_red_count); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '1,3,5,7,9', 'join');
                                            ?>
                                            <span id="van_cell2" class="van-progress__portion"
                                                style="text-align:center;background: rgb(21, 114, 57); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell2_count" class="van-progress__pivot"
                                                    style=" background: rgb(21, 114, 57)">Green:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '0,5', 'join');
                                            ?>
                                            <span id="van_cell3" class="van-progress__portion"
                                                style="text-align:center; background: rgb(232, 57, 241); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell3_count" class="van-progress__pivot"
                                                    style="
                              background: rgb(232, 57, 241);
                            ">Violet:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '0', 'individual');
                                            ?>
                                            <span id="van_cell4" class="van-progress__portion"
                                                style="text-align:center; background: rgb(0, 122, 204); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell4_count"
                                                    style="background: rgb(0, 122, 204)">0:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '1', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell5"
                                                style="text-align:center; background: rgb(0, 122, 204); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell5_count" class="van-progress__pivot"
                                                    style="background: rgb(0, 122, 204)">1:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '2', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell6"
                                                style="text-align:center; background: rgb(0, 122, 204); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell6_count"
                                                    style="background: rgb(0, 122, 204)">2:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '3', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell7"
                                                style="text-align:center; background: rgb(0, 122, 204); width: <?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell7_count" class="van-progress__pivot"
                                                    style="background: rgb(0, 122, 204)">3:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '4', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell8"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell8_count"
                                                    style="background: rgb(0, 122, 204)">4:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '5', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell9"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell9_count"
                                                    style="background: rgb(0, 122, 204)">5:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '6', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell10"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell10_count" class="van-progress__pivot"
                                                    style="background: rgb(0, 122, 204)">6:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '7', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell11"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell11_count"
                                                    style="background: rgb(0, 122, 204)">7:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '8', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell12"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    class="van-progress__pivot" id="van_cell12_count"
                                                    style="background: rgb(0, 122, 204)">8:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="van-cell">
                                    <div class="van-cell__value van-cell__value--alone">
                                        <div class="van-progress">
                                            <?php
                                                $bar_data = getTrendProgressWidth($all_games, '9', 'individual');
                                            ?>
                                            <span class="van-progress__portion" id="van_cell3"
                                                style="text-align:center; background: rgb(0, 122, 204); width:<?php echo e($bar_data['percent']); ?>%"><span
                                                    id="van_cell13_count" class="van-progress__pivot"
                                                    style="background: rgb(0, 122, 204)">9:<?php echo e($bar_data['count']); ?></span></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.3.min.js"
        integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>

    <script src="<?php echo e(asset('assets/js/custom.js')); ?>"></script>

    <script>
        let type = '<?php echo e($type); ?>';
        let reference = parseInt("<?php echo e($last_game_time); ?>");
        let update = true;
        let date_now = parseInt("<?php echo e($date_now); ?>");

        var myfunc = setInterval(function() {
            date_now = date_now + 1;
            let total_seconds = reference - date_now;
            if (total_seconds > 300) {
                $('#minutes_html').html("05");
                let seconds = total_seconds % 60;
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds > 240) {
                $('#minutes_html').html("04");
                let seconds = total_seconds % 60;
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds > 180) {
                $('#minutes_html').html("03");
                let seconds = total_seconds % 60;
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds > 120) {
                $('#minutes_html').html("02");
                let seconds = total_seconds % 60;
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds > 60) {
                $('#minutes_html').html("01");
                let seconds = total_seconds % 60;
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds > 0) {
                update = true;
                let seconds = total_seconds % 60;
                $('#minutes_html').html("00");
                if (seconds < 10) {
                    $('#seconds_html').html("0" + seconds);
                } else {
                    $('#seconds_html').html(seconds);
                }
            } else if (total_seconds < -2) {
                $('#minutes_html').html("00");
                $('#seconds_html').html("00");
                if (update) {
                    fetchTrendRecords(type);
                }
            } else if (total_seconds <= 0) {
                $('#minutes_html').html("00");
                $('#seconds_html').html("00");
            }
        }, 1000);

        let mode = 'ShowOpenNum';

        function openCity(evt, cityName) {
            var i, tablinks;
            tablinks = document.getElementsByClassName("top-selete-sub");
            for (i = 0; i < tablinks.length; i++) {
                tablinks[i].className = tablinks[i].className.replace(" active", "");
            }
            evt.currentTarget.className += " active";
        }

        function openCity2(evt, cityName) {
            mode = cityName;
            console.log(cityName);
            var i, tablinks;
            tablinks = document.getElementsByClassName("trend-btn--small");
            for (i = 0; i < tablinks.length; i++) {
                tablinks[i].className = tablinks[i].className.replace(
                    " trend-btn--primary",
                    " trend-btn--default"
                );
            }
            if (cityName == "ShowPeriod") {
                $('.game_code').css("display", "none");
                $('.game_period').css("display", "block");
            }
            if (cityName == "ShowOpenNum") {
                $('.game_code').css("display", "block");
                $('.game_period').css("display", "none");
            }
            evt.currentTarget.className += " trend-btn--primary";
        }
    </script>
</body>

</html>
<?php /**PATH /home/shyambabamatka/public_html/zupitogames.com/resources/views/userDashboard/trend.blade.php ENDPATH**/ ?>