<?php session_start();if(isset($_SESSION['id'])){$w0=$_SESSION['id'];}else{header("location:login");}
include_once '../includes/autoloader.php';
include_once '../includes/function.php';
$o1=new bank;
$l2=$o1->fetchAllProgress();
$g3=$o1->count_total_user();
$l4=$o1->count_total_deposit();
$y5=$o1->count_all_transactions();
$i6=$o1->count_total_withdrawal();?>
<!DOCTYPE html> 
<html lang="en"> 
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta charset="utf-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1" /> 
<meta name="description" content="Neon Admin Panel" /> 
<meta name="author" content="Laborator.co" /> 
<link rel="icon" href="assets/images/favicon.ico">  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'../www.googletagmanager.com/gtm5445.html?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K3LP6R3');</script>  <title>Wire Transfer | Alerts</title> 
<link rel="stylesheet" href="assets/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css" id="style-resource-1"> 
<link rel="stylesheet" href="assets/css/font-icons/entypo/css/entypo.css" id="style-resource-2"> 
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic" id="style-resource-3"> 
<link rel="stylesheet" href="assets/css/bootstrap.css" id="style-resource-4"> 
<link rel="stylesheet" href="assets/css/neon-core.css" id="style-resource-5"> 
<link rel="stylesheet" href="assets/css/neon-theme.css" id="style-resource-6"> 
<link rel="stylesheet" href="assets/css/neon-forms.css" id="style-resource-7"> 
<link rel="stylesheet" href="assets/css/custom.css" id="style-resource-8"> 
<link rel="stylesheet" href="../fontawesomev6/css/all.css">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="assets/js/jquery-1.11.3.min.js">
</script> 
<script type="text/javascript">

  function showModale(modalId) {
    jQuery('#' + modalId).modal('show', { backdrop: 'static' });
  }
  function showModal(element, modalId) {
    var userId = element.getAttribute('data-userid');
    jQuery('#' + modalId).modal('show', { backdrop: 'static' });
  var p =  document.getElementById('one').value = userId;
//   var pp =  document.getElementById('onecreate').value = userId;
  // console.log(p);
  var o =  document.getElementById('one_one').value = userId;
  var q =  document.getElementById('one_8').value = userId;
  var q =  document.getElementById('one_9').value = userId;
  }
  function validateInput() {
  if (isNumber(q) && q > 4) {
  document.getElementById('one_8').value = .0;
  } 
}
$('input[name="dor"]').keyup(function() {
  validateInput();
});
</script>
<!--[if lt IE 9]>
<script src="https://demo.neontheme.com/assets/js/ie8-responsive-file-warning.js">
</script>
<![endif]-->  <!--[if lt IE 9]> 
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
</script> 
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
</script> 
<![endif]-->  </head> 
<body class="page-body" data-url="https://demo.neontheme.com">  <noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K3LP6R3" height="0" width="0" style="display:none;visibility:hidden">
</iframe>
</noscript>   <div class="page-container">  
<?php include 'header.php';?>
<div class="main-content">  
<?php ?>
<hr/>  
<br/> 
<div class="row"> 
<div class="col-sm-3 col-xs-6"> 
<div class="tile-stats tile-red"> 
<div class="icon"><i class="entypo-users"></i></div> 
 
 
</div> 
</div> 
</div>
<hr/>
<h2>Everything About billing</h2> 

 


 <!-- Button to Open the Modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" style="margin:30px">
create Billing
</button>

<!-- The Modal -->
<div class="modal fade" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">create billing</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
      <form id="transactionForm">
    <div class="form-group">
        <label for="sender">Sender:</label>
        <input type="text" class="form-control" id="sender" name="sender">
    </div>
    <div class="form-group">
        <label for="recipient">Recipient:</label>
        <input type="text" class="form-control" id="recipient" name="recipient">
    </div>
    <div class="form-group">
        <label for="transferAmount">Transfer Amount:</label>
        <input type="number" class="form-control" id="transferAmount" name="transferAmount">
    </div>
    <div class="form-group">
        <label for="transProDate">Transaction Processing Date:</label>
        <input type="date" class="form-control" id="transProDate" name="transProDate">
    </div>
    <div class="form-group">
        <label for="transferFee">Transfer Fee:</label>
        <input type="number" class="form-control" id="transferFee" name="transferFee">
    </div>
    <div class="form-group">
        <label for="percentage">Percentage:</label>
        <input type="number" class="form-control" id="percentage" name="percentage">
    </div>
    <div class="form-group">
        <label for="transfeeStatus">Transfer Fee Status:</label><br>
        <span>note It should be pending or approved to aviod error<br> these are the only accepted parameters</span>
        <input type="text" class="form-control" id="transfeeStatus" name="transfeeStatus">
    </div>
    <div class="form-group">
        <label for="maturityDate">Maturity Date:</label>
        <input type="date" class="form-control" id="maturityDate" name="maturityDate">
    </div>
    <div class="form-group">
        <label for="maturityDateStatus">Maturity Date Status:</label><br>
        <span>note It should be pending or approved to aviod error<br> these are the only accepted parameters</span>
        <input type="text" class="form-control" id="maturityDateStatus" name="maturityDateStatus">
    </div>
    <div class="form-group">
        <label for="maturityDateStatus">input the Country you want the flag:</label> <br>
        <span>note the country should not be abbreviated to aviod error <br>browse the name if possible one mistake can result to error</span>
         
        <input type="text" class="form-control" id="Country" name="Country">
    </div>
    <div class="form-group">
        <label for="maturityDateStatus">message:</label> <br>
     <input type="text" class="form-control" id="message" name="message">
    </div>
    <div class="form-group">
    <label for="maturityDateStatus"> Country currency</label> <br>
    <select class="form-control"name="currency" id="currency">
    <option value="$">US Dollar (USD) - $</option>
    <option value="€">Euro (EUR) - €</option>
    <option value="¥">Japanese Yen (JPY) - ¥</option>
    <option value="£">British Pound (GBP) - £</option>
    <option value="$">Australian Dollar (AUD) - $</option>
    <option value="$">Canadian Dollar (CAD) - $</option>
    <option value="Fr">Swiss Franc (CHF) - Fr</option>
    <option value="¥">Chinese Yuan (CNY) - ¥</option>
    <option value="kr">Swedish Krona (SEK) - kr</option>
    <option value="$">New Zealand Dollar (NZD) - $</option>
    <option value="$">Mexican Peso (MXN) - $</option>
    <option value="$">Singapore Dollar (SGD) - $</option>
    <option value="$">Hong Kong Dollar (HKD) - $</option>
    <option value="kr">Norwegian Krone (NOK) - kr</option>
    <option value="php">Philippine Peso (PHP) - ₱</option>
    <option value="₩">South Korean Won (KRW) - ₩</option>
    <option value="₺">Turkish Lira (TRY) - ₺</option>
    <option value="₽">Russian Ruble (RUB) - ₽</option>
    <option value="₹">Indian Rupee (INR) - ₹</option>
    <option value="R$">Brazilian Real (BRL) - R$</option>
    <option value="R">South African Rand (ZAR) - R</option>
    <!-- Add more currencies as needed -->
</select>
</div>
    <button type="button" class="btn btn-primary" onclick="submitForm()">Submit</button>
</form>
      </div>
      <!-- Modal footer -->
      <div class="modal-footer">
       
        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
      </div>

    </div>
  </div>
</div>



<div class="table-responsive">
<table class="table table-bordered datatable" id="table-3"> 
<thead> 
<tr class="replace-inputs"> 
<th>#</th> 
<th>Sender</th>
        <th>Recipient</th>
        <th>Transfer Amount</th>
        <th>Transaction Date</th>
        <th>Transfer Fee</th>
        <th>Percentage</th>
        <th>Transaction Fee Status</th>
        <th>Maturity Date</th>
        <th>Maturity Date Status</th>
        <th>Link</th>
        <th>Message</th>
        <th>currency</th>
        <th>Action</th>
</tr> 
</thead> 
<tbody> <?php $j7=0;
$currentUrl = "http://".$_SERVER['HTTP_HOST'];
foreach($l2 as $w8){$j7++;?>
<tr> 
<td><?php echo $j7 ?></td>
<td><?php echo $w8["sender"];?></td>
<td><?php echo $w8["reciepient"];?></td>
<td><?php echo $w8["Transferamount"];?></td>
<td><?php echo $w8["transProDate"];?></td>
<td><?php echo $w8["TransferFee"];?></td>
<td><?php echo $w8["percentage"];?></td>
<td><?php echo $w8["transfeeStatus"];?></td>
<td><?php echo $w8["maturityDate"];?></td>
<td><?php echo $w8["maturityDateStatus"];?></td>
<td><?php echo $w8["message"];?></td>
<td><?php echo $w8["currency"];?></td>
<td><a href="<?php echo $currentUrl?>/progress/index?transId=<?php echo $w8['TransId']?>" target="blank">click here to get link</a></td>
<td> 
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal2">
edit Billing
</button>

<!-- The Modal -->
<div class="modal fade" id="myModal2">
  <div class="modal-dialog">
    <div class="modal-content">
      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">edit billing</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
      <form id="edittransactionForm">
    <div class="form-group">
        <label for="sender">Sender:</label>
        <input type="text" class="form-control" id="sender" name="sender">
    </div>
    <div class="form-group">
        <label for="recipient">Recipient:</label>
        <input type="text" class="form-control" id="recipient" name="recipient">
    </div>
    <div class="form-group">
        <label for="transferAmount">Transfer Amount:</label>
        <input type="number" class="form-control" id="transferAmount" name="transferAmount">
    </div>
    <div class="form-group">
        <label for="transProDate">Transaction Processing Date:</label>
        <input type="date" class="form-control" id="transProDate" name="transProDate">
    </div>
    <div class="form-group">
        <label for="transferFee">Transfer Fee:</label>
        <input type="number" class="form-control" id="transferFee" name="transferFee">
    </div>
    <div class="form-group">
        
        <input type="hidden" class="form-control" id="id" name="id" value="<?php echo $w8["id"] ?>">
    </div>
    <div class="form-group">
        <label for="percentage">Percentage:</label>
        <input type="number" class="form-control" id="percentage" name="percentage">
    </div>
    <div class="form-group">
        <label for="transfeeStatus">Transfer Fee Status:</label><br>
        <span>note It should be pending or approved to aviod error<br> these are the only accepted parameters</span>
        <input type="text" class="form-control" id="transfeeStatus" name="transfeeStatus">
    </div>
    <div class="form-group">
        <label for="maturityDate">Maturity Date:</label>
        <input type="date" class="form-control" id="maturityDate" name="maturityDate">
    </div>
    <div class="form-group">
        <label for="maturityDateStatus">Maturity Date Status:</label><br>
        <span>note It should be pending or approved to aviod error<br> these are the only accepted parameters</span>
        <input type="text" class="form-control" id="maturityDateStatus" name="maturityDateStatus">
    </div>
    <div class="form-group">
        <label for="maturityDateStatus">input the Country you want the flag:</label> 
        <br>
        <span>note the country should not be abbreviated to aviod error <br>browse the name if possible one mistake can result to error</span>
         
        <input type="text" class="form-control" id="Country" name="Country">
    </div>
    <button type="button" class="btn btn-primary" onclick="editsubmitForm()">Submit</button>
</form>
      </div>
      <!-- Modal footer -->
      <div class="modal-footer">
       
        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
      </div>

    </div>
  </div>
</div>
<button class="btn btn-danger btn-lg deleteButton" data-userid="<?php echo $w8['id'];?>" > 
Delete
</b> 
<!-- <a href="#" class="btn btn-info btn-sm btn-icon icon-left" > 
<i class="entypo-info">
</i>
Profile
</a>  -->
</td> 
 
</tr>  
<?php }?>
</tfoot> 
</table> 
<br/> 
<br/>  
</div>
</div>      
</div> 
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="../js/jquery-3.5.1.js"></script>
<script src="../js/Admin_fund.js"></script>
<script src="../js/Admin_edit_user.js"></script>
<script src="../js/Admin_edit_code.js"></script>
<script src="../js/Admin_change_code.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>


<link rel="stylesheet" href="assets/js/datatables/datatables.css" id="style-resource-1"> 
<link rel="stylesheet" href="assets/js/select2/select2-bootstrap.css" id="style-resource-2"> 
<link rel="stylesheet" href="assets/js/select2/select2.css" id="style-resource-3"> 
<script src="assets/js/gsap/TweenMax.min.js" id="script-resource-1"></script> 
<script src="assets/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js" id="script-resource-2"></script> 
<script src="assets/js/bootstrap.js" id="script-resource-3"></script> 
<script src="assets/js/joinable.js" id="script-resource-4"></script> 
<script src="assets/js/resizeable.js" id="script-resource-5"></script> 
<script src="assets/js/neon-api.js" id="script-resource-6"></script> 
<script src="assets/js/cookies.min.js" id="script-resource-7"></script> 
<script src="assets/js/datatables/datatables.js" id="script-resource-8"></script> 
<script src="assets/js/select2/select2.min.js" id="script-resource-9"></script> 
<script src="assets/js/neon-chat.js" id="script-resource-10"></script>  
<script src="assets/js/neon-custom.js" id="script-resource-11"></script>  
<script src="assets/js/neon-demo.js" id="script-resource-12"></script> 
<script src="assets/js/gsap/TweenMax.min.js" id="script-resource-1">
</script> 
<script src="assets/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js" id="script-resource-2">
</script> 
<script src="assets/js/bootstrap.js" id="script-resource-3">
</script> 
  
<script>
function submitForm() {
    const form = document.getElementById('transactionForm');
    const formData = new FormData(form);

    let allFieldsFilled = true;
    formData.forEach((value, key) => {
        if (!value) {
            allFieldsFilled = false;
            alert(key + ' cannot be empty');
        }
    });

    if (allFieldsFilled) {
        const data = {};
        formData.forEach((value, key) => {
            data[key] = value;
        });

        axios.post('../includes/Admin_billin', data)
            .then(response => {
             const result =  response.data;
     
             if (result === true) {
                alert('billing created sucessfully');
                location.reload();
             }
            })
            .catch(error => {
                console.error('There was an error submitting the form:', error);
            });
    }
}
function editsubmitForm() {
    const form = document.getElementById('edittransactionForm');
    const formData = new FormData(form);

        axios.post('../includes/editAdmin_billin', formData)
            .then(response => {
                const result =  response.data;
                
             if (result === true) {
                alert('billing edited sucessfully'); 
                location.reload();
             }
            
            })
            .catch(error => {
                console.error('There was an error submitting the form:', error);
            });
    
}
</script>
<script src="assets/js/neon-skins.js" id="script-resource-11">
</script> 
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28991003-7']);
_gaq.push(['_setDomainName', 'demo.neontheme.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

function GetURLParameter(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return decodeURIComponent(sParameterName[1]);
        }
    }
}
var id = GetURLParameter('id');
if (id) {
var id = GetURLParameter('id');
}
</script> 
 
<script>
  $(document).ready(function() {
    $('.deleteButton').click(function() {
      var userId = $(this).data('userid');
 console.log(userId);
      $.ajax({
        url: '../includes/deleteprogres',
        type: 'POST',
        data: { userId: userId },
        success: function(response) {
          // Handle the response from the server after successful deletion
          console.log(response);          
          alert(response);

// Reload the page
location.reload();
        },
        error: function(xhr, status, error) {
          // Handle any error that occurred during the AJAX request
          console.log(error);

        }
      });
    });
  });
</script>

<script>
 function toggledisabbble(userId) {
  console.log(userId);
  $.ajax({
    url: '../includes/update_disallowed',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      console.log(response);

      if (response === 'transaction outcome will be transaction failed') {
        alert(response);
        $('#togggleButto-' + userId).addClass('disabled');
        // $('#togggleButto-' + userId).text('Disable Email');
        $('#togggl-' + userId).removeClass('disabled');
        
      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}


 function toggleUserEnabledd(userId) {
  console.log(userId);
  $.ajax({
    url: '../includes/update_allowed',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      if (response === 'transaction outcome will be transaction successful') {
        alert(response);
        $('#togggl-' + userId).addClass('disabled');
        // $('#togggl-' + userId).text('Enable');
        $('#togggleButto-' + userId).removeClass('disabled');
        


      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}

 function toggleUserEnabled(userId) {
  console.log(userId);
  $.ajax({
    url: '../includes/update_database',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      console.log(response);
      if (response) {
        alert(response);
        $('#toggle-' + userId).addClass('disabled');
        $('#toggle-' + userId).text('Enable');
        $('#toggleButton-' + userId).removeClass('disabled');
        


      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}

function toggleUserLogin(userId) {
  console.log(userId);
  $.ajax({
    url: '../includes/update_database_new',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      if (response === 'Login disabled successfully') {
        alert(response);
        $('#toggleButton-' + userId).addClass('disabled');
        $('#toggleButton-' + userId).text('Disable');
        $('#toggle-' + userId).removeClass('disabled');
        
      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}

function toggledisable(userId) {
  console.log(userId);
  $.ajax({
    url: '../includes/update_email_disable_alert',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      console.log(response);
      if (response === 'Email disabled successfully') {
        alert(response);
        $('#toggleButto-' + userId).addClass('disabled');
        $('#toggleButto-' + userId).text('Disable Email');
        $('#toggl-' + userId).removeClass('disabled');
        
      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}

function toggleenable(userId) {
  $.ajax({
    url: '../includes/update_email_alert',
    type: 'POST',
    data: { userId: userId },
    success: function(response) {
      // Handle the response from the server after successful update
      console.log(response);

      if (response === 'Email enabled successfully') {
        alert(response);
   
        
        $('#toggl-' + userId).addClass('disabled');
        $('#toggl-' + userId).text('Enable Email');
        $('#toggleButto-' + userId).removeClass('disabled');
      }

      // Reload the page if needed
      // location.reload();
    },
    error: function(xhr, status, error) {
      // Handle any error that occurred during the AJAX request
      console.log(error);
    }
  });
}
</script>
</body> 
</html>