<?php
@session_start();
include "control/activity.php";

 $dd = new activity();
 $loginStatus = $_SESSION['loginDetails'];


  if(isset($_SESSION['loginDetails'])){

  }else{
     header("Location:dashboard.php");
  }

  if($loginStatus == null){
    echo "<script>window.open('logout.php','_self')</script>";
  }

  
  $iid = $_REQUEST['iid'];
  $table = "create_package";
  $condition = " where package_iid='$iid'";
  $getPackage = $dd->single($table,$condition);



  $table = "admin_calculation";
  $condition = null;
  $getAdminDetails = $dd->single($table,$condition);
  
?>

<!DOCTYPE html>
<html lang="en">
<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 href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title><?= $getAdminDetails['title']; ?></title>
</head>
<body>

    <div class="main" id="main">
		  <?php include "menu.php"; ?>
    <div class="right"> 
  <div class="tab-content">


   <?php include "headermenu.php"; ?>


        <!-- Overview -->
         <div id="overview" class="tab-pane active"  >
                <div class="content" >
                  
               <div class="content-wrapper">
                 <div class="container-fluid">

                      <!--======================================================  Content  ====================================================-->                                            
                          <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                              <a href="#"> Edit Package</a>
                            </li>
                          </ol>

                          <div class="row">
                              <div class="col-xl-4 col-sm-4 mb-4">
                                 <table class="table table-bordered data-table">
                                    <form method="post">
                                    <tr>
                                        <td>Package Name : <input disabled value="<?= $getPackage['packageName']; ?>" name="" class="form-control" /></td>
                                    </tr>
                                    <tr>
                                        <td>Package Amount : <input value="<?= $getPackage['package_amount']; ?>" type="number" name="packAmount" class="form-control" /></td>
                                    </tr>
                                    <tr>
                                        <td>Created Date : <input disabled name="" value="<?= $getPackage['created_date']; ?>" class="form-control" /></td>
                                    </tr>
                                    <tr>
                                        <td>Commission : <input name="commission"  value="<?= $getPackage['commission']; ?>" class="form-control" /></td>
                                    </tr>
                                    <tr>
                                        <td>Status : <input disabled name="" value="<?= $getPackage['status_action']; ?>"  class="form-control" /></td>
                                    </tr>
                                    <tr>
                                        <td><button name="update" class="btn btn-block btn-info">Update</button></td>
                                    </tr>
                                    </form>
                                 </table>
                              </div>
                          </div>
  
  
     
      </div>
      <!-- /.container-fluid-->
       </div>  <!-- /content-wrapper-->


                </div>
                </div>
             </div><!--Right panel-->
</div><!--Main-->
<?php
 if(isset($_POST['update']))
 {
     $packAmount = $_REQUEST['packAmount'];
     $commission = $_REQUEST['commission'];

     $table = "create_package";
     $value = "package_amount='$packAmount',commission='$commission'";
     $condition = " package_iid='$iid'";
     $result = $dd->updateData($table,$value,$condition);
     if($result){
        echo "<script>alert('Update Successfully..!!'),window.open('createPackage.php','_self')</script>";
     }
 }

?>

</body>
</html>

<?php include "style.php" ?>