@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
@using Dynamicweb.Frontend
@using System.Collections.Generic

@{
    if(Model.Item.TryGetUser("User", out UserViewModel user)) {
         
        <div class="card h-100 text-center shadow-sm" itemscope itemtype="https://schema.org/Person">
            <div class="card-body">
                @if(user.TryGetImageFile(out ImageFileViewModel image))
                {
                    <figure class="mb-4">
                        <img src="@image.ToGetImage(new(){ Width = 100, Ratio = "1/1" })" alt="@user.Name" class="img-thumbnail rounded-circle" itemprop="image"/>
                    </figure>
                }
                <div class="mb-2 fs-7">
                    @if(!string.IsNullOrEmpty(user.Name))
                    {
                        <h4 class="mb-0 h5" itemprop="name">@user.Name</h4>
                    }
                    @if(!string.IsNullOrEmpty(user.JobTitle))
                    {
                        <p class="mb-0 text-muted text-opacity-75" itemprop="jobTitle">@user.JobTitle</p>
                    }
                    @if(!string.IsNullOrEmpty(user.Department))
                    {
                        <p class="mb-0 text-muted text-opacity-75" itemprop="department">@user.Department</p>
                    }
                    @if(!string.IsNullOrEmpty(user.Company))
                    {
                        <p class="mb-0 text-muted text-opacity-75" itemprop="worksFor">@user.Company</p>
                    }
                    <div class="border-top mx-auto my-3" style="max-width: 5rem;"></div>
                    @if(!string.IsNullOrEmpty(user.Email))
                    {
                        <a href="mailto:@user.Email" itemprop="email">
                            <span class="d-block pb-1">@user.Email</span>
                        </a>
                    }
                    @if(!string.IsNullOrEmpty(user.PhoneBusiness))
                    {
                        <a href="tel:@user.PhoneBusiness" itemprop="telephone">
                            <span class="d-block">@user.PhoneBusiness</span>
                        </a>
                    }
                </div>
            </div>
        </div>
    }           
}


