<?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);
?>
<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-edit" aria-hidden="true"></i>&nbsp;Modify 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" onfocus="showHint('edtClientName'); validate_edtClientName();" onblur="hideHint('edtClientName');" placeholder="Client Name" onkeypress="handleEnter(this, event);" 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" onfocus="showHint('edtClientSurname'); validate_edtClientSurname();" onblur="hideHint('edtClientSurname');" placeholder="Client Surname" onkeypress="handleEnter(this, event);" 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">
					<div class="dropdown">
						<select name="selIdTypeId" type="select" id="selIdTypeId" onfocus="showHint('selIdTypeId');" onblur="hideHint('selIdTypeId'); validate_selIdTypeId()" onkeypress="handleEnter(this, event)" placeholder="Id Type">
<?php echo(SableDBFunctions::getOptions("id_type", "id_type_id", "id_type_name", $row['id_type_id'])); ?>
						</select>
					</div>
				</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" onfocus="showHint('edtClientIdNo'); validate_edtClientIdNo();" onblur="hideHint('edtClientIdNo');" placeholder="Client Id No" onkeypress="handleEnter(this, event);" 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" onfocus="showHint('edtClientEmail'); validate_edtClientEmail();" onblur="hideHint('edtClientEmail');" placeholder="Client Email" onkeypress="handleEnter(this, event);" 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" 
onfocus="showHint('txtClientAddress');" onblur="hideHint('txtClientAddress'); validate_txtClientAddress()"
 placeholder="Client Address"	
 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" onfocus="showHint('edtClientPhone'); validate_edtClientPhone();" onblur="hideHint('edtClientPhone');" placeholder="Client Phone" onkeypress="handleEnter(this, event);" 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">
					<div class="dropdown">
						<select name="selClientTypeId" type="select" id="selClientTypeId" onfocus="showHint('selClientTypeId');" onblur="hideHint('selClientTypeId'); validate_selClientTypeId()" onkeypress="handleEnter(this, event)" placeholder="Client Type">
<?php echo(SableDBFunctions::getOptions("client_type", "company_type_id", "company_type_name", $row['client_type_id'])); ?>
						</select>
					</div>
				</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="modifyClient();" value="Update Client" class="submit"/>
				</div>
			</div>
		<!-- buttons //-->
		<?php include(SABLE_INCLUDES_PATH.'googleMapsDisplay.php'); ?>
		</div>
	</div>
</form>
<!-- Client //-->
