<?php
	include("service_func.php");
	$hddnServiceId = $_SESSION['caller']['args'][1];
	if ($_SESSION['user']['access_level'] < SABLE_ACCESS_MANAGER)
	{
		SableGeneralFunctions::divertFromPage();
	}
	$row = $sableDB->getRow("select * from service where service_id = ".$hddnServiceId);
//	$areas = $sableDB->getRows("select * from service__area where service_id = ".$hddnServiceId);
//	$js = '<script>';
	//$js = '$(document).ready(function(e){';
//	foreach($areas as $area)
//	{
//		$js .= "document.getElementById('selAreaId').value = '".$area['area_id']."';".PHP_EOL;
//		$js .= "areaItem.setReadOnly(true)".PHP_EOL;
//		$js .= "areaItem.addItem(document.getElementById('selAreaId'));".PHP_EOL;
//	}
	//$js .= "});"; //areaItem.addItem(this)
//	$js .= '</script>';	
?>
<script src="<?php SableGeneralFunctions::printModuleJS('service'); ?>"></script>

<!--// Service -->
<form id="frmService" name="frmService" autocomplete="on">
	<input type="hidden" value="<?php echo(SableSystem::sableEncode($hddnServiceId)); ?>" id="hddnServiceId" name="hddnServiceId" />
	<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 Service</h3>
					<p></p>
				</div>
			</div>
			<p></p>
			<!--// edtServiceName -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtServiceName" type="text" id="edtServiceName"readonly value="<?php echo($row['service_name']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtServiceName">Service</div>
				</div>
			</div>
			<p></p>
			<!-- edtServiceName //-->
			<p></p>
			<!--// edtServiceDuration -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtServiceDuration" type="number" id="edtServiceDuration" class="mod" readonly value="<?php echo($row['service_duration']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtServiceDuration">Duration</div>
				</div>
			</div>
			<p></p>
			<!-- edtServiceDuration //-->
			<p></p>
			<!--// edtServicePrice -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<input name="edtServicePrice" type="number" id="edtServicePrice" class="mod" readonly value="<?php echo($row['service_price']); ?>" >
				</div>
				<div class="col-md-8">
					<div class="fieldHint" id="hint_edtServicePrice">Price</div>
				</div>
			</div>
			<p></p>
			<!-- edtServicePrice //-->
			<p></p>
			<!--// selAreaId -->
			<div class="row forms-grid">
				<div class="col-md-4 forms-grid">
					<div class="dropdown">
						<select name="selAreaId" type="select" id="selAreaId" onChange="areaItem.addItem(this);" onfocus="showHint('selAreaId');" onblur="hideHint('selAreaId'); validate_selAreaId()" onkeypress="handleEnter(this, event)" placeholder="Areas" 
								disabled class="readonly noArrow" style="display: none;">
						<?php echo(SableDBFunctions::getOptions("area", "area_id", "area_name", -1)); ?>
						</select>
					</div>					
				</div>
			</div>

			<!-- selAreaId //-->
	<!--		<div class="row forms-grid">
				<div class="col-md-12">
					<div class="fieldHint" id="hint_selAreaId">Areas</div>
				</div>				
				<div id="AreaElement">  -->
					<!--// Selected elements will be placed here. -->
		<!--		</div>
			</div>			
			<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('/service/'); ?>'"/>
				</div>
				<div class="col-md-2 forms-grid">
					<input id="btnOk" type="button" onclick="editService('<?php echo(SableSystem::sableEncode($hddnServiceId)); ?>')" value="Modify Service" class="submit"/>
				</div>
			</div>
		<!-- buttons //-->
		</div>
	</div>
</form>
<!-- Service //-->
<?php echo($js); ?>