<?php
	include("building_func.php");
	$hddnBuildingId = $_SESSION['caller']['args'][1];
	if ($_SESSION['user']['access_level'] < SABLE_ACCESS_MANAGER)
	{
		SableGeneralFunctions::divertFromPage();
	}
	$row = $sableDB->getRow("select * from building where building_id = ".$hddnBuildingId);
	$selClientId  = $sableDB->getValue("select concat(client_name, ' ', client_surname) from `client` where client_id = '".$row["client_id"]."'");
	$selAreaId  = $sableDB->getValue("select area_name from `area` where area_id = '".$row["area_id"]."'");
	$selAreaId = empty($selAreaId) ? 'Unknown' : $selAreaId;
?>
<script src="<?php SableGeneralFunctions::printModuleJS('building'); ?>"></script>

<!--// Building -->
<form id="frmBuilding" name="frmBuilding" autocomplete="on">
	<input type="hidden" value="<?php echo(SableSystem::sableEncode($hddnBuildingId)); ?>" id="hddnBuildingId" name="hddnBuildingId" />
	<div class="forms">
		<div class="container forms-grids">
			<div class="row forms-grid">
				<div class="col-md-12">
					<h3 class="title"><i class="fa fa-eye" aria-hidden="true"></i>&nbsp;View Building</h3>
					<p></p>
				</div>
			</div>
			<!--// selClientId -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="selClientId" type="text" id="selClientId"readonly value="<?php echo($selClientId); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_selClientId">Client</div>
				</div>
			</div>
			<p></p>
			<!-- selClientId //-->
			<p></p>
			<!--// selAreaId -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="selAreaId" type="text" id="selAreaId"readonly value="<?php echo($selAreaId); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_selAreaId">Area</div>
				</div>
			</div>
			<p></p>
			<!-- selAreaId //-->
			<p></p>
			<!--// edtBuildingName -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtBuildingName" type="text" id="edtBuildingName"readonly value="<?php echo($row['building_name']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtBuildingName">Building Name</div>
				</div>
			</div>
			<p></p>
			<!-- edtBuildingName //-->

			<p></p>
			<!--// txtBuildingNeeds -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<textarea name="txtBuildingNeeds" type="date" id="txtBuildingNeeds" onfocus="showHint('txtBuildingNeeds'); validate_txtBuildingNeeds();" 
							  class="readonly" disabled readonly
							  onblur="hideHint('txtBuildingNeeds');" placeholder="Requirements/Special Needs" onkeypress="handleEnter(this, event);" ><?php echo($row['building_notes']); ?></textarea>	
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_txtBuildingNeeds">Requirements/Special Needs</div>
				</div>
			</div>
			<p></p>
			<!-- txtBuildingNeeds //-->			
			<p></p>
		<!--// buttons -->
			<div class="row forms-grid">
				<div class="col-md-2">
					<input type="button" id="btnCancel" value="Cancel"
					class="submit" onclick="window.location = '<?php SableSystem::printCallPageLink('/building/'); ?>'"/>
				</div>
				<div class="col-md-2 forms-grid">
					<input id="btnOk" type="button" onclick="editBuilding('<?php echo(SableSystem::sableEncode($hddnBuildingId)); ?>')" value="Modify Building" class="submit"/>
				</div>
			</div>
		<!-- buttons //-->
		</div>
	</div>
</form>
<!-- Building //-->
