<?php $page_title = "Deposit Funds" ?>
<?php include 'user_header.php'; ?>
<style>
#btc_wallet, #eth_wallet, #ltc_wallet, #usdt_wallet{
  display: none;
  position: relative;
}
.fa-copy{
  position: absolute;
  right: 2%;
  top: 14%;
  font-size: 130%;
  color: ;
  cursor: pointer;
}
</style>
<?php include '../database/deposit_script.php'; ?>

  <?php
    $dep_status = $_GET['status']
   ?>
  <?php if ($dep_status == "success"): ?>
    <div class='alert alert-success d-flex align-items-center' role='alert'>
      <i class='fa fa-check'></i> &nbsp; Proof of Deposit Uploaded successfully
    </div>
  <?php elseif ($dep_status == "error"): ?>
    <div class='alert alert-danger d-flex align-items-center' role='alert'>
      <i class='fa fa-warning'></i> &nbsp;  Sorry an error occurred. Please try again later or contact support
    </div>
  <?php else: ?>
      <?php echo $error; ?>
  <?php endif; ?>


<div class="container-fluid content-inner pb-0">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <h3 class="p-3">Deposit into your wallet</h3>
                <div class="p-3">
                    <form action="" method="post" enctype="multipart/form-data">
                        <div class="mb-3">
                            <label for="exampleInputEmail1" class="form-label">Select a coin</label>
                            <select name="coin" class="form-control" onchange="showDiv(this)">
                                <option value="">--Select Coin--</option>
                                <option value="BTC">BTC</option>
                                <option value="ETH">ETH</option>
                                <option value="LTC">LTC</option>
                                <option value="USDT">USDT</option>
                            </select>
                            <br>

                            <div class="mb-3">
                                <label for="exampleInputAmount" class="form-label">Amount</label>
                                <input type="text" name="amount" class="form-control" id="exampleInputAmount" >
                            </div>

                            <div class="">
                              <div class="mb-3" id="btc_wallet">
                                  <label for="exampleInputAmount" class="form-label">BTC Wallet Address</label>
                                  <input type="text" value="bc1qc8sua5pstmxmkrlcjzvavvh9a0wrhdvg9dlcqa" class="form-control" readonly id="bc1qc8sua5pstmxmkrlcjzvavvh9a0wrhdvg9dlcqa">
                                  <i class="fa-solid fa-copy" onclick="copyBtc()"></i>
                                  <br>
                                  <small>
                                    <i>Make sure that you are sending funds to the correct wallet address and blockchain network.
                                      Sending coins or tokens other than BTC to this address may result in loss of your deposit.</i>
                                  </small>
                                  <br><br>
                                  <div id="btc_qrcode"></div>
                              </div>

                              <div class="mb-3" id="eth_wallet">
                                  <label for="exampleInputAmount" class="form-label">ETH Wallet Address</label>
                                  <input type="text" value="0x0d8c60002809cf6FE00c3ebc11D482970A1138b8" class="form-control" readonly id="eth_walletAddress">
                                  <i class="fa-solid fa-copy" onclick="copyEth()"></i>
                                  <br>
                                  <small>
                                    <i>Make sure that you are sending funds to the correct wallet address and blockchain network.
                                      Sending coins or tokens other than ETH to this address may result in loss of your deposit.</i>
                                  </small>
                                  <br><br>
                                  <div id="eth_qrcode"></div>
                              </div>

                              <div class="mb-3" id="ltc_wallet">
                                  <label for="exampleInputAmount" class="form-label">LTC Wallet Address</label>
                                  <input type="text" value="<?php echo $ltc_wallet ?>" class="form-control" readonly id="ltc_walletAddress">
                                  <i class="fa-solid fa-copy" onclick="copyLtc()"></i>
                                  <br>
                                  <small>
                                    <i>Make sure that you are sending funds to the correct wallet address and blockchain network.
                                      Sending coins or tokens other than LTC to this address may result in loss of your deposit.</i>
                                  </small><br><br>
                                  <div id="ltc_qrcode"></div>
                              </div>

                              <div class="mb-3" id="usdt_wallet">
                                  <label for="exampleInputAmount" class="form-label">USDT (trc20) Wallet Address</label>
                                  <input type="text" value="TAg9znpCbKFDVfdbwNEmxjNV7nMbx4SPUX" class="form-control" readonly id="usdt_walletAddress">
                                  <i class="fa-solid fa-copy" onclick="copyUsdt()"></i>
                                  <br>
                                  <small>
                                    <i>Make sure that you are sending funds to the correct wallet address and blockchain network.
                                      Sending coins or tokens other than USDT(trc20) to this address may result in loss of your deposit.</i>
                                  </small><br><br>
                                  <div id="usdt_qrcode"></div>
                              </div>
                            </div>

                            <div class="mb-3">
                                <label for="exampleInputAmount" class="form-label">Made payment? Send proof of payment here</label>
                                <input type="file" name="proof" class="form-control" id="exampleInputAmount" required>
                            </div>

                            <div id="emailHelp" class="form-text">Deposit reflects after 2 network confirmations.</div>
                        </div>
                        <button name="deposit" type="submit" class="btn btn-primary">Deposit</button>
                    </form>
                </div>
            </div>
        </div>
        <!-- tradeview here -->
        <?php include 'tradingview_widget.php'; ?>
        <!-- tradeview here -->

    </div>
</div>

<!-- Include the QRCode.js library -->
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<script>
// Generate the BTC QR code
var btc_qrcode = new QRCode(document.getElementById("btc_qrcode"), {
    text: "bc1qc8sua5pstmxmkrlcjzvavvh9a0wrhdvg9dlcqa",
    width: 128,
    height: 128,
});

// Generate the ETH QR code
var eth_qrcode = new QRCode(document.getElementById("eth_qrcode"), {
    text: "0x0d8c60002809cf6FE00c3ebc11D482970A1138b8",
    width: 128,
    height: 128,
});

// Generate the LTC QR code
var ltc_qrcode = new QRCode(document.getElementById("ltc_qrcode"), {
    text: "<?php echo $ltc_wallet ?>",
    width: 128,
    height: 128,
});

// Generate the USDT QR code
var usdt_qrcode = new QRCode(document.getElementById("usdt_qrcode"), {
    text: "TAg9znpCbKFDVfdbwNEmxjNV7nMbx4SPUX",
    width: 128,
    height: 128,
});

//BTC copy address
function copyBtc() {
  var copyText = document.getElementById("btc_walletAddress");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  navigator.clipboard.writeText(copyText.value);
  swal("COPIED", copyText.value, "success");
}

//ETH copy address
function copyEth() {
  var copyText = document.getElementById("eth_walletAddress");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  navigator.clipboard.writeText(copyText.value);
  swal("COPIED", copyText.value, "success");
}

//LTC copy address
function copyLtc() {
  var copyText = document.getElementById("ltc_walletAddress");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  navigator.clipboard.writeText(copyText.value);
  swal("COPIED", copyText.value, "success");
}

//USDT copy address
function copyUsdt() {
  var copyText = document.getElementById("usdt_walletAddress");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  navigator.clipboard.writeText(copyText.value);
  swal("COPIED", copyText.value, "success");
}
</script>
<script>
function showDiv( select ) {

        //btc
        if ( select.value == 'BTC' ) {
            document.getElementById( 'btc_wallet' ).style.display = "block";
            document.getElementById( 'eth_wallet' ).style.display = "none";
            document.getElementById( 'ltc_wallet' ).style.display = "none";
            document.getElementById( 'usdt_wallet' ).style.display = "none";
        } else {
            document.getElementById( 'btc_wallet' ).style.display = "none";
        }

        //ETH
        if ( select.value == 'ETH' ) {
            document.getElementById( 'btc_wallet' ).style.display = "none";
            document.getElementById( 'eth_wallet' ).style.display = "block";
            document.getElementById( 'ltc_wallet' ).style.display = "none";
            document.getElementById( 'usdt_wallet' ).style.display = "none";
        } else {
            document.getElementById( 'eth_wallet' ).style.display = "none";
        }

        //LTC
        if ( select.value == 'LTC' ) {
            document.getElementById( 'btc_wallet' ).style.display = "none";
            document.getElementById( 'eth_wallet' ).style.display = "none";
            document.getElementById( 'ltc_wallet' ).style.display = "block";
            document.getElementById( 'usdt_wallet' ).style.display = "none";
        } else {
            document.getElementById( 'ltc_wallet' ).style.display = "none";
        }

        //USDT
        if ( select.value == 'USDT' ) {
            document.getElementById( 'btc_wallet' ).style.display = "none";
            document.getElementById( 'eth_wallet' ).style.display = "none";
            document.getElementById( 'ltc_wallet' ).style.display = "none";
            document.getElementById( 'usdt_wallet' ).style.display = "block";
        } else {
            document.getElementById( 'usdt_wallet' ).style.display = "none";
        }
}
</script>

 <?php include 'user_footer.php'; ?>
