<section role="main" class="content-body">
					<header class="page-header">
						<h2>Manage Store Products</h2>
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="<?php echo base_url();?>admin">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Manage Store Products</span></li>
							</ol>
						</div>
					</header>
						<section class="panel">
							<header class="panel-heading">
								<h2 class="panel-title">List of All Store Products</h2>
							</header>
							<div class="panel-body">
								<table class="table table-bordered table-striped mb-none" id="datatable-tabletools" data-swf-path="assets/vendor/jquery-datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf">
        	<thead>
												<tr>
													<th>S.No.</th>
													<th>Photo</th>
													<th>Title</th>
													<th>Category</th>
													<th>Action</th>
												</tr>
											</thead>
			<tbody>
                                            <?php  $i=1;foreach($products as $myad){?>
                                            <tr data-category="active">
													<td data-title=""><?php echo $i;?></td>
             <td data-title="Photo"><img style="width:100px;" src="<?php echo base_url();?>assets/images/products/<?php echo $myad->img;?>" alt=""></td>
                            <td data-title="Title">
                                <h4><?php echo substr($myad->title,0,20);?>
                                <br/><small class="text-warning"><?php echo $myad->pro_title;?></small></h4>
                            </td>
                            <td data-title="Category"><span class="tg-adcategories"><?php 
$mcat=$this->db->get_where("mcategory",array("mid"=>$myad->mid))->row();
$cat=$this->db->get_where("category",array("cid"=>$myad->cid))->row();//print_r($cat);
$scat=$this->db->get_where("subcategory",array("sid"=>$myad->sid))->row();
if(!empty($mcat)){
echo '<b class="text-success">'.$mcat->mcat_name.'</b><br/>';}
if(!empty($cat)){
echo '<b class="text-info">'.$cat->cat_name.'</b><br/>';}
if(!empty($scat)){echo $scat->subcat_name;;}?></span></td>
                        <td data-title="Action">
<div class="tg-btnsactions">
    <?php if($myad->store_p_status==""){$st="Disable";}else{$st="Enable";}?>
                <a href="<?php echo $myad->store_pid;?>" class="btn btn-xs btn-default enable"><?php echo $st;?></a>
   <!-- <a class="btn btn-xs btn-warning" href="<?php echo base_url();?>admin/add_to_store/<?php echo $myad->store_pid;?>/edit"><i class="fa fa-edit"></i></a>-->
    <a class="btn btn-xs btn-danger pro_delete" href="<?php echo $myad->store_pid;?>"><i class="fa fa-trash-o"></i></a>
    <a href="#" class="btn btn-xs btn-success"><i class="fa fa-shopping-cart"></i> Stores</a>
  	<!--<a href="#" title="<?php echo $myad->title;?> Deal" id="<?php echo $myad->store_pid;?>" class="btn btn-xs btn-info deal_pro" data-toggle="modal" data-target="#myModal">Deals</a>-->
</div>
                        </td>
												</tr>
                                            <?php $i++;}?>
                                            </tbody>
        </table>
							</div>
						</section>
				</section>
                <div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog modal-md">

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

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

			
		</section>

		<!-- Vendor -->
        <script>
	$(document).ready(function(){
		$(".deal_pro").click(function(e){e.preventDefault();
			$(".modal-body").html("<h2>Loading...</h2>");
			var pid=$(this).attr("id");
			var title=$(this).attr("title");
			$(".modal-title").text(title);
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/deal_pro',
							 data: {pid:pid},
							 success: function(response){
								 //alert(response);
								 $(".modal-body").html(response);
							 }
							 });
		});
		$(".enable").click(function(e){e.preventDefault();
			var st=$(this).text();
			var id=$(this).attr("href");
			if(st=="Enable"){
			$(this).text("Disable");
			}else{
			$(this).text("Enable");	
			}
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/store_proenable',
							 data: {id:id,st:st},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
		
		$(".in_feat").click(function(){
							var id=$(this).val();
							var v="";
							if ($(this).is(':checked')) {
								var v='yes';
							}
							//alert(v);
							$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/in_feat',
							 data: {v:v,id:id},
							 success: function(response){
								// alert(response);
							 }
							 });
						});
						$(".buy_now").click(function(){
							var id=$(this).val();
							var v="";
							if ($(this).is(':checked')) {
								var v='yes';
							}
							//alert(v);
							$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/buy_now',
							 data: {v:v,id:id},
							 success: function(response){
								// alert(response);
							 }
							 });
						});
						$(".autoclone").click(function(){
							var totc=$('input.autoclone:checked').length;
							if(totc>4){alert("Maximum 4 Auctions can be set in Autoclone");return false;}
							//alert(totc);
							var id=$(this).val();
							var v="";
							if ($(this).is(':checked')) {
								var v='yes';
							}
							//alert(v);
							$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/autoclone',
							 data: {v:v,id:id},
							 success: function(response){
							//	alert(response);
							 }
							 });
						});
		$(".pro_delete").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			var id=$(this).attr("href");$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/store_pro_delete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>
	<script src="<?php echo base_url();?>admin_assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/magnific-popup/magnific-popup.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Specific Page Vendor -->
		<script src="<?php echo base_url();?>admin_assets/vendor/select2/select2.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.init.js"></script>


		<!-- Examples -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.default.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.row.with.details.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.tabletools.js"></script>
</body>
</html>