<script type="text/javascript">
$(document).ready(function(){
    $('#select_all').on('click',function(){
        if(this.checked){
            $('.checkbox').each(function(){
                this.checked = true;
            });
        }else{
             $('.checkbox').each(function(){
                this.checked = false;
            });
        }
    });
    
    $('.checkbox').on('click',function(){
        if($('.checkbox:checked').length == $('.checkbox').length){
            $('#select_all').prop('checked',true);
        }else{
            $('#select_all').prop('checked',false);
        }
    });
});
</script>
<div class="panel panel-default">

    <div class="panel-heading hidden-print">
        <h6 class="panel-title"><i class="fa fa-desktop"></i> Student SMS Information</h6> 
        <a onclick="window.print();" style="cursor:pointer;" class="pull-right btn btn-circle btn-xs btn-default hidden-print"><i class="fa fa-print"></i> Print</a> 					
    </div>

    <div class="panel-body">

        <form action="<?php echo site_url('everbright/studentsmsadd'); ?>" method="post" class="validate hidden-print" role="form">
            <div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Class <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Class --:)" name="sclass" class="select-search">
                        <option value=""></option>

                        <?php
                        $query_invno = $this->main_model->sclass(); 
                        foreach($query_invno as $row_invno):
                        ?>
                        <option value="<?php echo $row_invno['scid']; ?>" >
                            <?php echo $row_invno['name']; ?>
                        </option>													
                        <?php endforeach; ?>
                    </select> 
                </div>

            </div>
			<div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Section <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Class --:)" name="shift_name" class="select-search">
								<option value=""></option>
								<option selected value="1">A</option>
                                <option value="2">B</option>
								<option value="3">C</option>
								<option value="4">D</option>
                    </select> 
                </div>

                
            </div>
			<div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Group Name <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Group --:)" name="section_name" class="select-search">
								<option value=""></option>
								 <option selected value="General">General</option>
                                <option value="Science">Science</option>
								<option value="Commerce">Commerce</option>
								<option value="Arts">Arts</option>
                    </select> 
                </div>

                <div class="col-xs-2">
                    <button type="submit" name="search" value="Search" class="pull-left btn btn-circle btn-xs btn-default"><i class="fa fa-search"></i> Search</button>
                </div>
            </div>
            <hr />
        </form> 



       <?php if(isset($sclass) && $sclass!=0): ?>

          <form action="<?php echo site_url('everbright/studentsms/add'); ?>" method="post" class="form-horizontal validate" role="form">   
            <!-- Arrival_NOC -->
            <div class="row">
                <div class="col-xs-12">
                    <table class="page-setup_ table table-bordered">
                        <caption>
                            <p class="text-center" style="font-size: 13px;">
                                <strong>Class Wise SMS Send</strong>
                            </p>
                        </caption>
                        <thead>
                            <tr>
                                <th>S/L</th> 
<th style="text-align:center;"><input type="checkbox" id="select_all"></th>								
                        <th>Picture</th>   
						<th>Class-Section-Roll</th>
						<th>UI-Name-Group</th>
						<th>Guardian</th>
						<th>Number</th>
                            </tr>
                        </thead>
                        <tbody> 
						<input type="hidden" name="sclass" value="<?php echo $sclass; ?>">
						<input type="hidden" name="shift_name" value="<?php echo $shift_name; ?>">
						<input type="hidden" name="section_name" value="<?php echo $section_name; ?>">
                           <?php 
						$i=1;
						$where1 = "class_name='$sclass'";
						$where2 = "shift_name='$shift_name'";
						$where3 = "section_name='$section_name'";
						$this->db->where($where1);
						$this->db->where($where2);
						$this->db->where($where3);
                        $query = $this->main_model->student();
                        foreach($query as $row):
                        ?>                          
                                     <tr>
						<td> <?php echo $i; ?>
						<td><input style="margin-left:10px; margin-right:-5px;" type="checkbox" class="checkbox" name="sID[]" value="<?php echo $row['sID'];?>"></td>
						   <td><img width="60" src="<?php echo base_url();?>uploads/<?php echo $row['thumb_image']; ?>"></td>
                           
							<td>
							
							<?php 
									$query111 = $this->main_model->sclass();
									foreach($query111 as $row123):
								?>
								<?php if($row['class_name']==$row123['scid']): ?><?php echo $row123['name']; ?><?php endif; ?>
                            <?php endforeach; ?>
							
							
							<br><?php if($row['shift_name']==1): ?><?php echo 'A'; ?><?php else: ?><?php echo 'B'; ?><?php endif; ?>-<?php echo $row['stID']; ?>
							</td>
							 <td><font style="color:#009; font-weight:bold; "><?php echo $row['jbID']; ?></font><br><?php echo $row['name']; ?><br><?php echo $row['section_name']; ?></td>
							<td><?php echo $row['f_name']; ?><br><?php echo $row['m_name']; ?></td>
							<td><?php echo $row['mobile']; ?></td>

                          
                        </tr>
						<?php $i=$i+1; ?>
                        <?php endforeach; ?>                      
                        </tbody>                            
                    </table> 
                </div>
            </div>
            <!-- /Arrival_NOC --> 
<br>			

            <div class="form-group">
                <label class="control-label col-md-1 text-right"><strong>SMS</strong> </label>
                <div class="col-md-11">
                    <textarea type="text" class="form-control" placeholder="SMS" name="sms"></textarea>
                </div>
            </div>
            
            <div class="form-actions text-right">
                <button type="submit" value="Submit" class="btn btn-primary"><i class="fa fa-check"></i> Submit</button>
            </div>
			</form>
           


        <?php endif; ?>

    </div>

</div>
