<input type="hidden" id="baseurl" value="<?php echo base_url(); ?>" >
<div class="row">
    <div class="col-md-12">
        <div class="hs_heading medium">
            <h3>Blogs (<?php if(!empty($all_blogs)) { echo count($all_blogs); }else{ echo 0; } ?>) <a href="<?= base_url('admin/add_blog') ?>" class="btn">Add new</a></h3>
        </div>
        <div class="hs_datatable_wrapper">
            <table class="hs_datatable table table-bordered">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Title</th>
                        <th>Category</th>
                        <th>Created Date</th>
						<th>Image</th>
                        <th>Status</th>
						<th>Action</th>
                    </tr>
                </thead>
                <tbody>
				<?php 
				$i =0;
				if(!empty($all_blogs)){
					foreach($all_blogs as $blog){
				?>
				    <tr>
                        <td><?php echo ++$i; ?></td>
                        <td width="200">
                            <div class="hs_user">
                               <div class="user_name">
                                    <p><?php echo $blog->blog_title; ?></p>
                               </div>
                            </div>
                        </td>
						 <?php 
						if(!empty($all_blogcate)){ 
							foreach($all_blogcate as $blogcate){ 
								if($blogcate->cate_id == $blog->blog_category){
						?>
								<td><?php echo $blogcate->cate_name; ?></td>
						<?php } 
						   } 
						}
						?>
						<td><?php echo date('d M Y', strtotime($blog->blog_date)); ?></td>
						<td>
							<div class="blog_simg"><img src="<?php echo base_url().$blog->blog_image; ?>" alt="icon"></div>
						</td>
						<td>
							<label class="switch">
								<input id="blogstatus_<?php echo $blog->blog_id; ?>" onclick="change_blog_status(<?php echo $blog->blog_id; ?>);" type="checkbox" value="" <?php if($blog->blog_status == 1){ echo "checked"; } ?> >
								<span class="slider"></span>
							</label>
                        </td>
						<td width="200">
                            <a href="<?php echo base_url().'admin/update_blogs/'.$blog->blog_id; ?>" class="btn" title="Edit"><i class="fa fa-pencil" aria-hidden="true"></i></a>
                            <a href="<?php echo base_url().'admin/delete_blogs/'.$blog->blog_id; ?>"  class="btn" title="Delete" onclick="return delete_confirmation()"><i class="fa fa-trash" aria-hidden="true"></i></a>
                        </td>
				  </tr> 
            <?php 
				}
			}
            ?>				
                </tbody>
            </table>
        </div>
    </div>
</div>