<!DOCTYPE html>
<html>
<head>
<title>RESULT VIEWER</title>
<script src="<?php echo base_url(); ?>backend/custom/jquery.min.js"></script>
<link rel="stylesheet" href="<?php echo base_url(); ?>backend/bootstrap/css/bootstrap.min.css">
<script src="<?php echo base_url(); ?>backend/bootstrap/js/bootstrap.min.js"></script>
</head>
<body style="background:url('<?php echo base_url()?>/backend/usertemplate/assets/img/backgrounds/user15.jpg') 100%;">
<div class="content-wrapper" style="min-height: 500px;">
	<!--
    <section class="content-header">
        <h1>
            <i class="fa fa-map-o"></i> SIGNATURES <small><?php echo $this->lang->line('student_fee1'); ?></small> </h1>
			<?php 
		//	echo "<pre>"; 
		//	print_r($gradeList);			
		//	echo "</pre>"; 
			?>

		<div style='color:red;'>			

		</div>
			
    </section>
	
	-->



					<!--
						
						<form method='POST' enctype="multipart/form-data" action="<?php echo site_url('admin/signatures/create') ?>">
                        <div class="box-body">
                            <div class="row">                             
                                <?php echo $this->customlib->getCSRF(); ?>
								
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">Upload Signature:</label>
										<input type='file' name='upload_sign' style='display:block;opacity: 1;' />
                                    </div>
                                </div>
								                                <div class="col-md-4" style='display:;'>
                                    <div class="form-group" >
                                        <label for="exampleInputEmail1"><?php echo $this->lang->line('exam_name'); ?></label>

                                        <select autofocus="" id="exam_id" name="exam_id" class="form-control" >
                                            <?php
                                            foreach ($examlist as $exam) {
                                                ?>
                                                <option value="<?php echo $exam['id'] ?>" <?php
                                                if ($exam_id == $exam['id']) {
                                                    echo "selected = selected";
													$current_term = $exam['name'];
                                                }
                                                ?>><?php echo $exam['name'] ?></option>
                                                        <?php
                                                        $count++;
                                                    }
                                                    ?>		
                                        </select>
                                        <span class="text-danger"><?php echo form_error('exam_id'); ?></span>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1"><?php echo $this->lang->line('class'); ?></label>
                                        <select  id="class_id" name="class_id" class="form-control" >
                                            <option value=""><?php echo $this->lang->line('select'); ?></option>
                                            <?php
                                            foreach ($classlist as $class) {
                                                ?>
                                                <option value="<?php echo $class['id'] ?>" <?php
                                                if ($class_id == $class['id']) {
                                                    echo "selected =selected";
													$current_class = $class['class'];
                                                }
                                                ?>><?php echo $class['class'] ?></option>

                                                <?php
                                                $count++;
                                            }
                                            ?>
											<option value="0">Head of School</option>
                                        </select>
                                        <span class="text-danger"><?php echo form_error('class_id'); ?></span>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1"><?php echo $this->lang->line('section'); ?></label>
                                        <select  id="section_id" name="section_id" class="form-control" >
                                            <option value=""><?php echo $this->lang->line('select'); ?></option>
                                        </select>
                                        <span class="text-danger"><?php echo form_error('section_id'); ?></span>
                                    </div>
                                </div>
								
								<div class="col-md-4">
                                    <div class="form-group">		
																	
										<input type='submit' name='sub_sig' value='UPLOAD' />
                                    </div>
                                </div>
								
                            </div>
                        </div>
                   
						
						</form>
						
					-->
						
	<?php
		//echo "<pre>";
		//	print_r($classlist);
		//	print_r($sectionlist);
		//	print_r($classsectionlist);
		//echo "</pre>";
	?>	

<?php
	$setting_name = $setting['name'];
	$setting_email = $setting['email'];
	$setting_phone = $setting['phone'];
	$setting_address = $setting['address'];
	$setting_image = $setting['image'];
	
	$school_logo = base_url() . "/uploads/school_content/logo/" . $setting_image;
?>	
					
<div style="">
	<center>
	<h1>
	Online Result Checker
	</h1>
	<div style='background:white;width:400px;border:1px grey solid;border-radius:5px 5px;box-shadow: 2px 2px 2px grey;'>
	<h2>
		<img src="<?php echo $school_logo; ?>" height="150px" /> <br />
		<?php echo $setting_name; ?>
	</h2>
    <table>
          <tr><td  style='text-align:right;'>	Admission No:</td><td> <input name='adm_no' id='adm_no' required /></td></tr>
          <tr><td style='text-align:right;'>	Session:</td><td> <select name='session' id='session'>
              <option value='2018-19'>2018-19</option>
              <option value='2019-20'>2019-20</option>
              <option value='2020-21'>2020-21</option>
              <option value='2022-23'>2022-23</option>
              <option value='2023-24'>2023-24</option>
              <option value='2024-25'>2024-25</option>
              <option value='2025-26'>2025-26</option>
              <option value='2026-27'>2026-27</option>
              <option value='2027-28'>2027-28</option>
              <option value='2028-29'>2028-29</option>
              </select> </td></tr>
          <tr><td style='text-align:right;'>	Term:</td><td> <select name='term' id='term'>
			  <?php
				  foreach ($examlist as $exam) {
					  
					  ?>
					<option value="<?php echo $exam['id'] ?>">  <?php echo $exam['name']; ?> </option>
				  <?php } ?>
              <option value='ANNUAL'>	ANNUAL</option>
              </select>
              </td></tr>
          <tr><td style='text-align:right;'>	Pin :</td><td> <input name='pin_key'  id='pin_key' type='password' required></td></tr>
          <tr><td></td><td>	<input type='submit' class="btn btn-success" onclick="view_result();" id='view_result' name='view_result' value='CHECK'><br /> <br /> </td></tr>
       
	</table>	
    </div>
	
    </center>
</div>
					
                 

<?php

?>


<style>
#dialog {
position:fixed;
top:0px;
left:0px;
width:100%;
height:100%;
background: rgba(0,0,0,0.5);
display:none;
z-index:100000;
}

#dialog_box {
width:50%;
height:50%;
background:white;
overflow: auto;
position:absolute;
border-radius:10px 10px;
border:2px green solid;
z-index:100002;
}

#dialog_head{
opacity:1;
}
</style>

<div id="dialog">

<div id="dialog_box">
<h1 style="margin:0px;text-align:center;" id="dialog_head"></h1>
<div id="dialog_body">

</div>
<center><button class='btn btn-primary btn-sm' onclick="close_dialog()">CLOSE</button></center>
</div>

</div>


<script>
function dialog(head,body){
//$("#dialog").slideDown();
$("#dialog").fadeIn();
$("#dialog_head").html(head);
$("#dialog_body").html(body);
//$("#dialog_box").css("width", "200px");
//alert(document.body.getBoundingClientRect().width);
window_width = document.body.getBoundingClientRect().width;
box_width = Math.round(7/10 * window_width);
box_position_x = Math.round(window_width-box_width)/2;


window_height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;

//window_height = document.body.getBoundingClientRect().height;
box_height = Math.round(9/10 * window_height);
box_position_y = Math.round(window_height-box_height)/2;


if(window_width < 400){box_width = window_width; box_position_x = 0;}
if(window_height < 300){box_height = window_height; box_position_y = 0;}

//$("#dialog").css("display", "");
$("#dialog_box").css("position", "fixed");

$("#dialog_box").css("width", box_width + "px");
$("#dialog_box").css("left", box_position_x + "px");

$("#dialog_box").css("height", box_height + "px");
$("#dialog_box").css("top", box_position_y + "px");


}

function close_dialog(){
$("#dialog").fadeOut();
}
</script>
<script type="text/javascript">
    function getSectionByClass(class_id, section_id) {
        if (class_id != "" && section_id != "") {
            $('#section_id').html("");
            var base_url = '<?php echo base_url() ?>';
            var div_data = '<option value=""><?php echo $this->lang->line('select'); ?></option>';
            $.ajax({
                type: "GET",
                url: base_url + "sections/getByClass",
                data: {'class_id': class_id},
                dataType: "json",
                success: function (data) {
                    $.each(data, function (i, obj)
                    {
                        var sel = "";
                        if (section_id == obj.section_id) {
                            sel = "selected";
                        }
                        div_data += "<option value=" + obj.section_id + " " + sel + ">" + obj.section + "</option>";
                    });
                    $('#section_id').append(div_data);
                }
            });
        }
    }

    $(document).ready(function () {
        $(document).on('change', '#class_id', function (e) {
            $('#section_id').html("");
            var class_id = $(this).val();
            var base_url = '<?php echo base_url() ?>';
            var div_data = '<option value=""><?php echo $this->lang->line('select'); ?></option>';
            $.ajax({
                type: "GET",
                url: base_url + "sections/getByClass",
                data: {'class_id': class_id},
                dataType: "json",
                success: function (data) {
                    $.each(data, function (i, obj)
                    {
                        div_data += "<option value=" + obj.section_id + ">" + obj.section + "</option>";
                    });
                    $('#section_id').append(div_data);
                }
            });
        });
        var class_id = $('#class_id').val();
        var section_id = '<?php echo set_value('section_id') ?>';
        getSectionByClass(class_id, section_id);
        $(document).on('change', '#feecategory_id', function (e) {
            $('#feetype_id').html("");
            var feecategory_id = $(this).val();
            var base_url = '<?php echo base_url() ?>';
            var div_data = '<option value=""><?php echo $this->lang->line('select'); ?></option>';
            $.ajax({
                type: "GET",
                url: base_url + "feemaster/getByFeecategory",
                data: {'feecategory_id': feecategory_id},
                dataType: "json",
                success: function (data) {
                    $.each(data, function (i, obj)
                    {
                        div_data += "<option value=" + obj.id + ">" + obj.type + "</option>";
                    });
                    $('#feetype_id').append(div_data);
                }
            });
        });
    });
    $(document).on('change', '#section_id', function (e) {
        $("form#schedule-form").submit();
    });
</script>

<script>		
    function view_result(){
	//alert('hello');
	//dialog('Upload result','<center>Uploading' + term + ' result for' + admission_no + ' ...' + '</center>'); 
	dialog("RETRIEVING RESULT","<center>Please wait....<br /> <img src='<?php echo base_url()?>/backend/images/loading.gif' width='100px'></center><br /><br /><br /><br />");
		$(document).ready(function(){
	//adm_no,session,term,pin_key,view_result
	
var adm_no = $('#adm_no').val();
var session = $('#session').val();
var term = $('#term').val();
var pin_key = $('#pin_key').val();
var view_result = $('#view_result').val();
		var base_url = "<?php echo base_url()?>";
		var view_url = base_url + 'application/scripts/view_result.php';
				  $.post(view_url,{
					 adm_no:adm_no,
					 pin_key:pin_key,
					 view_result:view_result,
					 session:session,
					 term:term
					  },function(result){
					$("#dialog_body").html(result);
				  });
		});
	}
</script>	
<style>
.gallery{
width:200px; 
float:left; 
padding: 5px;
margin: 5px;
border:3px #eeeeee solid;
text-align:center;
box-shadow: 2px 2px 2px grey;
background: ;
}

.gallery .pname{
width:100%; 
position:relative;
text-align:left;
padding-top:5px;
height:150px;
overflow:auto;
}

.gallery .pphoto{
height:200px;
max-height:200px;
overflow:hidden;
text-align:center;
background:white;
}

.gallery img {
min-width:100%;
max-width:100%;
padding:0px;
margin:0px;
}
p {display:inline;}

</style>

	<div style="text-align:center;">
		Powered by VRabbi SMS &copy; 2018
	</div>
</div>
</body>
</html>