         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		  $(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		  	    var status = $(this).data('status');
		   $("#status").val(status); 
		  
		   
        });
		
		
		
		
    </script>   

 
 <div class="row">
  
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> View Sms Template</span>					                   
						 <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add SMS Template </a>

														 <a href="<?php echo base_url(). "user/viewsms"; ?>" class="btn btn-info">Go to sms window</a>

            	</div>
            </div>
			<div class="panel-body">

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP

 $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
				echo $this->session->flashdata('msg');
				echo $this->session->flashdata('deletemsg'); 
				
								?>	
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
     <th>No#</th>
     <th>Name</th>
	   
	  <th>Description</th>	 
	  <th>Status</th>	 

	<td> more</td>	
	

                 </tr>
             </thead><tbody>
<?php

 if(!is_array($viewtemplate)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='4'>";
    
       echo '<div class="alert alert-warning text-center">You can add sms template. These are sms used more oftenly hence you can just store them here and copy them every time you want send sms.</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($viewtemplate as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>

              


  <td><?php echo $c->id ; ?></td>
  <td><?php echo $c->name ; ?></td>
     <td><?php echo $c->description ; ?></td>
     <td><?php echo $c->status ; ?></td>

 
			 <td> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									<?php
										if($usertype=="admin"){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                     	  <li> 

	 <a class="btn btn-primary editbtn" id="editbtn" data-status='<?php echo  $c->status;?>' data-name='<?php echo  $c->name;?>' data-description='<?php echo  $c->description;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
		 
		 
		 
		 
		 
             </tr>

	<?php endforeach;} ?>

             
<tbody>
        </table>

									
									
									
					</div>	
					
					
					
					
					
					
					
					
					
					
					
					
					

					<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('adminlogged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="smstemplate">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewsmstemplate">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>



<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update Category/group</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updateSmstemplate' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
	<input type="hidden" name="mycategoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">
			  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	SMS	Title </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" id="name" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	SMS Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  id="description" class="form-control" required  placeholder="Enter SMS description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		
		
 
  
       <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status" id="status"required>
	
	<option value="" selected></option>
		<option value=""  >---Select Status---</option>
		<option value="active"  >Active</option>
		<option value="inactive"  >Inactive</option>
		<option value="visitor"  > Visitor</option>
		<option value="gatepass"  > Gatepass SMS</option>

	

</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>
  	

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="smstemplate" name="btn_updatesmstemplate" class="btn btn-primary"> Update Category   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>




















  
<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Add new SMS Template</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addsmstemplate' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
				  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">SMS	Title </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	SMS Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  required class="form-control"  placeholder="Enter SMS description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="smstemplate" name="btn_addsmstemplate" class="btn btn-primary"> Add  SMS template   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>





					
									
									
							</div>		
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
		
		
  

 
</div>


















