<?php
$sid=$this->uri->segment('3');
$student_table='student';
$get_student_info=$this->CertificateModel->get_item_data($sid,$student_table);
if($get_student_info){
    foreach($get_student_info as $student_info){
        
    
?>

<style>
.issue-doc-section{width:100%;height:55px;}
    .doc-item{padding:10px;box-shadow:0 0 5px silver;margin-left:15px;margin-right:15px;border-radius:15px;color:#293A4A;font-weight:600;}
    .doc-link{width:33%;float:left;text-decoration:none;color:#293A4A;text-align:center;}
    .doc-link:hover {text-decoration:none;}
</style>
<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Certificate/dashboard">Certificate</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Certificate/students">Students</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Certificate/students"><?php echo $student_info['student_name'];?></a></li>
            </ul>
            
            <?php $table="student";
            $data_student = $this->NewFeeModel->get_item_data($sid,$table);
            if($data_student){
                $count = 1;
                foreach($data_student as $records){
            ?>
                <div class="table-responsive">
                    <table class="table table-bordered table-striped">
                    <!--<thead>-->
                    <!--<tr><th></th></tr>    -->
                    <!--</thead>    -->
                    <tbody>
                        <tr>
                            <td>Scholar No.</td>
                            <td><?php echo $records['sch_no']; ?></td>
                        </tr>
                        <tr>
                            <td>Student Name</td>
                            <td><?php echo $records['student_name']; ?></td>
                        </tr>
                        <tr>
                            <td>Father's Name</td><td><?php echo $records['father_name'];?></td>
                        </tr>
                        <tr>
                            
                            <td>Class : <?php echo $records['class'];?></td>
                            <td>Section : <?php echo $records['section'];?></td>
                        </tr>
                        <tr>
                            <td>D.O.B. </td>
                            <td><?php echo date('d-M-Y',strtotime($records['dob'])); ?></td>
                        </tr>
                        <tr>
                            <td>Contact No.</td>
                            <td><?php echo $records['contact_no'];?></td>
                        </tr>
                        <tr>
                            <td>Alternate No.</td>
                            <td><?php echo $records['alternate_no'];?></td>
                        </tr>
                        <tr>
                            <td>Address :</td>
                            <td><?php echo $records['address'];?></td>
                        </tr>
                        <tr>
                            <td>Admission Date : </td>
                            <td><?php echo date('d-M-Y',strtotime($records['admission_date']));?></td>
                        </tr>

                    </tbody>
                </table>    
            </div>
            
            <?php
                }
            }
            ?>
            <div class="issue-doc-section mt-3 mb-3 pb-3 pt-3">
                <a href="<?php echo base_url();?>Certificate/issue_student_certificate/<?php echo $sid;?>" class="doc-link mt-3 mb-3" target="_blank">
                    <div class="doc-item">
                        Issue  Bonafied Certificate
                    </div>
                </a>
                <a href="<?php echo base_url();?>Certificate/issue_transfer_certificate/<?php echo $sid;?>" class="doc-link mt-3 mb-3" target="_blank">
                    <div class="doc-item">
                        </svg>  Issue  Transfer Certificate
                    </div>
                </a>    
                <a href="<?php echo base_url();?>Certificate/issue_fee_certificate/<?php echo $sid;?>" class="doc-link mt-3 mb-3" target="_blank">
                    <div class="doc-item">
                        Issue Student  Fee  Certificate 
                    </div>
                </a>
                
            </div>
            <div class="issue-doc-section mt-3 mb-3 pb-3 pt-3">
                <a href="<?php echo base_url();?>Certificate/issue_reimbursment_cea_certificate/<?php echo $sid;?>" class="doc-link mt-3 mb-3" target="_blank">
                    <div class="doc-item">
                        Reimbursment Cea Certificate
                    </div>
                </a>
                
                <a href="<?php echo base_url();?>Certificate/issue_character_certificate/<?php echo $sid;?>" class="doc-link mt-3 mb-3" target="_blank">
                    <div class="doc-item">
                       Issue Character Certificate
                    </div>
                </a>
            </div>
            
            
            
            
            <div class="all-certificates">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th class="sl_no">Sl. No</th>
                            <th>Date</th>
                            <th>Doc Type</th>
                            <th>Issued By</th>
                            <th>Copy</th>
                            <th>View</th>
                            <th>Edit</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $tc_table='student_transfer_certificate';
                        $doc_type='Student-Transfer-Certificate';
                        $all_tc_docs =$this->CertificateModel->get_doc($sid,$doc_type,$tc_table);
                        // $all_tc_docs=$this->CertificateModel->get_data($tc_table);
                        if($all_tc_docs){
                            foreach($all_tc_docs as $tc_docs){
                                $tid=$tc_docs['cat_by'];
                                $staff_table='school_staff';
                                $staff_name='';
                                $staff_info=$this->CertificateModel->get_item_data($tid,$staff_table);
                                if($staff_info){
                                    foreach($staff_info as $staffinfo){
                                        $staff_name=$staffinfo['name'];
                                    }
                                }
                        ?>
                        <tr>
                            <td><?php echo $tc_docs['id'];?></td>
                            <td><?php echo date('d-M-Y',strtotime($tc_docs['issuing_date']));?></td>
                            <td><?php echo $tc_docs['doc_type'];?></td>
                            <td><?php echo $staff_name;?></td>
                            <td><?php echo $tc_docs['doc_copy_order'];?></td>
                            <td><a href="<?php echo base_url();?>Certificate/transfer_certificate/<?php echo $tc_docs['id'];?>" class="btn btn-sm btn-info" target="_blank">View</a></td>
                            <td><a href="<?php echo base_url();?>Certificate/issue_transfer_certificate/<?php echo $tc_docs['sid'].'/'.$tc_docs['id']; ?>" class="btn btn-sm btn-warning" target="_blank">Edit</a></td>
                        </tr>
                        <?php
                            }
                        }
                        ?>
                        <?php
                    $student_bonafied_certificate_table='student_bonafied_certificate';
                    $doc_type1='Student-Bonafied-Certificate';
                        // $all_docs=$this->CertificateModel->get_data($doc_table);
                        $all_docs =$this->CertificateModel->get_doc($sid,$doc_type1,$student_bonafied_certificate_table);
                        if($all_docs){
                            foreach($all_docs as $docs){
                                $tid=$docs['cat_by'];
                                $staff_table='school_staff';
                                $staff_name='';
                                $staff_info=$this->CertificateModel->get_item_data($tid,$staff_table);
                                if($staff_info){
                                    foreach($staff_info as $staffinfo){
                                        $staff_name=$staffinfo['name'];
                                    }
                                }
                        ?>
                        <tr>
                            <td><?php echo $docs['id'];?></td>
                            <td><?php echo date('d-M-Y',strtotime($docs['issuing_date']));?></td>
                            <td><?php echo $docs['doc_type'];?></td>
                            <td><?php echo $staff_name;?></td>
                            <td><?php echo $docs['doc_copy_order'];?></td>
                            <td><a href="<?php echo base_url();?>Certificate/student_certificate/<?php echo $docs['id'];?>" class="btn btn-sm btn-info" target="_blank">View</a></td>
                        </tr>
                        <?php
                            }
                        }
                        ?>
                    </tbody>
                </table>
                
            </div>
            
        </div>
    </div>
</div>
<?php
    }
}
?>