<section role="main" class="content-body">
    <header class="page-header">
        <h2>Manage Offline Payments</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 Offline Payments</span></li>
            </ol>
        </div>
    </header>
    <section class="panel">
        <header class="panel-heading">
            <h2 class="panel-title">List of All Bids Purchased</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>User</th><th>Trans.DateTime</th><th>Trans.ID</th><th>Resp.Code</th><th>Amount</th><th>Status/Payment Ref./Method</th><th>Plan</th><th>Action</th></tr></thead>
<tbody>
    <?php $i=1;foreach($bid_trans as $btr){?>
    <tr><td><?php echo $i;?></td>
    <td><?php echo $btr->first_name.' '.$btr->last_name;?></td>
    <td><?php echo date("d M'y H:i a",strtotime($btr->trans_date));?></td>
        <td><?php echo $btr->trans_id;?></td><td><?php echo $btr->resp_code;?></td>
<td><?php if($btr->currency=="NAIRA"){echo "₦".$btr->amount;}else{echo '<i class="fa fa-'.strtolower($btr->currency).'"></i>'.$btr->amount/100;}?></td>
        <td><?php if($btr->trans_desc=="Approved Successful"){?>
        <label class="label label-success"><?php echo $btr->trans_desc;?></label>
        <?php }else if($btr->trans_desc==""){?>
        <label class="label label-warning">Transaction Pending</label>
        <?php }else{?><label class="label label-danger"><?php echo $btr->trans_desc;?></label>
        <?php }?><br />
        <?php echo $btr->payment_ref;if($btr->currency=="NAIRA"){?><br/><label class="label label-primary">InterSwitch</label><?php }else{?><br/><label class="label label-info">PayPal</label><?php }?></td>
        <td><?php echo $btr->plname.' Plan <br/>'.$btr->credits;?> BidCoin</td>
        <td>
<a href="#" id="<?php echo $btr->purid;?>" class="btn btn-xs btn-warning trans_refresh"><i class="fa fa-refresh"></i> Requery</a></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">Auction Fields</h4>
      </div>
      <div class="modal-body"></div>
    </div>
  </div>
</div>
</div>

    
</section>
<script>
$(document).ready(function(){
	$(".trans_refresh").click(function(e){e.preventDefault();
		var id=$(this).attr("id");
		$.ajax({
						 type: "POST",
						 url: '<?php echo base_url();?>admin/trans_refresh',
						 data: {id:id},
						 success: function(response){
							console.log(response);
							alert(response);
						 }
						 });
	});
	$(".auction").click(function(e){e.preventDefault();
		var pid=$(this).attr("id");
		var title=$(this).attr("title");
		$(".modal-title").text(title);
		$.ajax({
						 type: "POST",
						 url: '<?php echo base_url();?>admin/set_auction',
						 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/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);
						 }
						 });
					});
	$(".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/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>