<!-- Blank Header -->
<div class="content-header">
    <div class="header-section">
        <h1>
            <i class="gi gi-airplane"></i><Strong>Transfer Confirmation</Strong><br><small>Flight Operations | <?php echo SITE_NAME?> &copy; <?php echo date("Y"); ?></small>
        </h1>
    </div>
</div>
<ol class="breadcrumb breadcrumb-top">
  <li><a href="<?php echo SITE_URL?>/index.php"><i class="fa fa-home"></i></a></li>
  <li><a href="<?php echo SITE_URL?>/index.php/schedules">Flight Operations</i></a></li>
  <li><a href="<?php echo SITE_URL?>/index.php/flightsearch/jumpseat">Jumpseat Ticket</i></a></li>
  <li>Transfer Confirmation</i></li>
</ol>
<!-- END Blank Header -->
<div class="row">
 <div class="block">
	<div class="block-title">
                <h3><strong>Transfer Confirmation</strong></h3>
            </div>

<?php if($setting->jumpseatwait == '1') { ?>
Your transfer is in progress!
<?php } else { ?>
You have been transfered to your new location!
<?php } ?>
<br /><br /><br />

<?php if($setting->jumpseatwait == '1') { ?>
<table cellpadding="5px" class="table" cellspacing="0" width="100%">
<tr>
<td style="width:15%; text-align:center; vertical-align:middle; font-size:16px;"><?php 	
         echo "<strong>".$depapt->icao."</strong>"; ?></td>
<td style="width:70%;">
<div id="pbar_outerdiv" style="width: 100%; height: 40px; border: 1px solid grey; z-index: 1; position: relative;">
<div id="pbar_innerdiv" style="background:#FFA8AA; z-index: 2; background-position:right; height: 100%; width: 0%;"></div>
<div id="pbar_innertext" style="z-index: 3; line-height:40px; position: absolute; top: 0; left: 0; width: 100%; height: 100%; color: black; font-weight: bold; text-align: center;">0%</div>
</div>
</td>
<td style="width:15%; text-align:center; vertical-align:middle; font-size:16px;"><strong><?php echo $arrapt->icao; ?></strong></td>
</tr>
</table>
<?php } ?>



<table class="table table-striped table-hover">
<tr>
<td>Your old location:</td><td><?php echo $depapt->icao ?> - <?php echo $depapt->name ?></td>
</tr>
<tr>
<td>Your new location:</td><td><?php echo $arrapt->icao ?> - <?php echo $arrapt->name ?></td>
</tr>
<tr>
<td>Distance:</td><td><?php echo round($distance) ?> NM</td>
</tr>
<tr>
<td>Price:</td><td><?php echo FinanceData::formatMoney($price) ?></td>
</tr>
<?php if($setting->jumpseatwait == '1') { ?>
<tr>
<td>Arrival Time at your new location:</td><td><?php echo date('d.m.Y H:i', strtotime($arrtime)) ?></td>
</tr>
<tr>
<td>Total Minutes:</td><td>
<?php echo $flightminutes  ?> Minutes
</td>
</tr>
<?php } ?>
</table>
<br />
<br />
<Center>
<a class="btn btn-primary" href="<?php echo url('schedules'); ?>">Back to Schedule Search</a>
</Center>
<br />
<?php if($setting->jumpseatwait == '1') { ?>
<script>
var start = <?php echo strtotime($deptime) ?>;
var maxTime = <?php echo strtotime($arrtime) ?>;
var timeoutVal = Math.floor(5000);
animateUpdate();


function updateProgress(percentage) {
    $('#pbar_innerdiv').css("width", percentage + "%");
    $('#pbar_innertext').text(percentage + "%");
}

function animateUpdate() {
  $.get('/action.php/flightsearch/gettime/', function(result) {
  
    var now = result;
 
    var perc = Math.round(((now - start) / (maxTime - start)) * 100);	

    console.log(perc);
 
      if (perc <= 100) {
       updateProgress(perc);
       setTimeout(animateUpdate, timeoutVal);
      }
	  if(perc >= 100)
	  {
		 window.location = "<?php echo SITE_URL?>/index.php/schedules";
	  }
  });
}
</script>
<?php } ?>
</div></div>