<?php
include_once 'includes/processes.php';
$Process = new Login_Process;
$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);
$stopgapData = $Process->getStopgapInfo($_GET['stopgap_id']);

$stopgapLocation = $Process->getLocationInfo($stopgapData->user_location);
$locationName = $stopgapLocation->location_name;

?> 
  
  
	<div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h3 class="modal-title"><i class="fa fa-ticket"></i> View Stopgap</h3>
    </div>
	  <form action="stopgap.php" method="post">
	  <input type="hidden" name="stopgap_id" value="<?php echo $stopgapData->stopgap_id;  ?>" />
		<div class="modal-body">
			<div class="row">
			
				<div class="col-sm-12">
				
					<table class="table table-striped table-bordered table-hover">
						<tbody>
							<tr>
								<td>Stopgap User.</td>
								<td><?php echo $stopgapData->stopgap_user;  ?></td>
							</tr>
							<tr>
								<td>User Designation</td>
								<td><?php echo $stopgapData->designation;  ?></td>
							</tr>
							<tr>
								<td>Location</td>
								<td>
									<?php echo $locationName; ?>
								</td>
							</tr>
							<tr>
								<td>Device</td>
								<td>
									<?php 
										$deviceData = $Process->getDeviceInfo($stopgapData->device_id);
										echo $deviceData->device_name;
									?>
								</td>
							</tr>
							<tr>
								<td>Brand</td>
								<td>
									<?php 
										$brandData = $Process->getBrandInfo($stopgapData->brand_id);
										echo $brandData->brand_name;
									?>
								</td>
							</tr>
							<tr>
								<td>Brand</td>
								<td><?php echo $stopgapData->model_product_no;  ?></td>
							</tr>
							<tr>
								<td>Stopgap Tag</td>
								<td><?php echo $stopgapData->stopgap_tag;  ?></td>
							</tr>
							<tr>
								<td>Tagging No</td>
								<td><?php echo $stopgapData->tagging_no;  ?></td>
							</tr>
							<tr>
								<td>Date Returned</td>
								<td><?php echo $stopgapData->date_returned;  ?></td>
							</tr>
							
							<tr>
								<td>Date Given</td>
								<td><?php echo $stopgapData->date_given;  ?></td>
							</tr>
							<tr>
								<td>Status</td>
								<td><?php echo $stopgapData->stopgap_status;  ?></td>
							</tr>
							<tr>
								<td>Remarks</td>
								<td><?php echo $stopgapData->remarks;  ?></td>
							</tr>
							<tr>
								<td>Registered by</td>
								<td>
									<?php 
										$userData = $Process->getUserInfo($stopgapData->userid);
										echo $userData->firstname . " " . $userData->lastname;
									?>
								</td>
							</tr>
						</tbody>
					</table>
					
				</div>
			</div>			
		</div>
		<div class="modal-footer">
			<button type="button" class="btn btn-xs btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
		</div>
	  </form>
    </div><!-- /.modal-content -->