<input type="hidden" id="baseurl" value="<?php echo base_url(); ?>" >
<div class="row">
    <div class="col-md-12">
        <div class="hs_heading medium">
            <h3>Product reviews (<?php if(!empty($all_review)){ echo count($all_review); }else{ echo 0; } ?>)</h3>
        </div>
        <div class="hs_datatable_wrapper">
            <table class="hs_datatable table table-bordered">
                <thead>
                    <tr>
                        <th>#</th> 
                        <th>User name</th>
						<th>User Email</th>
						<th>Product Review</th>
						<th>Rating</th>
						<th>Status</th>
						<th>Action</th>
                    </tr>
                </thead>
                <tbody>
				<?php 
				  $i= 0;
				  if(!empty($all_review)){
				foreach($all_review  as $review){ ?>
					<tr>
						<td><?php echo ++$i; ?></td>
						<?php
							$user_query =$this->Data_access_model->select_data('*',' hs_user',array('user_id'=>$review->rating_uid));
							$uname = '';
							$useremail ='';
							if($user_query->num_rows() > 0){ 
							$user_details = $user_query->row();
								$uname = $user_details->user_name;
								$useremail = $user_details->user_email;
							}  
						?>
						<td><?php echo $uname; ?></td>
						<td><?php echo $useremail; ?></td>
						<td><?php 
							if(strlen($review->rating_review) >= 50) {
							echo substr($review->rating_review, 0, 50); ?>
							 <br><a href="javascript:;" onclick="read_more_comment('<?php echo $review->rating_review; ?>')">Read More...</a>
						<?php }else{
								echo $review->rating_review;
							 }
						?>
						</td>
						<td><?php echo $review->rating_star; ?></td>
						<td>
							<label class="switch">
								<input id="reviewstatus_<?php echo $review->rating_id; ?>" onclick="update_review_status(<?php echo $review->rating_id; ?>);" type="checkbox" value="" <?php if($review->rating_status == 1){ echo "checked"; } ?> >
								<span class="slider"></span>
							</label>
						</td>
						<td width="200">
							<a  href="<?php echo base_url().'admin/delete_review/'.$review->rating_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>


 <!-- read more comment content popup start -->
<div class="modal_box">
<div id="readmore_comment" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"><span>Read</span> Product Review</h4>
            </div>
            <div class="modal-body">
				<div class="hs_input">
                    <label>Review</label>
                    <textarea rows="8" cols=""class="form-control" name="rm_content" id="rm_content" disabled></textarea>
                </div>
			</div>
		</div>
    </div>
</div>
</div>
<!-- read more comment content popup start -->
	
	
	