<?php include("../Header/Session.php"); ?>
<?php include("../Header/Connection.php"); ?>

<!DOCTYPE html>
<html lang="en">
<?php include ("../Header/head.php"); ?>
<body class="skin-default fixed-layout">

<div id="main-wrapper">
<?php include ("../Header/header.php"); ?>
<?php include ("../Header/left_menu.php"); ?>
<?php include ("../Header/right_sidebar.php"); ?>

<div class="page-wrapper">
<div class="container-fluid">
<br><br>

<?php
if ($ref_code != "MGP10000")
{
    echo "<script type='text/javascript'>alert('You are not authorized');</script>";
    unset($_SESSION['sess_user']);
    session_destroy();
    echo "<script type='text/javascript'> document.location='https://mygoldsdnbhd.com/log-masuk/'; </script>";
    exit();
}
?>

<div class="row">
<div class="col-12">
<div class="card">
    <div class="card-body">
        <h4 class="card-title">Hibah Unilevel Settings</h4>

        <div class="table-responsive m-t-40">
            <table class="display nowrap table table-hover table-striped table-bordered" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th>Level 1 (%)</th>
                        <th>Level 2 (%)</th>
                        <th>Level 3 (%)</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $q = "SELECT *
                          FROM hibah_unilevel_setting
                          WHERE status = '1'
                          ORDER BY id ASC";
                    $result = $mysqli->query($q);

                    if ($result && $result->num_rows > 0)
                    {
                        while($row = $result->fetch_assoc())
                        {
                            $id = $row['id'];
                            $level_1 = $row['level_1'];
                            $level_2 = $row['level_2'];
                            $level_3 = $row['level_3'];
                            $status = $row['status'];
                            $created_date = $row['created_date'];
                    ?>
                    <tr>
                        <form method="post" action="../Controller/Database_sql.php" enctype="multipart/form-data" onsubmit="return confirm('Do you want to proceed?');">
                            <td><input type="number" class="form-control" name="level_1" value="<?php echo $level_1; ?>" required></td>
                            <td><input type="number" class="form-control" name="level_2" value="<?php echo $level_2; ?>" required></td>
                            <td><input type="number" class="form-control" name="level_3" value="<?php echo $level_3; ?>" required></td>
                            <td>
                                <input type="hidden" name="id" value="<?php echo $id; ?>">
                                <button name="Update_Hibah_Unilevel_Setting" class="btn btn-success">
                                    <i class="fa fa-check"></i> Update
                                </button>
                            </td>
                        </form>
                    </tr>
                    <?php
                        }
                    }
                    ?>
                </tbody>
            </table>
        </div>

    </div>
</div>
</div>
</div>

</div>
</div>

<?php include ("../Footer/footer.php"); ?>
</div>

<?php include ("../Header/all_jquery.php"); ?>
</body>
</html>