<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="keyword" content="<?php echo $page_data['meta_keyword']; ?>">
		<meta name="description" content="<?php echo $page_data['meta_description']; ?>">
		<!-- Favicon -->
		<link rel="shortcut icon" href="<?php echo base_url('uploads/frontend/images/' . $cms_setting['fav_icon']); ?>">
		<title><?php echo $page_data['page_title']; ?></title>
		<!-- Bootstrap -->
		<link href="<?php echo base_url() ?>assets/frontend/css/bootstrap.min.css" rel="stylesheet">
		<!-- Template CSS Files  -->
		<link rel="stylesheet" href="<?php echo base_url('assets/vendor/font-awesome/css/all.min.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/frontend/plugins/animate.min.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/responsive.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/owl.carousel.min.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/vendor/select2/css/select2.min.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/vendor/sweetalert/sweetalert-custom.css');?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/frontend/plugins/magnific-popup/magnific-popup.css'); ?>">
		<link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/style.css'); ?>">
		<script src="<?php echo base_url('assets/vendor/jquery/jquery.min.js'); ?>"></script>
		<!-- If user have enabled CSRF proctection this function will take care of the ajax requests and append custom header for CSRF -->
		<script type="text/javascript">
			var base_url = "<?php echo base_url(); ?>";
			var csrfData = <?php echo json_encode(csrf_jquery_token()); ?>;
			$(function($) {
				$.ajaxSetup({
					data: csrfData
				});
			});
		</script>
		<!-- Google Analytics --> 
		<?php echo $cms_setting['google_analytics']; ?>
		
		<!-- Theme Color Options -->
		<script type="text/javascript">
			document.documentElement.style.setProperty('--thm-primary', '<?php echo $cms_setting["primary_color"] ?>');
			document.documentElement.style.setProperty('--thm-hover', '<?php echo $cms_setting["hover_color"] ?>');
			document.documentElement.style.setProperty('--thm-text', '<?php echo $cms_setting["text_color"] ?>');
			document.documentElement.style.setProperty('--thm-secondary-text', '<?php echo $cms_setting["text_secondary_color"] ?>');
			document.documentElement.style.setProperty('--thm-footer-text', '<?php echo $cms_setting["footer_text_color"] ?>');
			document.documentElement.style.setProperty('--thm-radius', '<?php echo $cms_setting["border_radius"] ?>');
		</script>
	</head>
	<body>











<style type="text/css">
    #print {
        margin-bottom: 20px;
        margin-top: 0px;
        padding: 2px 15px;
        font-size: 14px;
        font-weight: 500;
    }
</style>

<!-- Breadcrumb Starts -->
<div class="container px-md-0 main-container">
<div class="row">
    <div class="col-md-12">
        <div class="box2 form-box">
	        <?php
	        if($this->session->flashdata('success')) {
	            echo '<div class="alert alert-success"><i class="icon-text-ml far fa-check-circle"></i>' . $this->session->flashdata('success') . '</div>';
	        }
	        ?>
        	<div id="card_holder">
                <button type="button" class="btn btn-1" id="print"><i class="fas fa-print"></i> <?=translate('print')?></button>
                <div id="card">
				<style type="text/css">
					@media print {
						.pagebreak {
							page-break-before: always;
						}
					}
					.mark-container {
					    background: #fff;
					    width: 1000px;
					    position: relative;
					    z-index: 2;
					    margin: 0 auto;
					    padding: 20px 30px;
					}
					table {
					    border-collapse: collapse;
					    width: 100%;
					    margin: 0 auto;
					}
		            .status-list {
		                margin: 0;
		                padding: 0;
		                list-style: none;
		            }
		            .status-list li {
		                display: inline-block;
		                text-align: center;
		                border: 1px solid #ddd;
		                padding: 9px 14px;
		                border-radius: 4px;
		                font-size: 13px;
		                margin-top: 0.5rem;
		                background-color: #cff4fc;
		            }
		            .status-list li span {
		                font-weight: bold;
		                display: block;
		            }
				</style>
				<?php $getSchool = $this->db->where(array('id' => $student['branch_id']))->get('branch')->row_array(); ?>
					<div class="mark-container">
						<table border="0" style="margin-top: 20px; height: 100px;">
							<tbody>
								<tr>
									<td style="width:40%;vertical-align: top;"><img style="max-width:225px;" src="<?=$this->application_model->getBranchImage($student['branch_id'], 'report-card-logo')?>"></td>
									<td style="width:60%;vertical-align: top;">
										<table align="right" class="table-head text-right" >
											<tbody style="text-align: right;">
												<tr><th style="font-size: 26px;" class="text-right"><?=$getSchool['school_name']?></th></tr>
												<tr><td><?=$getSchool['address']?></td></tr>
												<tr><td><?=$getSchool['mobileno']?></td></tr>
												<tr><td><?=$getSchool['email']?></td></tr>
											</tbody>
										</table>
									</td>
								</tr>
							</tbody>
						</table>
						<h4 style="padding-top: 30px">Admission Form (Student Copy)</h4>
						<ul class="status-list">
							<li>Reference No<span><?php echo empty($student['reference_no']) ? "N/A" : $student['reference_no']; ?></span></li>
							<li>Admission Status <?php
								if ($student['status'] == 1)
									$status = '<span class="text-info">' . translate('under_review') . '</span>';
								else if ($student['status']  == 2)
									$status = '<span class="text-success">' . translate('approved') . '</span>';
								else if ($student['status']  == 3)
									$status = '<span class="text-danger">' . translate('declined') . '</span>';
								echo ($status);
								?></li>
							<li>Payment Status<?php if ($student['payment_status'] == 0) { ?>
							    <span class="text-warning">Unpaid</span>
							    <?php } else if ($student['payment_status'] == 1) { ?>
							    <span class="text-success">Paid</span>
							    <?php } ?></li>
						</ul>

						<table class="table table-condensed table-bordered" style="margin-top: 20px;">
							<tbody>
								<tr>
									<th>Admission ID</td>
									<td colspan="2"><?=$student['id'] ?></td>
									<th>Apply Date</td>
									<td colspan="2"><?=_d($student['apply_date'])?></td>
								</tr>
								<tr>
									<th>Academic Session</td>
									<td><?=get_type_name_by_id('schoolyear', get_global_setting('session_id'), "school_year")?></td>
									<th>Class</td>
									<td colspan><?=$student['class_name'] ?></td>
									<th>Section</td>
									<td><?=(empty($student['section_name'])) ? "N/A" : $student['section_name'] ?></td>
								</tr>
							</tbody>
						</table>

						<table class="table table-condensed table-bordered" style="margin-top: 20px;">
							<tbody>
								<tr>
									<th>First Name</td>
									<td><?=$student['first_name']?></td>
									<th>Last Name</td>
									<td><?=$student['last_name']?></td>
									<th>Gender</td>
									<td><?=ucfirst($student['gender'])?></td>
								</tr>
								<tr>
									<th>Date of Birth</td>
									<td><?=_d($student['birthday'])?></td>
									<th>Mobile No</td>
									<td><?=$student['mobile_no'] ?></td>
									<th>Email</td>
									<td><?=$student['email']?></td>
								</tr>
								<tr>
									<th>Father Name</td>
									<td><?=(empty($student['father_name'])) ? "N/A" : $student['father_name'] ?></td>
									<th>Apply Date</td>
									<td colspan="4"><?=_d($student['apply_date'])?></td>								</tr>
								<tr>
									<th>Mother Name</td>
									<td><?=(empty($student['mother_name'])) ? "N/A" : $student['mother_name'] ?></td>
									<th>Class</td>
									<td><?=$student['class_name']?></td>
									<th>Section</td>
									<td><?=(empty($student['section_name'])) ? "N/A" : $student['section_name'] ?></td>
								</tr>
								<tr>
									<th>Present Address</td>
									<td colspan="2"><?=(empty($student['present_address'])) ? "N/A" : $student['present_address'] ?></td>
									<th>Permanent Address</td>
									<td colspan="2"><?=(empty($student['permanent_address'])) ? "N/A" : $student['permanent_address'] ?></td>
								</tr>
						<?php 
						$show_custom_fields = custom_form_table('student', $student['branch_id']);
						if (!empty($show_custom_fields)) {
							foreach(array_chunk($show_custom_fields, 3) as $linkGroup) { 
								$colspan = "";
								$groupNo = count($linkGroup);
								if ($groupNo < 3) {
									$colspan = " colspan= '" . (6 - $groupNo) . "'";
								} ?>
								<tr>
									<?php
										$i = 1;
										foreach($linkGroup as $link) {
									?>
									<th><?php echo $link['field_label'] ?></th>   
									<td<?php echo ($groupNo == $i ? $colspan : ''); ?>><?php echo get_online_custom_table_custom_field_value($link['id'], $student['id']);?></td>        
									<?php $i++; } ?>
								</tr>
						<?php } } ?>
							</tbody>
						</table>
						<table class="table table-condensed table-bordered" style="margin-top: 20px;">
							<tbody>
								<tr>
									<th>Relation</td>
									<td><?=(empty($student['guardian_relation'])) ? "N/A" : $student['guardian_relation'] ?></td>
									<th>Guardian Name</td>
									<td><?=(empty($student['guardian_name'])) ? "N/A" : $student['guardian_name'] ?></td>
									<th>Father Name</td>
									<td><?=(empty($student['father_name'])) ? "N/A" : $student['father_name'] ?></td>
								</tr>
								<tr>
									<th>Mother Name</td>
									<td><?=(empty($student['mother_name'])) ? "N/A" : $student['mother_name'] ?></td>
									<th>Guardian Email</td>
									<td><?=(empty($student['grd_email'])) ? "N/A" : $student['grd_email'] ?></td>
									<th>Guardian Mobile No</td>
									<td><?=(empty($student['grd_mobile_no'])) ? "N/A" : $student['grd_mobile_no'] ?></td>
								</tr>
								<tr>
									<th>Guardian Address</td>
									<td colspan="6"><?=(empty($student['grd_address'])) ? "N/A" : $student['grd_address'] ?></td>
								</tr>
							</tbody>
						</table>
						<?php if ($student['payment_status'] == 1) {
							$paymentDetails = json_decode($student['payment_details'], true);

							?>
						<h4 style="padding-top: 30px">Payment Details</h4>
						<table class="table table-condensed table-bordered" style="margin-top: 20px;">
							<tbody>
								<tr>
									<th>Paid Amount</td>
									<td><?=$student['symbol'] . " " .  $student['payment_amount'] ?></td>
									<th>Payment Method</td>
									<td colspan="2"><?=ucfirst($paymentDetails['payment_method'])?></td>
								</tr>
							</tbody>
						</table>
						<?php } ?>
					</div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('#print').on('click', function(e){
            var oContent = document.getElementById('card').innerHTML;
		    var frameDoc=window.open('', 'document-print');
		    frameDoc.document.open();
		    //create a new HTML document.
		    frameDoc.document.write('<html><head><title></title>');
		    frameDoc.document.write('<link rel="stylesheet" href="' + base_url + 'assets/vendor/bootstrap/css/bootstrap.min.css">');
		    frameDoc.document.write('<link rel="stylesheet" href="' + base_url + 'assets/css/custom-style.css">');
		    frameDoc.document.write('<link rel="stylesheet" href="' + base_url + 'assets/css/ramom.css">');
		    frameDoc.document.write('</head><body onload="window.print()">');
		    frameDoc.document.write(oContent);
		    frameDoc.document.write('</body></html>');
		    frameDoc.document.close();
		    setTimeout(function () {
		        frameDoc.close();      
		    }, 5000);
        });
    });
</script>































<a href="#" class="back-to-top"><i class="far fa-arrow-alt-circle-up"></i></a>
<!-- JS Files -->
<script src="<?php echo base_url('assets/frontend/js/bootstrap.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/frontend/js/owl.carousel.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/frontend/plugins/shuffle/jquery.shuffle.modernizr.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/vendor/select2/js/select2.full.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/vendor/sweetalert/sweetalert.min.js');?>"></script>
<script src="<?php echo base_url('assets/frontend/plugins/magnific-popup/jquery.magnific-popup.min.js');?>"></script>
<script src="<?php echo base_url('assets/frontend/js/jquery.marquee.min.js');?>"></script>
<script src="<?php echo base_url('assets/frontend/js/custom.js'); ?>"></script>

<?php
$alertclass = "";
if($this->session->flashdata('alert-message-success')){
    $alertclass = "success";
} else if ($this->session->flashdata('alert-message-error')){
    $alertclass = "error";
} else if ($this->session->flashdata('alert-message-info')){
    $alertclass = "info";
}
if($alertclass != ''):
    $alert_message = $this->session->flashdata('alert-message-'. $alertclass);
?>
<script type="text/javascript">
    swal({
        toast: true,
        position: 'top-end',
        type: '<?php echo $alertclass?>',
        title: '<?php echo $alert_message?>',
        confirmButtonClass: 'btn btn-1',
        buttonsStyling: false,
        timer: 8000
    })
</script>
<?php endif; ?>


	</body>
</html>