<?php 
$submit_url = $file_name."?page=view"; 
$show_all_page = "page=view";
?>
<!-- search form -->
<form class="form-horizontal" action="<?php echo $submit_url;?>" method="post" name="search_form" id="search_form">
	<div class="card-body">
		<div class="row">
				<div class="col-lg-4 col-12">
					<label for="Name" class="control-label">Search By Id/Comp./Name/Post</label>
					<input type="text" class="form-control" id="search" name="search" value="<?php echo $search;?>" placeholder="Id/Name/Postcode">
				</div>
				<div class="col-lg-4 col-12">
					<label for="From" class="control-label">From</label>
					<input type="text" class="form-control datepicker" id="from_date" name="from_date" value="<?php (isset($from_date) && $from_date !="") ? utility::getFormatedDate($from_date) : "";?>">
				</div>
				<div class="col-lg-4 col-12">
					<label for="To" class="control-label">To</label>
					<input type="text" class="form-control datepicker" id="to_date" name="to_date" value="<?php (isset($to_date) && $to_date !="") ? utility::getFormatedDate($to_date) : "";?>">
				</div>
				<div class="col-lg-4 col-12">
					<label for="County" class="control-label">County</label>
					<? $gsi->getCountyList("county",$county,"100%",false,"form-control"); ?>
				</div>
				<?if(!isset($_SESSION['is_consultant']) && $_SESSION['is_consultant'] ==""){?>
				<div class="col-lg-4 col-12">
					<label for="Consultant" class="control-label">Consultant</label>
					<? //Admin::getAdminList("admin_id_search",$admin_id_search,"100%",false,"form-control"); ?>
					<? Admin::getAdminList("admin_id_search",$admin_id_search,"100%",false,"form-control","","","","1"); ?>				 
				</div>
				<?}?>
				<div class="col-lg-4 col-12">
					<label for="Phone" class="control-label">Phone</label>
					<input type="text" class="form-control" id="phone_no" name="phone_no" value="<?php echo $phone_no;?>" placeholder="Phone">
				</div>
				<div class="col-lg-4 col-12">
					<label for="Email" class="control-label">Email</label>
					<input type="text" class="form-control" id="email_search" name="email_search" value="<?php echo $email_search;?>" placeholder="Email">
				</div>
				<div class="col-lg-4 col-12">
					<label for="Postcode" class="control-label">Sector</label>
					<? echo Keycode::getKeycodeListValue("sector", $sector, $width = "100%", "Sector", "id", "code", "sector","","form-control select2",true); ?>
				</div>
				<div class="col-lg-4 col-12">
					<label for="Contact Source" class="control-label">Enquiry Source</label>
					<? echo Keycode::getKeycodeListValue("enquiry_source", $enquiry_source, $width = "100%", "Enquiry Source", "id", "code", "enquiry_source","","form-control select2"); ?>
				</div>
				<div class="col-lg-2 col-12">	
					<label for="Archived" class="control-label">Archived</label><br>
					<div class="icheck-primary d-inline">
						<input type="checkbox" class="flat-red" id="is_archive" name="is_archive" value="1"  <? echo ($is_archive ==1) ? 'checked':''; ?>>
						<label for="is_archive"></label>
					</div>
				</div>
				<div class="col-lg-4 col-12">
					<label for="Postcode" class="control-label">&nbsp;</label><br>
					<button type="submit" class="btn btn-success">Search
						<i class="fa fa-refresh fa-spin" style="display:none;" id="page_load_div"></i>
					</button>
					<button type="button" value="Show All" onclick="javascript:window.location='?<?php echo $show_all_page ?>'" class="btn btn-info">Show All</button>
				</div>
		</div>
	</div>
</form>
<!-- /.search form -->
<script type="text/javascript">
$(function () {
	$('#search_form').submit(function(){
		$("#submit").attr("disabled", true);
		$('#page_load_div').show();
	});
});
</script>