      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
           View Penalties
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Penalties</a></li>
            <li class="active">View Penalties</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
           <div class="row">         
           
           	 <div class="col-md-12">
              <div class="box box-success">
                <div class="box-header with-border">
                  <h3 class="box-title">List of Penalties</h3>                  
                </div><!-- /.box-header -->  
              <div class="box-body">
                  <table id="viewPenalties" class="table table-bordered table-striped">                    
					<thead>
						<tr>
							<th>S No.</th>
							<th>Name</th>
							<th>Month</th>
							<th>Reason</th>
							<th>Amount</th>
							<th>Status</th>
                            <?php
							$user_type = $this->login_model->user_type();
							 if($user_type == 2)
								echo "<td>Action</td>";
							?>
						</tr>
					</thead>
					<tbody>
                    <?php
					$x=0;
					if($penalties == NULL){?>
					
					<tr>
							<td colspan="6">  There are currently no Members in the system </td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <?php if($user_type == 2)
							echo "<td>Action</td>";
							?>
					
					<?php } else{
					foreach($penalties as $row){$x++;
					?>
					<!-- Start: list_row -->
						<tr>
							<td><?php echo $row->id;?></td>
							<td><?php echo $this->main_model->get_full_name($row->user_id);?></td>
							<td><?php echo date("M Y",$row->date_time);?></td>
							<td><?php echo $row->reason;?></td>
							<td><?php echo $row->amount;?>
							<td><?php echo $status = ($row->status !=1)?"<span class='red' id='status{$row->id}'>Not Paid</span>":"<span class='green'>Paid</span>";?></td>
                            <?php if($user_type == 2)
							echo "<td>
									<a href='javascript:void(0)' onclick = 'check_penalty($row->id);'>
										<span class='green'><i class='fa fa-check fa-2x'></i></span>
									</a>
								</td>";
							?>
						</tr>
                      <?php  }} ?>
					
					<!-- End: list_row -->
					</tbody>
					<tfoot>
						<tr>
							<tr>
							<th>S No.</th>
							<th>Name</th>
							<th>Month</th>
							<th>Reason</th>
							<th>Amount</th>
							<th>Status</th>
                            <?php if($user_type == 2)
							echo "<th>Action</th>";
							?>
						</tr>
						</tr>
					</tfoot>
				</table>
                </div><!-- /closing outer box --> 
                </div><!-- /.box -->   
           	</div>
          </div>   <!-- /.row -->

        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
      
      <script type="text/javascript">
	  	
			function check_penaltyForJAlert(id)
			{
				  var id = id;					  					  
				  var form_data = {'id': id};					  
				  console.log(form_data);
				  $.ajax({ 
					  type 		: 'POST',
					  url 		: url+'penalties/check_penalty', 
					  data 		: form_data, 
					  success 	: function() 
								  {	
									 //window.location.href = url+'penalties/view_penalties';
									 $('#status'+id).removeClass('red').addClass('green').text('Paid');						
								  }
				  });	
			}
			
			function check_penalty(id)
			  {
					var user_id = id;
					$.jAlert({
						'title': 'Change Penalty Status',
						'content': 'Are you sure you want to mark the penalty as paid?',
						'theme': 'blue',
						'size': 'sm',
						'showAnimation': 'fadeInUp',
						'hideAnimation': 'fadeOutDown',
						'btns': {
									'text': 'Mark As Paid',
									'theme': 'green',
									'onClick': function(e,btn){e.preventDefault();check_penaltyForJAlert(id);}
								  }
						 
				   });					  
			  }
	  </script>