<!DOCTYPE html>
<html lang="en">
<head>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
    <title>MIGRATE - @mybot</title>


</head>
<body>
    <nav class="navbar navbar-light bg-light">
        <a href='index.php' class="navbar-brand">@MYBOT</a>
    </nav>
	<div class="container" >

        <?php if(isset($_GET['gid'])){
            $GID = $_GET['gid'];
            $res = [];
            if($GID != ''){
                include 'database.php';
                $res = get_gid($GID);
            }
             ?>

        <form action="find_source.php"  method="get" >
            <div class="form-group">
                <label>GID only</label>
                <input type="text" name="gid" class="form-control" value="<?php echo $GID; ?>"  placeholder="GID">
            </div>
            <button type="submit" class="btn btn-primary">ค้นหา</button>
        </form>
        <br>



        <nav>
			<div class="nav nav-tabs" id="nav-tab" role="tablist">
				<a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">[DB เก่า]</a>
				<a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">[DB ใหม่]</a>
			</div>
		</nav>
		<div class="tab-content" id="nav-tabContent">
			<div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
				<br>
                <?php foreach($res['json'] as $key => $value){ ?>
				<div class="card mb-4 shadow-sm">
					<div class="card-header">
						<h4 class="my-0 font-weight-normal"><?php echo mb_substr(str_replace("?","",$value['groupline_name']), 0, 30, 'UTF-8');?></h4>
					</div>
					<div class="card-body">
						<h1 class="card-title pricing-card-title">ID : <?php echo $value['groupline_id']; ?></h1>
						<ul class="list-unstyled mt-3 mb-4">
                            <li>วันที่เช่า : <?php echo $value['groupline_buy_date']; ?></li>
                            <li>ถึงวันที่ : <?php echo $value['groupline_buy_end']; ?></li>
                            <li>รวมทั้งสิ้น : <?php echo $value['groupline_alldate']; ?> วัน</li>
                            <li>บอท : <?php echo $value['groupline_products']; ?></li>
                            <li>เวอชั่น : <?php echo $value['groupline_version']; ?></li>
                            <li> <?php echo $value['groupline_key']; ?> </li>
						</ul>
					</div>
                    <a href="filter.php?gid=<?php echo $value['groupline_key']; ?>" style="clear: both; float: left;" class="btn btn-dark btn-sm">Merge List</a>
				</div>
                <?php } ?>
			</div>
			<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">
				<br>
                <?php foreach($res['to'] as $key => $value){ ?>
				<div class="card mb-4 shadow-sm">
					<div class="card-header">
						<h4 class="my-0 font-weight-normal"><?php echo mb_substr(str_replace("?","",$value['groupline_name']), 0, 30, 'UTF-8');?></h4>
					</div>
					<div class="card-body">
						<h1 class="card-title pricing-card-title">ID : <?php echo $value['groupline_id']; ?></h1>
						<ul class="list-unstyled mt-3 mb-4">
                            <li>วันที่เช่า : <?php echo $value['groupline_buy_date']; ?></li>
                            <li>ถึงวันที่ : <?php echo $value['groupline_buy_end']; ?></li>
                            <li>รวมทั้งสิ้น : <?php echo $value['groupline_alldate']; ?> วัน</li>
                            <li>บอท : <?php echo $value['groupline_products']; ?></li>
                            <li>เวอชั่น : <?php echo $value['groupline_version']; ?></li>
                            <li> <?php echo $value['groupline_key']; ?> </li>
						</ul>
					</div>
                    <a href="UpdateTime.php?id=<?php echo $value['groupline_id']; ?>" style="clear: both; float: left;" class="btn btn-info btn-sm">Update Time</a>
				</div>
                <?php } ?>
			</div>
		</div>

        <?php }else{ ?>


            <form action="find_source.php"  method="get" >
            <div class="form-group">
                <label>GID only</label>
                <input type="text" name="gid" class="form-control"  placeholder="GID">
            </div>
            <button type="submit" class="btn btn-primary">ค้นหา</button>
        </form>
        <br>


        <?php } ?>
    </div>

</body>
</html>
