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

{block name="content"}

<section class="user-profile mb-5 mt-5/*vh /*">
    <div class="row">
        <div class="col-md-4 text-center">
            <img src="{$smarty.env.IMG_USER_PATH}{$user->getImage() ?? "images.jpg"}" alt="Avatar de {$user->getPseudo()}" class="rounded-circle flex-shrink-0 border border-2 border-white"
     				style="width: 256px; height: 256px; object-fit: cover; margin-top: 8px;"
     				 >
        </div>
        <div class="col-md-8  align-items-center p-0">
            <div>
                <h1>{$user->getPseudo()}</h1>
                <p class="text-muted">{$user->getMail()}</p>

                {if $user->getWork()}
                    <p>{$user->getWork()}</p>
                {/if}

                {if $user->getLocation()}
                    <p>{$user->getLocation()}</p>
                {/if}

                <p class="mt-3">{$user->getDescription()}</p>
                {if $smarty.session.user.user_id == $user->getId()}
                <a class="btn btn-sm btn-primary flex-fill" 
                       href="?ctrl=user&action=edit">Edit account</a>
            {/if}
            </div>
            
        </div>
    </div>
</section>

<section>
    <h2 class="mb-4 border-bottom pb-2">Les projets de {$user->getPseudo()}</h2>
    
    <div class="row m-0">
        {if count($arrProjectToDisplay) > 0}
            {foreach $arrProjectToDisplay as $objProject}
                    {include file="views/_partial/preview.tpl"}
            {/foreach} 
        {else}
            <div class="col-12">
            <p class="col-12 alert alert-info">Cet utilisateur n'a pas encore publié de projets.</p>
            </div>
        {/if}
    </div>
</section>

{/block}