{# =======================================================
JULICO Home Page — with Search & Filter
✅ Place at: templates/produit/index.html.twig
======================================================= #}
<!DOCTYPE html>
<html lang="{{ _locale ?? 'en' }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Julico — Where Trust Meets Success</title>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/julico-home.css">
<style>
.prod-card { display:flex; flex-direction:column; }
.prod-card-link { text-decoration:none; color:inherit; display:flex; flex-direction:column; flex:1; }
.prod-card-link:hover { color:inherit; }
.prod-img.out-of-stock img { opacity:0.35; filter:grayscale(60%); }
.out-of-stock-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
.out-of-stock-label { background:#1f2937; color:white; font-size:11px; font-weight:800; letter-spacing:0.08em; text-transform:uppercase; padding:6px 14px; border-radius:100px; }
.add-btn { touch-action:manipulation; -webkit-tap-highlight-color:transparent; cursor:pointer; }
.card-qty-row { display:none; align-items:center; border:1.5px solid var(--brand); border-radius:var(--rsm); overflow:hidden; height:34px; }
.card-qty-row.visible { display:flex; }
.cq-btn { width:34px; height:34px; background:var(--brand-light); color:var(--brand); border:none; font-size:18px; font-weight:700; cursor:pointer; font-family:var(--font); display:flex; align-items:center; justify-content:center; transition:background .15s; touch-action:manipulation; flex-shrink:0; }
.cq-btn:hover { background:var(--brand); color:white; }
.cq-num { min-width:28px; text-align:center; font-size:13px; font-weight:800; color:var(--gray-900); border-left:1px solid var(--brand-mid); border-right:1px solid var(--brand-mid); padding:0 4px; }
/* FILTER SIDEBAR */
.shop-layout { display:grid; grid-template-columns:250px 1fr; gap:24px; align-items:start; margin-top:24px; }
.filter-sidebar { position:sticky; top:80px; }
.filter-card { background:var(--white); border:1.5px solid var(--gray-100); border-radius:var(--rlg); padding:20px; box-shadow:var(--shadow-sm); }
.filter-title { font-size:14px; font-weight:800; color:var(--gray-900); margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--gray-100); display:flex; align-items:center; justify-content:space-between; }
.filter-section { margin-bottom:18px; padding-bottom:18px; border-bottom:1px solid var(--gray-100); }
.filter-section:last-child { margin-bottom:0; padding-bottom:0; border-bottom:none; }
.filter-lbl { font-size:11px; font-weight:700; color:var(--gray-400); text-transform:uppercase; letter-spacing:0.07em; margin-bottom:10px; }
.cat-check { display:flex; align-items:center; gap:8px; margin-bottom:7px; cursor:pointer; }
.cat-check input { width:15px; height:15px; accent-color:var(--brand); cursor:pointer; flex-shrink:0; }
.cat-check span { font-size:13px; font-weight:500; color:var(--gray-700); cursor:pointer; }
.price-row { display:grid; grid-template-columns:1fr auto 1fr; gap:6px; align-items:center; }
.price-input { height:36px; border:1.5px solid var(--gray-200); border-radius:var(--rsm); padding:0 10px; font-family:var(--font); font-size:13px; color:var(--gray-800); background:var(--gray-50); outline:none; width:100%; box-sizing:border-box; }
.price-input:focus { border-color:var(--brand); background:var(--white); }
.promo-check { display:flex; align-items:center; gap:8px; padding:10px 12px; border:1.5px solid var(--gray-200); border-radius:var(--rsm); cursor:pointer; transition:all .2s; }
.promo-check:hover { border-color:var(--brand); background:var(--brand-light); }
.promo-check input { width:16px; height:16px; accent-color:var(--brand); cursor:pointer; }
.promo-check span { font-size:13px; font-weight:700; color:var(--gray-700); }
.btn-apply { width:100%; height:42px; background:var(--brand); color:white; border:none; border-radius:var(--rsm); font-family:var(--font); font-size:13px; font-weight:700; cursor:pointer; transition:background .2s; margin-top:16px; }
.btn-apply:hover { background:var(--brand-dark); }
.btn-clear { width:100%; height:38px; background:var(--white); color:var(--gray-500); border:1.5px solid var(--gray-200); border-radius:var(--rsm); font-family:var(--font); font-size:12px; font-weight:600; cursor:pointer; transition:all .2s; margin-top:8px; text-decoration:none; display:flex; align-items:center; justify-content:center; }
.btn-clear:hover { border-color:var(--brand); color:var(--brand); }
.sort-bar { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:10px; }
.results-count { font-size:13px; color:var(--gray-500); }
.results-count strong { color:var(--gray-900); font-weight:800; }
.sort-select { height:36px; border:1.5px solid var(--gray-200); border-radius:var(--rsm); padding:0 12px; font-family:var(--font); font-size:13px; color:var(--gray-700); background:var(--white); outline:none; cursor:pointer; }
.sort-select:focus { border-color:var(--brand); }
.active-pills { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.pill { display:inline-flex; align-items:center; gap:5px; background:var(--brand-light); border:1px solid var(--brand-mid); color:var(--brand-dark); font-size:11px; font-weight:700; padding:4px 10px; border-radius:100px; text-decoration:none; }
.filter-badge { background:var(--brand); color:white; font-size:10px; font-weight:800; padding:2px 7px; border-radius:100px; margin-left:6px; }
.filter-toggle-btn { display:none; align-items:center; gap:8px; background:var(--white); border:1.5px solid var(--gray-200); border-radius:var(--rsm); padding:9px 16px; font-family:var(--font); font-size:13px; font-weight:700; cursor:pointer; color:var(--gray-700); margin-bottom:14px; width:100%; }
.filter-toggle-btn:hover { border-color:var(--brand); color:var(--brand); }
.store-link { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--gray-600); text-decoration:none; padding:6px 0; transition:color .2s; }
.store-link:hover { color:var(--brand); }
@media(max-width:900px) {
.shop-layout { grid-template-columns:1fr; }
.filter-sidebar { position:static; display:none; }
.filter-sidebar.open { display:block; }
.filter-toggle-btn { display:flex; }
}
</style>
</head>
<body>
{# ── Cart session ── #}
{% set panier = app.session.get('panier') ?? [] %}
{% set cartCount = 0 %}
{% set cartTotal = 0 %}
{% for pan in panier %}
{% set cartCount = cartCount + pan.qtt %}
{% for p in produits %}
{% if p.id == pan.id %}
{% set unitPrice = p.prix %}
{% if p.salePrice is defined and p.salePrice and p.salePrice > 0 and p.salePrice < p.prix %}
{% set unitPrice = p.salePrice %}
{% endif %}
{% set cartTotal = cartTotal + (unitPrice * pan.qtt) %}
{% endif %}
{% endfor %}
{% endfor %}
{# ── Safe defaults for filter vars ── #}
{% set currentQ = currentQ ?? '' %}
{% set currentMin = currentMin ?? '' %}
{% set currentMax = currentMax ?? '' %}
{% set currentPromo = currentPromo ?? '' %}
{% set currentCategories = currentCategories ?? [] %}
{% set currentSort = currentSort ?? '' %}
{% set activeFilters = activeFilters ?? 0 %}
{% set allCategories = allCategories ?? [] %}
{# ── Is any filter active? ── #}
{% set filtersActive = (currentQ is not empty) or (currentPromo is not empty) or (currentMin is not empty) or (currentMax is not empty) or (currentCategories is not empty) %}
<!-- TOP BAR -->
<div class="topbar">
🎉 Biggest Sale of the Year — Up to <strong>50% OFF</strong> storewide!
<a href="{{ path('app_home') }}">Shop Now →</a>
</div>
<!-- NAVBAR -->
<nav class="navbar">
<div class="navbar-inner">
<a href="{{ path('app_home') }}" class="logo">
<img src="/images/julico-logo.png" alt="Julico" style="height:48px;object-fit:contain">
</a>
<button class="location-btn">
<svg viewBox="0 0 20 20" fill="currentColor" style="width:14px;height:14px;color:var(--brand)"><path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd"/></svg>
Beirut, LB
</button>
<div class="search-wrap">
<form action="{{ path('app_home') }}" method="GET">
<svg class="search-icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd"/></svg>
<input type="text" name="q" value="{{ currentQ }}" placeholder="Search products, categories…">
<button type="submit" class="search-btn">
<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd"/></svg>
</button>
</form>
</div>
<div class="nav-actions">
<a href="{{ path('app_panier') }}" class="nav-icon-btn" style="position:relative" title="My Cart">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>
{% if cartCount > 0 %}<span class="nbadge" id="nav-cart-badge">{{ cartCount }}</span>{% endif %}
</a>
{% if app.user %}
<a href="{{ path('app_orders') }}" class="nav-icon-btn" title="My Orders">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2"/>
<rect x="9" y="3" width="6" height="4" rx="1"/>
<path d="M9 12h6M9 16h4"/>
</svg>
</a>
<a href="{{ path('app_profile') }}" class="btn-signin">{{ app.user.pseudo }}</a>
<a href="/logout" class="btn-register">Logout</a>
{% else %}
<a href="/login" class="btn-signin">Sign In</a>
<a href="/register" class="btn-register">Register Free</a>
{% endif %}
</div>
</div>
</nav>
<!-- SUBNAV -->
<div class="subnav">
<div class="subnav-inner">
<a href="{{ path('app_home') }}" class="snav-item {% if not filtersActive %}active{% endif %}"><span>🏠</span>All</a>
{% for magasin in magasins %}
<a href="{{ path('app_home', {'shopName': magasin.nom}) }}" class="snav-item"><span>🏪</span>{{ magasin.nom }}</a>
{% endfor %}
<a href="{{ path('app_home') }}?promo=1" class="snav-item {% if currentPromo %}active{% endif %}"><span>🔥</span>Promotions</a>
</div>
</div>
<div class="page">
{# Hero only when no filters active #}
{% if not filtersActive %}
<div class="hero-section">
<div class="hero-grid">
<div class="hero-main">
<div class="hero-chip">🔥 Limited Time — Up to 50% Off</div>
<h1 class="hero-h1">Your B2B Wholesale<br><span>Command Center</span></h1>
<p class="hero-p">
{{ produits|length }}+ professional-grade products.
{% for magasin in magasins %}<strong style="color:#b3ffe8">{{ magasin.nom }}</strong>{% if not loop.last %} & {% endif %}{% endfor %} networks.
</p>
<div class="hero-cta">
<a href="{{ path('app_home') }}" class="hbtn-p">Browse Catalogue →</a>
<a href="{{ path('app_home') }}?promo=1" class="hbtn-s">View Promotions ›</a>
</div>
<div class="hero-stats">
<div><div class="hstat-n">{{ produits|length }}</div><div class="hstat-l">Products</div></div>
<div><div class="hstat-n">{{ magasins|length }}</div><div class="hstat-l">Networks</div></div>
<div><div class="hstat-n">{{ produitsNouveaute|length }}</div><div class="hstat-l">New Arrivals</div></div>
<div><div class="hstat-n">B2B</div><div class="hstat-l">Wholesale</div></div>
</div>
</div>
<div class="hero-side">
{% for magasin in magasins|slice(0,2) %}
<a href="{{ path('app_home', {'shopName': magasin.nom}) }}" class="side-banner {{ loop.first ? 'sb1' : 'sb2' }}">
<div><div class="sb-label">{{ loop.first ? 'Our Network' : 'Partner Store' }}</div><div class="sb-title">{{ magasin.nom }}</div><div class="sb-cta">Shop Now ›</div></div>
<div class="sb-badge">B2B</div>
</a>
{% else %}
<div class="side-banner sb1"><div><div class="sb-label">Flash Deal</div><div class="sb-title">PPE &<br>Disposables</div><div class="sb-cta">Shop Now ›</div></div><div class="sb-badge">−40%</div></div>
<div class="side-banner sb2"><div><div class="sb-label">New Arrivals</div><div class="sb-title">Organic &<br>Healthy</div><div class="sb-cta">Explore ›</div></div><div class="sb-badge">NEW</div></div>
{% endfor %}
</div>
</div>
</div>
<div class="trust-bar">
<div class="trust-item"><div class="trust-icon">🚚</div><div><div class="trust-t">Fast Delivery</div><div class="trust-d">Next-day dispatch on orders</div></div></div>
<div class="trust-item"><div class="trust-icon">💰</div><div><div class="trust-t">Volume Pricing</div><div class="trust-d">Better rates at scale</div></div></div>
<div class="trust-item"><div class="trust-icon">🔒</div><div><div class="trust-t">Secure Payments</div><div class="trust-d">100% protected checkout</div></div></div>
<div class="trust-item"><div class="trust-icon">🤝</div><div><div class="trust-t">B2B Accounts</div><div class="trust-d">Dedicated account manager</div></div></div>
</div>
<div class="promo-strip">
<a href="{{ path('app_home') }}?promo=1" class="promo-card pc1"><div class="p-em">🔥</div><div><div class="p-lbl">Limited Time</div><div class="p-title">Active Promotions</div><div class="p-sub">Best deals available now</div></div></a>
<a href="{{ path('app_home') }}" class="promo-card pc2"><div class="p-em">📦</div><div><div class="p-lbl">New Arrivals</div><div class="p-title">{{ produitsNouveaute|length }} New Products</div><div class="p-sub">Just added to catalogue</div></div></a>
<a href="{{ path('app_home') }}" class="promo-card pc3"><div class="p-em">🌍</div><div><div class="p-lbl">B2B Wholesale</div><div class="p-title">{{ magasins|length }} Networks</div><div class="p-sub">Professional pricing</div></div></a>
</div>
{% endif %}
{# Cart session for JS #}
<script>
window.CART_SESSION = {
{% for pan in panier %}
"{{ pan.id }}": {{ pan.qtt }}{% if not loop.last %},{% endif %}
{% endfor %}
};
</script>
{# Results header when filtering #}
{% if filtersActive %}
<div style="margin:24px 0 16px">
<div style="font-size:11px;font-weight:700;color:var(--brand);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:3px">Search Results</div>
<div style="font-size:22px;font-weight:800;color:var(--gray-900);letter-spacing:-0.02em">
{% if currentQ is not empty %}Results for "{{ currentQ }}"
{% elseif currentPromo %}🔥 Active Promotions
{% else %}Filtered Products{% endif %}
<span style="font-size:15px;font-weight:500;color:var(--gray-400)">({{ produits|length }})</span>
</div>
</div>
{% endif %}
{# Mobile filter toggle #}
<button class="filter-toggle-btn" onclick="toggleFilters()" style="margin-top:{{ filtersActive ? '0' : '24px' }}">
🔧 Filters {% if activeFilters > 0 %}<span class="filter-badge">{{ activeFilters }}</span>{% endif %}
</button>
<div class="shop-layout" style="margin-top:{{ filtersActive ? '0' : '24px' }}">
{# ── FILTER SIDEBAR ── #}
<div class="filter-sidebar" id="filter-sidebar">
<form action="{{ path('app_home') }}" method="GET" id="filter-form">
{# Preserve search query in filters #}
{% if currentQ is not empty %}
<input type="hidden" name="q" value="{{ currentQ }}">
{% endif %}
<div class="filter-card">
<div class="filter-title">
🔧 Filters
{% if activeFilters > 0 %}
<a href="{{ path('app_home') }}" style="font-size:11px;font-weight:600;color:var(--brand);text-decoration:none">Clear all</a>
{% endif %}
</div>
{# PROMO #}
<div class="filter-section">
<div class="filter-lbl">Deals</div>
<label class="promo-check" style="{{ currentPromo ? 'border-color:var(--brand);background:var(--brand-light)' : '' }}">
<input type="checkbox" name="promo" value="1" {{ currentPromo ? 'checked' : '' }} onchange="this.form.submit()">
<span>🔥 Promotions Only</span>
</label>
</div>
{# CATEGORIES #}
{% if allCategories|length > 0 %}
<div class="filter-section">
<div class="filter-lbl">Category</div>
{% for cat in allCategories %}
<label class="cat-check">
<input type="checkbox" name="categories[]" value="{{ cat.id }}"
{% if currentCategories is iterable %}
{% for cid in currentCategories %}
{% if cid == cat.id %}checked{% endif %}
{% endfor %}
{% endif %}
>
<span>{{ cat.nom }}</span>
</label>
{% endfor %}
</div>
{% endif %}
{# PRICE #}
<div class="filter-section">
<div class="filter-lbl">Price Range ($)</div>
<div class="price-row">
<input type="number" name="min" class="price-input" placeholder="Min" value="{{ currentMin }}" min="0">
<span style="font-size:12px;color:var(--gray-400);text-align:center">—</span>
<input type="number" name="max" class="price-input" placeholder="Max" value="{{ currentMax }}" min="0">
</div>
</div>
{# STORES #}
<div class="filter-section">
<div class="filter-lbl">Store</div>
{% for magasin in magasins %}
<label class="cat-check">
<input type="checkbox" name="shopName" value="{{ magasin.nom }}"
{% if app.request.query.get('shopName') == magasin.nom %}checked{% endif %}>
<span>🏪 {{ magasin.nom }}</span>
</label>
{% endfor %}
</div>
<button type="submit" class="btn-apply">Apply Filters</button>
<a href="{{ path('app_home') }}" class="btn-clear">Reset</a>
</div>
</form>
</div>
{# ── PRODUCTS AREA ── #}
<div>
{# Active filter pills #}
{% if activeFilters > 0 %}
<div class="active-pills">
{% if currentQ is not empty %}
<a href="{{ path('app_home') }}?promo={{ currentPromo }}&min={{ currentMin }}&max={{ currentMax }}" class="pill">🔍 "{{ currentQ }}" ×</a>
{% endif %}
{% if currentPromo %}
<a href="{{ path('app_home') }}?q={{ currentQ }}&min={{ currentMin }}&max={{ currentMax }}" class="pill">🔥 Promo ×</a>
{% endif %}
{% if currentMin is not empty %}
<a href="{{ path('app_home') }}?q={{ currentQ }}&promo={{ currentPromo }}&max={{ currentMax }}" class="pill">Min ${{ currentMin }} ×</a>
{% endif %}
{% if currentMax is not empty %}
<a href="{{ path('app_home') }}?q={{ currentQ }}&promo={{ currentPromo }}&min={{ currentMin }}" class="pill">Max ${{ currentMax }} ×</a>
{% endif %}
</div>
{% endif %}
{# Sort + count bar #}
<div class="sort-bar">
<span class="results-count"><strong>{{ produits|length }}</strong> product{% if produits|length != 1 %}s{% endif %} found</span>
<select class="sort-select" onchange="applySort(this.value)">
<option value="">Sort: Default</option>
<option value="price_asc" {% if currentSort == 'price_asc' %}selected{% endif %}>Price: Low to High</option>
<option value="price_desc" {% if currentSort == 'price_desc' %}selected{% endif %}>Price: High to Low</option>
<option value="newest" {% if currentSort == 'newest' %}selected{% endif %}>Newest First</option>
<option value="name_asc" {% if currentSort == 'name_asc' %}selected{% endif %}>Name: A–Z</option>
</select>
</div>
{# Products #}
{% if produits|length > 0 %}
<div class="prod-grid">
{% for produit in produits %}
{% set qttValue = produit.qtt is defined ? produit.qtt : null %}
{% set isOutOfStock = (qttValue is null) or (qttValue <= 0) %}
{% set unitPrice = produit.prix %}
{% if produit.salePrice is defined and produit.salePrice and produit.salePrice > 0 and produit.salePrice < produit.prix %}
{% set unitPrice = produit.salePrice %}
{% endif %}
<div class="prod-card" style="{% if isOutOfStock %}opacity:0.85{% endif %}" data-product-id="{{ produit.id }}">
<a href="{{ path('show_produit', {'id': produit.id}) }}" class="prod-card-link">
<div class="prod-img {% if isOutOfStock %}out-of-stock{% endif %}">
{% set imgs = produit.images %}
{% if imgs is not empty %}
<img src="{{ asset('assets/uploads/products/' ~ imgs|first.fileName) }}"
alt="{{ produit.productName }}"
onerror="this.onerror=null;this.src='/assets/uploads/products/{{ imgs|first.fileName }}'">
{% else %}
<div style="font-size:40px;opacity:0.2{% if isOutOfStock %};filter:grayscale(80%){% endif %}">📦</div>
{% endif %}
{% if produit.promo and not isOutOfStock %}<span class="pbadge badge-sale">PROMO</span>{% endif %}
{% if isOutOfStock %}<div class="out-of-stock-overlay"><span class="out-of-stock-label">Out of Stock</span></div>{% endif %}
</div>
<div class="prod-body">
<div class="prod-brand">
{% if produit.category is defined and produit.category %}{{ produit.category.nom }}{% endif %}
{% if produit.magasin is defined and produit.magasin %} · {{ produit.magasin.nom }}{% endif %}
</div>
<div class="prod-name" style="{% if isOutOfStock %}color:var(--gray-400){% endif %}">{{ produit.productName }}</div>
<div class="prod-unit">{{ produit.description|slice(0,40) }}{% if produit.description|length > 40 %}…{% endif %}</div>
</div>
</a>
<div style="padding:0 14px 14px;display:flex;align-items:center;justify-content:space-between;margin-top:auto;position:relative;z-index:5;">
<div>
{% if produit.salePrice is defined and produit.salePrice and produit.salePrice > 0 and produit.salePrice < produit.prix %}
<div class="prod-price" style="{% if isOutOfStock %}color:var(--gray-400){% endif %}"><sup>$</sup>{{ produit.salePrice|number_format(2) }}</div>
<div class="prod-old">${{ produit.prix|number_format(2) }}</div>
{% else %}
<div class="prod-price" style="{% if isOutOfStock %}color:var(--gray-400){% endif %}"><sup>$</sup>{{ produit.prix|number_format(2) }}</div>
{% endif %}
</div>
{% if isOutOfStock %}
<button class="add-btn" disabled style="background:var(--gray-200);color:var(--gray-400);cursor:not-allowed;font-size:11px;width:auto;padding:0 10px">Sold Out</button>
{% else %}
<div class="card-qty-row" id="qty-row-{{ produit.id }}">
<button type="button" class="cq-btn" data-action="{{ path('panier_minus', {'id': produit.id, 'idVariante': 'notdefined', 'option': 'home'}) }}" data-csrf="{{ csrf_token('authenticate') }}" data-id="{{ produit.id }}" data-price="{{ unitPrice }}" data-type="minus">−</button>
<span class="cq-num" id="qty-num-{{ produit.id }}">0</span>
<button type="button" class="cq-btn" data-action="{{ path('panier_add', {'id': produit.id, 'idVariante': 'notdefined', 'option': 'home'}) }}" data-csrf="{{ csrf_token('authenticate') }}" data-id="{{ produit.id }}" data-price="{{ unitPrice }}" data-type="plus">+</button>
</div>
<button type="button" class="add-btn" id="add-btn-{{ produit.id }}"
data-action="{{ path('panier_add', {'id': produit.id, 'idVariante': 'notdefined', 'option': 'home'}) }}"
data-csrf="{{ csrf_token('authenticate') }}"
data-id="{{ produit.id }}"
data-price="{{ unitPrice }}"
title="Add to cart">+</button>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{# Pagination #}
{% if previous is defined and next is defined %}
{% if previous >= 0 or next < produits|length %}
<div style="display:flex;justify-content:center;gap:12px;margin-top:32px">
{% if previous >= 0 %}<a href="{{ path('app_home') }}?offset={{ previous }}&q={{ currentQ }}&promo={{ currentPromo }}&min={{ currentMin }}&max={{ currentMax }}" class="see-all">← Previous</a>{% endif %}
{% if next < produits|length %}<a href="{{ path('app_home') }}?offset={{ next }}&q={{ currentQ }}&promo={{ currentPromo }}&min={{ currentMin }}&max={{ currentMax }}" class="see-all">Next →</a>{% endif %}
</div>
{% endif %}
{% endif %}
{% else %}
<div style="text-align:center;padding:60px 20px;color:var(--gray-400)">
<div style="font-size:48px;margin-bottom:16px">🔍</div>
<div style="font-size:18px;font-weight:700;color:var(--gray-600)">No products found</div>
<div style="margin-top:8px;margin-bottom:20px">Try adjusting your search or filters</div>
<a href="{{ path('app_home') }}" class="see-all" style="display:inline-flex">Clear all filters</a>
</div>
{% endif %}
</div>{# /products area #}
</div>{# /shop-layout #}
{% if not filtersActive %}
<!-- B2B -->
<div class="b2b-strip" style="margin-top:40px">
<div>
<div class="b2b-tag">🌐 B2B Platform</div>
<div class="b2b-h">Scale Your Business<br>with <span>Julico</span></div>
<div class="b2b-p">Access wholesale pricing and {{ produits|length }}+ products across {% for m in magasins %}{{ m.nom }}{% if not loop.last %} & {% endif %}{% endfor %} networks.</div>
<a href="/register" class="b2b-btn">Open a Business Account →</a>
</div>
<div class="b2b-feats">
<div class="b2b-feat"><div class="b2b-ficon">📊</div><div class="b2b-ft">Volume Discounts</div><div class="b2b-fd">Tiered pricing that scales with your order volume.</div></div>
<div class="b2b-feat"><div class="b2b-ficon">🚀</div><div class="b2b-ft">Fast Dispatch</div><div class="b2b-fd">Same-day processing on orders before 2PM.</div></div>
<div class="b2b-feat"><div class="b2b-ficon">📋</div><div class="b2b-ft">Custom Invoicing</div><div class="b2b-fd">Branded invoices and flexible payment terms.</div></div>
<div class="b2b-feat"><div class="b2b-ficon">🌍</div><div class="b2b-ft">Global Network</div><div class="b2b-fd">{% for m in magasins %}{{ m.nom }}{% if not loop.last %} & {% endif %}{% endfor %} networks.</div></div>
</div>
</div>
<!-- PWA -->
<div class="pwa-banner">
<div class="pwa-left">
<div class="pwa-chip"><span class="pwa-chip-dot"></span> <span id="pwa-chip-text">Web App — No App Store Needed</span></div>
<div class="pwa-h" id="pwa-headline">Install Julico on<br>Your Device, Instantly</div>
<div class="pwa-p" id="pwa-desc">Get the full Julico experience right from your browser.</div>
<div class="pwa-features">
<div class="pwa-feat"><span class="pwa-feat-icon">⚡</span> Instant Load</div>
<div class="pwa-feat"><span class="pwa-feat-icon">📴</span> Works Offline</div>
<div class="pwa-feat"><span class="pwa-feat-icon">🔔</span> Push Alerts</div>
<div class="pwa-feat"><span class="pwa-feat-icon">🔒</span> Secure</div>
</div>
<button class="pwa-install-btn" id="pwa-btn" onclick="handleInstall()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v12m0 0l-4-4m4 4l4-4M2 17l.621 2.485A2 2 0 004.561 21h14.878a2 2 0 001.94-1.515L22 17"/></svg>
<span id="pwa-btn-text">Add to Home Screen</span>
</button>
</div>
<div class="pwa-right">
<div class="pwa-device-card">
<div class="pwa-device-header">
<div class="pwa-device-icon" id="pwa-device-icon">📱</div>
<div>
<div class="pwa-device-name" id="pwa-device-name">Detecting device…</div>
<div class="pwa-device-browser" id="pwa-device-browser">Checking browser…</div>
</div>
<div class="pwa-device-status ready" id="pwa-device-status">Ready</div>
</div>
<div class="pwa-steps-wrap" id="pwa-steps"></div>
</div>
</div>
</div>
<div class="install-toast" id="install-toast"><div class="toast-icon">✓</div><span id="toast-msg">Julico added!</span></div>
{% endif %}
</div>{# /page #}
<!-- FOOTER -->
<footer>
<div class="footer-top">
<div>
<div class="footer-bname">JULI<span>CO</span></div>
<div class="footer-btag">Where Trust Meets Success</div>
<div class="footer-bdesc">Lebanon's leading B2B wholesale platform.</div>
<div class="footer-socials">
<div class="social-btn">f</div><div class="social-btn">in</div>
<div class="social-btn">tw</div><div class="social-btn">ig</div>
</div>
</div>
<div>
<div class="footer-ct">Shop</div>
<a href="{{ path('app_home') }}" class="footer-link">All Products</a>
<a href="{{ path('app_home') }}?promo=1" class="footer-link">Promotions</a>
{% for magasin in magasins %}<a href="{{ path('app_home', {'shopName': magasin.nom}) }}" class="footer-link">{{ magasin.nom }}</a>{% endfor %}
</div>
<div>
<div class="footer-ct">Categories</div>
{% for cat in allCategories|slice(0,6) %}
<a href="{{ path('app_home') }}?categories[]={{ cat.id }}" class="footer-link">{{ cat.nom }}</a>
{% endfor %}
</div>
<div>
<div class="footer-ct">Account</div>
<a href="/register" class="footer-link">Register</a>
<a href="/login" class="footer-link">Sign In</a>
<a href="{{ path('app_panier') }}" class="footer-link">My Cart</a>
{% if app.user %}<a href="{{ path('app_orders') }}" class="footer-link">My Orders</a>{% endif %}
</div>
<div>
<div class="footer-ct">Support</div>
<a href="#" class="footer-link">Help Center</a>
<a href="#" class="footer-link">Contact Us</a>
<a href="{{ path('app_locale', {'_locale': 'en'}) }}" class="footer-link">English</a>
<a href="{{ path('app_locale', {'_locale': 'fr'}) }}" class="footer-link">Français</a>
</div>
</div>
<div class="footer-bottom">
<div class="footer-copy">© {{ "now"|date("Y") }} Julico S.A.R.L. All rights reserved.</div>
<div class="footer-pays"><div class="pay-chip">VISA</div><div class="pay-chip">MC</div><div class="pay-chip">CASH</div></div>
<div class="footer-legal"><a href="#">Privacy</a><a href="#">Terms</a></div>
</div>
</footer>
<a href="{{ path('app_panier') }}" class="cart-bar" id="cart-bar"
style="{% if cartCount == 0 %}display:none;{% endif %}text-decoration:none">
<span>🛒</span>
<div class="cart-cnt">{{ cartCount }}</div>
<span class="cart-label">{{ cartCount }} item{% if cartCount != 1 %}s{% endif %} in cart</span>
<span style="color:rgba(255,255,255,0.4)">·</span>
<span class="cart-total" id="cart-total-price">${{ cartTotal|number_format(2) }}</span>
<span style="opacity:0.6">→</span>
</a>
<script src="/js/julico-app.js"></script>
<script>
function toggleFilters() {
document.getElementById('filter-sidebar').classList.toggle('open');
}
function applySort(val) {
var url = new URL(window.location.href);
if (val) { url.searchParams.set('sort', val); }
else { url.searchParams.delete('sort'); }
window.location.href = url.toString();
}
</script>
</body>
</html>