<?php 

require __dir__ . '/init.php';

require _SDIR . '/for-otp.php';

events::addListener("@header", function() { ?>
	<link href="../library/spry/textfieldvalidation/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
	<script src="../library/spry/textfieldvalidation/SpryValidationTextField.js" type="text/javascript"></script>
<?php });

template::get_header();

?>

	<div class='my-5'></div>
	
	<div class='card'>
		<div class='card-body'>

			<div id="contentbar" class="content loyalty-loyaltyprograms-index">
			
				<a id="loyalty-overview-header" class="travel">
					<span class="pull-left">OTP VERIFICATION</span>
					<span class="pull-right name">OTP INPUT</span>
				</a>

				<div class="row-fluid" id="loyalty-program-overview">
				
					<div class="span6">
						<div class="sub-header transactions">
							<h2>
								<a >
									OTP Countdown
								</a>
							</h2>
						</div>

						<div id="last-rewardable-transactions">
						
							<h4 class="title">
								Aunthentication token code has been sent to your Phone<br> Number (<?php echo $__user['phone']; ?>)  
							</h4>
							<h2>
								You have <span style="color:#0066CC;font-weight:bold;" id="time">05:00</span> minutes! to validate the transfer.
							</h2>

							<script>
								function startTimer(duration, display) {
									var timer = duration, minutes, seconds;
									setInterval(function () {
										minutes = parseInt(timer / 60, 10)
										seconds = parseInt(timer % 60, 10);

										minutes = minutes < 10 ? "0" + minutes : minutes;
										seconds = seconds < 10 ? "0" + seconds : seconds;

										display.textContent = minutes + ":" + seconds;

										if (--timer < 0) {
											timer = duration;
										}
									}, 1000);
								}

								window.onload = function () {
									var fiveMinutes = 60 * 5,
										display = document.querySelector('#time');
									startTimer(fiveMinutes, display);
								};
							</script>  
				
						</div>
					</div> <!-- span6 -->

					<div class="span6">
					
						<div class="sub-header transactions travel">
							<h2>
								<a >
									OTP Input
								</a>
								<span class="pull-right"></span>
							</h2>
						</div>
					
						<div id="last-bonus-transactions">
						
							<p><?php template::alert( $msg ); ?></p>
							
							<div class="name">Enter the OTP code you received on your mobile number or email</div>
							
							<form class="form" action="?v=Token" method="post" class="form-horizontal">
						
								<div class="form-items mb-2">
									<div class="control-group " data-name="currentPassword">
										<label style="" class="control-label">
										Enter OTP
										</label>
										<div class="controls">
											<span id="sprytf_token">
												<input type="text" placeholder="OTP Code"   name="token" autofocus="" class='form-control mb-1'>
												<input type="text" disabled="true"  value="<?php echo $__user['phone']?>" autofocus="" class='form-control mb-1'>
												<span class="textfieldRequiredMsg">Transaction Authorization Code is required.</span>
												<span class="textfieldInvalidFormatMsg">Transaction Authorization Code must be Integer.</span>
												<span class="textfieldMinCharsMsg">Transaction Authorization Code must specify at least 6 characters.</span>
												<span class="textfieldMaxCharsMsg">Transaction Authorization Code must specify at max 8 characters.</span>
											</span>
										</div>
									</div>
								</div>

								<div class="form-actions">
									<span class="confirmation">
										<button  name="send" type="submit"  class="btn btn-primary">Validate Transfer</button>
									</span>
								</div>
							   
							</form>
							
						</div>
					</div>

					<div style="margin-top: 1.5em">
						<div class="clearfix not-refused-offers"></div>
					</div>
					
					<div class="bottom-cms-content">
						<div class="cms-content"></div>
					</div>

				</div>
			</div>

		</div>
	</div>
	
<?php template::get_footer(); ?>  