<?php
    //echo "<pre>";print_r($result_subject);
    //echo "<pre>";print_r($result);exit;
    
?>

 <div class="right_col" role="main">

            <div class="row">
               <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                        <div><h2 style="float:none;margin:15px -2px 6px;">Result</h2></div>
                        <div><h4 style="margin-left:0px;"><?php echo $result['exam_name'] ?></h4></div>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
                    </ul>
                  </div>
              
                  <div class="x_content">
                      
                    <div class="row form-horizontal">
                        <div class="col-md-7 col-sm-7 col-xs-12">
                            <div class="">
                                <h4 class="col-md-2 col-sm-2 col-xs-12"><strong>SID.</strong></h4>
                                <h4 class="col-md-10 col-sm-10 col-xs-12"><?php echo $result['p_no']; ?></h4>
                            </div>
                            <div class="">
                                <h4 class="col-md-2 col-sm-2 col-xs-12"><strong>Student</strong></h4>
                                <h4 class="col-md-10 col-sm-10 col-xs-12"><?php echo $result['student_name']; ?></h4>
                            </div>
                            <div class="">
                                <h4 class="col-md-2 col-sm-2 col-xs-12"><strong>Father</strong></h4>
                                <h4 class="col-md-10 col-sm-10 col-xs-12"><?php echo $result['father_name']; ?></h4>
                            </div>
                            <div class="">
                                <h4 class="col-md-2 col-sm-2 col-xs-12"><strong>Contact</strong></h4>
                                <h4 class="col-md-10 col-sm-10 col-xs-12"><?php echo $result['father_contact']; ?></h4>
                            </div>
                        </div>
                        <div class="col-md-5 col-sm-5 col-xs-12">
                            <div class="">
                                <strong class="control-label col-md-8 col-sm-8 col-xs-8">Exam Start Date:</strong>
                                <strong class="control-label col-md-3 col-sm-3 col-xs-12"><?php echo date("d-m-Y",strtotime($result['start'])); ?></strong>
                            </div>
                            <div class="">
                                <strong class="control-label col-md-8 col-sm-8 col-xs-8">Exam Start Date:</strong>
                                <strong class="control-label col-md-3 col-sm-3 col-xs-12"><?php echo date("d-m-Y",strtotime($result['end'])); ?></strong>
                            </div>
                        </div>
                    </div>
<!-- ========================================================================================= -->
					
    					  <div class="body">
                            <table class="table table-bordered">
                                <tr style="background: #A8CD1B;color:white;">
                                    <th class="th">SR#</th>
                                    <th class="th">Subject</th>
                                    <th class="th">Total Marks</th>
                                    <th class="th">Obtained Marks</th>
                                    <th class="th">Date</th>
                                    <th class="th">Status</th>
                                </tr>
                                <?php $serial=1;$re=0;$to=0; foreach ($result_subject as $key => $res) { ?>
                                <tr>
                                    <td class="td"><?php echo $serial++; ?></td>
                                    <td class="td"><?php echo $res['subject_name']; ?></td>
                                    <td class="td"><?php echo $res['total_marks'];?> </td>
                                    <td class="td"><?php echo $res['obtained_marks'];?></td>
                                    <td class="td"><?php echo $res['paper_date'];?></td>
                                    <?php if($res['obtained_marks']=="A")
                                     {
                                     ?> <td class="td" style="font-weight:bold;color:red">
                                     <?php echo "Fail";} 
                                     else if($res['obtained_marks']>$res['passing_marks']){
                                     ?> <td class="td" style="font-weight:bold;color:green">
                                    <?php  echo "Pass";} 
                                    else { ?> <td class="td" style="font-weight:bold;color:red">
                                     <?php echo "Fail";}?></td>
                                </tr>
                                <?php } ?>
                            </table>
                            
                    <div class="col-md-6 pull-right"> 

                                <table class=" table table-striped table-bordered dt-responsive nowrap">
                               
                                <tbody>
                                  <tr> 
                                    <th class="heading" style="background: #74AFAD;color:white;">Total Marks</th>
                                    <td style="background: #A8CD1B;color:white;font-weight: bold"><?php echo $result['total_marks'];?></td>
                                  </tr>
                                   <tr> 
                                    <th style="background: #D9853B;color:white;"  class="heading">Obtained Marks</th>
                                    <td style="background: #DF3D82;color:white;font-weight: bold"><?php echo $result['obtained_marks'];?></td>
                                  </tr>
                               
                                </tbody>
                              </table>

                              <table class=" table table-striped table-bordered dt-responsive nowrap">
                               
                                <tbody>
                                  <tr> 
                                    <th style="background:#A8CD1B;color:white; class="heading">Grade</th>
                                    <td style="background:  #585858;color:white;font-weight: bold"><?php echo $result['grade'];?></td>
                                  </tr>
                                   <tr> 
                                    <th style="background: #D9853B;color:white;"class="heading">Position</th>
                                    <td style="background: #DF3D82;color:white;font-weight: bold"><?php echo $result['position'];?></td>
                                  </tr>
                               
                                </tbody>
                              </table>
                            

                              <table class=" table table-striped table-bordered dt-responsive nowrap">
                               
                                <tbody>
                                  <tr> 
                                    <th  style="background: #585858;color:white;" class="heading">Marks </th>
                                    <td style="background:#4A96AD;color:white;font-weight: bold"><?php echo round( ($result['obtained_marks'] / $result['total_marks']) * 100, 1)."%";?></td>
                                  </tr>
                                   <tr> 
                                    <th  style="background: #D9853B;color:white;" class="heading">Attendance </th>
                                    <td style="background: #DF3D82;color:white;font-weight: bold"><?php echo $result['attendance'];?></td>
                                  </tr>
                               
                                </tbody>
                              </table>
                               

                    </div><!-- col-md-6 -->

               
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
<!-- ============================================================================================= -->

  				</div><!-- x_content -->
              </div><!-- x_panel -->
            </div> <!-- col-lg-12 -->
         	</div> <!-- /#row -->  
        </div><!-- right_col -->




<script>
        $(document).ready(function()
        {
            $(document).on("change","#branch",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/classs/role/"+value,{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $("#class").html(pre+d);
                });
            });
            
        });
          $(document).ready(function(){
            $(document).on("change","#class",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/section/role/"+value,{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $("#section").html(pre+d);
                });
            });
            
        });
          $(document).ready(function(){
            $(document).on("change","#class",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/exam/"+value,{},function(d){
                    var pre = '<option value="">Select Exam</opiton>';
                    $("#exam").html(pre+d);
                });
            });
            
        });
    </script>