<?php
	include("client_func.php");
	$hddnClientId = $_SESSION['caller']['args'][1];
	if ($_SESSION['user']['access_level'] < SABLE_ACCESS_MANAGER)
	{
		SableGeneralFunctions::divertFromPage();
	}
	$row = $sableDB->getRow("select * from client where client_id = ".$hddnClientId);
    $selIdTypeId  = $sableDB->getValue("select id_type_name from `id_type` where id_type_id = '".$row["id_type_id"]."'");
    $selClientTypeId  = $sableDB->getValue("select client_type_name from `client_type` where client_type_id = '".$row["client_type_id"]."'");
?>
<script src="<?php SableGeneralFunctions::printModuleJS('client'); ?>"></script>

<?php include(SABLE_INCLUDES_PATH.'googleMaps.php'); ?>

<!--// Client -->
<form id="frmClient" name="frmClient" autocomplete="on">
	<input type="hidden" value="<?php echo(SableSystem::sableEncode($hddnClientId)); ?>" id="hddnClientId" name="hddnClientId" />
	<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 Client</h3>
					<p></p>
				</div>
			</div>
			<!--// edtClientName -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtClientName" type="text" id="edtClientName"readonly value="<?php echo($row['client_name']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtClientName">Client Name</div>
				</div>
			</div>
			<p></p>
			<!-- edtClientName //-->
			<p></p>
			<!--// edtClientSurname -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtClientSurname" type="text" id="edtClientSurname"readonly value="<?php echo($row['client_surname']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtClientSurname">Client Surname</div>
				</div>
			</div>
			<p></p>
			<!-- edtClientSurname //-->
			<p></p>
			<!--// selIdTypeId -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="selIdTypeId" type="text" id="selIdTypeId"readonly value="<?php echo($selIdTypeId); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_selIdTypeId">Id Type</div>
				</div>
			</div>
			<p></p>
			<!-- selIdTypeId //-->
			<p></p>
			<!--// edtClientIdNo -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtClientIdNo" type="text" id="edtClientIdNo"readonly value="<?php echo($row['client_id_no']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtClientIdNo">Client Id No</div>
				</div>
			</div>
			<p></p>
			<!-- edtClientIdNo //-->
			<p></p>
			<!--// edtClientEmail -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtClientEmail" type="email" id="edtClientEmail"readonly value="<?php echo($row['client_email']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtClientEmail">Client Email</div>
				</div>
			</div>
			<p></p>
			<!-- edtClientEmail //-->
			<p></p>
			<!--// txtClientAddress -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
			<textarea name="txtClientAddress" type="textarea" id="txtClientAddress" 
readonly onChange="updateMapData();" ><?php echo($row['address'])?></textarea>
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_txtClientAddress">Client Address</div>
				</div>
			</div>
			<p></p>
			<!-- txtClientAddress //-->
			<div class="row forms-grids">
				<div class="col-md-12 forms-grid">
					<div id="searchResults"></div>
				</div>
			</div>
			<p></p>
			<!--// edtClientPhone -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtClientPhone" type="tel" id="edtClientPhone"readonly value="<?php echo($row['client_phone']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtClientPhone">Client Phone</div>
				</div>
			</div>
			<p></p>
			<!-- edtClientPhone //-->
			<p></p>
			<!--// selClientTypeId -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="selClientTypeId" type="text" id="selClientTypeId"readonly value="<?php echo($selClientTypeId); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_selClientTypeId">Client Type</div>
				</div>
			</div>
			<p></p>
			<!-- selClientTypeId //-->
			<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('/client/'); ?>'"/>
				</div>
				<div class="col-md-2 forms-grid">
					<input id="btnOk" type="button" onclick="editClient('<?php echo(SableSystem::sableEncode($hddnClientId)); ?>')" value="Modify Client" class="submit"/>
				</div>
			</div>
		<!-- buttons //-->
		<?php include(SABLE_INCLUDES_PATH.'googleMapsDisplay.php'); ?>
		</div>
	</div>
</form>
<!--// Google Maps -->
<script src="<?php echo(SABLE_URL_ROOT.'scripts/googleMapB.js'); ?>"></script>
<!-- Google Maps //-->
<!-- Client //-->
