<?php 
    $matches = bongdako_fetch_and_merge_data(DB_DOMAIN.'/gf/data/bf_vn_nt_live.js');
    array_shift($matches);
    $url_api_rate = DB_DOMAIN.'/gf/data/bf_vn_nt_live.js';
    $leagues_rate = bongdako_fetch_and_merge_data_faked($url_api_rate);

    $odd_home = number_format(rand(1, 20) / 10, 2); // Giá trị "Chủ"
    $odd_draw = number_format(rand(1, 20) / 10, 2); // Giá trị "Hòa"
    $odd_away = number_format(rand(1, 20) / 10, 2); // Giá trị "Khách"
    $odd_over = number_format(rand(1, 20) / 10, 2); // Giá trị "Trên"
    $odd_equal = number_format(rand(1, 20) / 10, 2); // Giá trị "Tỷ lệ"
    $odd_under = number_format(rand(1, 20) / 10, 2); // Giá trị "Dưới"

    $class_home = getRandomColorClass();
    $class_draw = getRandomColorClass();
    $class_away = getRandomColorClass();
    $class_over = getRandomColorClass();
    $class_equal = getRandomColorClass();
    $class_under = getRandomColorClass();

    fake_iframe_rate_admin();
?>
<?php require_once plugin_dir_path(__FILE__) . '/styles.php'; ?>
<div id="soccer">
    <div id="homepage" class="mcontent">
        <div id="main" class="main-home-page-mobile">
            <div id="appHome" class="w-100 mx-auto">                 
                <!--Render PHP-->
                <div id="fake_iframeRate" class="game-rate index idx-homepage css-home-page home-page-mobile removeDiv">
                    <?php $item = array_values($leagues_rate)[0]['matches'][0]; ?>
                    <div id="min">
                        <div class="d-none d-lg-block w-100">
                            <div class="game-rate-core-container">
                                <div class="team-left">
                                    <div class="name-team-left">
                                        <p class="team-home-name"><?php echo $item['teams']['home']; ?></p>
                                        <img src="<?= IMGS3_PLUGINS ?>/assets/images/home_1.svg" alt="<?php echo $item['teams']['home'];?>" style="width: 20px; height: 20px; object-fit: cover;" data-pin-no-hover="true">
                                    </div>
                                </div>
                                <div class="game-rate-ratio">
                                    <span class="home-score ratio-value"><?php echo $item['score']['home'];?></span>
                                    <span>:</span>
                                    <span class="away-score ratio-value"><?php echo $item['score']['away'];?></span>
                                </div>
                                <div class="team-right">
                                    <div class="name-team-right">
                                        <img src="<?= IMGS3_PLUGINS ?>/assets/images/away_1.svg" alt="<?php echo $item['teams']['away']; ?>" style="width: 20px; height: 20px; object-fit: cover;" data-pin-no-hover="true">
                                        <p class="team-away-name"><?php echo $item['teams']['away']; ?></p>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div id="game-rate" class="row d-flex j-sb al-fs video-content">
                            <div class="live-frame">
                                <div class="match bh-299d5">
                                    <div class="match-content">
                                        <iframe id="live-frame" src="" class="match-content-iframe" frameborder="0"></iframe>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="d-block d-lg-none w-100">
                                <div class="game-rate-core-container">
                                    <div class="team-left">
                                        <div class="name-team-left">
                                            <p class="team-home-name"><?php echo $item['teams']['home']; ?></p>
                                            <img src="<?= IMGS3_PLUGINS ?>/assets/images/home_1.svg" alt="<?php echo $item['teams']['home']; ?>" data-pin-no-hover="true" style="width: 20px; height: 20px; object-fit: cover;">
                                        </div>
                                    </div>
                                    <div class="game-rate-ratio">
                                        <span class="home-score ratio-value"><?php echo $item['score']['home'];?></span>
                                        <span>:</span>
                                        <span class="away-score ratio-value"><?php echo $item['score']['away'];?></span>
                                    </div>
                                    <div class="team-right">
                                        <div class="name-team-right">
                                            <img src="<?= IMGS3_PLUGINS ?>/assets/images/away_1.svg" alt="<?php echo $item['teams']['away']; ?>" data-pin-no-hover="true" style="width: 20px; height: 20px; object-fit: cover;">
                                            <p class="team-away-name"><?php echo $item['teams']['away']; ?></p>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div id="tableCore">
                                <div class="core-container">
                                    <div class="d-flex ai-c j-sb">
                                        <div class="odds-title d-flex gap-2 align-items-center">
                                            <span class="text-uppercase">tài xỉu</span>
                                            <a href="javascript:;" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="ข้อมูลจะได้อัพเดทในเวอร์ชั่นถัดไป ของคุณครับ">
                                                <img src="<?= IMGS3 ?>/assets/football-vn/images/game-rate/info.svg?v=1727680733" alt="info-svg" data-pin-no-hover="true">
                                            </a>
                                        </div>
                                        <div class="custom-select-02 core-custom-select">
                                            <div class="custom-select">Sbobet</div>
                                            <div class="custom-options">
                                                <div class="custom-option">K - Sport</div>
                                                <div class="custom-option">Sbobet</div>
                                                <div class="custom-option">Bet365</div>
                                                <div class="custom-option">188bet</div>
                                                <div class="custom-option">12bet</div>
                                                <div class="custom-option">Crown</div>
                                                <div class="custom-option">18Bet</div>
                                                <div class="custom-option">Macauslot</div>
                                                <div class="custom-option">Ladbrokes</div>
                                                <div class="custom-option">Easybet</div>
                                            </div>
                                        </div>
                                    </div>
                                    <table class="table-score-container">
                                        <tbody>
                                            <tr>
                                                <td width="100%" class="text-left">
                                                    <span class="odds-name">Sớm</span>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_home; ?>"><?php echo $odd_home; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_draw; ?>"><?php echo $odd_draw; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_away; ?>"><?php echo $odd_away; ?></div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100%" class="text-left">
                                                    <span class="odds-name">Live</span>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_over; ?>"><?php echo $odd_over; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_equal; ?>"><?php echo $odd_equal; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_under; ?>"><?php echo $odd_under; ?></div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="core-container">
                                    <div class="d-flex ai-c j-sb">
                                        <div class="odds-title d-flex gap-2 align-items-center">
                                            <span class="text-uppercase">HDP</span>
                                            <a href="javascript:;" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="ข้อมูลจะได้อัพเดทในเวอร์ชั่นถัดไป ของคุณครับ">
                                                <img src="<?= IMGS3 ?>/assets/football-vn/images/game-rate/info.svg?v=1727680733" alt="info-svg" data-pin-no-hover="true">
                                            </a>
                                        </div>
                                        <div class="custom-select-02 core-custom-select">
                                            <div class="custom-select">Sbobet</div>
                                            <div class="custom-options">
                                                <div class="custom-option">K - Sport</div>
                                                <div class="custom-option">Sbobet</div>
                                                <div class="custom-option">Bet365</div>
                                                <div class="custom-option">188bet</div>
                                                <div class="custom-option">12bet</div>
                                                <div class="custom-option">Crown</div>
                                                <div class="custom-option">18Bet</div>
                                                <div class="custom-option">Macauslot</div>
                                                <div class="custom-option">Ladbrokes</div>
                                                <div class="custom-option">Easybet</div>
                                            </div>
                                        </div>
                                    </div>
                                    <table class="table-score-container">
                                        <tbody>
                                            <tr>
                                                <td width="100%" class="text-left">
                                                    <span class="odds-name">Sớm</span>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_home; ?>"><?php echo $odd_home; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_draw; ?>"><?php echo $odd_draw; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_away; ?>"><?php echo $odd_away; ?></div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100%" class="text-left">
                                                    <span class="odds-name">Live</span>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_over; ?>"><?php echo $odd_over; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_equal; ?>"><?php echo $odd_equal; ?></div>
                                                </td>
                                                <td>
                                                    <div class="odds-number <?php echo $class_under; ?>"><?php echo $odd_under; ?></div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div id="tableCoreSP" class="core-container container-sp core-container-mobile live-table-w">
                                    <div class="d-flex ai-c j-sb">
                                        <div class="odds-title d-flex gap-2 align-items-center">
                                            <img src="<?php echo DB_DOMAIN.$item['flag']; ?>" alt="<?php echo $item['teams']['home']; ?>" class="cImg lazy flag-img" id="leagueFlagSp" style="width: 15px; height: 15px; object-fit: cover; border-radius: 50%;"> 
                                            <span><?php echo $item['league']; ?></span>
                                        </div>
                                        <select class="over-select form-select ws-select ws-select-underlin d-none"> - </select>
                                        <div class="custom-select-02 core-custom-select">
                                            <div class="custom-select">Sbobet</div>
                                            <div class="custom-options">
                                                <div class="custom-option">K - Sport</div>
                                                <div class="custom-option">Sbobet</div>
                                                <div class="custom-option">Bet365</div>
                                                <div class="custom-option">188bet</div>
                                                <div class="custom-option">12bet</div>
                                                <div class="custom-option">Crown</div>
                                                <div class="custom-option">18Bet</div>
                                                <div class="custom-option">Macauslot</div>
                                                <div class="custom-option">Ladbrokes</div>
                                                <div class="custom-option">Easybet</div>
                                            </div>
                                        </div>
                                    </div>
                                    <table class="table-score-container">
                                        <tbody>
                                            <tr class="tm-detail-rp">
                                                <td class="status handpoint status-time-match td_status" id="time_<?php echo $item['matchId'];?>" width="50">
                                                    <span id="got_<?php echo $item['matchId'];?>"> 73</span>
                                                </td>
                                                <td class="tm-detail-rp-left" id="ht_<?php echo $item['matchId'];?>">
                                                    <span class="hdpstar" style="display: inline;"></span>
                                                    <div class="team-box tleft">
                                                        <a href=""><?php echo $item['teams']['home']; ?></a>
                                                        <img src="<?= IMGS3_PLUGINS ?>/assets/images/home_1.svg" alt="<?php echo $item['teams']['home']; ?>">
                                                        <p class="team-more-info">
                                                            <span id="horder_34302" class="hidden-element team-hg"></span>
                                                            <span id="yellow1_34302">
                                                                <span class="yellowcard" style="display: none;"><?php echo $item['yellow_card']['home']; ?></span>
                                                            </span>
                                                        </p>
                                                    </div>
                                                </td>
                                                <td class="tm-detail-rp-center blue handpoint score-color">
                                                    <b class="scored-s match-not-finished"><?php echo $item['score']['home'];?>-<?php echo $item['score']['away'];?></b>
                                                </td>
                                                <td class="tm-detail-rp-right" id="gt_<?php echo $item['matchId'];?>">
                                                    <div class="team-box">
                                                        <img src="<?= IMGS3_PLUGINS ?>/assets/images/away_1.svg" alt="<?php echo $item['teams']['away']; ?>">
                                                        <a href=""><?php echo $item['teams']['away']; ?></a>
                                                        <p class="team-more-info">
                                                            <span id="yellow2_61853">
                                                                <span class="yellowcard" style="display: none;"><?php echo $item['yellow_card']['away']; ?></span>
                                                            </span>
                                                            <span id="horder_61853" class="hidden-element team-hg"></span>
                                                        </p>
                                                    </div>
                                                </td>
                                                <td class="table-core-odds-value table-core-odds-value-6">
                                                    <p data-before-content="Chủ" class="<?php echo $class_home; ?> odds-animated odds-number"><?php echo $odd_home; ?></p>
                                                </td>
                                                <td class="table-core-odds-value table-core-odds-value-7">
                                                    <p data-before-content="Hòa" class="<?php echo $class_draw; ?> odds-animated odds-number"><?php echo $odd_draw; ?></p>
                                                </td>
                                                <td class="table-core-odds-value table-core-odds-value-8">
                                                    <p data-before-content="Khách" class="<?php echo $class_away; ?> odds-animated odds-number"><?php echo $odd_away; ?></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="live-channel live-channel-mobile">
                                    <div id="btn-first-live" class="btn-live-chanel btn-first-live-mobile">Xem chi tiết 
                                        <div class="btn-live-chanel-icon"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="live-mobile-title">
                            <span class="upper-live-icon-football"></span>
                            <span>Tất cả trận đang live</span>
                        </div>

                        <div id="mintable">
                            <div id="live">
                                <table id="table_live" class="table-time table-game-rate" width="100%" align="center" cellspacing="0" border="0" cellpadding="0">
                                    <tbody>
                                        <?php echo renderLiveTableHeaderLiveRate();?>
                                        <?php echo renderHeaderLiveTableTitleRate();?>   
                                        <?php fetchdataRate($field['number_match']); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <?php ;?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php require_once plugin_dir_path(__FILE__) . '/functions.php'; ?>