<link href="{{CONFIG theme_url}}/js/lib/jquery-datatable/skin/bootstrap/css/dataTables.bootstrap.min.css" rel="stylesheet">
<script src="{{CONFIG theme_url}}/js/lib/jquery-datatable/jquery.dataTables.js"></script>
<script src="{{CONFIG theme_url}}/js/lib/jquery-datatable/skin/bootstrap/js/dataTables.bootstrap.js"></script>
<?php if ($pt->config->credit_card == 'yes') { ?>
<script src="https://js.stripe.com/v3/"></script>
<?php } ?>
<?php if ($pt->config->securionpay_payment == 'yes') { ?>
<script src="https://securionpay.com/checkout.js"></script>
<?php } ?>
<?php echo PT_LoadPage('third-party/paypal-demo'); ?>

<div class="user-setting-panel pt_shadow">
	<h4 class="pt_mn_page_hd"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21,18V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V6H12C10.89,6 10,6.9 10,8V16A2,2 0 0,0 12,18M12,16H22V8H12M16,13.5A1.5,1.5 0 0,1 14.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,12A1.5,1.5 0 0,1 16,13.5Z"></path></svg> {{LANG wallet}}</h4>
	<div class="row">
		<div class="col-md-6">
			<div class="pt_invit_link green wallet">
				<div>{{LANG wallet}} <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"> <path style="fill:#455A64;" d="M394.667,73.532H117.333C52.561,73.603,0.071,126.093,0,190.865v21.333 c0,5.891,4.776,10.667,10.667,10.667h490.667c5.891,0,10.667-4.776,10.667-10.667v-21.333 C511.929,126.093,459.439,73.603,394.667,73.532z"/> <path style="fill:#4CAF50;" d="M436.203,143.42L391.04,53.095C372.599,16.21,327.75,1.259,290.865,19.699 c-0.669,0.334-1.332,0.679-1.991,1.033L69.611,138.791c-5.184,2.798-7.118,9.269-4.32,14.453c1.86,3.447,5.46,5.596,9.376,5.6h352 c5.891,0,10.667-4.776,10.666-10.667c0-1.659-0.387-3.295-1.13-4.778V143.42z"/> <path style="fill:#607D8B;" d="M74.667,137.532h362.667c41.237,0,74.667,33.429,74.667,74.667v213.333 c0,41.237-33.429,74.667-74.667,74.667H74.667C33.429,500.199,0,466.769,0,425.532V212.199C0,170.961,33.429,137.532,74.667,137.532 z"/> <path style="fill:#455A64;" d="M501.333,244.199H416c-41.237,0.022-74.649,33.468-74.628,74.706 c0.022,41.207,33.421,74.606,74.628,74.628h85.333c5.891,0,10.667-4.776,10.667-10.667v-128 C512,248.974,507.224,244.199,501.333,244.199z"/> <circle style="fill:#90A4AE;" cx="416" cy="318.865" r="32"/></svg></div>
				<span>{{CURRENCY}}{{ME wallet}}</span>
				<button class="btn btn-success" type="button" onclick="PT_ReplenishWallet();">{{LANG replenish}}</button>
			</div>
		</div>
		<div class="col-md-6">
			<div class="pt_invit_link blue wallet">
				<div>{{LANG balance}} <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 486.404 486.404" xml:space="preserve"> <path style="fill:#E2A63B;" d="M486.404,317.919v55.38c0,18.808-50.155,34.482-111.804,34.482s-110.759-15.151-110.759-33.959 v-6.269l-1.045-43.886h0.522c8.359,16.196,54.335,28.735,109.714,28.735s112.327-15.673,112.327-34.482H486.404z"/> <path style="fill:#F4B844;" d="M371.465,112.074v54.857h-1.045c0,19.331-51.722,34.482-112.849,34.482 c-23.51,0.522-47.543-2.09-70.531-7.837l-1.045,1.045c-11.494-9.404-24.555-16.718-38.661-21.42v-1.045l-1.567-57.992 c3.657,17.763,52.245,31.869,111.282,31.869s113.371-15.151,113.371-33.959H371.465z"/> <path style="fill:#FEDB41;" d="M371.465,113.119L371.465,113.119c0,18.808-51.722,33.959-113.371,33.959 s-108.147-14.106-111.804-31.869c0-0.522-0.522-1.567-0.522-2.09c0-18.808,50.155-34.482,112.327-34.482 C320.265,78.115,371.465,93.788,371.465,113.119z"/> <path style="fill:#F4B844;" d="M263.318,323.666L263.318,323.666l-0.522-11.494l-1.045-47.02 c3.657,17.763,52.245,31.869,111.282,31.869s111.282-15.151,112.849-33.437h0.522v54.335h-1.045 c0,18.808-50.678,34.482-112.327,34.482C311.384,352.4,271.678,339.862,263.318,323.666z"/> <path style="fill:#E2A63B;" d="M188.608,358.67c14.106-13.061,25.078-29.78,30.824-48.065h2.612 c11.494,1.045,22.988,1.567,35.527,1.567h5.224v11.494l1.045,43.886h-5.747c-22.988,0.522-45.453-2.09-67.918-7.314L188.608,358.67z "/> <path style="fill:#F4B844;" d="M263.318,260.972v2.612l1.045,48.588h-5.225c-13.061,0-25.078-0.522-36.571-1.567h-2.612 c3.657-10.971,5.224-22.465,5.224-33.959c0-7.837-1.045-15.151-2.612-22.465h2.612c10.971,1.045,21.943,1.567,33.959,1.567 l4.702,2.612C263.318,259.404,263.318,260.449,263.318,260.972z"/> <path style="fill:#E2A63B;" d="M187.041,193.576c22.988,5.747,47.02,8.359,70.531,7.837c61.126,0,112.849-15.151,112.849-34.482 h1.045v61.649c-56.947,0-103.445,13.584-109.192,30.824l-4.702-2.612c-11.494,0-22.465-0.522-32.914-1.567h-2.612 c-4.702-24.033-17.241-45.453-36.049-61.127L187.041,193.576z"/> <g> <path style="fill:#FEDB41;" d="M223.09,255.225L223.09,255.225c-5.224-24.033-18.286-45.975-37.094-62.171 c-11.494-10.449-25.078-17.763-39.706-21.943c-10.449-3.657-21.943-5.224-32.914-5.224C51.204,165.363,0.526,214.996,0.004,277.167 c-0.522,62.171,49.11,112.849,111.282,113.371c28.735,0,55.902-10.449,77.322-29.78c14.629-13.584,25.6-30.824,31.347-49.633 c3.657-10.971,5.224-21.943,5.224-33.437C225.18,270.376,223.09,262.539,223.09,255.225z"/> <path style="fill:#FEDB41;" d="M485.882,262.539v1.045c-1.567,18.286-52.245,33.437-112.849,33.437s-107.625-14.106-111.282-31.869 v-2.612c0-1.045,0-2.09,0.522-3.135c5.747-17.241,52.245-30.824,109.192-30.824h1.567 C434.682,228.58,485.882,243.731,485.882,262.539z"/> </g> <path style="fill:#E2A63B;" d="M113.376,264.106c-9.404,0-17.241-7.837-17.241-17.241c0-9.404,7.837-17.241,17.241-17.241 s17.241,7.837,17.241,17.241c0,5.747,4.702,10.449,10.449,10.449c5.747,0,10.449-4.702,10.449-10.449 c0-16.718-11.494-31.869-27.69-36.571v-4.18c0-5.747-4.702-10.449-10.449-10.449s-10.449,4.702-10.449,10.449v4.18 c-16.718,4.18-28.212,19.331-27.69,36.571c0,20.898,17.241,38.139,38.139,38.139c9.404,0,17.241,7.837,17.241,17.241 c0,9.404-7.837,17.241-17.241,17.241l0,0c-9.404,0-17.241-7.837-17.241-17.241c0-5.747-4.702-10.449-10.449-10.449 s-10.449,4.702-10.449,10.449c0,17.241,11.494,31.869,27.69,36.571v8.359c0,5.747,4.702,10.449,10.449,10.449 s10.449-4.702,10.449-10.449v-8.359c20.375-5.747,31.869-27.167,25.6-47.543C144.723,275.6,130.094,264.106,113.376,264.106z"/></svg></div>
				<span>{{CURRENCY}}{{ME balance}}</span>
				<button class="btn btn-main" type="button" onclick="PT_ReplenishBalance();">{{LANG replenish}}</button>
			</div>
		</div>
	</div>
</div>

<br>

<div class="modal fade matdialog" id="2checkout_modal" role="dialog" data-keyboard="false" style="overflow-y: auto;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></span></button>
				<h4 class="modal-title">{{LANG checkout_text}}</h4>
			</div>
			<form class="form form-horizontal" method="post" id="2checkout_form" action="#">
				<div class="modal-body twocheckout_modal">
					<div id="2checkout_alert"></div>
					<div class="clear"></div>
					<div class="sun_input col-md-6">
						<input id="card_name" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG name}}" value="<?php echo($pt->user->name) ?>">
					</div>
					<div class="sun_input col-md-6">
						<input id="card_address" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG address}}" value="<?php echo($pt->user->address) ?>">
					</div>
					<div class="sun_input col-md-6">
						<input id="card_city" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG city}}" value="<?php echo($pt->user->city) ?>">
					</div>
					<div class="sun_input col-md-6">
						<input id="card_state" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG state}}" value="<?php echo($pt->user->state) ?>">
					</div>
					<div class="sun_input col-md-6">
						<input id="card_zip" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG zip}}" value="<?php echo($pt->user->zip) ?>">
					</div>
			        <div class="sun_input col-md-6">
			             <select id="card_country" name="card_country" class="form-control">{{COUNTRIES}}</select>
			        </div>
					<div class="sun_input col-md-6">
						<input id="card_email" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG email}}" value="<?php echo($pt->user->email) ?>">
					</div>
					<div class="sun_input col-md-6">
						<input id="card_phone" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG phone_number}}" value="<?php echo($pt->user->phone_number) ?>">
					</div>
					<div class="clear"></div>
					<hr>
					<div class="row two_check_card">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20,8H4V6H20M20,18H4V12H20M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z" /></svg>
						<div class="sun_input col-xs-12">
							<input id="_number_" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG card_number}}">
							<input id="card_number" name="card_number" type="hidden" class="form-control input-md" autocomplete="off">
						</div>
						<div class="sun_input col-xs-4">
							<select id="card_month" name="card_month" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG month}} (01)">
								<option value="01">01</option>
								<option value="02">02</option>
								<option value="03">03</option>
								<option value="04">04</option>
								<option value="05">05</option>
								<option value="06">06</option>
								<option value="07">07</option>
								<option value="08">08</option>
								<option value="09">09</option>
								<option value="10">10</option>
								<option value="11">11</option>
								<option value="12">12</option>
							</select>
						</div>
						<div class="sun_input col-xs-4 no-padding-both">
							<select id="card_year" name="card_year" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG year}} (2019)">
				                <?php for ($i=date('Y'); $i <= date('Y')+15; $i++) {  ?>
									<option value="<?php echo($i) ?>"><?php echo($i) ?></option>
								<?php } ?>
				            </select>
						</div>
						<div class="sun_input col-xs-4">
							<input id="card_cvc" name="card_cvc" type="text" class="form-control input-md" autocomplete="off" placeholder="CVC" maxlength="3" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">
						</div>
					</div>
					<div class="clear"></div>
					<input type="text" id="2checkout_type" class="hidden" name="type">
					<input id="card_token" name="token" type="hidden" value="">
				</div>
				<div class="clear"></div>
				<div class="modal-footer">
					<div class="ball-pulse"><div></div><div></div><div></div></div>
					<button type="button" class="btn btn-main" onclick="tokenRequest()" id="2checkout_btn">{{LANG pay}}</button>
				</div>
			</form>
		</div>
	</div>
</div>

<div class="modal fade matdialog" id="authorize_modal" role="dialog" data-keyboard="false" style="overflow-y: auto;">
        <div class="modal-dialog">
            <div class="modal-content">
                <h4 class="modal-title">{{LANG authorize}}</h4>
                <form class="form form-horizontal" method="post" id="authorize_form" action="#">
                    <div class="modal-body authorize_modal">
                        <div id="authorize_alert"></div>
                        <div class="clear"></div>
                        <div class="row">
                            <div class="input-field col s12">
                                <input id="authorize_number" type="text" class="form-control input-md" autocomplete="off" placeholder="{{LANG card_number}}">
                            </div>
                            <div class="input-field col s4">
                                <select id="authorize_month" name="card_month" type="text" class="browser-default" autocomplete="off" placeholder="{{LANG month}} (01)">
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                    <option value="05">05</option>
                                    <option value="06">06</option>
                                    <option value="07">07</option>
                                    <option value="08">08</option>
                                    <option value="09">09</option>
                                    <option value="10">10</option>
                                    <option value="11">11</option>
                                    <option value="12">12</option>
                                </select>
                            </div>
                            <div class="input-field col s4 no-padding-both">
                                <select id="authorize_year" name="card_year" type="text" class="browser-default" autocomplete="off" placeholder="{{LANG year}} (2021)">
                                    <?php for ($i=date('Y'); $i <= date('Y')+15; $i++) {  ?>
                                        <option value="<?php echo($i) ?>"><?php echo($i) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="input-field col s4">
                                <input id="authorize_cvc" name="card_cvc" type="text" class="form-control input-md" autocomplete="off" placeholder="CVC" maxlength="3" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="modal-footer">
                        <div class="ball-pulse"><div></div><div></div><div></div></div>
                        <button type="button" class="btn btn-main" onclick="AuthorizeRequest()" id="authorize_btn">{{LANG pay}}</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
<div class="modal fade matdialog" id="aamarpay_modal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content add_money_modal add_address_modal">
            <h5 class="modal-title text-center">{{LANG aamarpay}}</h5>
            <div class="modal-body">
                <div id="aamarpay_alert" style="    color: red;"></div>
                <form id="aamarpay_form" method="post">
                    <div class="form-group">
                        <input class="form-control shop_input" type="text" placeholder="{{LANG name}}"  value="<?php echo($pt->user->name) ?>" id="aamarpay_name">
                    </div>
                    <div class="form-group">
                        <input class="form-control shop_input" type="email" placeholder="{{LANG email}}" value="<?php echo($pt->user->email) ?>" id="aamarpay_email">
                    </div>
                    <div class="form-group">
                        <input id="aamarpay_number" class="form-control shop_input" type="text" placeholder="{{LANG phone_number}}" value="<?php echo($pt->user->phone_number) ?>">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-main" onclick="AamarpayRequest()" id="aamarpay_button">{{LANG pay}}</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
<?php if ($pt->config->coinpayments == 'yes') { ?>
	function pay_using_coinpayments() {
		amount = $("#wallet_amount").val();
		$.post('{{LINK aj/wallet/get_coinpayments}}',{amount:amount}, function (data) {
	        if (data.status == 200) {
	        	location.href = data.url;
	        }
	    }).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
	}
<?php } ?>
<?php if ($pt->config->ngenius_payment == 'yes') { ?>
	function pay_using_aamarpay() {
		$('#pay-go-pro').modal('hide');
		$('#aamarpay_modal').modal({
             show: true
            });
	}
	function AamarpayRequest() {
		amount = $("#wallet_amount").val();
		$.post('{{LINK aj/wallet/get_aamarpay}}',{amount:amount,name:$('#aamarpay_name').val(),email:$('#aamarpay_email').val(),phone:$('#aamarpay_number').val()}, function (data) {
			$('#aamarpay_button').removeAttr('disabled');
	        $('#aamarpay_button').text("{{LANG pay}}");
	        if (data.status == 200) {
	        	location.href = data.url;
	        }
	    }).fail(function(data) {
	    	$('#aamarpay_button').removeAttr('disabled');
	        $('#aamarpay_button').text("{{LANG pay}}");
    		M.toast({html: data.responseJSON.message});
		});
		
	}
<?php } ?>
<?php if ($pt->config->ngenius_payment == 'yes') { ?>
	function pay_using_ngenius() {
		amount = $("#wallet_amount").val();
		$.post('{{LINK aj/wallet/get_ngenius}}',{amount:amount}, function (data) {
	        if (data.status == 200) {
	        	location.href = data.url;
	        }
	    }).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
	}
<?php } ?>
<?php if ($pt->config->coinbase_payment == 'yes') { ?>
	function pay_using_coinbase() {
		amount = $("#wallet_amount").val();
		$.post('{{LINK aj/wallet/get_coinbase}}',{amount:amount}, function (data) {
	        if (data.status == 200) {
	        	location.href = data.url;
	        }
	    }).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
	}
<?php } ?>
<?php if ($pt->config->fortumo_payment == 'yes') { ?>
	function pay_using_fortumo() {
		$.post('{{LINK aj/wallet/get_fortumo}}', function (data) {
	        if (data.status == 200) {
	        	location.href = data.url;
	        }
	    }).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
	}
<?php } ?>
<?php if ($pt->config->yoomoney_payment == 'yes') { ?>
	function pay_using_yoomoney() {
		amount = $("#wallet_amount").val();
	    $.post('{{LINK aj/wallet/create_yoomoney}}',{amount:amount}, function (data) {
	        if (data.status == 200) {
	        	$('body').append(data.html);
				document.getElementById("yoomoney_form").submit();
				$("#yoomoney_form").remove();
	        }
	    }).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
	}
<?php } ?>
<?php if ($pt->config->authorize_payment == 'yes') { ?>
	function PayAuthorize(){
        $('#authorize_btn').attr('onclick', 'AuthorizeWalletRequest()');
        $('#pay-go-pro').modal('hide');
        $('#authorize_modal').modal({
             show: true
            });
    }
    function AuthorizeWalletRequest() {
		$('#authorize_btn').html("{{LANG please_wait}}");
	    $('#authorize_btn').attr('disabled','true');
		authorize_number = $('#authorize_number').val();
		authorize_month = $('#authorize_month').val();
		authorize_year = $('#authorize_year').val();
		authorize_cvc = $('#authorize_cvc').val();
		amount = $("#wallet_amount").val();
		$.post('{{LINK aj/wallet/authorize}}', {card_number:authorize_number,card_month:authorize_month,card_year:authorize_year,card_cvc:authorize_cvc,amount:amount}, function(data) {
			if (data.status == 200) {
				window.location.href = data.url;
			} else {
				$('#authorize_alert').html("<div class='alert alert-danger'>"+data.message+"</div>");
				setTimeout(function () {
					$('#authorize_alert').html("");
				},3000);
			}
			$('#authorize_btn').html("{{LANG pay}}");
		    $('#authorize_btn').removeAttr('disabled');
		}).fail(function(data) {
		    $('#authorize_alert').html("<div class='alert alert-danger'>"+data.responseJSON.message+"</div>");
			setTimeout(function () {
				$('#authorize_alert').html("");
			},3000);
			$('#authorize_btn').html("{{LANG pay}}");
		    $('#authorize_btn').removeAttr('disabled');
		});
	}
<?php } ?>
<?php if ($pt->config->securionpay_payment == 'yes') { ?>
	$(function () {
		SecurionpayCheckout.key = '<?php echo($pt->config->securionpay_public_key); ?>';
		SecurionpayCheckout.success = function (result) {
			$.post('{{LINK aj/wallet/securionpay_handle}}', result, function(data, textStatus, xhr) {
				if (data.status == 200) {
					window.location.href = data.url;
				}
			}).fail(function(data) {
	    		M.toast({html: data.responseJSON.message});
			});
		};
		SecurionpayCheckout.error = function (errorMessage) {
			M.toast({html: errorMessage});
		};
	});
    function PaySecurionpay(){
    	amount = $("#wallet_amount").val();
    	$.post('{{LINK aj/wallet/securionpay_token}}', {amount:amount}, function(data, textStatus, xhr) {
    		if (data.status == 200) {
    			SecurionpayCheckout.open({
					checkoutRequest: data.token,
					name: 'Top Up Wallet',
					description: 'Top Up Wallet'
				});
    		}
    	}).fail(function(data) {
    		M.toast({html: data.responseJSON.message});
		});
    }
<?php } ?>

<?php if ($pt->config->credit_card == 'yes') { ?>
	function PT_OpenStripe(pkg,self,video_id = 0,price = 0){
		var stripe = Stripe('<?php echo $pt->config->stripe_id;?>');
		$.post('{{LINK aj/wallet/stripe_session}}', {amount: $('#wallet_amount').val()}, function(data, textStatus, xhr) {
			if (data.status == 200) {
				return stripe.redirectToCheckout({ sessionId: data.sessionId });
			}
			else{
		    	$('.wallet_show_alert').html("<div class='alert alert-danger'>"+data.message+"</div>");
				setTimeout(function () {
					$('.wallet_show_alert').html("");
				},3000);
		    }
		});
	}
<?php } ?>

<?php if ($pt->config->checkout_payment == 'yes') { ?>
	// Called when token created successfully.
	var successCallback = function(data) {
		amount = $("#wallet_amount").val();
	    var myForm = document.getElementById('2checkout_form');
	    $.post('{{LINK aj/wallet/checkout_replenish}}', {card_number: $("#card_number").val(),card_cvc: $("#card_cvc").val(),card_month: $("#card_month").val(),card_year: $("#card_year").val(),card_name: $("#card_name").val(),card_address: $("#card_address").val(),card_city: $("#card_city").val(),card_state: $("#card_state").val(),card_zip: $("#card_zip").val(),card_country: $("#card_country").val(),card_email: $("#card_email").val(),card_phone: $("#card_phone").val(),type: 'wallet',token: data.response.token.token,amount:amount}, function(data, textStatus, xhr) {
	    	$('#2checkout_btn').html("{{LANG pay}}");
	    	$('#2checkout_btn').attr('disabled');
	    	$('#2checkout_btn').removeAttr('disabled');
	    	$('#2checkout_form').find('.ball-pulse').fadeOut(100);
	    	if (data.status == 200) {
	      	 	window.location.href = data.url;
	      	} else {
	      	 	$('#2checkout_alert').html("<div class='alert alert-danger'>"+data.error+"</div>");
				setTimeout(function () {
					$('#2checkout_alert').html("");
				},3000);
	      	}
	    	/*optional stuff to do after success */
	    });
	};

	// Called when token creation fails.
	var errorCallback = function(data) {
		$('#2checkout_btn').html("{{LANG pay}}");
		$('#2checkout_btn').removeAttr('disabled');
		$('#2checkout_form').find('.ball-pulse').fadeOut(100);
	    if (data.errorCode === 200) {
	        tokenRequest();
	    } else {
	    	$('#2checkout_alert').html("<div class='alert alert-danger'>"+data.errorMsg+"</div>");
			setTimeout(function () {
				$('#2checkout_alert').html("");
			},3000);
	    }
	};

	var tokenRequest = function() {
		$('#card_number').val($('#_number_').val());
		$('#2checkout_btn').html("{{LANG please_wait}}");
		$('#2checkout_btn').attr('disabled','true');
		if ($("#card_number").val() != '' && $("#card_cvc").val() != '' && $("#card_month").val() != '' && $("#card_year").val() != '' && $("#card_name").val() != '' && $("#card_address").val() != '' && $("#card_city").val() != '' && $("#card_state").val() != '' && $("#card_zip").val() != '' && $("#card_country").val() != 0 && $("#card_email").val() != '' && $("#card_phone").val() != '') {
			$('#2checkout_form').find('.ball-pulse').fadeIn(100);
			// Setup token request arguments
		    var args = {
		        sellerId: "<?php echo($pt->config->checkout_seller_id) ?>",
		        publishableKey: "<?php echo($pt->config->checkout_publishable_key) ?>",
		        ccNo: $("#card_number").val(),
		        cvv: $("#card_cvc").val(),
		        expMonth: $("#card_month").val(),
		        expYear: $("#card_year").val()
		    };

		    // Make the token request
		    TCO.requestToken(successCallback, errorCallback, args);
		}
		else{
			$('#2checkout_btn').html("{{LANG pay}}");
			$('#2checkout_btn').removeAttr('disabled');
			$('#2checkout_alert').html("<div class='alert alert-danger'>{{LANG please_check_details}}</div>");
			setTimeout(function () {
				$('#2checkout_alert').html("");
			},3000);

		}


	};

	$(function() {
	    // Pull in the public encryption key for our environment
	    TCO.loadPubKey("<?php echo($pt->config->checkout_mode) ?>");
	});
<?php } ?>

























	$(document).ready( function () {
	    $('#pt-user-ads-table').DataTable();
		$('#pt-user-ads-table').on( 'page.dt', function () {
		    PT_Delay(function(){
		    	$('#pt-user-ads-table').find('[type="checkbox"]').each(function(index, el) {
			    	$(el).bootstrapToggle();
			    });
		    },50)
		});
	});


	var amount;

	function PT_ReplenishWallet() {
		swal({
		  html:$('.replenish-wallet-form').clone().addClass('clone').removeClass('hidden'),
		  showCloseButton: true,
		  showCancelButton: true,
		  focusConfirm: false,
		  confirmButtonText:"{{LANG replenish}}",
		  cancelButtonText:"{{LANG cancel}}",
		  buttonsStyling:false,
		  confirmButtonClass:'btn btn-success btn-block pt_wallet_btn',
		  cancelButtonClass:"btn btn-default btn-block pt_wallet_btn",
		  allowOutsideClick:false,
		  showLoaderOnConfirm: true,
		  preConfirm: function () {
		    return new Promise(function (resolve, reject) {
		    	amount = $(".replenish-wallet-form.clone").find('input').val();
		    	if (!amount || amount < 1){
		    		reject("{{LANG please_check_details}}!");
		    	}
		    	else{
		    		$('#wallet_amount').val(amount);
		    		swal.close();
		    		PT_ShowMethods('wallet');
		    	}
		    })
		  }
		}).then(function(){/*pass*/},function(){/*pass*/});
	}
	function PT_ReplenishBalance() {
		swal({
		  html:$('.replenish-balance-form').clone().addClass('clone').removeClass('hidden'),
		  showCloseButton: true,
		  showCancelButton: false,
		  focusConfirm: false,
		  confirmButtonText:"{{LANG replenish}}",
		  buttonsStyling:false,
		  confirmButtonClass:'btn btn-success btn-block pt_wallet_btn',
		  allowOutsideClick:false,
		  showLoaderOnConfirm: true,
		  preConfirm: function () {
		    return new Promise(function (resolve, reject) {
		    	amount = $(".replenish-balance-form.clone").find('input').val();
		    	if ({{ME balance}} < 1) {
		    		reject("{{LANG no_balance_to_move}}!");
		    	}
		    	else if (!amount || amount < 1){
		    		reject("{{LANG please_check_details}}!");
		    	}
		    	else if(amount > {{ME balance}}){
		    		reject("{{LANG more_than_balance}}!");
		    	}
		    	else{
		    		$.post('{{LINK aj/wallet/move_to_wallet}}', {amount: amount}, function(data, textStatus, xhr) {
		    			if (data.status == 200) {
		    				location.reload();
		    			}
		    			else{
		    				reject(data.message);
		    			}
		    		});
		    	}
		    })
		  }
		}).then(function(){/*pass*/},function(){/*pass*/});
	}

	function PT_DeleteAd(id){
		if (!id) {
			return false;
		}
		swal({
		  title: '{{LANG confirmation}}',
		  text: "{{LANG confirm_delete_ad}}",
		  type: 'warning',
		  showCloseButton: true,
		  showCancelButton: true,
		  focusConfirm: false,
		  confirmButtonText:"<i class='material-icons'>delete</i> {{LANG delete}}!",
		  cancelButtonText:"<i class='fa fa-ban'></i> {{LANG cancel}}",
		  buttonsStyling:false,
		  confirmButtonClass:'btn btn-success margin-right',
		  cancelButtonClass:"btn btn-default",
		  allowOutsideClick:false,
		}).then(function (){
			$.post('{{LINK aj/ads/delete}}', {id:id}, function(data, textStatus, xhr) {/* pass */});
			$("tr[data-ads-list='"+id+"']").slideUp(function(){
				$(this).remove();
				swal({
					title:'{{LANG deleted}}',
				    type:'success',
				    buttonsStyling:false,
				    confirmButtonClass:'btn btn-success',
				});
			});
		});
	}

	function PT_ToggleAdsStatus(id){
		if (!id) {
			return false;
		}
		$.post('{{LINK aj/ads/toggle-stat}}', {id:id}, function(data, textStatus, xhr) {/* pass */});
	}



	


	  $(document).on('click', '#select-img', function(event) {
		$("#thumbnail").click()
	});
	$(document).on('change', '#thumbnail', function(event) {
		let imgPath = $(this)[0].files[0].name;
	    if (typeof(FileReader) != "undefined") {
	        let reader = new FileReader();
	        reader.onload = function(e) {
				$('#receipt_img_preview').attr('src', e.target.result);
	        }
	        reader.readAsDataURL(this.files[0]);
	    }
		$('#bank_transfer_modal').addClass('up_rec_img_ready');
	});

	jQuery(document).ready(function($) {
		$('#bank_transfer_form').ajaxForm({
		  url: '{{LINK aj/wallet/bank_replenish}}',
		  beforeSend: function() {
		    $('#bank_transfer_form').find('.ball-pulse').fadeIn(100);
		    $('#bank_transfer_form').find('.btn-main').text("{{LANG please_wait}}").attr('disabled', 'true');
		  },
		  success: function(data) {
		    if (data['status'] == 200) {
		    	$("#blog-alert").html('<div class="alert alert-success">'+ data['message'] +'</div>');
		    	setTimeout(function () {
		    		window.location = "<?php echo $pt->config->site_url;?>";
		    		$(".prv-img").html('<div class="thumbnail-rendderer"><div><div class="error-text-renderer"></div><div><p>{{LINK browse_to_upload}}</p></div></div> </div>');
		    		$("#blog-alert").html('');
		    		$('#configreset').click();

		    	},3000)
		    } else if (data['message']) {
		      $("#blog-alert").html('<div class="alert alert-danger">' + data['message'] + '</div>');
		    }
		    $('#bank_transfer_form').find('.ball-pulse').fadeOut(100);
		    $('#bank_transfer_form').find('.btn-main').text("{{LANG publish}}");
            $('#bank_transfer_form').find('.btn-main').removeAttr('disabled');
		}});
	});

	 function PT_OpenBank(pkg,self,video_id = 0,price = 0){
	    if (!pkg || !self) {
	      return false;
	    }
	    amount = $("#wallet_amount").val()+'00';
	    $('#bank_transfer_amount').val(amount)
	    $(self).text("{{LANG please_wait}}").attr('disabled', 'true');
	    $('#pay-go-pro').modal('hide');
	    $('#configreset').click();
		$("#blog-alert").html('');
    	$('#pay-go-pro').modal('hide');
    	$('#bank_transfer_modal').modal({
             show: true
            });
	}

</script>

<form class="replenish-wallet-form pt_wallet_forms hidden">
	<div class="form-group">
		<label>
			<span>{{LANG wallet}}</span>
		</label>
	</div>
	<div class="form-group">
		<small>{{LANG replenish_my_balance}}</small>
		<input type="number" class="form-control" placeholder="00.00">
	</div>
</form>
<form class="replenish-balance-form pt_wallet_forms hidden">
	<div class="form-group">
		<label>
			<span>{{LANG my_balance}}</span>
		</label>
	</div>
	<div class="form-group">
		<small>{{LANG move_balance_to_wallet}}</small>
		<input type="number" class="form-control" placeholder="00.00">
	</div>
</form>



<div class="modal fade matdialog" id="bank_transfer_modal" role="dialog" data-keyboard="false" style="overflow-y: auto;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></span></button>
				<h4 class="modal-title">{{LANG bank_transfer}}</h4>
			</div>
			<form class="form form-horizontal" method="post" id="bank_transfer_form" action="#">
				<div id="blog-alert"></div>
				<div class="modal-body dt_bank_trans_modal">


					<?php echo html_entity_decode($pt->config->bank_description);?>

					<?php if (!empty($pt->config->bank_transfer_note)) { ?>
						<div class="dt_user_profile hide_alert_info_bank_trans">
							<span class="valign-wrapper">
								<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"></path></svg> Note:
							</span>
							<ul class="dt_prof_vrfy">
								<li><?php echo $pt->config->bank_transfer_note;?></li>
							</ul>
						</div>
					<?php } ?>
					<p class="dt_bank_trans_upl_rec"><a href="javascript:void(0);" onclick="$('#bank_transfer_modal').addClass('up_rec_active'); return false"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13.5,16V19H10.5V16H8L12,12L16,16H13.5M13,9V3.5L18.5,9H13Z"></path></svg> {{LANG upload}}</a></p>
					<div class="upload_bank_receipts">
						<div onclick="document.getElementById('thumbnail').click(); return false">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13.5,16V19H10.5V16H8L12,12L16,16H13.5M13,9V3.5L18.5,9H13Z"></path></svg>
							<p>{{LANG browse_to_upload}}</p>
							<img id="receipt_img_preview" src="">
						</div>
					</div>
					<input type="file" class="hidden" id="thumbnail" name="thumbnail" accept="image/*">
					<input name="image" type="file" id="upload" class="hidden">
					<input name="type" type="hidden" id="bank_transfer_type" class="hidden">
					<input name="description" type="hidden" id="bank_transfer_des" class="hidden">
					<input name="amount" type="hidden" id="bank_transfer_amount" class="hidden">
					<input type="reset" id="configreset" value="Reset" class="hidden">
				</div>
				<div class="modal-footer">
					<div class="ball-pulse"><div></div><div></div><div></div></div>
					<button type="submit" class="btn btn-main">{{LANG publish}}</button>
				</div>
			</form>
		</div>
	</div>
</div>
