{% extends 'frontend/base.html.twig' %}
{% block CSS %}
<link href="{{asset('build/admin/user.css')}}" rel="stylesheet" type="text/css" />
{{block('CSS', 'frontend/homepage.html.twig')}}
{% endblock %}
{% block JS %}
<script src="{{ asset('build/admin/user.js') }}"></script>
{{block('JS', 'frontend/homepage.html.twig')}}
{% endblock %}
{% block title %}{% endblock %}
{% block metaDescription %}{% endblock %}
{% block content %}
<section style="width: 80%;margin-left: auto; margin-right: auto;" class="section-blog-archive">
<!-- Page-Title -->
<div class="row">
<div class="col-12">
<h4 class="m-t-20 m-b-20">{% if title is defined %}{{title}}{% else %}Les épiceries{% endif %}</h4>
{% if logoPage is defined or pageText is defined %}
<div class="row">
<div class="col-md-4">
{% if logoPage is defined %}
{% set url = path('getImageAsThumb', { 'id': logoPage.id, 'height': '250', 'width':'250'}) %}
<img class="card-img-top img-fluid" src="{{url}}" alt="" style="margin-left: auto; margin-right: auto;width:auto!important;">
{% endif %}
</div>
<div class="col-md-8">
{% if pageText is defined %}
{{pageText}}
{% endif %}
</div>
</div>
<br><hr><br>
{% endif %}
<div class="card-deck-wrapper">
<div class="card-deck">
{% for c in companies%}
<div class="card m-b-20">
{% if global.associationUserIsBrowsing %}
<a href="{{path('viewCompanyInGroup', {'urlname': c.urlName, 'id': c.id, 'groupurlname': association}) }}">
{% else %}
<a href="{{path('companyStore', {'urlname': c.urlName, 'id': c.id})}}">
{% endif %}
{% if c.image %}
{% set url = path('getImageAsThumb', { 'id': c.image.id, 'height': '250', 'width':'350'}) %}
{% else %}
{% set url = "/assets/frontend/images/logo.png" %}
{% endif %}
<div style="height: 370px;display:table-cell; vertical-align:middle; text-align:center; width: 370px;">
<img class="card-img-top img-fluid" src="{{url}}" alt="" style="margin-left: auto; margin-right: auto;">
</div>
{#<img class="card-img-top img-fluid" src="{{path('getImageAsCroppedThumb', {'id': post.image.id, 'height': '250', 'width' : '350'})}}" alt="Card image cap">#}
<div class="card-body">
<h5 class="card-title">{{c.name}}</h5>
{% if c.mainLocation %}
<h5 class="card-title">{{c.mainLocation.region.name }}</h5>
{% endif %}
<p class="card-text">
{{c.description | striptags | slice(0, 350) | raw}}{% if c.description | length > 350 %}...{%endif %}
</p>
<p class="card-text">
<small class="text-muted">Inscrit depuis {{c.dateCreated | date('d/m/Y')}}</small>
</p>
</div>
</a>
</div>
{% if loop.index is divisible by (3) %}
</div>
<div class="card-deck">
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
<!-- end row -->
</section>
{% endblock %}