<?php
	include("legal_func.php");
	$hddnLegalId = $_SESSION['caller']['args'][1];
	if ($_SESSION['user']['access_level'] < 9)
	{
		if ((isset($hddnLegalId)) && ($hddnLegalId != $_SESSION['user']['user_code'])) SableGeneralFunctions::divertFromPage("legal/view.php");
	}
	$row = $sableDB->getRow("select * from legal where legal_id = ".$hddnLegalId);
?>


<script src="<?php echo(SABLE_URL_ROOT.'scripts/nicEdit.js'); ?>"></script>
<script>bkLib.onDomLoaded(function(){nicEditors.editors.push(new nicEditor().panelInstance(document.getElementById('txtLegalText')));});</script>

<script src="<?php SableGeneralFunctions::printModuleJS('legal'); ?>"></script>

<!--// Legal -->
<form id="frmLegal" name="frmLegal" autocomplete="on">
	<input type="hidden" value="<?php echo(SableSystem::sableEncode($hddnLegalId)); ?>" id="hddnLegalId" name="hddnLegalId" />
	<div class="forms">
		<div class="container forms-grids">
			<div class="col-md-12 form-grid">
				<h3 class="title"><i class="fa fa-edit" aria-hidden="true"></i>&nbsp;Modify Legal</h3>
				<p></p>
				<div class="clearfix"> </div>
			</div>
		</div>
		<!--// edtLegalName -->
		<div class="container forms-grids">
			<div class="col-md-4 forms-grid">
		<input name="edtLegalName" type="text" id="edtLegalName"
		onfocus="showHint('edtLegalName');" 
		onblur="hideHint('edtLegalName');" 
		onfocus="validate_edtLegalName()" 
 placeholder="Name"	
onkeypress="handleEnter(this, event)" 
 value="<?php echo($row['legal_name'])?>" />
			</div>


			<div class="col-md-8">
				<div class="fieldHint" id="hint_edtLegalName">Legal Item Name</div>
			</div>
			<div class="clearfix"> </div>
		</div>
		<p></p>
		<!-- edtLegalName //-->


<p></p>
		<!--// txtLegalText -->
		<div class="container forms-grids">
			<div class="col-md-12 forms-grid">
			<textarea name="txtLegalText" type="textarea" id="txtLegalText" class="nicEdit"
onfocus="showHint('txtLegalText');" onblur="hideHint('txtLegalText'); validate_txtLegalText()"
 placeholder="Content"	
><?php echo($row['legal_text'])?></textarea>
			</div>


			<div class="col-md-12">
				<div class="fieldHint" id="hint_txtLegalText">Legal Item Content</div>
			</div>
			<div class="clearfix"> </div>
		</div>
		<p></p>
		<!-- txtLegalText //-->


<p></p>
		<!--// cbLegalActive -->
		<div class="container forms-grids">
			<div class="col-md-4 forms-grid">
				<?php $cbLegalActive = $row['legal_active']; ?>
			<div class="switch">
				<input name="cbLegalActive" type="checkbox" 
				id="cbLegalActive" class="form-toggle form-toggle-yes-no"
				onfocus="showHint('cbLegalActive');" onblur="hideHint('cbLegalActive'); 
				validate_cbLegalActive()"
 placeholder="Active"	
onkeypress="handleEnter(this, event)" 
				<?php if($cbLegalActive) echo("checked='checked'"); ?> />
				<label for="cbLegalActive" data-on="Yes" data-off="No"></label>
			</div>
			</div>


			<div class="col-md-8">
				<div class="fieldHint" id="hint_cbLegalActive">Active</div>
			</div>
			<div class="clearfix"> </div>
		</div>
		<p></p>
		<!-- cbLegalActive //-->


<p></p>
		<!--// buttons -->
		<div class="container">
			<div class="forms-grids">
				<div class="col-md-2 forms-grid">
					<input type="button" id="btnCancel" value="Cancel"
					class="submit" onclick="window.location = '<?php SableSystem::printCallPageLink('/legal/'); ?>'"/>
				</div>
				<div class="col-md-2 forms-grid">
					<input id="btnOk" type="button" onclick="modifyLegal()" value="Update Legal" class="submit"/>
				</div>
			</div>
		</div>
		<!-- buttons //-->
	</div>
</form>
<!-- Legal //-->
