<!DOCTYPE html>
<html>
    <head>
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@200;300;400;500;600;700&display=swap" rel="stylesheet"> 
        <title>Admit Card</title>
        <style>
            html{padding:0px;margin:0px;}
            body{
                padding:25px;margin:0px;vertical-align:middle;
                font-family: 'Inconsolata', monospace;
            }
            /*.report-card{*/
            /*    border : 2px solid #4F3F83;*/
            /*    height:96%;*/
            /*    border-radius:5px;*/
            /*    margin:0px;*/
            /*    padding:5px;*/
            /*}*/
            /*.report-2{*/
            /*    border:1px solid #4F3F83 !important;*/
            /*    height:97%;*/
            /*    border-radius:5px;*/
                /*background-image: url("<?php echo logo_png; ?>");*/
                /*opacity: 0.1;*/
                /*background-repeat: no-repeat;*/
                /*background-size:auto 40%;*/
                /*background-position: center;*/
            /*}*/
            /*table{border-collapse:collapse;width:100%;}*/
            /*table tr{*/
            /*    border :1px solid !important;*/
            /*    border-collapse:collapse;*/
            /*}*/
            /*tr th{*/
            /*    margin:0px;*/
            /*    padding:2px;*/
            /*    font-size:14px;*/
            /*    font-weight:700;*/
            /*    border :1px solid !important;*/
            /*    border-collapse:collapse;*/
            /*}*/
            /*.report-3{*/
            /*    height:97%;*/
            /*    background-image: url("<?php echo logo_png; ?>");*/
            /*    opacity: 0.1;*/
            /*    background-repeat: no-repeat;*/
            /*    background-size:auto 40%;*/
            /*    background-position: center;*/
            /*}*/
        
            
            
            
            .w-50{
                width:100%;
                height:23%;
                /*float:left;*/
                border:1px solid red;
                margin-bottom:10px;
            }
            .students-data{
                width:100%;
                /*height:250px;*/
                /*border:1px solid red;*/
            }
            tr th{
                text-align:left;
            }
        </style>
    </head>
    <body>
    
    <?php
    $exam_id=$this->uri->segment('3');
    $class=$this->uri->segment('4');
    $section=$this->uri->segment('5');
    

    $exam_table="exam_list";
    $get_exam_data=$this->NewExamModel->get_item_data($exam_id,$exam_table);

    $y1="";
    $y2="";
    $exam_title="";
    if($get_exam_data){
        foreach($get_exam_data as $exam_data){
            $y1=$exam_data['y1'];
            $y2=$exam_data['y2'];
            $exam_title=$exam_data['exam_title'];
        }
    }

    $acedemic_session=$this->session->userdata('acedemic_session');
    $all_students=$this->NewExamModel->get_students_ac_session_by_course_and_class($acedemic_session,$class,$section);

    $scount=0;

    if($all_students){
        foreach($all_students as $data){
            $sid=$data['sid'];
            $course_id=$data['course_id'];
            $student_table='student';
            $get_student_data=$this->NewExamModel->get_item_data($sid,$student_table);
            if($get_student_data ){
                foreach($get_student_data as $students){
                    if($students['status'] ==1){
                        $admit_card_table="admin_card_list";
                        $get_course_and_exam_admit_card=$this->NewExamModel->get_course_exam_admit_card($course_id,$exam_id,$acedemic_session,$admit_card_table);
                    
                        if($get_course_and_exam_admit_card){
                            foreach($get_course_and_exam_admit_card as $admit_card){
                            
                                $tid="";
                                $get_class_teacher_data=$this->WelcomeModel->get_class_teacher_for_class_section($class,$section,$acedemic_session);
                                if($get_class_teacher_data){
                                    foreach($get_class_teacher_data as $teacher_info){
                                        $tid=$teacher_info['class_teacher'];
                                    }
                                }
                            $teachers_sign="";
                            $teacher_table="school_staff";
                            $get_teacher_data=$this->WelcomeModel->get_item_data($tid,$teacher_table);
                            if($get_teacher_data){
                                foreach($get_teacher_data as $teacher_data){
                                    $teachers_sign=$teacher_data["signature"];        
                                }
                            }
                    //     }

                    // }
?>
                <div class="w-50">
                    <div class="students-data">
                    <div>
                    <table class="table" style="width:100%;border-bottom:2px solid #4F3F83;width:100%;">
                        <tr>
                            <th style="width:15%;border:none !important;text-align:center;">
                                <img src='<?php echo logo_png; ?>' style="width:auto;height:40px;" />
                            </th>
                            <th style="width:75%;border:none !important;">
                                <p style="padding:0px; margin:0px;font-size:26px;text-align:center;font-weight:900;color:#29166f;"><?php echo school_full_name; ?></p>
                                <p style='padding:0px; margin:0px;text-align:center;color:#29166f;font-size:18px;'><b>Affiliated to ICSE / ISC</b></p>
                                
                                <p style='padding:0px; margin:0px;text-align:center;color:#29166f;font-size:18px;'><b>Admit Card - <?php echo $exam_title; ?> <?php echo $y1; ?>-<?php echo $y2; ?></b></p>
                            </th>
                            <th style="width:15%;">
                                
                            </th>
                        </tr>
                    </table>
                    
                    <table style="width:100%;">
                        <tr>
                            <th colspan="3" style="border-bottom:1p dotted red;">Student's Name : <?php echo $students['student_name']; ?></th>
                            <th style="border-bottom:1p dotted red;">Class : <?php echo $class."-".$section; ?></th>
                        </tr>
                        <tr>
                            <th colspan="2" style="border-bottom:1p dotted red;width:50%;">Father's Name : <?php echo $students['father_name']; ?></th>
                        <!--</tr>-->
                        
                        <!--<tr>-->
                            <th colspan="2" style="border-bottom:1p dotted red;width:50%;">Mother's Name : <?php echo $students['mother_name']; ?></th>
                        </tr>
                        
                        <tr>
                            <!--<th colspan="2" style="border-bottom:1p dotted red;">Date of issue : <?php echo date('d-m-Y',strtotime($admit_card['issue_date'])); ?></th>-->
                            <th colspan="4" style="border-bottom:1p dotted red;">Valid till : <?php echo date('d-m-Y',strtotime($admit_card['end_date'])); ?></th>
                        </tr>
                        
                        <tr>
                            <!--<th style="text-align:center;vertical-align:bottom;"><br><br>Clerk's Signature</th>-->
                            <th colspan="2" style="text-align:center;vertical-align:bottom;">
                            <?php
                            if($teachers_sign !=""){
                            ?>
                            <img src="<?php echo base_url(); ?>assets/signature/<?php echo $teachers_sign; ?>" style="height:40px;width:100px;"><br>
                            <?php }else{ echo "<br>"; } ?>    
                                
                            Class Teacher's Signature</th>
                            
                            <th colspan="2" style="text-align:center;vertical-align:bottom;padding-top:5px;">
                                <p style="padding:0px;margin:0px;"><img src="<?php echo base_url().PrincipalSign; ?>" style="height:40px;width:100px;"></p>
                                <p style="padding:0px;margin:0px;">Principal's Signature</p>
                            </th>
                        </tr>
                    </table>
                    </div>
                </div>
            </div>
<?php
        
                        }
                    }
                    
                }
            }
        }
    }
}
?>

    </body>
</html>    