{# templates/entreprise/appartement/index.html.twig #} {% extends 'entreprise/entreprise_base.html.twig' %} {% block title %}Gestion des Appartements | {{ entreprise.raisonSociale|default('Mon Bureau') }}{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block body %} {% set plan = (abonnementActuel and abonnementActuel.abonnement) ? abonnementActuel.abonnement : null %} {% set isExpired = (abonnementActuel is null or not abonnementActuel.isActive()) %} {% set totalApparts = appartements|length %} {% set quotaAppartAtteint = (plan and plan.limiteAppartement > 0 and totalApparts >= plan.limiteAppartement) %} {% set canModify = (not isExpired) %} {% set canAddAppart = (not isExpired and not quotaAppartAtteint) %} {% set targetImmeubleId = immeubleSelectionne.id ?? (immeubles|first).id ?? null %}
{# --- EN-TÊTE --- #}

Gérez vos unités locatives et leur ordre d'affichage.

{% if is_granted('ROLE_ENTREPRISE_COLLAB') %} Nouvel Appartement {% endif %}
{# --- BARRE DE FILTRE (Style Locataire appliqué) --- #}
{% include 'flash_messages.html.twig' %} {# --- LISTE DES APPARTEMENTS --- #} {% if appartements is empty %}

Aucun appartement trouvé

Ajustez vos filtres ou créez un nouvel appartement.

{% else %}
{% for item in appartements %} {% set appartement = item.appartement %} {% set currentLoyer = item.currentLoyer %}
{# 1. ORDRE (Uniquement si filtré par lot et sans recherche textuelle pour éviter les conflits logiques) #} {% if immeubleSelectionne and not app.request.query.get('q') %}
{% if not loop.first %} {% else %} {% endif %} {{ appartement.ordre }} {% if not loop.last %} {% else %} {% endif %}
{% endif %} {# 2. INFOS APPARTEMENT #}
{{ appartement.titre }}
{% if not immeubleSelectionne %} {{ appartement.immeuble.titre }} {% endif %} {{ appartement.nbrePieces|default(0) }} pièces {{ appartement.nbreSalleBain|default(0) }} SdB
{# 3. BLOC LOYER #}
Loyer Mensuel
{{ currentLoyer and currentLoyer.montantLoyer ? currentLoyer.montantLoyer|format_money : 'N/D' }}
{# 4. ACTIONS #}
Détails
{% endfor %}
{% endif %}
{% endblock %}