<?php 
require('includes/header_pemohon.php');
$myID = $my_details->usr_id;
$dateTimeNow = dateTimeNow();

$teksi_Query = "SELECT A.*
				  FROM m_bantuan A
				  WHERE A.id_pemohon = ?";
$PDO_stmt = $PDO->prepare($teksi_Query);
$PDO_stmt->bindValue(1, $myID, PDO::PARAM_INT);
$PDO_stmt->execute();
$bantuan_List = $PDO_stmt->fetch(PDO::FETCH_ASSOC);
?>	

<style>
.tidaklayak {
    color:red;
	background-color:#f8f9fa;
}

</style>
<!--begin::Content-->
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
	<!--begin::Entry-->
	<div class="d-flex flex-column-fluid">
		<!--begin::Container-->
		<div class="container">
			<!--begin::Dashboard--> 
			<!--begin::Row-->
			<div class="row">
				<div class="col-lg-12">
					<!--begin::List Widget 11-->
					<div class="card card-custom card-stretch gutter-b">
						<!--begin::Header-->
						<div class="card-header border-0">
							<h3 class="card-title font-weight-bolder text-dark">Maklumat Penternak</h3>
						</div>
						<!--end::Header-->
						<!--begin::Body-->
						<?php
							echo '<div class="card-body pt-0">';
								echo '<div class="d-flex align-items-center mb-9 bg-light-warning rounded p-5">';
									echo $Dashboard_svg;
									echo '<div class="d-flex flex-column flex-grow-1 mr-2">';									
										echo '<a href="general-borangternak.php" class="font-weight-bold text-dark-75 text-hover-primary font-size-lg mb-1">Borang Maklumat Penternak</a>';
									echo '</div>';
								echo '</div>';
							echo '</div>';
						
						createModal();
						?>
						<!--end::Body-->
					</div>
					<!--end::List Widget 11-->
				</div>
			</div>
			<div class="row">			
				<div class="col-lg-4">
					<!--begin::Callout-->
					<div class="card card-custom wave wave-animate-slow wave-primary mb-8 mb-lg-0">
						<div class="card-body">
							<div class="d-flex align-items-center p-5">
								<!--begin::Icon-->
								<div class="mr-6">
									<?=$Globe_svg?>
								</div>
								<!--end::Icon-->
								<!--begin::Content-->
								<div class="d-flex flex-column">
									<a href="in_ad.php" class="text-dark text-hover-primary font-weight-bold font-size-h4 mb-3">Aduan</a>
									<div class="text-dark-75">Semakan dan membuat aduan<br></div>
								</div>
								<!--end::Content-->
							</div>
						</div>
					</div>
					<!--end::Callout-->
				</div>		
				<div class="col-lg-4">
					<!--begin::Callout-->
					<div class="card card-custom wave wave-animate-slow wave-primary mb-8 mb-lg-0">
						<div class="card-body">
							<div class="d-flex align-items-center p-5">
								<!--begin::Icon-->
								<div class="mr-6">
									<?=$Globe_svg?>
								</div>
								<!--end::Icon-->
								<!--begin::Content-->
								<div class="d-flex flex-column">
									<?php
									echo '<a href="javascript:;" onclick="loadMyModal(\'general-bantuan.php\', \'#ajax-modal\')" title="Permohonan Bantuan Ternakan">Bantuan Ternakan</a>';
									?>
									<div class="text-dark-75">Permohonan Bantuan<br></div>
								</div>
								<!--end::Content-->
							</div>
						</div>
					</div>
					<!--end::Callout-->
				</div>	
				<div class="col-lg-4">
					<!--begin::Callout-->
					<div class="card card-custom wave wave-animate-slow wave-primary mb-8 mb-lg-0">
						<div class="card-body">
							<div class="d-flex align-items-center p-5">
								<!--begin::Icon-->
								<div class="mr-6">
									<?=$Globe_svg?>
								</div>
								<!--end::Icon-->
								<!--begin::Content-->
								<div class="d-flex flex-column">
									<?php
									echo 'Lesen';
									?>
									<div class="text-dark-75">Permohonan Pembaharuan Lesen Ladang Babi<br></div>
								</div>
								<!--end::Content-->
							</div>
						</div>
					</div>
					<!--end::Callout-->
				</div>	
			</div>
				<?php
			
				if($bantuan_List['id_bantuan'] > 0)
				{
				?>
					</br>
					<div class="row">
						<div class="col-lg-12">
							<!--begin::List Widget 11-->
							<div class="card card-custom card-stretch gutter-b">
								<!--begin::Header-->
								<div class="card-header border-0">
									<h3 class="card-title font-weight-bolder text-dark">Rekod Permohonan Bantuan Tahun Semasa</h3>
								</div>
								<!--end::Header-->
								<!--begin::Body-->
								<?php
									//$text = '<br><h4><p style="color:red">Sila Cetak dan Hantar Borang Permohonan Anak Emas Yang Lengkap Dengan Lampirannya ke Pejabat Daerah & Tanah berhampiran bagi <b>CARA HANTAR PERMOHONAN KE KAUNTER</b>. Permohonan Tidak Akan Diproses Tanpa Penghantaran Borang Permohonan yang Lengkap</h4></p>';
									$text = '';
								
									$tbColumn = array();
									$tbColumn[] = array('Bil', 15);
									$tbColumn[] = array('Pilihan Pertama', 15);
									$tbColumn[] = array('Jenis Pilihan Pertama', 30);
									$tbColumn[] = array('Pilihan Kedua', 15);
									$tbColumn[] = array('Jenis Pilihan Kedua', 30);
									$tbColumn[] = array('Pilihan Ketiga', 15);
									$tbColumn[] = array('Jenis Pilihan Ketiga', 30);
									
									$userBtn = '';
									createTable('bantuan_table', $tbColumn, '', $text, 0, $userBtn, 'ajax-modal', 12);
								?>
								<!--end::Body-->
							</div>
							<!--end::List Widget 11-->
						</div>
					</div>
				<?php
				}
				?>
			<!--end::Row-->
			<!--end::Dashboard-->
		</div>
		<!--end::Container-->
	</div>
	<!--end::Entry-->
</div>
<!--end::Content-->
					
<?php 
require('includes/footer.php');
?>	

<script>
var ajaxUrl_bantuan = "index_pemohon-bantuan_ajax.php";
function getData()
{
	return {
		sqlOnly: 0,
	};
}

function reloadTable_bantuan()
{
	reinitTable('bantuan_table', this.ajaxUrl_bantuan, this.getData(), 1, 0);
}

$(document).ready(function(){  

	$('#ajax-modal').on('shown.bs.modal', function () {  // this is to clear modal cache each time modal load
	 $(this).removeData('bs.modal');
	}); 
	
	initTable('bantuan_table', ajaxUrl_bantuan, getData(), 1, 0);
});
</script>
