<?php session_start(); include"../connect/db.php" ?>    
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Admin| Users</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
       
      </li>
      <li class="nav-item d-none d-sm-inline-block">
   
      </li>
    </ul>

    <!-- SEARCH FORM -->
    
    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Messages Dropdown Menu -->
      
      <!-- Notifications Dropdown Menu -->
      
      <li class="nav-item">
        <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
          <i class="fas fa-th-large"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->


  <?php           


?> 
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../index3.html" class="brand-link">
      <img src="../dist/img/AdminLTELogo.png"
           alt="AdminLTE Logo"
           class="brand-image img-circle elevation-3"
           style="opacity: .8">
      <span class="brand-text font-weight-light">Admin</span>
    </a>

    <!-- Sidebar -->

    <?php include"includes/sidebar.php" ?>        
 
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1> Edit User</h1>
            
          <div class="col-sm-6">
        
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
   
      <div class="container-fluid">
        
      <div class="page-wrapper">

   

<?php
$maga = mysqli_real_escape_string($con, $_GET['user'] ?? '');
 include"../connect/db.php";
 $sql11 = mysqli_query($con, "SELECT * FROM beneficiary WHERE id = '$maga' ");
 $rowss = mysqli_fetch_assoc($sql11);
 ?>          

<!-- PAGE CONTAINER-->
<div class="page-container"> 

    <!-- MAIN CONTENT-->
    <div class="main-content">
        <div class="section__content section__content--p30">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-1"></div>
                    <div class="col-lg-10"><br><br>
                        <div class="card">
                            <div class="card-body" style="border-radius: 5px;box-shadow: 0 0 10px 5px #cecece;">
                                <ul class="nav nav-tabs nav-tabs-warning top-icon nav-justified">
                                    <li class="nav-item">
                                        <a href="javascript:void();" data-target="#profile" data-toggle="pill" class="nav-link active"><i class="icon-user"></i> <span class="hidden-xs"><?php echo $rowss['email'] ?>  Profile</span></a>
                                    </li>        
                                </ul>
                                <div class="tab-content p-3">
                                    <div class="tab-pane active" id="profile"> 
                                        <div class="row">
                                            <div class="col-lg-1"></div>
                                            <div class="col-lg-10">
                                                  <br>
                                                  <?php
                                            		$maga = mysqli_real_escape_string($con, $_GET['user'] ?? '');

                                            		$sql = mysqli_query($con, "SELECT * FROM beneficiary WHERE id = '$maga' ");
                                            
                                            		while( $row = mysqli_fetch_assoc($sql) ){
                                            
                                            			if( $row['gender'] == "Male"  ){
                                            				$gender =  
                                            				'
                                            	                <option selected="selcted" value="Male">Male</option>
                                            	                <option value="Female">Female</option>
                                            	            ';    				
                                            			}
                                            			else{
                                            				$gender = 
                                            				'
                                            	                <option value="Male">Male</option>
                                            	                <option selected="selcted" value="Female">Female</option>
                                            				';
                                            			}
										
                                            			echo
                                            			'
                                                            <div class="login-form">
                                                                <form class="regForm form">
                                                                    <div class="form-group">
                                                                    <label for="relationship">Title</label>
                                                                        <input class="form-control" type="text" name="title" value="'.$row['title'].'">
                                                                    </div>                    
                                                                    <div class="form-group">
                                                                    <label for="relationship">First name</label>
                                                                        <input class="form-control" type="text" name="f_name" value="'.$row['f_name'].'">
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">Middle name</label>
                                                                        <input class="form-control" type="text" name="m_name" value="'.$row['m_name'].'">
                                                                    </div>                                                                    
                                                                    <div class="form-group">
                                                                    <label for="relationship">Last name</label>
                                                                        <input class="form-control" type="text" name="l_name" value="'.$row['l_name'].'">
                                                                    </div>
                                                                    <div class="form-group">
                                                                        <label for="relationship">Relationship</label>
                                                                        <input class="form-control" type="text" name="relationship" value="'.$row['relationship'].'">
                                                                    </div>                                                                    
                                                                    <div class="form-group">
                                                                    	<label for="phone">Phone</label>
                                                                        <input class="form-control" type="text" name="phone" value="'.$row['phone'].'">
                                                                    </div>
                                                                    <div class="form-group">
                                                                    	<label for="acc_num">Account Num</label>
                                                                        <input class="form-control" type="text" name="acc_num" value="'.$row['acc_num'].'">
                                                                    </div>                                                                              
                                                                    <div class="form-group">
                                                                    <label for="relationship">ID</label>
                                                                        <input class="form-control" type="text" name="email" value="'.$row['id'].'" >
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">Email Address</label>
                                                                        <input class="form-control" type="text" name="emails" value="'.$row['email'].'" >
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">Date of Birth</label>
                                                                        <input class="form-control" type="date" name="d_o_b" value="'.$row['d_o_b'].'">
                                                                    </div>   
                                                                    <div class="form-group">
                                                                    <label for="relationship">Gender</label>
                                                                        <select id="gender" name="gender" class="form-control">
                                                                        	'.$gender.'
                                                                        </select>
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">Address</label>
                                                                        <textarea rows="4" class="form-control" name="address" id="address" >'.$row['address'].'</textarea>
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">City</label>
                                                                        <input class="form-control" type="text" name="city" value="'.$row['city'].'">
                                                                    </div>
                                                                    <div class="form-group">
                                                                    <label for="relationship">State</label>
                                                                        <input class="form-control" type="text" name="state" value="'.$row['state'].'">
                                                                    </div>
                                                                    <div class="form-group">
                                                                    	<label for="zip_code">Zip Code</label>
                                                                        <input class="form-control" type="text" name="zip_code" value="'.$row['zip_code'].'">
                                                                    </div>
                                                                    <span onclick="updateProfileBenefitciary()" class="btn btn-warning pull-right">Update</span>
                                                                </form>    
                                                            </div>
                                            			';
                                            		}


                                            ?> 
                                            </div>
                                            <div class="col-lg-1"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>                                               
                    </div>
                    <div class="col-lg-1"></div>
                </div>
    
            </div>
        </div>
    </div>
    <!-- END MAIN CONTENT-->
    <!-- END PAGE CONTAINER-->
</div>

</div>
        <div class="row">
        
       
          
          <div class="col-12">
        
        
            <!-- /.card -->

    
              
              <!-- /.card-body -->
              
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
      <!-- MODAL CREATE TRANSACTION -->

      <div class="modal fade" id="modalCreate" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
          <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <?php

              $maga = mysqli_real_escape_string($con, $_GET['user'] ?? '');
                      $vanila = mysqli_query($con,"SELECT * FROM users WHERE email = '$maga' ");
                        $crow = mysqli_fetch_assoc($vanila);
                        ?>
              <div class="modal-body">
              <form method="POST" action="../apps/man/createtrans.php">
                  <?= csrf_field() ?>
                  <div class="form-group">

                    <input  type="hidden" class="form-control" required name="user" id="user"   value="<?php echo $crow['email'] ?>">
                  </div>
                  <div class="form-group">
                    <label for="action">Action</label>
                    <input type="text" class="form-control" required name="action" id="action">
                  </div>
                  <div class="form-group">
                    <label for="asset">Asset</label>
                    <input type="text" class="form-control" required name="asset" id="asset">
                  </div>                                    
                  <div class="form-group">
                    <label for="amount">Amount</label>
                    <input type="text" class="form-control" required name="amount" id="amount">
                  </div>
                  <div class="form-group">
                    <label for="trade_time">Trade Time</label>
                    <input type="text" class="form-control" required name="trade_time" id="trade_time">
                  </div>
                  <div class="form-group">
                    <label for="trade_date">Trade Date</label>
                    <input type="date" class="form-control" required name="trade_date" id="trade_date">
                  </div>
                  <div class="form-group">
                    <label for="result">Result</label>
                    <input type="text" class="form-control" placeholder="win or loss" required name="result" id="result">
                  </div>                  
                    <div class="row">
                        <div class="col-lg-3"></div>
                        <div class="col-lg-6" style="text-align: center;">
                            <button type="submit" class="btn btn-md btn-dark" >Submit</button>
                        </div>
                        <div class="col-lg-3"></div>
                    </div>                         
                </form>                                            
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
              </div>
            </div>
          </div>
        </div>        
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2021 <a href="#">Swagalomo's Admin</a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- page script -->
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true,
      "autoWidth": false,
    });
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>

<script src="js/sweetalert2.all.min.js"></script>
    <!-- Main JS-->
    <script src="js/main.js"></script>
    <script src="js/custom.js"></script>
</body>
</html>
