<!DOCTYPE html>
<html lang="en">
<?php 
    include('include/head.php');
    include("loginCheck.php");
    include('include/header.php');
    include('include/menu.php'); 
?>
<div id="main-content">
    <div class="container-fluid">
        <div class="block-header">
            <div class="row">
                <div class="col-lg-5 col-md-8 col-sm-12">                        
                    <h2>
                        <a href="javascript:void(0);" onclick="window.history.back();" class="btn btn-xs btn-link btn-toggle-fullwidth">
                            <i class="fa fa-arrow-left"></i>
                        </a>Referral Percent Update
                    </h2>
                    <ul class="breadcrumb">
                        <li class="breadcrumb-item"><a href="dashboard"><i class="icon-home"></i></a></li>
                        <li class="breadcrumb-item">Setting</li>
                        <li class="breadcrumb-item active">Referral Percent Update</li>
                    </ul>
                </div>            
            </div>
        </div>

        <div class="row clearfix">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="card">
                    <div class="header">
                        <h2>Referral Percent Update</h2>
                    </div>
                    <div class="body">
                        <div class="table-responsive">
                            <table class="table table-hover dataTable table-custom mb-0">
                                <thead>
                                    <tr>
                                        <th>#</th>                    
                                        <th>Referral Percent</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                        $queryConfig = mysqli_query($con, "SELECT * FROM meddolic_config_misc_setting");
                                        $valConfig = mysqli_fetch_assoc($queryConfig); 
                                    ?>
                                    <tr>
                                        <form action="referralSettingProcess.php" method="POST"> 
                                            <td>1</td>
                                            <td>
                                                <input type="text" name="directPercent" class="form-control" 
                                                       value="<?php echo htmlspecialchars($valConfig['directPercent']); ?>" required>
                                            </td> 
                                            <td class="text-center">
                                                <input type="submit" class="btn btn-success" name="updateBinary" value="Update">
                                            </td>
                                        </form>
                                    </tr>
                                </tbody>
                            </table>
                            <?php if (isset($_GET['status']) && $_GET['status'] == 'success') { ?>
                                <div class="alert alert-success mt-3">Referral percent updated successfully.</div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php include('include/footer.php'); ?>

<script>
var d = document.getElementById("Setting");
if (d) d.className += " active";
var d2 = document.getElementById("referralSetting");
if (d2) d2.className += " active";
</script>
</body>
</html>
