<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Become a Seller β Julico</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="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css"/>
<link rel="stylesheet" href="/css/julico-home.css">
<style>
*, *::before, *::after { box-sizing:border-box; }
body { font-family:'Plus Jakarta Sans',-apple-system,sans-serif; background:var(--gray-50); margin:0; min-height:100vh; }
.s-nav { background:var(--white); border-bottom:1px solid var(--gray-200); padding:0 24px; height:64px; display:flex; align-items:center; justify-content:space-between; }
.s-link { font-size:14px; font-weight:700; color:var(--brand); text-decoration:none; }
.s-wrap { max-width:680px; margin:0 auto; padding:32px 18px 60px; }
.s-hero { text-align:center; margin-bottom:26px; }
.s-hero h1 { font-size:28px; font-weight:800; color:var(--gray-900); margin:0 0 8px; letter-spacing:-0.02em; }
.s-hero p { font-size:14px; color:var(--gray-500); margin:0; line-height:1.6; }
.s-card { background:var(--white); border:1.5px solid var(--gray-100); border-radius:var(--rlg); padding:26px; box-shadow:var(--shadow-sm); }
.s-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.fld { margin-bottom:15px; }
.fld label { display:block; font-size:12px; font-weight:800; color:var(--gray-700); margin-bottom:6px; text-transform:uppercase; letter-spacing:.03em; }
.fld .opt { color:var(--gray-400); font-weight:600; text-transform:none; letter-spacing:0; }
.fld input, .fld textarea, .fld select { width:100%; font-family:inherit; font-size:14px; padding:11px 13px; border:1.5px solid var(--gray-200); border-radius:var(--rsm); color:var(--gray-900); background:#fff; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline:none; border-color:var(--brand); }
.fld textarea { min-height:96px; resize:vertical; }
.fld input[type=file] { padding:9px 11px; background:var(--gray-50); cursor:pointer; }
.fld-hint { font-size:11px; color:var(--gray-400); margin-top:4px; line-height:1.5; }
.logo-preview { margin-top:8px; }
.logo-preview img { width:64px; height:64px; border-radius:12px; object-fit:cover; border:1.5px solid var(--gray-200); display:none; }
.req { color:#dc2626; }
.sec-label { font-size:12px; font-weight:800; color:var(--brand-dark); text-transform:uppercase; letter-spacing:.04em; margin:22px 0 10px; padding-top:18px; border-top:1.5px solid var(--gray-100); }
.loc-search-row { display:flex; gap:8px; margin-bottom:10px; }
.loc-search-wrap { position:relative; flex:1; }
.loc-search-wrap input { width:100%; font-family:inherit; font-size:14px; padding:11px 13px; border:1.5px solid var(--gray-200); border-radius:var(--rsm); color:var(--gray-900); }
.loc-search-wrap input:focus { outline:none; border-color:var(--brand); }
.loc-suggest { position:absolute; top:calc(100% + 4px); left:0; right:0; background:#fff; border:1.5px solid var(--gray-200); border-radius:var(--rsm); box-shadow:0 8px 24px rgba(0,0,0,0.12); z-index:1000; max-height:240px; overflow-y:auto; display:none; }
.loc-suggest.open { display:block; }
.loc-suggest-item { padding:10px 12px; font-size:13px; color:var(--gray-800); cursor:pointer; border-bottom:1px solid var(--gray-100); line-height:1.4; }
.loc-suggest-item:last-child { border-bottom:none; }
.loc-suggest-item:hover, .loc-suggest-item.active { background:var(--brand-light); }
.loc-search-btn { position:static !important; top:auto !important; right:auto !important; left:auto !important; bottom:auto !important; font-size:13px; font-weight:700; color:#fff; background:var(--brand); border:none; border-radius:var(--rsm); padding:0 16px; cursor:pointer; white-space:nowrap; }
.loc-search-btn:hover { background:var(--brand-dark); }
.locate-btn { font-size:13px; font-weight:700; color:var(--brand-dark); background:var(--brand-light); border:1.5px solid var(--brand-mid); border-radius:var(--rsm); padding:9px 14px; cursor:pointer; margin-bottom:10px; }
.locate-btn:hover { background:var(--brand); color:#fff; }
#map { height:240px; border-radius:var(--rsm); border:1.5px solid var(--gray-200); margin-bottom:8px; }
.map-status { font-size:12px; font-weight:600; min-height:18px; margin-bottom:10px; }
.map-status.loading { color:#92400e; }
.map-status.success { color:#047857; }
.map-status.error { color:#b91c1c; }
.map-filled { border-color:var(--brand) !important; background:#f0fdfa; }
.map-hint { font-size:11px; color:var(--gray-400); margin-bottom:10px; }
.agree-fld { margin:20px 0 6px; padding-top:16px; border-top:1.5px solid var(--gray-100); }
.agree-check { display:flex; align-items:flex-start; gap:10px; font-size:13px; font-weight:600; color:var(--gray-700); line-height:1.55; }
.agree-check input { width:18px; height:18px; margin-top:1px; flex-shrink:0; accent-color:var(--brand); cursor:pointer; }
.agree-check a { color:var(--brand); font-weight:700; text-decoration:underline; cursor:pointer; }
.s-btn { width:100%; font-size:15px; font-weight:800; color:#fff; background:var(--brand); border:none; border-radius:var(--rsm); padding:14px; cursor:pointer; margin-top:6px; }
.s-btn:hover { background:var(--brand-dark); }
.s-errors { background:#fef2f2; border:1.5px solid #fecaca; color:#b91c1c; border-radius:var(--rsm); padding:12px 14px; font-size:13px; font-weight:600; margin-bottom:14px; }
.s-errors ul { margin:6px 0 0; padding-left:18px; }
.s-suggest { background:#f0fdfa; border:1.5px solid var(--brand-mid); border-radius:var(--rsm); padding:12px 14px; margin-bottom:18px; }
.s-suggest-h { font-size:12px; font-weight:800; color:var(--brand-dark); margin-bottom:8px; }
.s-suggest-chips { display:flex; flex-wrap:wrap; gap:8px; }
.s-chip { font-family:inherit; font-size:13px; font-weight:700; color:var(--brand-dark); background:#fff; border:1.5px solid var(--brand-mid); border-radius:999px; padding:7px 13px; cursor:pointer; }
.s-chip:hover { background:var(--brand); color:#fff; border-color:var(--brand); }
.s-ok { background:var(--white); border:1.5px solid var(--gray-100); border-radius:var(--rlg); padding:40px 26px; box-shadow:var(--shadow-sm); text-align:center; }
.s-ok .ic { font-size:46px; }
.s-ok h2 { font-size:22px; font-weight:800; color:var(--gray-900); margin:14px 0 8px; }
.s-ok p { color:var(--gray-500); font-size:14px; line-height:1.6; margin:0 0 20px; }
.legal-modal { display:none; position:fixed; inset:0; z-index:3000; align-items:center; justify-content:center; padding:3vh 3vw; }
.legal-modal.open { display:flex; }
.legal-modal-backdrop { position:absolute; inset:0; background:rgba(15,23,42,0.55); }
.legal-modal-card { position:relative; width:min(780px,96vw); height:92vh; background:#fff; border-radius:14px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 24px 70px rgba(0,0,0,0.35); }
.legal-modal-bar { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1.5px solid var(--gray-100); flex-shrink:0; }
.legal-modal-title { font-size:14px; font-weight:800; color:var(--gray-900); }
.legal-modal-close { font-size:15px; font-weight:800; color:var(--gray-500); background:var(--gray-50); border:1.5px solid var(--gray-200); border-radius:var(--rsm); width:34px; height:34px; cursor:pointer; }
.legal-modal-close:hover { background:var(--gray-100); color:var(--gray-800); }
.legal-modal-frame { flex:1; width:100%; border:0; }
@media (max-width:560px){ .s-row{ grid-template-columns:1fr; } }
</style>
</head>
<body>
<nav class="s-nav">
<a href="{{ path('app_home') }}"><img src="/images/julico-logo.png" alt="Julico" style="height:42px;object-fit:contain"></a>
<a href="{{ path('app_home') }}" class="s-link">β Back to store</a>
</nav>
<div class="s-wrap">
{% if sent %}
<div class="s-ok">
<div class="ic">π</div>
<h2>Application received!</h2>
<p>Thanks for your interest in selling on Julico. Our team will review your application and get in touch. Approved sellers get their own shop on a flat monthly plan β no commission, and you handle your own delivery.</p>
<a href="{{ path('app_home') }}" class="s-link">β Back to store</a>
</div>
{% else %}
<div class="s-hero">
<h1>Sell on Julico</h1>
<p>Reach wholesale buyers across Lebanon. Flat monthly subscription, zero commission β you keep 100% of every sale.</p>
</div>
<div class="s-card">
{% if errors|length > 0 %}
<div class="s-errors">Please fix the following:<ul>{% for e in errors %}<li>{{ e }}</li>{% endfor %}</ul></div>
{% endif %}
{% if suggestions is defined and suggestions|length > 0 %}
<div class="s-suggest">
<div class="s-suggest-h">β¨ These names are available β tap to use one:</div>
<div class="s-suggest-chips">
{% for name in suggestions %}
<button type="button" class="s-chip" data-name="{{ name }}">{{ name }}</button>
{% endfor %}
</div>
</div>
{% endif %}
<form method="post" action="{{ path('seller_apply') }}" enctype="multipart/form-data">
<div class="fld">
<label>Business / shop name <span class="req">*</span></label>
<input type="text" id="field-business" name="business_name" value="{{ old.business_name ?? '' }}" required>
</div>
<div class="fld">
<label>Shop logo <span class="opt">(optional)</span></label>
<input type="file" name="logo" id="logo-input" accept="image/png,image/jpeg,image/webp">
<div class="logo-preview"><img id="logo-preview-img" alt="Logo preview"></div>
<div class="fld-hint">A square image works best β it becomes your shop's icon across Julico. PNG, JPG or WEBP, up to 4 MB. You can also add or change it later from your dashboard.</div>
</div>
<div class="s-row">
<div class="fld">
<label>Your name <span class="req">*</span></label>
<input type="text" name="contact_name" value="{{ old.contact_name ?? prefill.contact_name }}" required>
</div>
<div class="fld">
<label>Phone <span class="req">*</span></label>
<input type="text" name="phone" value="{{ old.phone ?? '' }}" required>
</div>
</div>
<div class="s-row">
<div class="fld">
<label>Email <span class="opt">(optional)</span></label>
<input type="email" name="email" value="{{ old.email ?? prefill.email }}">
<div class="fld-hint">No email? Leave it blank β we'll set up your login when your shop is approved.</div>
</div>
<div class="fld">
<label>What do you sell?</label>
<select name="category">
<option value="">β Select a category β</option>
{% for c in categories ?? [] %}
<option value="{{ c.nom }}"{{ (old.category ?? '') == c.nom ? ' selected' }}>{{ c.nom }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="sec-label">π Your location</div>
<div class="loc-search-row">
<div class="loc-search-wrap">
<input type="text" id="loc-search" autocomplete="off" placeholder="Search a place β e.g. Tripoli, Lebanon">
<div id="loc-suggest" class="loc-suggest"></div>
</div>
<button type="button" id="search-btn" class="loc-search-btn">π Search</button>
</div>
<button type="button" id="locate-btn" class="locate-btn">π‘ Use my location</button>
<div id="map"></div>
<div id="map-status" class="map-status"></div>
<div class="map-hint">Start typing a place and pick a suggestion, use your location, or drop a pin on the map. Country, region and city fill in automatically β you can edit them after.</div>
<div class="fld">
<label>Country</label>
<input type="text" id="field-country" name="country" value="{{ old.country ?? '' }}">
</div>
<div class="s-row">
<div class="fld">
<label>Region</label>
<input type="text" id="field-region" name="region" value="{{ old.region ?? '' }}" placeholder="e.g. Beirut, South">
</div>
<div class="fld">
<label>City</label>
<input type="text" id="field-city" name="city" value="{{ old.city ?? '' }}">
</div>
</div>
<input type="hidden" id="field-lat" name="latitude" value="{{ old.latitude ?? '' }}">
<input type="hidden" id="field-lng" name="longitude" value="{{ old.longitude ?? '' }}">
<div class="fld" style="margin-top:6px">
<label>Tell us about your business</label>
<textarea name="description" placeholder="Product range, number of SKUs, current sales channels β anything that helps us review.">{{ old.description ?? '' }}</textarea>
</div>
<div class="sec-label">πͺͺ Identity verification</div>
<div class="fld">
<label>Owner's government ID <span class="req">*</span></label>
<input type="file" name="id_document" accept=".jpg,.jpeg,.png,.webp,.pdf,image/*,application/pdf" required>
<div class="fld-hint">A clear photo or scan of the owner's valid government-issued ID β National ID, Iqama, or Passport. JPG, PNG, WEBP or PDF, up to 8 MB. By uploading your ID you confirm it is genuine and belongs to you, and you reconfirm your agreement to Julico's Seller Agreement and Privacy Policy.</div>
</div>
<div class="agree-fld">
<div class="agree-check">
<input type="checkbox" name="agree" value="1"{{ (old.agree ?? '') ? ' checked' }} required>
<span>I have read and agree to the
<a href="{{ path('legal_seller_agreement') }}" class="legal-open" data-title="Seller Agreement">Seller Agreement</a>
and the
<a href="{{ path('legal_privacy') }}" class="legal-open" data-title="Privacy Policy">Privacy Policy</a>.</span>
</div>
</div>
<button type="submit" class="s-btn">Submit application</button>
</form>
</div>
{% endif %}
</div>
<div id="legal-modal" class="legal-modal" aria-hidden="true">
<div class="legal-modal-backdrop" data-close></div>
<div class="legal-modal-card">
<div class="legal-modal-bar">
<span class="legal-modal-title">Document</span>
<button type="button" class="legal-modal-close" data-close aria-label="Close">β</button>
</div>
<iframe class="legal-modal-frame" title="Document"></iframe>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded',function(){
var biz=document.getElementById('field-business');
document.querySelectorAll('.s-chip').forEach(function(ch){
ch.addEventListener('click',function(){
if(biz){ biz.value=ch.getAttribute('data-name'); biz.focus(); window.scrollTo({top:0,behavior:'smooth'}); }
});
});
// Live logo preview before upload
var logoInput = document.getElementById('logo-input');
var logoImg = document.getElementById('logo-preview-img');
if (logoInput && logoImg) {
logoInput.addEventListener('change', function(){
var f = this.files && this.files[0];
if (f) { logoImg.src = URL.createObjectURL(f); logoImg.style.display = 'block'; }
else { logoImg.style.display = 'none'; }
});
}
// Open legal documents in a pop-up over the form, so nothing typed is lost.
var modal = document.getElementById('legal-modal');
var frame = modal.querySelector('.legal-modal-frame');
var titleEl = modal.querySelector('.legal-modal-title');
frame.addEventListener('load', function(){
try {
var d = frame.contentDocument;
if (d) {
var nav = d.querySelector('.l-nav, .s-nav');
if (nav) nav.style.display = 'none';
}
} catch(e){}
});
function openDoc(src, title){
titleEl.textContent = title || 'Document';
frame.src = src;
modal.classList.add('open');
modal.setAttribute('aria-hidden','false');
document.body.style.overflow = 'hidden';
}
function closeDoc(){
modal.classList.remove('open');
modal.setAttribute('aria-hidden','true');
document.body.style.overflow = '';
setTimeout(function(){ frame.src = 'about:blank'; }, 200);
}
document.querySelectorAll('.legal-open').forEach(function(a){
a.addEventListener('click', function(e){
e.preventDefault();
openDoc(a.getAttribute('href'), a.getAttribute('data-title'));
});
});
modal.querySelectorAll('[data-close]').forEach(function(el){
el.addEventListener('click', closeDoc);
});
document.addEventListener('keydown', function(e){ if(e.key==='Escape' && modal.classList.contains('open')) closeDoc(); });
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js"></script>
<script>
(function(){
var DEFAULT=[33.8938,35.5018];
var map, marker;
var suggestTimer=null, suggestXhr=null, suggestions=[];
function makeIcon(){
var c=document.createElement('canvas');
c.width=30; c.height=38;
var ctx=c.getContext('2d');
ctx.fillStyle='#00a7b5';
ctx.beginPath(); ctx.arc(15,15,13,0,Math.PI*2); ctx.fill();
ctx.strokeStyle='white'; ctx.lineWidth=3; ctx.stroke();
ctx.beginPath(); ctx.moveTo(9,24); ctx.lineTo(15,38); ctx.lineTo(21,24); ctx.fill();
return L.icon({iconUrl:c.toDataURL(),iconSize:[30,38],iconAnchor:[15,38]});
}
function setLatLng(lat,lng){
var la=document.getElementById('field-lat'), lo=document.getElementById('field-lng');
if(la) la.value=Number(lat).toFixed(7);
if(lo) lo.value=Number(lng).toFixed(7);
}
function setField(id,val){
var el=document.getElementById(id);
if(el&&val){ el.value=val; el.classList.add('map-filled'); }
}
function fillAddress(a){
if(!a) return;
setField('field-country', a.country||'');
setField('field-region', a.state||a.region||a.county||a.state_district||'');
setField('field-city', a.city||a.town||a.village||a.municipality||a.suburb||'');
}
function showStatus(type,msg){
var el=document.getElementById('map-status');
if(el){ el.className='map-status '+type; el.textContent=msg; }
}
function geocode(lat,lng){
showStatus('loading','π Looking up addressβ¦');
var xhr=new XMLHttpRequest();
xhr.open('GET','https://nominatim.openstreetmap.org/reverse?lat='+lat+'&lon='+lng+'&format=json&addressdetails=1');
xhr.setRequestHeader('Accept-Language','en');
xhr.onload=function(){
if(xhr.status!==200){showStatus('error','β Could not find address');return;}
var d=JSON.parse(xhr.responseText);
if(!d||!d.address){showStatus('error','β No address found');return;}
fillAddress(d.address);
showStatus('success','β
Location set β review the fields below.');
};
xhr.onerror=function(){showStatus('error','β Network error');};
xhr.send();
}
function hideSuggest(){
var d=document.getElementById('loc-suggest');
if(d){ d.classList.remove('open'); d.innerHTML=''; }
suggestions=[];
}
function chooseSuggestion(s){
var lat=parseFloat(s.lat), lng=parseFloat(s.lon);
map.setView([lat,lng],14);
marker.setLatLng([lat,lng]);
setLatLng(lat,lng);
if(s.address){ fillAddress(s.address); }
else { geocode(lat,lng); }
var si=document.getElementById('loc-search');
if(si){ si.value=s.display_name||''; }
hideSuggest();
showStatus('success','β
Location set β review the fields below.');
}
function renderSuggest(list){
var d=document.getElementById('loc-suggest');
if(!d) return;
suggestions=list||[];
if(!suggestions.length){ hideSuggest(); return; }
d.innerHTML='';
suggestions.forEach(function(s){
var it=document.createElement('div');
it.className='loc-suggest-item';
it.textContent=s.display_name;
it.addEventListener('mousedown',function(e){ e.preventDefault(); chooseSuggestion(s); });
d.appendChild(it);
});
d.classList.add('open');
}
function fetchSuggest(q){
if(suggestXhr){ try{ suggestXhr.abort(); }catch(e){} }
suggestXhr=new XMLHttpRequest();
suggestXhr.open('GET','https://nominatim.openstreetmap.org/search?q='+encodeURIComponent(q)+'&format=json&addressdetails=1&limit=5');
suggestXhr.setRequestHeader('Accept-Language','en');
suggestXhr.onload=function(){
if(suggestXhr.status!==200){ return; }
var r;
try { r=JSON.parse(suggestXhr.responseText||'[]'); } catch(e){ r=[]; }
renderSuggest(Array.isArray(r)? r : []);
};
suggestXhr.onerror=function(){};
suggestXhr.send();
}
function searchLocation(){
var q=(document.getElementById('loc-search').value||'').trim();
if(!q){ showStatus('error','Type a place to search.'); return; }
showStatus('loading','π Searchingβ¦');
var xhr=new XMLHttpRequest();
xhr.open('GET','https://nominatim.openstreetmap.org/search?q='+encodeURIComponent(q)+'&format=json&addressdetails=1&limit=1');
xhr.setRequestHeader('Accept-Language','en');
xhr.onload=function(){
if(xhr.status!==200){showStatus('error','β Search failed');return;}
var r=JSON.parse(xhr.responseText);
if(!r||!r.length){showStatus('error','β No place found β try a different search');return;}
chooseSuggestion(r[0]);
};
xhr.onerror=function(){showStatus('error','β Network error');};
xhr.send();
}
function initMap(lat,lng){
map=L.map('map').setView([lat,lng],11);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{attribution:'Β© OpenStreetMap',maxZoom:19}).addTo(map);
marker=L.marker([lat,lng],{draggable:true,icon:makeIcon()}).addTo(map);
setLatLng(lat,lng);
marker.on('dragend',function(e){var p=e.target.getLatLng();setLatLng(p.lat,p.lng);geocode(p.lat,p.lng);});
map.on('click',function(e){marker.setLatLng(e.latlng);setLatLng(e.latlng.lat,e.latlng.lng);geocode(e.latlng.lat,e.latlng.lng);});
}
function locate(){
var btn=document.getElementById('locate-btn');
if(!navigator.geolocation){showStatus('error','β Not supported by your browser');return;}
btn.disabled=true; btn.textContent='β³ Locatingβ¦';
showStatus('loading','π‘ Getting your locationβ¦');
navigator.geolocation.getCurrentPosition(
function(p){
map.setView([p.coords.latitude,p.coords.longitude],16);
marker.setLatLng([p.coords.latitude,p.coords.longitude]);
setLatLng(p.coords.latitude,p.coords.longitude);
geocode(p.coords.latitude,p.coords.longitude);
btn.disabled=false; btn.textContent='π‘ Use my location';
},
function(){ btn.disabled=false; btn.textContent='π‘ Use my location'; showStatus('error','β Could not get your location'); }
);
}
document.addEventListener('DOMContentLoaded',function(){
if(!document.getElementById('map')||!window.L){return;}
initMap(DEFAULT[0],DEFAULT[1]);
var lb=document.getElementById('locate-btn');
if(lb) lb.addEventListener('click',locate);
var sb=document.getElementById('search-btn');
if(sb) sb.addEventListener('click',function(){ hideSuggest(); searchLocation(); });
var si=document.getElementById('loc-search');
if(si){
si.addEventListener('input',function(){
var q=(si.value||'').trim();
if(suggestTimer){ clearTimeout(suggestTimer); }
if(q.length<3){ hideSuggest(); return; }
suggestTimer=setTimeout(function(){ fetchSuggest(q); },350);
});
si.addEventListener('keydown',function(e){
if(e.key==='Enter'){
e.preventDefault();
if(suggestions.length){ chooseSuggestion(suggestions[0]); }
else { searchLocation(); }
} else if(e.key==='Escape'){
hideSuggest();
}
});
si.addEventListener('blur',function(){ setTimeout(hideSuggest,150); });
}
var hasLoc = (document.getElementById('field-country').value
|| document.getElementById('field-region').value
|| document.getElementById('field-city').value);
if(!hasLoc && navigator.geolocation){
navigator.geolocation.getCurrentPosition(
function(p){
map.setView([p.coords.latitude,p.coords.longitude],16);
marker.setLatLng([p.coords.latitude,p.coords.longitude]);
setLatLng(p.coords.latitude,p.coords.longitude);
geocode(p.coords.latitude,p.coords.longitude);
},
function(){}
);
}
});
}());
</script>
</body>
</html>