{extends file="views/layout.tpl"}

{block name="content"}
	<section class="container mt-5 p-5 d-flex flex-column align-items-center text-center">
		<h1 class="logo">Folliow</h1>
		<h2>Là où les talents rencontrent leur avenir</h2>
		<p class="col-6">Une plateforme de portfolio adapté à vos besoins et aux besoins des entreprises. 
			Créer un portfolio réellement pertinent aux exigences du marché et rentrez 
			directement en contact avec les entreprises.</p>
	</section>

	<section class="container mt-5 p-5 d-flex flex-column align-items-center text-center">
		<div class="mb-4">
		<form method="GET" action="index.php">
			<input type="hidden" name="ctrl" value="project">
			<input type="hidden" name="action" value="home">
			<button type="submit" name="filter_cat" value="1" class="btn btn-primary">Design</button>
			<button type="submit" name="filter_cat" value="2" class="btn btn-primary">Développement Web</button>
			<button type="submit" name="filter_old" value="true" class="btn btn-primary">Plus de 6 mois</button>
			<a href="index.php?ctrl=project&action=home" class="btn btn-primary">Tout</a>
		</form>
	</div>
	</section>

<section class="container-fluid" aria-label="Articles récents">
	<h2 class="visually-hidden">Les 4 derniers articles</h2>
	<div class="row mb-2">
	
	{foreach from=$arrProjectToDisplay item=objProject}

		{assign var="isAuthor" value=(isset($smarty.session.user) && $smarty.session.user.user_id == $objProject->getUser_id())}
		{assign var="isModerator" value=(isset($smarty.session.user) && $smarty.session.user.user_status == 2)}
		{assign var="isDeleted" value=($objProject->getProject_deleted_at() !== null)}
		{assign var="isRefused" value=($objProject->getStatus() == "refusé")}

		{if $isModerator 
			|| ($isAuthor && !$isDeleted) 
			|| (!$isRefused && !$isDeleted)}
			
			{include file="views/_partial/preview.tpl"}
		{/if}

	{/foreach}
</section>
{/block}
