<div class="u-popup popView popCenter" id="rechargeModel">
	<uni-view data-v-a75f7a08="" data-v-b2a05bc2="" onclick="cGx();" data-v-30282a05="" class="van-overlay"></uni-view>
    <form action="{{ route('user.deposit.insert') }}" method="post" class="guize_html">
        <span class="guize_html_nei">
			<p class="capCenter" style="margin-top: 3px;margin-bottom: 3px;">RECHARGE ACCOUNT</p>

			<div class="team-container !p-0 flex flex-col gap-y-2 !bg-transparent" style="margin-top:0px;margin-bottom:0px;">
				<div class="recharge-input" style="margin-top: -5px;background: none;">
					<div>
						<iconify-icon class="beautiful-text" width="25" height="25" icon="uil:atm-card"></iconify-icon>
						<input type="text" name="amount" class="amount" id="recharge-input" placeholder="Amount">
					</div>
				</div>

				<div class="label-container" style="margin-top: -10px;">
					<p class="label">Quick Amount</p>
				</div>
				<div class="select-amount" style="padding-top:4px;">
					<div data-role="amount-tip" class="active">25</div>
					<div data-role="amount-tip">50</div>
					<div data-role="amount-tip">100</div>
					<div data-role="amount-tip">150</div>
					<div data-role="amount-tip">200</div>
					<div data-role="amount-tip">500</div>
					<div data-role="amount-tip">1000</div>
					<div data-role="amount-tip">1500</div>
					<div data-role="amount-tip">2000</div>
				</div>

				<div class="listCur" data-v-1ae6f7fb="" data-v-70859265="" style="width:95%;margin:0 auto">
				  <label for="radioCardUSDT" class="radio-card currency">
					<input type="radio" name="recharge_currency" id="radioCardUSDT" value="USDT" class="hidden"/>
					<div class="card-content-wrapper">
					  <span class="check-icon"></span>
					  <img class="currencyIcon" src="{{ asset('users/assets/trade/img/tether.svg') }}" alt="" />
					  <div class="card-content">
						<h4><span>currency</span><span class="iUjsc">USDT</span></h4>
					  </div>
					</div>
				  </label>

				  <label for="radioCardNGN" class="radio-card currency">
					<input type="radio" name="recharge_currency" id="radioCardNGN" value="KWACHA" checked class="hidden" />
					<div class="card-content-wrapper">
					  <span class="check-icon"></span>
					  <img class="currencyIcon" src="{{ asset('users/assets/trade/img/naira.svg') }}" alt="" />
					  <div class="card-content">
						<h4><span>currency</span><span class="iUjsc">KWACHA</span></h4>
					  </div>
					</div>
				  </label>
				</div>

				<div class="recharge-input" style="margin-top: -15px;">
					<div>
						<p class="label">Pay Channel</p>
						<select name="method" id="method">
							<option value="1001">MOBILE MONEY</option>
							<!--option value="101">SHI Pay</option-->
						</select>
					</div>
				</div>
				@csrf

			</div>
        </span>
		
        <div class="btnyu" style="width:100%;border-radius:0px;">
			<div class="nav" data-v-1ae6f7fb="" data-v-70859265="" style="border-radius: 0;">
				<div class="item g_close" data-v-1ae6f7fb=""><span data-v-1ae6f7fb="">CANCEL</span></div>
				<button type="submit" class="item on rechargebtn" data-action="topup" data-v-1ae6f7fb=""><span data-v-1ae6f7fb="">TOPUP</span>&nbsp;<span id="current-value"></span></button>
			</div>
        </div>
    </form>
</div>

@push('script')
<script src="{{ asset('users/assets/trade/js/recharge-amount.js') }}"></script>

<script>
    $(".recharge-btn").click(function() {

        // Form input Value
        var method = $('#method').val();
        var amount = $('.amount').val();
		var currency = $("input[name='recharge_currency']:checked").val();
        var token = document.querySelector('input[name="_token"]').value;

        // Enable form submit
        var is_status = true;

        // Verify input
        if (!amount) {
            modalMsg("Please enter or select amount");
            is_status = false;
        }

        if (!currency) {
            modalMsg("Sorry, The select the currency");
            is_status = false;
        }
		
		if( currency == 'KWACHA'){
			if (amount < 25 || amount > 2000000) {
				modalMsg("Sorry, The KWACHA recharge amount ranges from 25 - 2000000");
				is_status = false;
			}
		}else{
			if (amount < 2 || amount > 50000) {
				modalMsg("Sorry, The recharge amount in USDT is from $2 - $50000");
				is_status = false;
			}
		}
        // End Verify

        // Send Data
        if (is_status) {

            // AJAX POST
            $.ajax({
                type: "POST",
                url: "{{ route('user.deposit.insert') }}",
                data: {
                    amount: amount,
                    method: method,
                    recharge_currency: currency,
                    _token: token
                },
                beforeSend: function() {
                    // Handle before sending the request
					loading.showLoading({type: 2,tip: "Please wait..."});
                },
                success: function(data) {
                    // Handle successful request
					loading.hideLoading();
                    modalMsg(data.message);
					$("body").removeClass('van-overflow-hidden');
					$(".popView").hide();
                    modalMessage(data.message, 200, data.link);
                },
                error: function(xhr, status, error) {
                    var responseText = JSON.parse(xhr.responseText);

                    // Handle errors
                    loading.hideLoading();
                    modalMsg(responseText.message);
                },
                fail: function() {
                    // Handle failed requests
                    loading.hideLoading();
                    modalMsg("Request Failed");
                }
            });
        }


        return false;
    })
	
	function recharge(){
		$("body").addClass('van-overflow-hidden');
		$("#rechargeModel").slideDown();
	}
</script>
@endpush