<div class="page-margin products">
	<div class="row">
		<div class="col-md-2 leftcol"><?php echo Wo_LoadPage("sidebar/left-sidebar"); ?></div>
		<div class="col-md-7 singlecol">
			<?php if ($wo['config']['user_ads'] == 1): ?>
				<div id="sidebar-sticky-funding">
					<?php 
					  $wo['sidebar-ad'] = Wo_GetAdsByType('funding');
					  if (!empty($wo['sidebar-ad'])) {
					  	echo Wo_LoadPage('ads/includes/funding-ad');
					  }
					?>
					<div class="clear"></div>
				</div>
		    <?php endif; ?>
			<div class="my_pages_header row">
				<ul class="<?php echo Wo_RightToLeft('pull-left'); ?>">
					<li class="active"><a href="<?php echo Wo_SeoLink('index.php?link1=funding'); ?>" data-ajax="?link1=funding"><?php echo $wo['lang']['funding'] ?></a></li>
					<li><a href="<?php echo Wo_SeoLink('index.php?link1=my_funding'); ?>" data-ajax="?link1=my_funding"><?php echo $wo['lang']['my_funding'] ?></a></li>
				</ul>
				<?php if ($wo['config']['funding_request'] == 'all' || ($wo['config']['funding_request'] == 'verified' && $wo['user']['verified'])) { ?>
					<span class="btn btn-success <?php echo Wo_RightToLeft('pull-right'); ?>">
						<a href="<?php echo Wo_SeoLink('index.php?link1=create_funding');?>" data-ajax="?link1=create_funding"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg></a>
					</span>
				<?php } ?>
			</div>
			<div class="clear"></div>
			<div id="recent-blogs" class="row">
				<?php
					$funding = GetFunding(9);
		               if (count($funding) > 0) {
		                   foreach ($funding as $key => $wo['fund']){
		                       echo Wo_LoadPage('funding/list');
						}
					} 
					else {
						echo '<h5 class="search-filter-center-text empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-dollar-sign"><line x1="12" y1="1" x2="12" y2="23"></line><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path></svg> ' . $wo['lang']['no_funding_found'] . '</h5>';
					}
				?>
			</div>
			<div class="posts_load">
				<?php if (count($funding) >= 8): ?>
				<div class="load-more">
					<button class="btn btn-default text-center pointer load-more-fund" id="hren" >
	                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg> <?php echo $wo['lang']['load_more'] ?>
					</button>
				</div>
				<?php endif ?>
			</div>
		</div>
	</div>
</div>

<script>
jQuery(document).ready(function($) {
    $(".load-more-fund").click(function () {
  		var last_id = (($("div[data-fund-id]").length > 0) ? $("div[data-fund-id]:last").attr('data-fund-id') : 0);
		$.ajax({	  
		     url: Wo_Ajax_Requests_File(),
		     type: 'GET',
		     dataType: 'json',
		     data: {f:"funding",s:"load_fund",offset:last_id},
		     success:function(data){
		        if (data['status'] == 200 && data['html'] != '') {
		            $("#recent-blogs").append(data['html']);
		        }
		        else{
		           $(".posts_load").remove()
		        }
		     }
		});
	});
});
</script>