<?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">

<!-- Main wrapper - style you can find in pages.scss -->
<div id="main-wrapper">    
<?php include ("../Header/header.php"); ?>
<?php include ("../Header/left_menu.php"); ?>
<?php include ("../Header/right_sidebar.php"); ?>
        
<!-- Page wrapper  -->
<div class="page-wrapper">
<!-- Container fluid  -->
<div class="container-fluid">
<!-- Bread crumb and right sidebar toggle -->
<!--?php include ("../Header/breadcumb.php"); ?-->
<br><br>
<!-- End Bread crumb and right sidebar toggle -->
<!-- Start Page Content -->
<!-- ============================================================== -->

<div class="row">
<div class="col-lg-12">
<div class="card">
    <div class="card-body">
        <form method="post" action="profit_sharing_process.php" enctype="multipart/form-data">
            <div class="form-body">
                <h3 class="card-title">Process Profit Sharing Setting</h3>
                <hr>
                <div class="row p-t-20">
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label">ROI(%)</label>
                            <input type="number" step="0.01" class="form-control" name="ROI" required>
                        </div>
                    </div>  
                    
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Member ID</label>
                            <input type="text" placeholder="MGP10001" class="form-control" name="member_ref_code">
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Profit Date</label>
                            <input type="date" class="form-control" name="profit_date">
                        </div>
                    </div>

                    <!--div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Package ID</label>
                            <input type="text" placeholder="PCK001" class="form-control" name="package_id">
                        </div>
                    </div-->

                </div>

                
            </div>
            <div class="form-actions">
                <button name="Process_Profit_Sharing_Setting" class="btn btn-success"><i class="fa fa-check"></i> Process Now</button>
            </div>
        </form>
    </div>
</div>
</div>
</div>


<div class="row">
<div class="col-lg-12">
<div class="card">
    <div class="card-body">
        <form method="post" action="../Controller/Database_sql.php" enctype="multipart/form-data">
            <div class="form-body">
                <h3 class="card-title">Add New Profit Sharing Setting</h3>
                <hr>
                <div class="row p-t-20">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Rank Level</label>
                            <input type="text" class="form-control" name="level_number"  required>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Commission Percent(%)</label>
                            <input type="text" class="form-control" name="commission_percent"  required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <button name="Add_Profit_Sharing_Setting" class="btn btn-success"><i class="fa fa-check"></i> Add</button>
            </div>
        </form>
    </div>
</div>
</div>
</div>

<div class="row">
<div class="col-12">
<div class="card">
    <div class="card-body">
        <h4 class="card-title">Profit Sharing 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>Rank Level</th>
                        <th>Commission Percent(%)</th>
                        <th>Action</th>
                    </tr>
                </thead>                                      
                <tbody>
                    <?php
                    $q = "SELECT *
                    FROM profit_sharing
                    Where status='1'
                    order by id Asc";
                    $result = $mysqli-> query($q);
                    if ($result -> num_rows > 0)
                    {
	                    while($record = $result -> fetch_assoc())
	                    {   
						    $id = $record['id'];
                            $level_number = $record['level_number'];
                            $commission_percent = $record['commission_percent'];
                    ?>
                    <form method="post" onsubmit="return confirm('Do you want to proceed?');" action="../Controller/Database_sql.php" enctype="multipart/form-data">
                    <tr>
                        <td><input type="number" class="form-control" name="level_number" value="<?php echo $level_number; ?>"></td>
                        <td><input type="number" class="form-control" name="commission_percent" value="<?php echo $commission_percent; ?>"></td>   
                        <input type="hidden" class="form-control"  name="id" value="<?php echo $id; ?>">
                        <td>
                            <button name="Update_Profit_Sharing_Setting" class="btn btn-success"><i class="fa fa-check"></i> Update</button>
                            <button name="Delete_Profit_Sharing_Setting" class="btn btn-danger"> Remove</button>                                   
                        </td>
                    </form> 
                    </tr>
                    <?php 
                    }
                    }
                    ?>
                </tbody>
            </table>
            </form>                                 
        </div>
    </div>
</div>                      
</div>
</div>
<!-- ============================================================== -->
<!-- End PAge Content -->

</div>
<!-- End Container fluid  -->
</div>
<!-- End Page wrapper  -->

<!-- Footer Start-->
<?php include ("../Footer/footer.php"); ?>
<!-- Footer End-->

</div>
<!-- End Wrapper -->
<!-- All Jquery -->
    

<!-- All Jquery Start-->
<?php include ("../Header/all_jquery.php"); ?>
<!-- All Jquery End-->

</body>

</html>