<?php
include('header.php');

if(isset($_GET['txn_status']) && $_GET['txn_status'] =='SUCCESS'){
    ?>
    <script>
            $(function(){
                Swal.fire(
                 'Success',
                        'Recharge Successfull',
                        'success'
                )
            });
        </script>
    <?php
}
if(isset($_GET['txn_status']) && $_GET['txn_status'] =='FAILED'){
    ?>
    <script>
        alert('Recharge Failed!');
    </script>
    <?php
}
if(isset($_GET['txn_status']) && $_GET['txn_status'] =='TXN_FAILED'){
    ?>
    <script>
        alert('Recharge Failed by bank!');
    </script>
    <?php
}
?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">

    <!-- Content Header (Page header) -->
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="m-0">Add Wallet</h1>
                </div><!-- /.col -->
               
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

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

		<?php
if(isset($_POST['submit'])){
    $user = $_SESSION['userid'];
     date_default_timezone_set('Asia/Kolkata');
   $datetime = date('d/m/Y h:i:s a', time());
   $amount = $_POST['remark'];
   $order_id = "" . rand(10000000,99999999);
    $query ="INSERT INTO `onlinepay`(`or id`, `user id`, `amount`, `date_time`) VALUES ('$order_id','$user','$amount','$datetime')";
   $run = mysqli_query($conn ,$query);
   if ($run == TRUE){
       
 ?>
<form method="post" action="payment/txnProcess.php" name="f1">
 <input type="hidden" id="ORDER_ID" tabindex="1" maxlength="20" size="20"
name="ORDER_ID" autocomplete="off"
                        value="<?php echo $order_id; ?>">
                        <input type="hidden" name="gateway_type" autocomplete="off" value="Robotics">
                        <input type="hidden" name="txnNote" autocomplete="off" value="<?php echo $user; ?>">
                        <input  type="hidden" name="cust_Mobile" autocomplete="off" value="9999999999">
                        <input  type="hidden" name="cust_Email" autocomplete="off" value="9999999999@gmail.com">
                        <input type="hidden" name="txnAmount"
                        value="<?php echo $amount; ?>">
                       
                       </form> 
                       <script type="text/javascript">
            document.f1.submit();
        </script>
    <?php	

}
}
?> 



			 <form class="user" action="" method="POST">

				  <div class="form-group row">
                  <div class="col-sm-6 mb-3 mb-sm-0">
                    <input required="required" type="text" class="form-control"  placeholder="Amount" name="remark" value="" onkeyup="this.value = this.value.toUpperCase();" onblur="this.value = this.value.toUpperCase();">
                  </div>
                  <br>
                  <div class="col-sm-6 mb-3 mb-sm-0">       
                    <input required="required" type="submit" name="submit" class="btn btn-info btn-block" value="Submit">
                  </div>
				  </div> 
				  
				  
				 </form>
		
		
			   			  <!--<div class="col-md-6 mb-4">   
<table class="table table-bordered">
<thead>
<tr>
<th>Pay Amount</th>
<th>TOKEN</th>
<th>Pay Amount</th>
<th>TOKEN</th>
<th>Pay Amount</th>
<th>TOKEN</th>
<th>Pay Amount</th>
<th>TOKEN</th>
<th>Pay Amount</th>
<th>TOKEN</th>
</tr>
</thead>
<tbody>
<tr>
<td>250</td>
<td><i style="color:red;display:block">350</i></td>
<td>300</td>
<td><i style="color:red;display:block">600</i></td>
<td>400</td>
<td><i style="color:red;display:block">700</i></td>
<td>500</td>
<td><i style="color:red;display:block">900</i></td>
<td>600</td>
<td><i style="color:red;display:block">1100</i></td>
</tr>
</tbody>
</table>-->
</div>    
    <!-- /.row -->

	</div><!-- /.container-fluid -->
</section>
<!-- /.content -->


  </div>
  <!-- /.content-wrapper -->

  <!----->
  
 <footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
    <span><strong>DESIGN AND DEVELOPED BY PRINCE RAJPUT</strong></span>
</div>
</div>
</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>
<!-- jQuery UI 1.11.4 -->
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- Select2 -->
<script src="plugins/select2/js/select2.full.min.js"></script>

<!-- SweetAlert -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/8.11.8/sweetalert2.all.min.js"></script>

<!-- DataTables  & Plugins -->
<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>
<script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>

<script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>

<!-- ChartJS -->
<script src="plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="plugins/moment/moment.min.js"></script>
<script src="plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="dist/js/pages/dashboard.js"></script>

<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js" integrity="sha512-37T7leoNS06R80c8Ulq7cdCDU5MNQBwlYoy1TX/WUsLFC2eYNqtKlV0QjH7r8JpG/S0GUMZwebnVFLPd6SU5yg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js" integrity="sha512-zlWWyZq71UMApAjih4WkaRpikgY9Bz1oXIW5G0fED4vk14JjGlQ1UmkGM392jEULP8jbNMiwLWdM8Z87Hu88Fw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script>
function alertMessage(type,message) {
  if (type=='error') {
    type = 'danger';
  }

  return "<div class='alert alert-"+type+" alert-dismissible'> <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a> "+message+" </div>";
}
</script>

<script>
  $(function () {
    $('#tb-wallet').DataTable({
      "paging": true,
      "lengthChange": true,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
    $('#tb-births').DataTable({
      "paging": true,
      "lengthChange": true,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>

</body>
</html>