Spaces:
Running
Running
Download map.html from DIgilianfr/immodesk-ma: direct link, hf CLI and curl.
- Browser
- Download file 47.9 kB
-
https://huggingface.co/spaces/DIgilianfr/immodesk-ma/resolve/main/map.html
- Command line
-
hf download hf://spaces/DIgilianfr/immodesk-ma/map.html
-
curl -L -o map.html https://huggingface.co/spaces/DIgilianfr/immodesk-ma/resolve/main/map.html
47.9 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Carte MarchΓ© Immobilier B2B β Maroc</title> | |
| <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/> | |
| <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> | |
| <style> | |
| :root { | |
| --bg: #f5f6fa; --surface: #ffffff; --surface2: #f0f2f8; --border: #dde1ec; | |
| --accent: #c8963e; --accent2: #e8b86d; --green: #2ecc8f; --red: #e74c3c; | |
| --blue: #4a9eff; --purple: #9b59b6; --text: #e8eaf0; --muted: #7b8099; | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; } | |
| body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; } | |
| /* ββ TOPBAR ββ */ | |
| .topbar { | |
| background: var(--surface); border-bottom: 1px solid var(--border); | |
| padding: 0 20px; height: 52px; display: flex; align-items: center; justify-content: space-between; | |
| flex-shrink: 0; z-index: 1000; | |
| } | |
| .topbar-left { display: flex; align-items: center; gap: 12px; } | |
| .back-btn { | |
| background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; | |
| color: var(--muted); padding: 5px 12px; font-size: 12px; cursor: pointer; | |
| text-decoration: none; display: flex; align-items: center; gap: 6px; | |
| } | |
| .back-btn:hover { color: var(--text); border-color: var(--accent); } | |
| .title { font-size: 15px; font-weight: 700; } | |
| .title span { color: var(--accent); } | |
| .topbar-right { display: flex; align-items: center; gap: 8px; } | |
| .layer-btn { | |
| padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border); | |
| background: none; color: var(--muted); font-size: 12px; cursor: pointer; transition: all .15s; | |
| } | |
| .layer-btn.active { background: var(--accent); color: #0f1117; border-color: var(--accent); font-weight: 700; } | |
| /* ββ FILTERBAR ββ */ | |
| .filterbar { | |
| background: var(--surface2); border-bottom: 1px solid var(--border); | |
| padding: 0 20px; height: 46px; display: flex; align-items: center; gap: 8px; | |
| flex-shrink: 0; z-index: 999; | |
| } | |
| .filterbar-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-right: 4px; flex-shrink: 0; } | |
| .type-btn { | |
| display: flex; align-items: center; gap: 6px; | |
| padding: 5px 14px; border-radius: 8px; border: 1px solid var(--border); | |
| background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; | |
| transition: all .18s; white-space: nowrap; | |
| } | |
| .type-btn .type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; } | |
| .type-btn:hover { border-color: var(--text); color: var(--text); } | |
| .type-btn.active { color: var(--text); font-weight: 700; border-color: var(--type-color, var(--accent)); background: color-mix(in srgb, var(--type-color, var(--accent)) 15%, transparent); } | |
| .type-btn.active .type-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--type-color, var(--accent)) 40%, transparent); } | |
| .filterbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; } | |
| .stock-summary { margin-left: auto; display: flex; gap: 16px; } | |
| .stock-stat { font-size: 12px; color: var(--muted); } | |
| .stock-stat strong { color: var(--text); } | |
| /* ββ MAIN LAYOUT ββ */ | |
| .main { flex: 1; display: flex; overflow: hidden; } | |
| /* ββ SIDEBAR ββ */ | |
| .sidebar { | |
| width: 300px; background: var(--surface); border-right: 1px solid var(--border); | |
| display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; | |
| } | |
| .sidebar-header { padding: 14px 16px; border-bottom: 1px solid var(--border); } | |
| .sidebar-header h3 { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; } | |
| .search-box { | |
| background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; | |
| padding: 8px 12px; width: 100%; color: var(--text); font-size: 13px; font-family: inherit; | |
| } | |
| .search-box:focus { outline: none; border-color: var(--accent); } | |
| .sidebar-list { overflow-y: auto; flex: 1; } | |
| /* city item */ | |
| .city-item { | |
| display: flex; align-items: center; padding: 11px 16px; cursor: pointer; | |
| border-bottom: 1px solid var(--border); transition: background .15s; gap: 12px; | |
| } | |
| .city-item:hover { background: var(--surface2); } | |
| .city-item.selected { background: rgba(200,150,62,.1); border-left: 3px solid var(--accent); } | |
| .city-item.faded { opacity: .35; } | |
| .city-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; } | |
| .city-info { flex: 1; } | |
| .city-name { font-size: 13px; font-weight: 600; } | |
| .city-region { font-size: 11px; color: var(--muted); } | |
| .city-price { text-align: right; } | |
| .city-price .val { font-size: 14px; font-weight: 700; color: var(--accent); } | |
| .city-price .delta { font-size: 11px; } | |
| .city-price .delta.up { color: var(--green); } | |
| .city-price .delta.down { color: var(--red); } | |
| .no-supply { font-size: 11px; color: var(--muted); font-style: italic; } | |
| /* ββ MAP ββ */ | |
| #map { flex: 1; z-index: 1; } | |
| /* ββ DETAIL PANEL ββ */ | |
| .detail-panel { | |
| width: 288px; background: var(--surface); border-left: 1px solid var(--border); | |
| padding: 20px; overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; | |
| } | |
| .detail-panel.hidden { display: none; } | |
| .detail-type-badge { | |
| display: inline-flex; align-items: center; gap: 6px; | |
| font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 700; | |
| border: 1px solid var(--border); margin-bottom: 8px; | |
| } | |
| .detail-city-name { font-size: 20px; font-weight: 700; } | |
| .detail-region { font-size: 12px; color: var(--muted); margin-bottom: 4px; } | |
| .detail-price { font-size: 28px; font-weight: 700; color: var(--accent); } | |
| .detail-price sub { font-size: 13px; color: var(--muted); font-weight: 400; } | |
| .detail-section h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; } | |
| .detail-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } | |
| .detail-kpi { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; } | |
| .detail-kpi .label { font-size: 11px; color: var(--muted); margin-bottom: 4px; } | |
| .detail-kpi .value { font-size: 16px; font-weight: 700; } | |
| .supply-table { width: 100%; border-collapse: collapse; } | |
| .supply-table th { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 0 8px; text-align: left; } | |
| .supply-table td { font-size: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); } | |
| .supply-table tr:last-child td { border: none; } | |
| .supply-avail { display: flex; align-items: center; gap: 6px; font-weight: 600; } | |
| .supply-dot-sm { width: 7px; height: 7px; border-radius: 50%; } | |
| .segment-list { display: flex; flex-direction: column; gap: 8px; } | |
| .segment-row { display: flex; align-items: center; gap: 8px; font-size: 12px; } | |
| .segment-label { width: 80px; color: var(--muted); flex-shrink: 0; } | |
| .segment-track { flex: 1; background: var(--surface2); border-radius: 3px; height: 6px; } | |
| .segment-fill { height: 100%; border-radius: 3px; } | |
| .segment-val { width: 40px; text-align: right; font-weight: 600; } | |
| .tag-list { display: flex; flex-wrap: wrap; gap: 6px; } | |
| .tag { font-size: 11px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface2); } | |
| .btn-agent { | |
| background: var(--accent); color: #0f1117; border: none; border-radius: 10px; | |
| padding: 10px; font-size: 13px; font-weight: 700; cursor: pointer; width: 100%; transition: opacity .15s; | |
| } | |
| .btn-agent:hover { opacity: .85; } | |
| /* ββ MAP OVERRIDES ββ */ | |
| .leaflet-container { background: #0d1020 ; } | |
| .leaflet-tile { filter: brightness(.65) saturate(.5) hue-rotate(185deg); } | |
| .leaflet-control-zoom a { background: var(--surface) ; color: var(--text) ; border-color: var(--border) ; } | |
| .leaflet-control-zoom a:hover { background: var(--surface2) ; } | |
| .leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.5); } | |
| .leaflet-popup-tip { background: var(--surface); } | |
| .custom-tooltip { | |
| background: var(--surface) ; border: 1px solid var(--border) ; | |
| border-radius: 8px ; color: var(--text) ; | |
| font-family: 'Segoe UI', system-ui, sans-serif; font-size: 12px ; | |
| padding: 8px 12px ; box-shadow: 0 4px 16px rgba(0,0,0,.4) ; | |
| white-space: nowrap; | |
| } | |
| .custom-tooltip::before { display: none ; } | |
| /* ββ LEGEND ββ */ | |
| .legend { | |
| position: absolute; bottom: 30px; right: 310px; z-index: 500; | |
| background: var(--surface); border: 1px solid var(--border); border-radius: 12px; | |
| padding: 14px 16px; min-width: 210px; | |
| } | |
| .legend h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; } | |
| .legend-scale { display: flex; flex-direction: column; gap: 6px; } | |
| .legend-row { display: flex; align-items: center; gap: 10px; font-size: 12px; } | |
| .legend-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; } | |
| /* ββ TYPE PULSE ββ */ | |
| @keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} } | |
| ::-webkit-scrollbar { width: 5px; } | |
| ::-webkit-scrollbar-track { background: transparent; } | |
| ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; } | |
| </style> | |
| </head> | |
| <body> | |
| <script> | |
| (function(){ | |
| var PWD = "E-nS4y622hqzgRcL"; | |
| var KEY = "immodesk_auth"; | |
| if(sessionStorage.getItem(KEY) !== "1"){ | |
| var o = document.createElement('div'); | |
| o.style.cssText = 'position:fixed;inset:0;background:#f5f6fa;display:flex;align-items:center;justify-content:center;z-index:99999;font-family:system-ui'; | |
| o.innerHTML = '<div style="background:#fff;border:1px solid #dde1ec;border-radius:16px;padding:40px;text-align:center;width:320px;box-shadow:0 8px 32px rgba(0,0,0,0.08)">' | |
| + '<div style="font-size:36px;margin-bottom:8px">🏢</div>' | |
| + '<div style="font-size:22px;font-weight:800;color:#c8963e;letter-spacing:2px;margin-bottom:4px">ImmoDesk MA</div>' | |
| + '<div style="font-size:11px;color:#6b7280;margin-bottom:24px;text-transform:uppercase;letter-spacing:1px">Accès sécurisé</div>' | |
| + '<input id="pi" type="password" placeholder="Mot de passe" style="width:100%;background:#f0f2f8;border:1px solid #dde1ec;border-radius:8px;padding:10px 14px;color:#1a1d2e;font-size:14px;outline:none;box-sizing:border-box;margin-bottom:12px" />' | |
| + '<button id="pb" style="width:100%;background:#c8963e;color:white;border:none;border-radius:8px;padding:10px;font-size:14px;font-weight:700;cursor:pointer">Accéder</button>' | |
| + '</div>'; | |
| document.body.appendChild(o); | |
| setTimeout(function(){ | |
| var inp = document.getElementById('pi'); | |
| var btn = document.getElementById('pb'); | |
| inp.focus(); | |
| inp.addEventListener('keydown', function(e){ if(e.key==='Enter') btn.click(); }); | |
| btn.addEventListener('click', function(){ | |
| if(inp.value === PWD){ sessionStorage.setItem(KEY,'1'); o.remove(); } | |
| else { inp.style.borderColor='#ef4444'; inp.value=''; inp.placeholder='Mot de passe incorrect'; } | |
| }); | |
| }, 50); | |
| } | |
| })(); | |
| </script> | |
| <!-- TOPBAR --> | |
| <div class="topbar"> | |
| <div class="topbar-left"> | |
| <a href="index.html" class="back-btn">β Retour</a> | |
| <div class="title">Carte MarchΓ© <span>Immobilier B2B</span> β Maroc</div> | |
| </div> | |
| <div class="topbar-right"> | |
| <span style="font-size:11px;color:var(--muted);margin-right:4px;">Couche :</span> | |
| <button class="layer-btn active" onclick="setLayer('prix',this)">Prix/mΒ²</button> | |
| <button class="layer-btn" onclick="setLayer('vacance',this)">Vacance</button> | |
| <button class="layer-btn" onclick="setLayer('demande',this)">Demande</button> | |
| </div> | |
| </div> | |
| <!-- FILTERBAR TYPE DE BIEN --> | |
| <div class="filterbar"> | |
| <span class="filterbar-label">Type de bien :</span> | |
| <button class="type-btn active" id="tbtn-all" style="--type-color:#1a1d2e" onclick="setType('all',this)"> | |
| <span class="type-dot" style="background:#e8eaf0"></span> Tous | |
| </button> | |
| <div class="filterbar-sep"></div> | |
| <button class="type-btn" id="tbtn-bureaux" style="--type-color:#4a9eff" onclick="setType('bureaux',this)"> | |
| <span class="type-dot" style="background:#4a9eff"></span> π’ Bureaux | |
| </button> | |
| <button class="type-btn" id="tbtn-immeuble" style="--type-color:#c8963e" onclick="setType('immeuble',this)"> | |
| <span class="type-dot" style="background:#c8963e"></span> ποΈ Immeubles entiers | |
| </button> | |
| <button class="type-btn" id="tbtn-entrepot" style="--type-color:#9b59b6" onclick="setType('entrepot',this)"> | |
| <span class="type-dot" style="background:#9b59b6"></span> π¦ EntrepΓ΄ts / Logistique | |
| </button> | |
| <button class="type-btn" id="tbtn-coworking" style="--type-color:#2ecc8f" onclick="setType('coworking',this)"> | |
| <span class="type-dot" style="background:#2ecc8f"></span> π‘ Coworking / Flex | |
| </button> | |
| <button class="type-btn" id="tbtn-local" style="--type-color:#e74c3c" onclick="setType('local',this)"> | |
| <span class="type-dot" style="background:#e74c3c"></span> πͺ Locaux commerciaux | |
| </button> | |
| <div class="stock-summary" id="stock-summary"> | |
| <span class="stock-stat">Villes affichΓ©es : <strong id="ss-villes">11</strong></span> | |
| <span class="stock-stat">Stock total : <strong id="ss-stock">β</strong></span> | |
| <span class="stock-stat">Prix moy. : <strong id="ss-prix">β</strong></span> | |
| </div> | |
| </div> | |
| <div class="main"> | |
| <!-- SIDEBAR --> | |
| <div class="sidebar"> | |
| <div class="sidebar-header"> | |
| <h3 id="sidebar-title">Toutes les villes</h3> | |
| <input class="search-box" type="text" placeholder="π Rechercher une villeβ¦" oninput="filterCities(this.value)"> | |
| </div> | |
| <div class="sidebar-list" id="city-list"></div> | |
| </div> | |
| <!-- MAP --> | |
| <div id="map"></div> | |
| <!-- DETAIL PANEL --> | |
| <div class="detail-panel hidden" id="detail-panel"> | |
| <div> | |
| <div class="detail-type-badge" id="d-type-badge">ποΈ Tous types</div> | |
| <div class="detail-city-name" id="d-name">β</div> | |
| <div class="detail-region" id="d-region">β</div> | |
| </div> | |
| <div> | |
| <div style="font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.7px;margin-bottom:6px;" id="d-layer-label">Prix/mΒ²</div> | |
| <div class="detail-price" id="d-price">β</div> | |
| <div style="font-size:13px;margin-top:4px;" id="d-delta"></div> | |
| </div> | |
| <!-- STOCK PAR TYPE --> | |
| <div class="detail-section" id="d-supply-section"> | |
| <h4>Offre disponible par type</h4> | |
| <table class="supply-table"> | |
| <thead><tr><th>Type</th><th>Stock</th><th>Prix/mΒ²</th><th>Dispo</th></tr></thead> | |
| <tbody id="d-supply-body"></tbody> | |
| </table> | |
| </div> | |
| <div class="detail-section"> | |
| <h4>Indicateurs clΓ©s</h4> | |
| <div class="detail-kpi-row" id="d-kpis"></div> | |
| </div> | |
| <div class="detail-section"> | |
| <h4>Demande par secteur</h4> | |
| <div class="segment-list" id="d-segments"></div> | |
| </div> | |
| <div class="detail-section"> | |
| <h4>Atouts & signaux</h4> | |
| <div class="tag-list" id="d-tags"></div> | |
| </div> | |
| <button class="btn-agent" onclick="openAnalyst()">π Analyser avec l'agent MarchΓ©</button> | |
| </div> | |
| </div> | |
| <!-- LEGEND --> | |
| <div class="legend" id="legend"> | |
| <h4 id="legend-title">Prix/mΒ² β Tous types</h4> | |
| <div class="legend-scale" id="legend-scale"></div> | |
| </div> | |
| <script> | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // TYPES DE BIEN | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| const TYPES = { | |
| all: { label: 'Tous types', icon: 'ποΈ', color: '#e8eaf0', priceKey: 'bureaux' }, | |
| bureaux: { label: 'Bureaux', icon: 'π’', color: '#4a9eff', priceKey: 'bureaux' }, | |
| immeuble: { label: 'Immeubles entiers', icon: 'ποΈ', color: '#c8963e', priceKey: 'immeuble' }, | |
| entrepot: { label: 'EntrepΓ΄ts / Logistique', icon: 'π¦', color: '#9b59b6', priceKey: 'entrepot' }, | |
| coworking: { label: 'Coworking / Flex', icon: 'π‘', color: '#2ecc8f', priceKey: 'coworking' }, | |
| local: { label: 'Locaux commerciaux', icon: 'πͺ', color: '#e74c3c', priceKey: 'local' } | |
| }; | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // CITIES DATA | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| const CITIES = [ | |
| { | |
| id: 'casa-cfc', name: 'Casablanca CFC', region: 'Grand Casablanca', | |
| lat: 33.5731, lng: -7.6298, | |
| bureaux: 18500, immeuble: 22000, entrepot: null, coworking: 5200, local: 16000, | |
| delta_b: 6.2, delta_i: 5.8, delta_co: 8.1, | |
| vacance: 4.8, demande: 92, | |
| supply: { | |
| bureaux: { stock: '320 000 mΒ²', dispo: true, note: 'Grade A dominant' }, | |
| immeuble: { stock: '8 immeubles', dispo: true, note: 'Rares, très demandés' }, | |
| entrepot: { stock: null, dispo: false, note: 'Hors zone' }, | |
| coworking: { stock: '12 espaces', dispo: true, note: 'Forte croissance' }, | |
| local: { stock: '45 000 mΒ²', dispo: true, note: 'RDC prime' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '2 400 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '4.8%', color: '#2ecc8f' }, | |
| { label: 'Rendement', value: '7.1%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '48/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Finance', pct: 45, color: '#4a9eff' }, | |
| { label: 'Consulting', pct: 25, color: '#c8963e' }, | |
| { label: 'Tech/IT', pct: 20, color: '#2ecc8f' }, | |
| { label: 'Autres', pct: 10, color: '#7b8099' } | |
| ], | |
| tags: ['π’ MarchΓ© tendu', 'β Grade A dominant', 'π° Fonds Golfe actifs', 'π Hub international'] | |
| }, | |
| { | |
| id: 'casa-anfa', name: 'Casablanca Anfa', region: 'Grand Casablanca', | |
| lat: 33.5892, lng: -7.6447, | |
| bureaux: 14200, immeuble: 17000, entrepot: null, coworking: 3800, local: 13000, | |
| delta_b: 4.1, delta_i: 3.5, delta_co: 5.2, | |
| vacance: 9.2, demande: 78, | |
| supply: { | |
| bureaux: { stock: '210 000 mΒ²', dispo: true, note: 'Offre variΓ©e' }, | |
| immeuble: { stock: '14 immeubles', dispo: true, note: 'Reconversion active' }, | |
| entrepot: { stock: null, dispo: false, note: 'Zone non compatible' }, | |
| coworking: { stock: '7 espaces', dispo: true, note: 'Expansion en cours' }, | |
| local: { stock: '62 000 mΒ²', dispo: true, note: 'Forte concentration' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 800 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '9.2%', color: '#f39c12' }, | |
| { label: 'Rendement', value: '6.4%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '32/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Finance', pct: 35, color: '#4a9eff' }, | |
| { label: 'Industrie', pct: 28, color: '#9b59b6' }, | |
| { label: 'Tech/IT', pct: 22, color: '#2ecc8f' }, | |
| { label: 'Autres', pct: 15, color: '#7b8099' } | |
| ], | |
| tags: ['π‘ MarchΓ© Γ©quilibrΓ©', 'ποΈ RΓ©novation active', 'π Reconversion en cours'] | |
| }, | |
| { | |
| id: 'casa-maarif', name: 'Casablanca Maarif', region: 'Grand Casablanca', | |
| lat: 33.5639, lng: -7.6278, | |
| bureaux: 11500, immeuble: 14000, entrepot: null, coworking: 2900, local: 10500, | |
| delta_b: 2.3, delta_i: 1.8, delta_co: 3.1, | |
| vacance: 12.1, demande: 65, | |
| supply: { | |
| bureaux: { stock: '145 000 mΒ²', dispo: true, note: 'Pression vacance' }, | |
| immeuble: { stock: '9 immeubles', dispo: true, note: 'OpportunitΓ©s achat' }, | |
| entrepot: { stock: null, dispo: false, note: 'Hors zone' }, | |
| coworking: { stock: '4 espaces', dispo: true, note: 'MarchΓ© Γ©mergent' }, | |
| local: { stock: '38 000 mΒ²', dispo: true, note: 'Offre abondante' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 400 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '12.1%', color: '#e74c3c' }, | |
| { label: 'Rendement', value: '5.8%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '21/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'PME', pct: 42, color: '#f39c12' }, | |
| { label: 'Commerce', pct: 30, color: '#c8963e' }, | |
| { label: 'Services', pct: 28, color: '#7b8099' } | |
| ], | |
| tags: ['π΄ Sur-offre partielle', 'π‘ Repositionnement', 'π Pression loyers'] | |
| }, | |
| { | |
| id: 'rabat-agdal', name: 'Rabat Agdal', region: 'Rabat-SalΓ©-KΓ©nitra', | |
| lat: 33.9813, lng: -6.8666, | |
| bureaux: 11800, immeuble: 14500, entrepot: null, coworking: 3200, local: 10000, | |
| delta_b: 3.5, delta_i: 4.1, delta_co: 4.8, | |
| vacance: 8.9, demande: 72, | |
| supply: { | |
| bureaux: { stock: '180 000 mΒ²', dispo: true, note: 'Grade B solide' }, | |
| immeuble: { stock: '11 immeubles', dispo: true, note: 'Institutionnels' }, | |
| entrepot: { stock: null, dispo: false, note: 'Zone administrative' }, | |
| coworking: { stock: '5 espaces', dispo: true, note: 'Croissance modΓ©rΓ©e' }, | |
| local: { stock: '28 000 mΒ²', dispo: true, note: 'Commerces de pied' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 500 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '8.9%', color: '#f39c12' }, | |
| { label: 'Rendement', value: '6.1%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '26/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Adm. publique', pct: 38, color: '#4a9eff' }, | |
| { label: 'Consulting', pct: 30, color: '#c8963e' }, | |
| { label: 'Finance', pct: 20, color: '#2ecc8f' }, | |
| { label: 'Autres', pct: 12, color: '#7b8099' } | |
| ], | |
| tags: ['ποΈ PΓ΄le administratif', 'π Demande institutionnelle', 'π΅ Locataires stables'] | |
| }, | |
| { | |
| id: 'rabat-hay-riad', name: 'Rabat Hay Riad', region: 'Rabat-SalΓ©-KΓ©nitra', | |
| lat: 33.9538, lng: -6.8672, | |
| bureaux: 10200, immeuble: 12500, entrepot: null, coworking: 2600, local: 8800, | |
| delta_b: 2.1, delta_i: 2.8, delta_co: 3.5, | |
| vacance: 10.5, demande: 60, | |
| supply: { | |
| bureaux: { stock: '95 000 mΒ²', dispo: true, note: 'MarchΓ© secondaire' }, | |
| immeuble: { stock: '6 immeubles', dispo: true, note: 'Mixte rΓ©sidentiel' }, | |
| entrepot: { stock: null, dispo: false, note: 'Non disponible' }, | |
| coworking: { stock: '3 espaces', dispo: true, note: 'Demande faible' }, | |
| local: { stock: '18 000 mΒ²', dispo: true, note: 'Offre correcte' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 300 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '10.5%', color: '#f39c12' }, | |
| { label: 'Rendement', value: '5.5%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '15/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Services', pct: 40, color: '#9b59b6' }, | |
| { label: 'PME', pct: 35, color: '#f39c12' }, | |
| { label: 'SantΓ©/Γdu', pct: 25, color: '#2ecc8f' } | |
| ], | |
| tags: ['ποΈ Mixte rΓ©sidentiel-bureau', 'π MarchΓ© secondaire', 'π MontΓ©e en gamme'] | |
| }, | |
| { | |
| id: 'tanger-marina', name: 'Tanger Marina / Free Zone', region: 'Tanger-TΓ©touan-Al HoceΓ―ma', | |
| lat: 35.7673, lng: -5.7998, | |
| bureaux: 8100, immeuble: 10200, entrepot: 4200, coworking: 2800, local: 7500, | |
| delta_b: 8.7, delta_i: 9.2, delta_co: 11.3, | |
| vacance: 7.3, demande: 80, | |
| supply: { | |
| bureaux: { stock: '95 000 mΒ²', dispo: true, note: 'Zone franche' }, | |
| immeuble: { stock: '7 immeubles', dispo: true, note: 'Investisseurs Γ©trangers' }, | |
| entrepot: { stock: '380 000 mΒ²', dispo: true, note: 'Hub logistique majeur β' }, | |
| coworking: { stock: '4 espaces', dispo: true, note: 'En dΓ©veloppement' }, | |
| local: { stock: '32 000 mΒ²', dispo: true, note: 'Marina et zone franche' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 050 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '7.3%', color: '#2ecc8f' }, | |
| { label: 'Rendement', value: '8.2%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '22/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Industrie', pct: 42, color: '#9b59b6' }, | |
| { label: 'Logistique', pct: 30, color: '#4a9eff' }, | |
| { label: 'BPO/Export', pct: 20, color: '#2ecc8f' }, | |
| { label: 'Autres', pct: 8, color: '#7b8099' } | |
| ], | |
| tags: ['π’ Croissance +8.7%', 'π’ Hub MΓ©diterranΓ©e', 'β Zone franche', 'π¦ Logistique #1'] | |
| }, | |
| { | |
| id: 'marrakech-gueliz', name: 'Marrakech GuΓ©liz', region: 'Marrakech-Safi', | |
| lat: 31.6295, lng: -8.0107, | |
| bureaux: 9400, immeuble: 11500, entrepot: 2800, coworking: 3100, local: 8200, | |
| delta_b: -1.2, delta_i: 0.5, delta_co: 4.2, | |
| vacance: 14.1, demande: 48, | |
| supply: { | |
| bureaux: { stock: '72 000 mΒ²', dispo: true, note: 'Vacance Γ©levΓ©e' }, | |
| immeuble: { stock: '5 immeubles', dispo: true, note: 'MarchΓ© lent' }, | |
| entrepot: { stock: '85 000 mΒ²', dispo: true, note: 'Zone logistique Sidi Ghanem' }, | |
| coworking: { stock: '8 espaces', dispo: true, note: 'Tourisme d\'affaires β' }, | |
| local: { stock: '54 000 mΒ²', dispo: true, note: 'Sur-offre importante' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 200 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '14.1%', color: '#e74c3c' }, | |
| { label: 'Rendement', value: '5.2%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '10/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Tourisme', pct: 38, color: '#f39c12' }, | |
| { label: 'HospitalitΓ©', pct: 30, color: '#e74c3c' }, | |
| { label: 'Retail', pct: 20, color: '#9b59b6' }, | |
| { label: 'Autres', pct: 12, color: '#7b8099' } | |
| ], | |
| tags: ['π΄ Sur-offre significative', 'ποΈ Tourisme dominant', 'β οΈ Loyers en baisse', 'π¦ Sidi Ghanem actif'] | |
| }, | |
| { | |
| id: 'casanearshore', name: 'Casanearshore (Hay Hassani)', region: 'Grand Casablanca', | |
| lat: 33.5439, lng: -7.6658, | |
| bureaux: 13500, immeuble: null, entrepot: null, coworking: 3500, local: null, | |
| delta_b: 5.1, delta_i: null, delta_co: 6.8, | |
| vacance: 6.2, demande: 85, | |
| supply: { | |
| bureaux: { stock: '320 000 mΒ²', dispo: true, note: 'Parc BPO/Tech exclusif' }, | |
| immeuble: { stock: null, dispo: false, note: 'Parc gΓ©rΓ©, non fractionnΓ©' }, | |
| entrepot: { stock: null, dispo: false, note: 'Non applicable' }, | |
| coworking: { stock: '6 espaces', dispo: true, note: 'Hubs startups' }, | |
| local: { stock: null, dispo: false, note: 'Zones bureaux only' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '1 700 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '6.2%', color: '#2ecc8f' }, | |
| { label: 'Rendement', value: '6.8%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '18/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'BPO/IT', pct: 58, color: '#4a9eff' }, | |
| { label: 'Tech', pct: 28, color: '#2ecc8f' }, | |
| { label: 'Autres', pct: 14, color: '#7b8099' } | |
| ], | |
| tags: ['β PΓ΄le BPO/Tech majeur', 'π’ Faible vacance', 'π‘ ΓcosystΓ¨me startups', 'π Multinationales'] | |
| }, | |
| { | |
| id: 'agadir', name: 'Agadir Talborjt', region: 'Souss-Massa', | |
| lat: 30.4278, lng: -9.5981, | |
| bureaux: 7500, immeuble: 9200, entrepot: 1900, coworking: 2100, local: 6800, | |
| delta_b: 3.2, delta_i: 4.5, delta_co: 5.5, | |
| vacance: 11.8, demande: 52, | |
| supply: { | |
| bureaux: { stock: '64 000 mΒ²', dispo: true, note: 'MarchΓ© modeste' }, | |
| immeuble: { stock: '4 immeubles', dispo: true, note: 'Peu actif' }, | |
| entrepot: { stock: '120 000 mΒ²', dispo: true, note: 'PΓ΄le agro-industriel' }, | |
| coworking: { stock: '3 espaces', dispo: true, note: 'Très émergent' }, | |
| local: { stock: '28 000 mΒ²', dispo: true, note: 'Commerce rΓ©gional' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '950 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '11.8%', color: '#e74c3c' }, | |
| { label: 'Rendement', value: '5.9%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '12/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Agro-industrie', pct: 40, color: '#2ecc8f' }, | |
| { label: 'Tourisme', pct: 30, color: '#f39c12' }, | |
| { label: 'PΓͺche/Export', pct: 20, color: '#4a9eff' }, | |
| { label: 'Autres', pct: 10, color: '#7b8099' } | |
| ], | |
| tags: ['πΏ Agro-industrie dominante', 'π¦ Zone entrepΓ΄ts solide', 'π DΓ©veloppement lent'] | |
| }, | |
| { | |
| id: 'fes', name: 'Fès Ville Nouvelle', region: 'Fès-Meknès', | |
| lat: 34.0181, lng: -5.0078, | |
| bureaux: 6800, immeuble: 8500, entrepot: 1500, coworking: 1800, local: 5900, | |
| delta_b: 1.1, delta_i: 0.8, delta_co: 2.0, | |
| vacance: 16.2, demande: 40, | |
| supply: { | |
| bureaux: { stock: '58 000 mΒ²', dispo: true, note: 'MarchΓ© atone' }, | |
| immeuble: { stock: '3 immeubles', dispo: true, note: 'Peu de transactions' }, | |
| entrepot: { stock: '65 000 mΒ²', dispo: true, note: 'PΓ΄le artisanat/industrie' }, | |
| coworking: { stock: '2 espaces', dispo: true, note: 'Très embryonnaire' }, | |
| local: { stock: '22 000 mΒ²', dispo: true, note: 'Commerce local' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '870 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '16.2%', color: '#e74c3c' }, | |
| { label: 'Rendement', value: '5.1%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '8/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Γducation', pct: 35, color: '#2ecc8f' }, | |
| { label: 'Commerce', pct: 30, color: '#c8963e' }, | |
| { label: 'Services', pct: 35, color: '#7b8099' } | |
| ], | |
| tags: ['π΄ MarchΓ© atone', 'π PΓ΄le universitaire', 'π‘ Potentiel sous-exploitΓ©'] | |
| }, | |
| { | |
| id: 'oujda', name: 'Oujda Centre', region: 'Oriental', | |
| lat: 34.6814, lng: -1.9086, | |
| bureaux: 5200, immeuble: 6800, entrepot: 1200, coworking: 1400, local: 4800, | |
| delta_b: 0.5, delta_i: 1.2, delta_co: 1.8, | |
| vacance: 18.5, demande: 30, | |
| supply: { | |
| bureaux: { stock: '35 000 m²', dispo: true, note: 'Activité très faible' }, | |
| immeuble: { stock: '2 immeubles', dispo: true, note: 'Prix d\'entrΓ©e bas' }, | |
| entrepot: { stock: '42 000 m²', dispo: true, note: 'Zone frontalière Algérie' }, | |
| coworking: { stock: '1 espace', dispo: true, note: 'MarchΓ© inexistant' }, | |
| local: { stock: '18 000 mΒ²', dispo: true, note: 'Sur-offre' } | |
| }, | |
| kpis: [ | |
| { label: 'Loyer/mΒ²/an', value: '660 MAD', color: '#c8963e' }, | |
| { label: 'Vacance', value: '18.5%', color: '#e74c3c' }, | |
| { label: 'Rendement', value: '4.8%/an', color: '#4a9eff' }, | |
| { label: 'Transactions', value: '4/trim', color: '#9b59b6' } | |
| ], | |
| segments: [ | |
| { label: 'Commerce', pct: 50, color: '#c8963e' }, | |
| { label: 'Services', pct: 35, color: '#7b8099' }, | |
| { label: 'Autres', pct: 15, color: '#4a9eff' } | |
| ], | |
| tags: ['π΄ MarchΓ© marginal', 'π Frontalier AlgΓ©rie', 'π‘ Zone franche potentielle'] | |
| } | |
| ]; | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // STATE | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| let currentType = 'all'; | |
| let currentLayer = 'prix'; | |
| let selectedCityId = null; | |
| let searchVal = ''; | |
| let markers = {}; | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // LAYER CONFIG | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| const LAYERS = { | |
| prix: { | |
| label: 'Prix/mΒ²', unit: ' MAD/mΒ²', | |
| getValue: (city) => { | |
| const key = currentType === 'all' ? 'bureaux' : TYPES[currentType].priceKey; | |
| return city[key]; | |
| }, | |
| scale: [ | |
| { min: 15000, label: '> 15 000', color: '#ff4757' }, | |
| { min: 10000, label: '10 000β15 000', color: '#ff8c00' }, | |
| { min: 7000, label: '7 000β10 000', color: '#c8963e' }, | |
| { min: 4000, label: '4 000β7 000', color: '#4a9eff' }, | |
| { min: 0, label: '< 4 000', color: '#7b8099' } | |
| ] | |
| }, | |
| vacance: { | |
| label: 'Taux de vacance (%)', unit: '%', | |
| getValue: (city) => city.vacance, | |
| scale: [ | |
| { min: 16, label: '> 16% (critique)', color: '#e74c3c' }, | |
| { min: 12, label: '12β16% (Γ©levΓ©)', color: '#ff8c00' }, | |
| { min: 8, label: '8β12% (moyen)', color: '#f39c12' }, | |
| { min: 4, label: '4β8% (sain)', color: '#2ecc8f' }, | |
| { min: 0, label: '< 4% (tendu)', color: '#00d4aa' } | |
| ] | |
| }, | |
| demande: { | |
| label: 'Score de demande /100', unit: '/100', | |
| getValue: (city) => city.demande, | |
| scale: [ | |
| { min: 85, label: '> 85 (très forte)', color: '#00d4aa' }, | |
| { min: 70, label: '70β85 (forte)', color: '#2ecc8f' }, | |
| { min: 55, label: '55β70 (modΓ©rΓ©e)', color: '#c8963e' }, | |
| { min: 40, label: '40β55 (faible)', color: '#ff8c00' }, | |
| { min: 0, label: '< 40 (atone)', color: '#e74c3c' } | |
| ] | |
| } | |
| }; | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // MAP INIT | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| const map = L.map('map', { center: [31.5, -6.5], zoom: 6 }); | |
| L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
| attribution: 'Β© OpenStreetMap', maxZoom: 18 | |
| }).addTo(map); | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // HELPERS | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function cityAvailable(city) { | |
| if (currentType === 'all') return true; | |
| return city.supply[currentType] && city.supply[currentType].dispo; | |
| } | |
| function getPriceForType(city) { | |
| if (currentType === 'all') return city.bureaux; | |
| return city[TYPES[currentType].priceKey]; | |
| } | |
| function getColor(val, layer) { | |
| if (val === null || val === undefined) return '#3a3d50'; | |
| const scale = LAYERS[layer].scale; | |
| for (const s of scale) if (val >= s.min) return s.color; | |
| return '#7b8099'; | |
| } | |
| function getRadius(val, layer) { | |
| if (!val) return 8; | |
| if (layer === 'prix') return 8 + Math.min(val / 1800, 18); | |
| if (layer === 'vacance') return 10 + val * 0.5; | |
| if (layer === 'demande') return 8 + val * 0.16; | |
| return 12; | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // MARKERS | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function buildMarkers() { | |
| Object.values(markers).forEach(m => map.removeLayer(m)); | |
| markers = {}; | |
| CITIES.forEach(city => { | |
| const avail = cityAvailable(city); | |
| const layer = LAYERS[currentLayer]; | |
| const val = layer.getValue(city); | |
| const color = avail ? getColor(val, currentLayer) : '#2e3347'; | |
| const radius = avail ? getRadius(val, currentLayer) : 7; | |
| const isSelected = city.id === selectedCityId; | |
| const typeInfo = TYPES[currentType]; | |
| const m = L.circleMarker([city.lat, city.lng], { | |
| radius, | |
| fillColor: color, | |
| color: isSelected ? '#fff' : (avail ? color : '#3a3d50'), | |
| weight: isSelected ? 3 : 1.5, | |
| opacity: 1, | |
| fillOpacity: avail ? (isSelected ? 1 : 0.82) : 0.3 | |
| }).addTo(map); | |
| const dispVal = val !== null && val !== undefined ? `${val.toLocaleString('fr-FR')}${layer.unit}` : 'N/D'; | |
| const typeTag = currentType !== 'all' | |
| ? `<div style="font-size:10px;margin-top:4px;color:${typeInfo.color};">${typeInfo.icon} ${typeInfo.label} β ${avail ? city.supply[currentType].note : 'Non disponible'}</div>` | |
| : ''; | |
| m.bindTooltip(` | |
| <div style="font-weight:700;font-size:13px;margin-bottom:2px;">${city.name}</div> | |
| <div style="color:#c8963e;font-size:14px;font-weight:700;">${dispVal}</div> | |
| <div style="color:#7b8099;font-size:11px;">${city.region}</div> | |
| ${typeTag} | |
| `, { className: 'custom-tooltip', sticky: true }); | |
| m.on('click', () => selectCity(city.id)); | |
| markers[city.id] = m; | |
| }); | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // SIDEBAR LIST | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function buildList() { | |
| const layer = LAYERS[currentLayer]; | |
| const container = document.getElementById('city-list'); | |
| const filtered = CITIES.filter(c => | |
| c.name.toLowerCase().includes(searchVal) || | |
| c.region.toLowerCase().includes(searchVal) | |
| ); | |
| // Sort: available first, then by value desc | |
| filtered.sort((a, b) => { | |
| const aa = cityAvailable(a), bb = cityAvailable(b); | |
| if (aa !== bb) return bb - aa; | |
| const va = layer.getValue(a) || 0, vb = layer.getValue(b) || 0; | |
| return vb - va; | |
| }); | |
| container.innerHTML = filtered.map(city => { | |
| const avail = cityAvailable(city); | |
| const val = layer.getValue(city); | |
| const color = avail ? getColor(val, currentLayer) : '#3a3d50'; | |
| const dispVal = val !== null && val !== undefined ? `${val.toLocaleString('fr-FR')}${layer.unit}` : 'β'; | |
| const deltaKey = currentType === 'all' ? 'delta_b' : (currentType === 'immeuble' ? 'delta_i' : currentType === 'coworking' ? 'delta_co' : 'delta_b'); | |
| const delta = city[deltaKey]; | |
| return ` | |
| <div class="city-item ${city.id === selectedCityId ? 'selected' : ''} ${!avail ? 'faded' : ''}" | |
| id="li-${city.id}" onclick="selectCity('${city.id}')"> | |
| <div class="city-dot" style="background:${color}"></div> | |
| <div class="city-info"> | |
| <div class="city-name">${city.name}</div> | |
| <div class="city-region">${city.region}${!avail ? ' Β· <em>non disponible</em>' : ''}</div> | |
| </div> | |
| <div class="city-price"> | |
| ${avail | |
| ? `<div class="val">${dispVal}</div>${delta !== null && delta !== undefined ? `<div class="delta ${delta >= 0 ? 'up' : 'down'}">${delta >= 0 ? 'β' : 'β'} ${Math.abs(delta)}%/an</div>` : ''}` | |
| : `<span class="no-supply">Pas d'offre</span>` | |
| } | |
| </div> | |
| </div> | |
| `; | |
| }).join(''); | |
| updateStockSummary(filtered); | |
| document.getElementById('sidebar-title').textContent = | |
| currentType === 'all' ? 'Toutes les villes' : `${TYPES[currentType].icon} ${TYPES[currentType].label}`; | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // STOCK SUMMARY BAR | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function updateStockSummary(cities) { | |
| const avail = cities.filter(c => cityAvailable(c)); | |
| const prices = avail.map(c => LAYERS[currentLayer].getValue(c)).filter(v => v !== null && v !== undefined); | |
| const moy = prices.length ? Math.round(prices.reduce((a, b) => a + b, 0) / prices.length) : 0; | |
| const unit = LAYERS[currentLayer].unit; | |
| document.getElementById('ss-villes').textContent = avail.length + ' / ' + cities.length; | |
| document.getElementById('ss-stock').textContent = currentType !== 'all' | |
| ? avail.reduce((acc, c) => { const s = c.supply[currentType]; return acc + (s && s.stock ? 1 : 0); }, 0) + ' sites' | |
| : 'β'; | |
| document.getElementById('ss-prix').textContent = prices.length | |
| ? moy.toLocaleString('fr-FR') + unit | |
| : 'β'; | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // SELECT CITY | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function selectCity(id) { | |
| selectedCityId = id; | |
| const city = CITIES.find(c => c.id === id); | |
| if (!city) return; | |
| document.querySelectorAll('.city-item').forEach(el => el.classList.remove('selected')); | |
| const li = document.getElementById('li-' + id); | |
| if (li) { li.classList.add('selected'); li.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); } | |
| buildMarkers(); | |
| map.flyTo([city.lat, city.lng], 10, { duration: 0.8 }); | |
| // ββ FILL DETAIL ββ | |
| const typeInfo = TYPES[currentType]; | |
| document.getElementById('d-type-badge').innerHTML = | |
| `<span style="font-size:14px;">${typeInfo.icon}</span> ${typeInfo.label}`; | |
| document.getElementById('d-type-badge').style.color = typeInfo.color; | |
| document.getElementById('d-type-badge').style.borderColor = typeInfo.color + '55'; | |
| document.getElementById('d-type-badge').style.background = typeInfo.color + '18'; | |
| document.getElementById('d-name').textContent = city.name; | |
| document.getElementById('d-region').textContent = city.region; | |
| const layer = LAYERS[currentLayer]; | |
| const val = layer.getValue(city); | |
| document.getElementById('d-layer-label').textContent = layer.label; | |
| document.getElementById('d-price').innerHTML = val !== null && val !== undefined | |
| ? `${val.toLocaleString('fr-FR')}<sub>${layer.unit}</sub>` | |
| : '<span style="color:var(--muted)">Non disponible</span>'; | |
| const deltaKey = currentType === 'immeuble' ? 'delta_i' : currentType === 'coworking' ? 'delta_co' : 'delta_b'; | |
| const delta = city[deltaKey]; | |
| const dEl = document.getElementById('d-delta'); | |
| if (delta !== null && delta !== undefined) { | |
| dEl.innerHTML = `<span style="color:${delta >= 0 ? 'var(--green)' : 'var(--red)'};font-weight:700;">${delta >= 0 ? 'β' : 'β'} ${Math.abs(delta)}%</span> <span style="color:var(--muted)">variation annuelle</span>`; | |
| } else { dEl.textContent = ''; } | |
| // Supply table | |
| const tbody = document.getElementById('d-supply-body'); | |
| tbody.innerHTML = Object.entries(city.supply).map(([k, s]) => { | |
| const t = TYPES[k]; | |
| return `<tr> | |
| <td><span class="supply-avail"> | |
| <span class="supply-dot-sm" style="background:${s.dispo ? t.color : '#3a3d50'}"></span> | |
| ${t.icon} ${t.label.split(' ')[0]} | |
| </span></td> | |
| <td style="color:${s.dispo ? 'var(--text)' : 'var(--muted)'};">${s.stock || 'β'}</td> | |
| <td style="color:var(--accent);font-weight:700;"> | |
| ${s.dispo && city[t.priceKey] ? city[t.priceKey].toLocaleString('fr-FR') + ' MAD' : 'β'} | |
| </td> | |
| <td style="color:${s.dispo ? 'var(--green)' : 'var(--muted)'};font-size:11px;"> | |
| ${s.dispo ? 'β' : 'β'} | |
| </td> | |
| </tr>`; | |
| }).join(''); | |
| document.getElementById('d-kpis').innerHTML = city.kpis.map(k => ` | |
| <div class="detail-kpi"> | |
| <div class="label">${k.label}</div> | |
| <div class="value" style="color:${k.color}">${k.value}</div> | |
| </div> | |
| `).join(''); | |
| document.getElementById('d-segments').innerHTML = city.segments.map(s => ` | |
| <div class="segment-row"> | |
| <div class="segment-label">${s.label}</div> | |
| <div class="segment-track"><div class="segment-fill" style="width:${s.pct}%;background:${s.color}"></div></div> | |
| <div class="segment-val">${s.pct}%</div> | |
| </div> | |
| `).join(''); | |
| document.getElementById('d-tags').innerHTML = city.tags.map(t => `<span class="tag">${t}</span>`).join(''); | |
| document.getElementById('detail-panel').classList.remove('hidden'); | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // LAYER + TYPE SWITCHES | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function setLayer(layer, btn) { | |
| currentLayer = layer; | |
| document.querySelectorAll('.layer-btn').forEach(b => b.classList.remove('active')); | |
| btn.classList.add('active'); | |
| buildMarkers(); buildList(); buildLegend(); | |
| if (selectedCityId) selectCity(selectedCityId); | |
| } | |
| function setType(type, btn) { | |
| currentType = type; | |
| document.querySelectorAll('.type-btn').forEach(b => b.classList.remove('active')); | |
| btn.classList.add('active'); | |
| buildMarkers(); buildList(); buildLegend(); | |
| if (selectedCityId) selectCity(selectedCityId); | |
| } | |
| function filterCities(val) { searchVal = val.toLowerCase(); buildList(); } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // LEGEND | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| function buildLegend() { | |
| const layer = LAYERS[currentLayer]; | |
| const typeInfo = TYPES[currentType]; | |
| document.getElementById('legend-title').textContent = | |
| `${typeInfo.icon} ${typeInfo.label} β ${layer.label}`; | |
| document.getElementById('legend-scale').innerHTML = layer.scale.map(s => ` | |
| <div class="legend-row"> | |
| <div class="legend-dot" style="background:${s.color}"></div> | |
| <span>${s.label}</span> | |
| </div> | |
| `).join('') + ` | |
| <div class="legend-row" style="margin-top:4px;padding-top:6px;border-top:1px solid var(--border);"> | |
| <div class="legend-dot" style="background:#2e3347;opacity:.5"></div> | |
| <span style="color:var(--muted)">Non disponible</span> | |
| </div> | |
| `; | |
| } | |
| function openAnalyst() { | |
| const city = CITIES.find(c => c.id === selectedCityId); | |
| if (city) window.open(`index.html#analyst&city=${encodeURIComponent(city.name)}&type=${currentType}`, '_blank'); | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // INIT | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| buildMarkers(); buildList(); buildLegend(); | |
| </script> | |
| </body> | |
| </html> | |