<?php defined('BASEPATH')or exit("NO DIRECT ACCESS iS ALLOWED");?>

<div class="col-md-12  padding_sidebar">
<div class="row" style="margin-right:0px ;margin-left:0px;">
		<div class="card-head profile-categories_bread">
    	 <!-- <header>Only One Request allowed as per subject in one Month  </header> -->
    		<div class="pull-left"><?php echo  $link;?></div>
    		 <ol class="breadcrumb page-breadcrumb pull-right">
                    <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="<?=site_url('Student')?>">Home</a>&nbsp;
                    <i class="fa fa-angle-right"></i></li>
                    <li><a class="parent-item" href="<?=site_url('Student/program')?>">Program Offered</a>&nbsp;
                    <i class="fa fa-angle-right"></i></li>
                    <li class="active">Subject List</li>
             </ol>
    	</div>
    <div class="card card-topline-purple">
    	<div class="card-head">

    	</div>

 	<div class="table-responsive">
	   <div id="tableContainer2" class="container-tb">
	     <table class="table" style="font-family: sans-serif;font-size: 12px;">
			<thead>
				<tr>
				    <th>#</th>
					<th>Program</th>
					<th>Class</th>
					<th>Subject</th>
					<th>Subject Code</th>
					<th>Action</th>
				</tr>
			</thead>
		   <tbody>
		   <?php if( count($list) ):$sn=1;
                $count = $this->uri->segment(4);
                foreach($list as $lists ):?>
				<tr>
				<td><?php echo  $sn;?></td>
				<td><?php echo  strtoupper($lists->category);?></td>
				<td><?php echo  strtoupper($lists->class);?></td>
				<td><?php echo  strtoupper($lists->subject);?></td>
				<td><?php echo  strtoupper($lists->category_code.$lists->class_code.$lists->subject_code);?></td>
				<?php //echo "<pre>";print_r($request_made);?>
				<td><?php if (!array_key_exists($lists->category_code.$lists->class_code.$lists->subject_code, $request_made)){?>

           <span class="label label-info label-mini" data-toggle="modal" data-target="#myModal-<?=$lists->id?>" style="cursor:pointer;">Send Request</span>
            <div class="modal-wrapper row">
                <div class="pull-left">
                <div class="modal fade" id="myModal-<?=$lists->id?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog">
                	<div class="modal-content">
                	  <div class="modal-header">
                		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                		<h4 class="modal-title" id="myModalLabel">
                		<?php echo  strtoupper($lists->category)." | ".strtoupper($lists->class)." | ".strtoupper($lists->subject);?>
                		<span style="color:#3498db"> | <?php echo  strtoupper($lists->category_code.$lists->class_code.$lists->subject_code);?></span>
                		</h4>
                	  </div>
                	  <div class="modal-body">
                	  	<?php echo form_open("Student/request_for_course_submit",['name'=>'login_form']);?>
                            <?php echo  form_hidden("category_id",$lists->category_id);?>
                            <?php echo  form_hidden("class_id",$lists->class_id);?>
                            <?php echo  form_hidden("subject_id",$lists->id);?>
                            <?php echo  form_hidden("subject_code",$lists->category_code.$lists->class_code.$lists->subject_code);?>
                            <!-- <label>User Messaage</label> -->
                          <p> <input type="text" name="user_message" class="form-control" placeholder="please enter your Message"></p>
                          <!-- <p><input type="submit" name="submit" class="form-control btn-primary" value="Send Message"></p>-->
                      <button type="submit" class="btn blue btn-lg pull-right" style="currsor:pointer;">Send Message</button>
                      </div>

                	  <?php echo form_close();?>
                	</div><!-- /.modal-content -->
                  </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->
                	</div>
                </div>

        <?php }else{?>

                <span class="label label-mini" data-toggle="modal" data-target="#myModal4-<?=$lists->id?>"  onclick="window.location.href='<?=site_url("Student/program/request-status");?>'" style="background: linear-gradient(45deg,#FF5370,#ff869a);cursor:pointer;" >Request sent</span>
           <?php /*?>
            <div class="modal-wrapper row">
                <div class="pull-left">
                <div class="modal fade" id="myModal4-<?=$lists->id?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog">
                	<div class="modal-content">
                	  <div class="modal-header">
                		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                		<h4 class="modal-title" id="myModalLabel"><?php //echo  strtoupper($lists->class);?><span style="color:#3498db"> <?php echo  strtoupper($lists->subject);?></span></h4>
                	  </div>
                	  <div class="modal-body">
                	  	<?php //echo form_open("Student/unbook_class",['name'=>'login_form']);?>
                            <?php //echo  form_hidden("subject_id",$lists->id);?>
            				<?php //echo  form_hidden("class_id",$class_id);?>
                     <div class="modal-footer" style="border:none;">
                     <p>Do you want to Take Request Back ?</p>
                		<!--<button type="button" class="btn default" data-dismiss="modal" style="currsor:pointer;">Close</button>-->
                		<button type="submit" class="btn blue" style="currsor:pointer;">OK</button>
                	  </div>
                      </div>

                	  <?php //echo form_close();?>
                	</div><!-- /.modal-content -->
                  </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->
                	</div>
                </div>
                <?php */?>
        <?php }?></td>

				</tr>
		<?php $sn++;unset($json2);?>
        <?php endforeach; ?>
        <?php else : ?>
        <tr><td><a href="#">No Record Found</a></td></tr>
         <?php endif; ?>
		  </tbody><?php $count++; //echo  $link; ?>

	</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <a class="popper" id="dd" data-popbox="pop1" onmouseover="hello(<?=$lists->id?>)" onmouseout="$('#pop1').empty();" >Hover</a> -->
<script type="text/javascript">

	function hello(id){
		$.ajax({
           type: "POST",
           url: "<?php echo site_url('nokia/po/ajax_view_custom_topic_chapter_id/')?>/" + id,
           data:{action:'call_this'},
           success:function(html) {
             $('#pop1').append(html);
           }
      	});
    }
</script>
<!--
#############
-->
<script>
var moveLeft = 0;
var moveDown = 0;
$('a.popper').hover(function (e) {

   var target = '#' + ($(this).attr('data-popbox'));
   $(target).show();
   moveLeft = $(this).outerWidth();
   moveDown = ($(target).outerHeight() / 2);
}, function () {
   var target = '#' + ($(this).attr('data-popbox'));
   if (!($("a.popper").hasClass("show"))) {
       $(target).hide();
   }
});

$('a.popper').mousemove(function (e) {
   var target = '#' + ($(this).attr('data-popbox'));

   leftD = e.pageX + parseInt(moveLeft);
   maxRight = leftD + $(target).outerWidth();
   windowLeft = $(window).width() - 40;
   windowRight = 0;
   maxLeft = e.pageX - (parseInt(moveLeft) + $(target).outerWidth() + 20);

   if (maxRight > windowLeft && maxLeft > windowRight) {
       leftD = maxLeft;
   }

   topD = e.pageY - parseInt(moveDown);
   maxBottom = parseInt(e.pageY + parseInt(moveDown) + 20);
   windowBottom = parseInt(parseInt($(document).scrollTop()) + parseInt($(window).height()));
   maxTop = topD;
   windowTop = parseInt($(document).scrollTop());
   if (maxBottom > windowBottom) {
       topD = windowBottom - $(target).outerHeight() - 20;
   } else if (maxTop < windowTop) {
       topD = windowTop + 20;
   }

   $(target).css('top', topD).css('left', leftD);
});
$('a.popper').click(function (e) {
   var target = '#' + ($(this).attr('data-popbox'));
   if (!($(this).hasClass("show"))) {
       $(target).show();
   }
   $(this).toggleClass("show");
});

</script>
<style>
.popbox {
   display: none;
   /*position:absolute;*/
 position:fixed; top:2%; right:2%;
   z-index: 99999;
   width: 1000px;
   padding: 0px;
   background: #EEEFEB;
   color: #000000;
   border: 1px solid #4D4F53;
   margin-top: -160px;
   -webkit-box-shadow: 0px 0px 5px 0px rgba(164, 164, 164, 1);
   box-shadow: 0px 0px 5px 0px rgba(164, 164, 164, 1);
}
.popbox h2 {
   background-color: #4D4F53;
   color: #E3E5DD;
   font-size: 14px;
   display: block;
   width: 100%;
   margin: -10px 0px 8px -10px;
   padding: 5px 10px;
}
</style>

 <!-----xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--->
<div id="pop1" class="popbox">

</div>
<!-----xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--->
