


<article class="col-md-3 mb-5 {if isset($smarty.session.user) and $smarty.session.user.user_status == 2} pb-5 {/if}">
    <div class="card h-100 shadow-sm article-card">
        
        {* IMAGE (80%) *}
        <div class="ratio ratio-16x9">
            <img src=".{$objProject->getThumbnail()}"
            class="w-100 h-100 object-fit-cover"
            alt=""
            loading="lazy">
        </div>

        <div class="d-flex align-items-start gap-3">

			{* PHOTO DE PROFIL *}
			<img src="{$objProject->getUser_image()}"
				 class="rounded-circle flex-shrink-0 mt-2 ml-5"
				 style="width: 48px; height: 48px; object-fit: cover;"
				 alt="Photo de profil">

			{* INFOS *}
			<div class="flex-grow-1 card-body p-3">
				<h3 class="h6 mb-1">{$objProject->getTitle()}</h3>

				<small class="text-body-secondary d-block mb-1">
					<time>{$objProject->getCreation_date()}</time>
					– 
					<a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}" 
					class="text-decoration-none" 
					style="position: relative; z-index: 2;">
						{$objProject->getCreatorname()}
					</a>
				</small>

				<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
				class="stretched-link small">
				Lire la suite →
				</a>
				{if isset($smarty.session.user)}
					{if $smarty.session.user.user_id == $objProject->getUser_id()}
						<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
					   class="stretched-link small">
						Editer
					</a>
					{/if}
				{/if}
			</div>

		</div>

    </div>
	{*Controle de l'utilisateur ainsi que du status du projet*}
	{if isset($smarty.session.user) and $smarty.session.user.user_status == 2}
		<div class="border rounded text-center">
			<a class="btn btn-sm m-1 btn-danger" href="?ctrl=project&action=delete&id={$objProject->getId()}" name="toDelete">Supprimer</a>
	{/if}
	{if isset($smarty.session.user) and $objProject->getStatus() eq "en_attente" and $smarty.session.user.user_status == 2}
			<a class="btn btn-sm m-1 btn-success" href="?ctrl=project&action=accept&id={$objProject->getId()}" name="toPublished">Accepter</a>
			<a class="btn btn-sm m-1 btn-warning" href="?ctrl=project&action=refuse&id={$objProject->getId()}" name="toRefused">Refuser</a>
		</div>
	{elseif $projectStatus eq "refusé"}
		<p class="text-danger fw-bold">Portfolio refusé</p>
	{/if}
</article>
