<?php
include_once ("includes/setup.inc.php");
?>
<div class="quick-search-result">
    <!--begin::Message-->
    <div class="text-muted d-none">
        No record found
    </div>
    <!--end::Message-->

    <!--begin::Section-->
    <div class="font-size-sm text-primary font-weight-bolder text-uppercase mb-2">
        Pemohon
    </div>
    <div class="mb-10">
		<?php
			$query = fetch_postget_val('query',$_POST, $_GET);
			$indicator_Query = "SELECT id_borang, nama_pemohon, kpbaru_pemohon
							  FROM m_borang
							  WHERE nama_pemohon LIKE ? OR kpbaru_pemohon LIKE ?";
			$PDO_stmt = $PDO->prepare($indicator_Query);
			$PDO_stmt->bindValue(1, '%'.$query.'%', PDO::PARAM_STR);
			$PDO_stmt->bindValue(2, '%'.$query.'%', PDO::PARAM_STR);
			$PDO_stmt->execute();
			$got_valid = false;
			while($result = $PDO_stmt->fetch(PDO::FETCH_ASSOC))
			{
				$got_valid = true;
				echo '<div class="d-flex align-items-center flex-grow-1 mb-2">';
					echo '<div class="symbol symbol-30  flex-shrink-0">';
						echo '<span class="navi-icon mr-1">
								<span class="svg-icon svg-icon-lg svg-icon-primary">';
								echo $User_svg;
								echo '</span>
							</span>';
					echo '</div>';
					echo '<div class="d-flex flex-column ml-3 mt-2 mb-2">';
						echo '<a href="javascript:;" onclick="loadMyModal(\'sen_penternak-maklumat.php?id='.$result['id_borang'].'\', \'#searchModal\')" class="font-weight-bold text-dark text-hover-primary">';
						echo $result['nama_pemohon'];
						echo '</a>';
						echo '<span class="font-size-sm font-weight-bold text-muted">No. KP : ';
						echo $result['kpbaru_pemohon'];
						echo '</span>';
					echo '</div>';
				echo '</div>';
			}
						
			if(!$got_valid)
			{
				echo '<div class="d-flex align-items-center flex-grow-1 mb-2">';
					echo '<div class="symbol symbol-30  flex-shrink-0">';
					echo '</div>';
					echo '<div class="d-flex flex-column ml-3 mt-2 mb-2">';
						echo 'Tiada Maklumat';
					echo '</div>';
				echo '</div>';
			}
		?>
    </div>
    <!--end::Section-->
</div>