- index.html devient l'espace projet : écran de mot de passe (même empreinte et même limite d'essais qu'avant) puis tableau de bord (Disponible / En construction), aux couleurs de la charte v1.1. - L'application passe dans app.html ; sans déverrouillage, elle renvoie vers index.html. tailwind.config.js lit app.html. - charte.html : charte graphique v1.1 (palette #8B9E90 / #2D2D2D / #F2F0E6, logo, icônes, animations), réservée comme app.html. Polices locales. - assets/icones-jobrunner/ : 15 icônes SVG (currentColor, sans cadre). - assets/img/logo-j.svg : logo J de la charte. - legal.html : lien « Retour à l'espace projet ». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6588 lignes
398 KiB
HTML
6588 lignes
398 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr" class="h-full">
|
|
<head>
|
|
<!-- Accès réservé : sans déverrouillage dans l'espace projet (index.html), retour à l'écran de mot de passe -->
|
|
<script>try{if(sessionStorage.getItem('jobrunner_dev_unlocked')!=='true')location.replace('index.html')}catch(e){location.replace('index.html')}</script>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
|
<title>Jobrunner - Services & Prestations Sécurisées</title>
|
|
<link rel="icon" type="image/svg+xml" href="assets/img/logo-light.svg">
|
|
|
|
<!-- Polices auto-hébergées (aucun appel externe) -->
|
|
<link rel="preload" href="assets/fonts/plus-jakarta-sans-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin>
|
|
<link rel="preload" href="assets/fonts/outfit-latin-700-normal.woff2" as="font" type="font/woff2" crossorigin>
|
|
<link rel="stylesheet" href="assets/css/fonts.css">
|
|
|
|
<script>
|
|
// ====== FALLBACK LOGO ROBUSTE ======
|
|
function handleLogoError(img, theme = 'sage') {
|
|
if (!img || img.dataset.fallbackApplied) return;
|
|
img.dataset.fallbackApplied = 'true';
|
|
const isBeige = theme === 'beige';
|
|
const bgClass = isBeige ? 'bg-[#F1EDE1] text-job-sage border border-job-sage/30' : 'bg-job-sage text-white';
|
|
const wrapper = document.createElement('div');
|
|
wrapper.className = `${img.className || ''} ${bgClass} flex items-center justify-center font-bold select-none shrink-0 overflow-hidden`;
|
|
wrapper.setAttribute('aria-label', 'Jobrunner');
|
|
wrapper.innerHTML = `<span class="font-titre font-black text-sm sm:text-base leading-none select-none" style="font-family:'Outfit',sans-serif;">J</span>`;
|
|
img.replaceWith(wrapper);
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
html, body {
|
|
height: 100%;
|
|
background-color: #F4F2EC;
|
|
color: #1F221E;
|
|
-webkit-tap-highlight-color: transparent;
|
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
h1, h2, h3, .font-titre {
|
|
font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
|
|
letter-spacing: -0.02em;
|
|
}
|
|
|
|
#app-wrapper {
|
|
width: 100%;
|
|
max-width: 480px;
|
|
min-height: 100vh;
|
|
margin: 0 auto;
|
|
background-color: #F4F2EC;
|
|
position: relative;
|
|
box-shadow: 0 0 60px rgba(0, 0, 0, 0.14);
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
#app-wrapper {
|
|
max-width: 100%;
|
|
box-shadow: none;
|
|
padding-top: 64px;
|
|
}
|
|
.app-view {
|
|
max-width: 1280px;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
width: 100%;
|
|
padding-bottom: 48px !important;
|
|
}
|
|
#view-messages.app-view {
|
|
max-width: 100% !important;
|
|
margin: 0 !important;
|
|
padding: 0 !important;
|
|
height: calc(100vh - 64px) !important;
|
|
overflow: hidden !important;
|
|
}
|
|
}
|
|
|
|
.hide-scroll {
|
|
-ms-overflow-style: none;
|
|
scrollbar-width: none;
|
|
}
|
|
.hide-scroll::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.app-view {
|
|
display: none !important;
|
|
opacity: 0;
|
|
transform: translateY(8px);
|
|
transition: opacity 0.22s ease-out, transform 0.22s ease-out;
|
|
flex-grow: 1;
|
|
padding-bottom: 96px;
|
|
}
|
|
.app-view.active {
|
|
display: block !important;
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
#view-home.active {
|
|
display: flex !important;
|
|
flex-direction: column;
|
|
}
|
|
#view-shorts.active {
|
|
display: block !important;
|
|
transform: none !important;
|
|
}
|
|
#bottom-nav {
|
|
position: fixed !important;
|
|
bottom: 0 !important;
|
|
left: 0 !important;
|
|
right: 0 !important;
|
|
margin-left: auto !important;
|
|
margin-right: auto !important;
|
|
}
|
|
|
|
@keyframes instaHeartPop {
|
|
0% {
|
|
transform: translate(-50%, -50%) scale(0) rotate(-22deg);
|
|
opacity: 0;
|
|
}
|
|
32% {
|
|
transform: translate(-50%, -50%) scale(1.32) rotate(8deg);
|
|
opacity: 1;
|
|
}
|
|
52% {
|
|
transform: translate(-50%, -50%) scale(1.02) rotate(-3deg);
|
|
opacity: 1;
|
|
}
|
|
70% {
|
|
transform: translate(-50%, -30px) scale(1.06) rotate(4deg);
|
|
opacity: 0.95;
|
|
}
|
|
100% {
|
|
transform: translate(-50%, -75px) scale(0.8) rotate(12deg);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
.insta-heart-anim {
|
|
animation: instaHeartPop 0.82s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
will-change: transform, opacity;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.pulse-dot {
|
|
animation: pulseAnimation 2s infinite;
|
|
}
|
|
@keyframes pulseAnimation {
|
|
0%, 100% { transform: scale(1); opacity: 1; }
|
|
50% { transform: scale(1.3); opacity: 0.5; }
|
|
}
|
|
|
|
.snap-y-mandatory {
|
|
scroll-snap-type: y mandatory;
|
|
scroll-behavior: smooth;
|
|
}
|
|
.snap-start {
|
|
scroll-snap-align: start;
|
|
scroll-snap-stop: always;
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="assets/icons/phosphor.css">
|
|
<link rel="stylesheet" href="assets/css/app.css">
|
|
</head>
|
|
<body class="selection:bg-job-sage selection:text-white">
|
|
|
|
|
|
<div id="app-wrapper">
|
|
|
|
<!-- Toast Notification Global -->
|
|
<div id="custom-modal" class="fixed top-6 left-1/2 -translate-x-1/2 bg-job-dark text-white px-5 py-3 rounded-full shadow-2xl z-[150] font-semibold text-sm hidden items-center gap-3 w-[90%] max-w-[420px] border border-white/10 backdrop-blur-md transition-all">
|
|
<div id="modal-icon-container" class="w-6 h-6 rounded-full bg-job-sage/30 text-job-sage flex items-center justify-center shrink-0">
|
|
<i id="modal-icon" class="ph-fill ph-check-circle text-lg"></i>
|
|
</div>
|
|
<span id="modal-text" class="flex-grow text-xs leading-snug">Notification</span>
|
|
</div>
|
|
|
|
<!-- ================= NAVIGATION SUPERIEURE DESKTOP (PC) ================= -->
|
|
<header id="desktop-navbar" class="hidden md:flex fixed top-0 left-0 right-0 z-50 bg-white/95 backdrop-blur-md border-b border-job-gray/80 px-4 sm:px-6 lg:px-8 py-2.5 shadow-xs transition-all w-full">
|
|
<div class="max-w-7xl mx-auto w-full flex items-center justify-between gap-3 lg:gap-5">
|
|
<!-- 1. Logo Jobrunner avec 'J' -->
|
|
<button onclick="navigate('home')" class="flex items-center gap-2.5 group transition-transform active:scale-95 shrink-0" aria-label="Jobrunner Accueil">
|
|
<img loading="lazy" decoding="async" src="assets/img/logo-light.svg" alt="Logo Jobrunner" class="w-10 h-10 object-contain object-center group-hover:scale-105 transition-transform select-none shrink-0" onerror="handleLogoError(this, 'sage')">
|
|
<span class="font-titre text-2xl font-black tracking-tight text-job-dark shrink-0">Job<span class="text-job-sage">runner</span></span>
|
|
</button>
|
|
|
|
<!-- 2. Barre de recherche rapide intégrée -->
|
|
<div class="flex-1 max-w-md min-w-0">
|
|
<div class="bg-job-bg hover:bg-white focus-within:bg-white focus-within:border-job-sage rounded-full flex items-center px-3.5 py-2 border border-job-gray/70 transition-all group overflow-hidden">
|
|
<button type="button" onclick="submitSearch(); navigate('search');" class="text-gray-400 group-focus-within:text-job-sage hover:text-job-sage mr-2 shrink-0 cursor-pointer" title="Rechercher">
|
|
<i class="ph ph-magnifying-glass text-base"></i>
|
|
</button>
|
|
<input type="text" id="desktop-top-search" placeholder="Rechercher un service, artisan, cours..." class="bg-transparent border-none outline-none w-full font-medium text-xs text-job-dark placeholder:text-gray-400" oninput="handleDesktopTopSearch(this.value)" onfocus="navigate('search')" onkeydown="if(event.key==='Enter') { submitSearch(); navigate('search'); }">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 3. Bouton Déposer une annonce -->
|
|
<button onclick="handlePublishClick()" class="bg-job-sage hover:bg-job-sage-dark text-white text-xs font-bold px-4 py-2.5 rounded-full flex items-center gap-2 shadow-floating transition-all active:scale-95 shrink-0 whitespace-nowrap">
|
|
<i class="ph-bold ph-plus-circle text-base"></i>
|
|
<span>Déposer une annonce</span>
|
|
</button>
|
|
|
|
<!-- 4. Navigation : Accueil, Loupe, Messages, Profil -->
|
|
<nav class="flex items-center gap-1 shrink-0">
|
|
<button onclick="navigate('home')" class="nav-btn flex items-center gap-1.5 px-3 py-2 rounded-full font-bold text-xs transition-all text-job-sage hover:bg-job-bg" data-target="home" title="Accueil">
|
|
<i class="ph-fill ph-house text-lg nav-icon"></i>
|
|
<span class="hidden xl:inline">Accueil</span>
|
|
</button>
|
|
<button onclick="navigate('search')" class="nav-btn flex items-center gap-1.5 px-3 py-2 rounded-full font-bold text-xs transition-all text-gray-500 hover:text-job-dark hover:bg-job-bg" data-target="search" title="Recherche">
|
|
<i class="ph ph-magnifying-glass text-lg nav-icon"></i>
|
|
<span class="hidden xl:inline">Recherche</span>
|
|
</button>
|
|
<button onclick="handleMessagesClick()" class="nav-btn flex items-center gap-1.5 px-3 py-2 rounded-full font-bold text-xs transition-all text-gray-500 hover:text-job-dark hover:bg-job-bg relative" data-target="messages" title="Messages">
|
|
<i class="ph ph-chat-circle text-lg nav-icon"></i>
|
|
<span class="hidden xl:inline">Messages</span>
|
|
<span id="desktop-messages-dot" class="w-2 h-2 rounded-full bg-rose-500 border border-white hidden -ml-0.5"></span>
|
|
</button>
|
|
<div id="desktop-auth-container" class="flex items-center ml-1 shrink-0">
|
|
<!-- Injecté dynamiquement par renderHeaderAuth() -->
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- ================= VUE 1 : ACCUEIL ================= -->
|
|
<main id="view-home" class="app-view active px-6 pt-6 md:pt-10">
|
|
<!-- Header : Profil ou Bouton Connexion -->
|
|
<header class="flex justify-between items-center mb-6 order-1">
|
|
<div>
|
|
<h1 class="text-3xl sm:text-4xl lg:text-5xl font-extrabold font-titre text-job-dark" id="home-greeting">Bonjour, <span class="text-job-sage whitespace-nowrap">Visiteur !</span></h1>
|
|
<p class="text-xs lg:text-sm text-gray-500 mt-1.5 font-medium hidden md:block">Jobrunner, trouvez, réservez, fait.</p>
|
|
</div>
|
|
<div id="header-auth-container" class="md:hidden"></div>
|
|
</header>
|
|
|
|
<!-- Barre de Recherche Rapide (visible uniquement sur mobile) -->
|
|
<div class="mb-6 md:hidden order-3">
|
|
<div class="bg-white rounded-2xl flex items-center px-4 py-3.5 shadow-card border border-job-gray/80 cursor-pointer hover:border-job-sage transition-all group" onclick="navigate('search')">
|
|
<i class="ph ph-magnifying-glass text-xl text-gray-400 group-hover:text-job-sage mr-3 transition-colors"></i>
|
|
<span class="text-gray-400 font-medium text-sm flex-grow">Chercher un service, plombier, cours...</span>
|
|
<div class="w-8 h-8 rounded-xl bg-job-bg flex items-center justify-center text-job-dark">
|
|
<i class="ph-bold ph-sliders-horizontal text-sm"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section Dernières recherches (Au-dessus des shorts sur mobile order-4, order-4 sur PC) -->
|
|
<div class="mb-7 order-4 md:order-4">
|
|
<div class="flex items-center gap-2 mb-2.5">
|
|
<i class="ph-bold ph-clock-counter-clockwise text-job-sage text-sm"></i>
|
|
<span class="text-xs font-bold uppercase tracking-wider text-gray-500">Dernières recherches</span>
|
|
</div>
|
|
<div class="flex items-center gap-2 overflow-x-auto md:overflow-visible md:flex-wrap hide-scroll pb-1" id="home-recent-searches">
|
|
<!-- Injecté dynamiquement par renderRecentSearches() -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section Shorts Vidéo avec quota pass (Sous les dernières recherches sur mobile order-5, tout en bas sur PC md:order-6) -->
|
|
<section id="home-shorts-section" class="mb-7 pt-1 md:pt-4 border-t-0 md:border-t md:border-job-gray/60 order-5 md:order-6">
|
|
<div class="flex justify-between items-center mb-3">
|
|
<div class="flex items-center gap-2">
|
|
<span class="w-2.5 h-2.5 rounded-full bg-rose-500 shadow-[0_0_8px_rgba(244,63,94,0.5)]"></span>
|
|
<h2 class="text-lg md:text-xl font-bold font-titre text-job-dark">Shorts</h2>
|
|
</div>
|
|
<button onclick="navigate('shorts')" class="text-[11px] font-bold text-gray-500 hover:text-job-dark flex items-center gap-1">
|
|
Plein écran <i class="ph-bold ph-caret-right text-sm"></i>
|
|
</button>
|
|
</div>
|
|
<div class="flex gap-4 overflow-x-auto hide-scroll pb-2 -mx-6 md:mx-0 px-6 md:px-0 snap-x snap-mandatory scroll-smooth" id="home-shorts-container" style="-webkit-overflow-scrolling: touch;">
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Annonces à la une (Boostées & Standard) -->
|
|
<section class="mb-8 order-6 md:order-5">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<div class="flex items-center gap-2">
|
|
<h2 class="text-lg font-bold font-titre text-job-dark">Annonces pertinentes</h2>
|
|
<span class="text-[11px] bg-emerald-100 text-emerald-800 font-bold px-2 py-0.5 rounded-full flex items-center gap-1">
|
|
<i class="ph-fill ph-sparkle text-job-sage"></i> Pertinence & Qualité
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6" id="home-recommendations-container">
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Footer Jobrunner (Accueil) -->
|
|
<div class="jobrunner-footer-slot -mx-6 mt-10 md:mx-0 order-7"></div>
|
|
</main>
|
|
|
|
<!-- ================= VUE 2 : RECHERCHE ================= -->
|
|
<main id="view-search" class="app-view px-6 pt-10 !pb-0">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h1 class="text-3xl font-bold font-titre text-job-dark">Recherche</h1>
|
|
<button onclick="resetAllFilters()" class="text-xs font-bold text-job-sage hover:underline">Réinitialiser</button>
|
|
</div>
|
|
|
|
<!-- Barre de recherche avec bouton Filtres -->
|
|
<div class="flex items-center gap-2 mb-3">
|
|
<div class="bg-white rounded-2xl flex-grow flex items-center px-4 py-3 shadow-card border border-job-gray/80 focus-within:ring-2 focus-within:ring-job-sage/60 transition-all">
|
|
<button type="button" onclick="submitSearch()" class="text-job-sage hover:text-job-sage-dark mr-2.5 shrink-0 cursor-pointer" title="Lancer la recherche">
|
|
<i class="ph ph-magnifying-glass text-xl"></i>
|
|
</button>
|
|
<input type="text" id="search-input" placeholder="Que recherchez-vous ? (service, métier, ville...)" class="bg-transparent border-none outline-none w-full font-medium text-xs text-job-dark placeholder:text-gray-400" oninput="filterRunners()" onkeydown="if(event.key==='Enter') { submitSearch(); }">
|
|
<button id="clear-search-btn" onclick="clearSearch()" class="hidden text-gray-400 hover:text-job-dark ml-1.5">
|
|
<i class="ph-bold ph-x-circle text-base"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<button onclick="openSearchFiltersModal()" id="search-filter-trigger-btn" class="h-11 px-3.5 bg-white border border-job-gray/80 rounded-2xl shadow-card flex items-center gap-1.5 text-job-dark hover:bg-job-bg transition-all active:scale-95 shrink-0 relative">
|
|
<i class="ph-bold ph-sliders-horizontal text-base text-job-sage"></i>
|
|
<span class="text-xs font-bold">Filtres</span>
|
|
<span id="search-filters-badge" class="hidden w-4 h-4 rounded-full bg-job-sage text-white text-[9px] font-bold items-center justify-center -ml-0.5">0</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Ruban de filtres rapides (chips horizontaux défilants sur mobile, wrap sur desktop) -->
|
|
<div class="flex items-center gap-2 overflow-x-auto md:overflow-visible md:flex-wrap hide-scroll pb-2 mb-4 -mx-1 px-1">
|
|
<button onclick="openSearchFiltersModal('location')" id="chip-location" class="shrink-0 px-3 py-1.5 rounded-full text-xs font-semibold bg-white border border-job-gray text-gray-700 hover:border-job-sage flex items-center gap-1.5 shadow-xs transition-all">
|
|
<i class="ph-fill ph-map-pin text-job-sage text-xs"></i>
|
|
<span id="chip-location-label">Toute la France</span>
|
|
</button>
|
|
<button onclick="openSearchFiltersModal('price')" id="chip-price" class="shrink-0 px-3 py-1.5 rounded-full text-xs font-semibold bg-white border border-job-gray text-gray-700 hover:border-job-sage flex items-center gap-1.5 shadow-xs transition-all">
|
|
<i class="ph-bold ph-tag text-xs text-gray-500"></i>
|
|
<span id="chip-price-label">Prix max</span>
|
|
</button>
|
|
<button onclick="togglePricingTypeFilter()" id="chip-unit" class="shrink-0 px-3 py-1.5 rounded-full text-xs font-semibold bg-white border border-job-gray text-gray-700 hover:border-job-sage flex items-center gap-1.5 shadow-xs transition-all">
|
|
<i class="ph-bold ph-clock text-xs text-gray-500"></i>
|
|
<span id="chip-unit-label">Tarif: Tous</span>
|
|
</button>
|
|
<button onclick="toggleRecommendedFilter()" id="chip-rec" class="shrink-0 px-3 py-1.5 rounded-full text-xs font-semibold bg-white border border-job-gray text-gray-700 hover:border-job-sage flex items-center gap-1.5 shadow-xs transition-all">
|
|
<i class="ph-fill ph-star text-amber-500 text-xs"></i>
|
|
<span>Recommandés</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Grille Métiers (4 col mobile, 8 col desktop) -->
|
|
<div class="mb-5">
|
|
<h2 class="text-[11px] font-bold text-gray-500 uppercase tracking-wider mb-2.5">Explorer par domaine</h2>
|
|
<div class="grid grid-cols-4 md:grid-cols-8 gap-2 md:gap-3" id="search-categories-grid">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Titre des résultats & tri -->
|
|
<div class="flex justify-between items-center mb-3">
|
|
<div class="flex items-center gap-2">
|
|
<h2 class="text-sm font-bold font-titre text-job-dark" id="search-results-title">Toutes les annonces</h2>
|
|
<span class="text-[11px] font-bold text-job-dark bg-white border border-job-gray px-2 py-0.5 rounded-full shadow-sm" id="results-count">0</span>
|
|
</div>
|
|
<div class="relative">
|
|
<select id="search-sort-select" onchange="applySearchSort(this.value)" class="bg-transparent text-[11px] font-bold text-job-sage outline-none cursor-pointer pr-1">
|
|
<option value="relevance">Trier: Pertinence</option>
|
|
<option value="price_asc">Prix croissant</option>
|
|
<option value="price_desc">Prix décroissant</option>
|
|
<option value="rating">Mieux notés</option>
|
|
<option value="distance">Proximité (km)</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6" id="search-results-container">
|
|
</div>
|
|
|
|
<!-- Footer Jobrunner (Recherche) -->
|
|
<div class="jobrunner-footer-slot -mx-6 mt-16 md:mx-0"></div>
|
|
</main>
|
|
|
|
<!-- ================= VUE 3 : PUBLIER UNE ANNONCE ================= -->
|
|
<main id="view-add" class="app-view px-6 pt-6 md:pt-10 max-w-3xl mx-auto">
|
|
<div class="flex items-center justify-between mb-2">
|
|
<h1 id="add-view-heading" class="text-3xl font-bold font-titre text-job-dark">Déposer une annonce</h1>
|
|
<span id="user-active-pass-badge" class="bg-job-sage-light text-job-sage-dark px-3 py-1 rounded-full text-xs font-bold">
|
|
Pass Gratuit
|
|
</span>
|
|
</div>
|
|
<p id="add-view-subheading" class="text-gray-500 text-sm mb-6">Proposez vos prestations ou chantiers en toute sérénité.</p>
|
|
|
|
<form id="add-ad-form" class="flex flex-col gap-4" onsubmit="handleAddAd(event)">
|
|
|
|
<!-- Titre de l'annonce -->
|
|
<div>
|
|
<label for="add-title" class="block text-xs font-bold uppercase tracking-wider text-gray-600 mb-1.5">Titre de la prestation</label>
|
|
<input type="text" id="add-title" required oninput="updateSuggestedPrice()" placeholder="Ex: Rénovation complète salle de bain & carrelage" class="w-full bg-white rounded-2xl px-4 py-3.5 text-sm shadow-card border border-job-gray focus:border-job-sage focus:outline-none transition-all">
|
|
</div>
|
|
|
|
<!-- Statut du Runner (Code de la consommation D111-8 II) -->
|
|
<fieldset>
|
|
<legend class="block text-xs font-bold uppercase tracking-wider text-gray-600 mb-1.5">Vous proposez ce service en tant que</legend>
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<label class="flex items-center gap-2 bg-white rounded-2xl px-4 py-3 text-sm shadow-card border border-job-gray cursor-pointer">
|
|
<input type="radio" name="add-seller-type" value="particulier" required class="accent-job-sage" onchange="document.getElementById('add-seller-warning').classList.toggle('hidden', this.value !== 'particulier')">
|
|
<span>Particulier</span>
|
|
</label>
|
|
<label class="flex items-center gap-2 bg-white rounded-2xl px-4 py-3 text-sm shadow-card border border-job-gray cursor-pointer">
|
|
<input type="radio" name="add-seller-type" value="pro" required class="accent-job-sage" onchange="document.getElementById('add-seller-warning').classList.toggle('hidden', this.value !== 'particulier')">
|
|
<span>Professionnel</span>
|
|
</label>
|
|
</div>
|
|
<p id="add-seller-warning" class="hidden mt-2 text-[11px] leading-snug text-amber-800 bg-amber-50 border border-amber-200 rounded-xl p-3">
|
|
Si vous exercez cette activité à titre professionnel, vous devez vous déclarer comme professionnel. Se présenter faussement comme particulier est une pratique commerciale trompeuse, punie de deux ans d'emprisonnement et de 300 000 € d'amende (article L132-2 du code de la consommation).
|
|
</p>
|
|
</fieldset>
|
|
|
|
<!-- Catégorie -->
|
|
<div>
|
|
<label for="add-category" class="block text-xs font-bold uppercase tracking-wider text-gray-600 mb-1.5">Catégorie</label>
|
|
<div class="relative">
|
|
<select id="add-category" required onchange="updateSuggestedPrice()" class="w-full bg-white rounded-2xl px-4 py-3.5 text-sm shadow-card border border-job-gray focus:border-job-sage focus:outline-none transition-all appearance-none cursor-pointer pr-10">
|
|
</select>
|
|
<i class="ph-bold ph-caret-down absolute right-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- OPTION SHORT VIDEO -->
|
|
<div class="bg-white rounded-3xl p-4 border border-job-gray shadow-card">
|
|
<div class="flex items-center justify-between mb-2">
|
|
<div class="flex items-center gap-2">
|
|
<div class="w-8 h-8 rounded-xl bg-rose-100 text-rose-600 flex items-center justify-center">
|
|
<i class="ph-bold ph-video-camera text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<span class="font-bold text-sm text-job-dark block">Accompagner d'un Short vidéo</span>
|
|
<span class="text-[11px] text-gray-400" id="shorts-quota-notice">Format vertical 9:16</span>
|
|
</div>
|
|
</div>
|
|
<label class="relative inline-flex items-center cursor-pointer">
|
|
<input type="checkbox" id="add-is-short" class="sr-only peer" onchange="toggleShortUploadOption()">
|
|
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-job-sage"></div>
|
|
</label>
|
|
</div>
|
|
|
|
<!-- Sélecteur vidéo si Short coché -->
|
|
<div id="short-video-container" class="hidden mt-3 pt-3 border-t border-job-gray">
|
|
<span class="block text-xs font-bold text-job-dark mb-1.5">Vidéo pour le Short (Format vertical)</span>
|
|
<div class="grid grid-cols-3 gap-2" id="short-video-picker">
|
|
</div>
|
|
<p class="text-[11px] text-gray-400 mt-2">La vidéo est exclusivement réservée au format Short. Les annonces standards utilisent une photo.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Zone Photo d'illustration classique -->
|
|
<div id="photo-upload-container">
|
|
<label class="block text-xs font-bold uppercase tracking-wider text-gray-600 mb-1.5">Photo d'illustration de l'annonce</label>
|
|
<div onclick="simulatePhotoUpload()" class="w-full h-32 bg-white rounded-2xl border-2 border-dashed border-gray-300 hover:border-job-sage flex flex-col items-center justify-center text-gray-500 cursor-pointer transition-all p-3 text-center relative overflow-hidden group">
|
|
<div id="upload-placeholder" class="flex flex-col items-center">
|
|
<div class="w-10 h-10 rounded-full bg-job-sage-light text-job-sage flex items-center justify-center mb-1 group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-camera text-lg"></i>
|
|
</div>
|
|
<span class="text-xs font-bold text-job-dark">Ajouter une photo représentative</span>
|
|
<span class="text-[10px] text-gray-400">JPG, PNG haute résolution</span>
|
|
</div>
|
|
<img loading="lazy" decoding="async" id="upload-preview" src="" alt="Aperçu" class="hidden absolute inset-0 w-full h-full object-cover">
|
|
<div id="upload-badge" class="hidden absolute bottom-2 right-2 bg-job-dark/80 text-white text-[10px] px-2.5 py-0.5 rounded-full backdrop-blur-sm">
|
|
Modifier photo
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tarification alignée sur une ligne -->
|
|
<div class="flex items-center gap-3">
|
|
<div class="flex-1">
|
|
<label for="add-price" class="block text-[10px] font-bold uppercase tracking-wider text-gray-600 mb-1.5 truncate">Montant (€)</label>
|
|
<div class="relative">
|
|
<input type="number" id="add-price" required placeholder="120" min="5" class="w-full bg-white rounded-2xl pl-4 pr-9 py-3.5 text-sm shadow-card border border-job-gray focus:border-job-sage focus:outline-none transition-all">
|
|
<span class="absolute right-4 top-1/2 -translate-y-1/2 font-bold text-gray-400 text-sm">€</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex-1">
|
|
<label for="add-time" class="block text-[10px] font-bold uppercase tracking-wider text-gray-600 mb-1.5 truncate">Tarification</label>
|
|
<div class="relative">
|
|
<select id="add-time" required onchange="updateSuggestedPrice()" class="w-full bg-white rounded-2xl px-4 py-3.5 text-sm shadow-card border border-job-gray focus:border-job-sage focus:outline-none transition-all appearance-none cursor-pointer pr-10">
|
|
<option value="forfait">Forfait global</option>
|
|
<option value="h">Par heure (/h)</option>
|
|
<option value="j">Par jour (/j)</option>
|
|
</select>
|
|
<i class="ph-bold ph-caret-down absolute right-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Indicateur d'aide prix conseillé dynamique -->
|
|
<div id="add-suggested-pricing-box" class="hidden bg-job-sage-light/60 border border-job-sage/30 rounded-2xl p-3 flex items-start gap-2.5 text-xs text-job-dark transition-all">
|
|
<i class="ph-fill ph-info text-job-sage text-base shrink-0 mt-0.5"></i>
|
|
<p id="add-suggested-pricing-text" class="leading-relaxed">Tarif conseillé : entre <strong class="text-job-dark font-bold">X €</strong> et <strong class="text-job-dark font-bold">Y €</strong> (basé sur les prestations similaires).</p>
|
|
</div>
|
|
|
|
<!-- Petit bouton Boost compact -->
|
|
<div class="flex items-center justify-between py-1 px-1">
|
|
<span class="text-xs text-gray-500 flex items-center gap-1.5 font-medium">
|
|
<i class="ph-fill ph-rocket-launch text-amber-500 text-sm"></i>
|
|
Envie d'être en tête des résultats ?
|
|
</span>
|
|
<button type="button" onclick="openPassStoreModal()" class="px-3 py-1.5 rounded-xl bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white text-xs font-bold shadow-xs transition-all flex items-center gap-1.5 active:scale-95 shrink-0">
|
|
<i class="ph-fill ph-lightning text-xs"></i>
|
|
<span>Booster</span>
|
|
</button>
|
|
<input type="checkbox" id="add-is-boosted" class="hidden">
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
<div>
|
|
<label for="add-desc" class="block text-[10px] font-bold uppercase tracking-wider text-gray-600 mb-1.5">Description détaillée</label>
|
|
<textarea id="add-desc" required rows="3" placeholder="Détaillez vos garanties, certifications, matériel inclus et disponibilités..." class="w-full bg-white rounded-2xl px-4 py-3 text-sm shadow-card border border-job-gray focus:border-job-sage focus:outline-none transition-all resize-none"></textarea>
|
|
</div>
|
|
|
|
<!-- Bouton Publication -->
|
|
<button type="submit" id="add-submit-btn" class="w-full bg-job-sage hover:bg-job-sage-dark text-white font-bold text-base rounded-2xl py-4 mt-2 shadow-floating transition-all flex justify-center items-center gap-2 active:scale-98">
|
|
<i class="ph-bold ph-paper-plane-tilt text-lg" id="add-submit-icon"></i>
|
|
<span id="add-submit-label">Publier l'annonce maintenant</span>
|
|
</button>
|
|
</form>
|
|
</main>
|
|
|
|
<!-- ================= VUE 4 : MESSAGES & CONTRATS ================= -->
|
|
<main id="view-messages" class="app-view px-4 pt-4 md:p-0 md:max-w-none w-full pb-28 md:pb-0">
|
|
<!-- Disposition Mobile (conservée intacte) -->
|
|
<div class="md:hidden">
|
|
<div class="flex items-center justify-between mb-2 px-1">
|
|
<div>
|
|
<h1 class="text-2xl font-bold font-titre text-job-dark">Messages</h1>
|
|
<p class="text-gray-400 text-[11px]">Échanges et paiement sécurisés</p>
|
|
</div>
|
|
<span class="text-[10px] font-bold bg-job-sage-light text-job-sage-dark px-2.5 py-1 rounded-full flex items-center gap-1">
|
|
<i class="ph-fill ph-shield-check text-job-sage"></i> Sécurisé
|
|
</span>
|
|
</div>
|
|
<!-- Liste des discussions mobile -->
|
|
<div class="flex flex-col gap-2 mt-3" id="messages-list-container">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Disposition Desktop 3 Colonnes (Style Leboncoin & Vinted - Plein Écran) -->
|
|
<div class="hidden md:grid md:grid-cols-12 gap-0 bg-white md:rounded-none overflow-hidden h-[calc(100vh-64px)] max-h-[calc(100vh-64px)] w-full">
|
|
<!-- Colonne 1 (Gauche, 3 colonnes) : Liste des discussions (triées de la plus récente en haut à la plus vieille en bas) -->
|
|
<aside class="md:col-span-4 lg:col-span-3 border-r border-job-gray/80 flex flex-col h-full bg-white overflow-hidden">
|
|
<div class="p-4 border-b border-job-gray/70 flex items-center justify-between shrink-0">
|
|
<div>
|
|
<h2 class="text-lg font-bold font-titre text-job-dark">Messages</h2>
|
|
<span class="text-[11px] text-gray-400 font-medium" id="desktop-conv-count">Discussions</span>
|
|
</div>
|
|
<span class="text-[10px] font-bold bg-job-sage-light text-job-sage-dark px-2.5 py-1 rounded-full flex items-center gap-1">
|
|
<i class="ph-fill ph-shield-check text-job-sage"></i> Sécurisé
|
|
</span>
|
|
</div>
|
|
<div class="flex-grow overflow-y-auto overscroll-contain divide-y divide-job-gray/40 hide-scroll" id="desktop-conversations-list">
|
|
<!-- Injecté dynamiquement par JS -->
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- Colonne 2 (Milieu, 6 colonnes) : Discussion interactive -->
|
|
<section class="md:col-span-8 lg:col-span-6 flex flex-col h-full bg-job-bg/40 border-r border-job-gray/80 relative overflow-hidden" onmouseenter="markCurrentDesktopChatRead()" onclick="markCurrentDesktopChatRead()">
|
|
<!-- Top bar du tchat cliquable pour voir le profil -->
|
|
<div class="p-3.5 px-5 bg-white border-b border-job-gray/80 flex items-center justify-between shrink-0">
|
|
<div class="flex items-center gap-3 cursor-pointer group" onclick="openProfileFromActiveChat()" title="Cliquer pour voir le profil">
|
|
<img loading="lazy" decoding="async" id="desktop-chat-avatar" src="" class="w-10 h-10 rounded-full object-cover border border-job-gray group-hover:scale-105 transition-transform" alt="Avatar">
|
|
<div>
|
|
<div class="flex items-center gap-2">
|
|
<h3 id="desktop-chat-name" class="font-bold text-sm text-job-dark group-hover:text-job-sage transition-colors">Nom</h3>
|
|
<button type="button" onclick="event.stopPropagation(); openReportModal('conversation', document.getElementById('desktop-chat-name').textContent)" class="text-[10px] text-gray-400 hover:text-rose-600 inline-flex items-center gap-0.5" title="Signaler cette conversation"><i class="ph-bold ph-flag"></i> Signaler</button>
|
|
</div>
|
|
<span class="text-[11px] text-job-sage font-semibold flex items-center gap-1">
|
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span> En ligne
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bannière de contrat / séquestre intégrée -->
|
|
<div id="desktop-chat-contract-banner" class="bg-white px-5 py-3 border-b border-job-gray/80 shadow-xs shrink-0">
|
|
<!-- Injecté dynamiquement par JS -->
|
|
</div>
|
|
|
|
<!-- Fil des messages -->
|
|
<div id="desktop-chat-messages" class="flex-grow p-5 overflow-y-auto overscroll-contain space-y-3">
|
|
<!-- Injecté dynamiquement par JS -->
|
|
</div>
|
|
|
|
<!-- Barre d'envoi avec bouton pièces jointes / photos / liens -->
|
|
<div class="p-3.5 px-5 bg-white border-t border-job-gray/80 shrink-0 relative">
|
|
<!-- Dropdown menu pièces jointes / photos / liens -->
|
|
<div id="desktop-attach-menu" class="hidden absolute bottom-16 left-5 w-60 bg-white rounded-2xl shadow-elevated border border-job-gray p-2 z-50 flex-col gap-1">
|
|
<button type="button" onclick="handleSendAttachment('photo')" class="flex items-center gap-2.5 p-2 rounded-xl text-xs font-bold text-job-dark hover:bg-job-bg w-full text-left transition-colors">
|
|
<div class="w-7 h-7 rounded-lg bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i class="ph-bold ph-image text-base"></i>
|
|
</div>
|
|
<span>Envoyer une photo</span>
|
|
</button>
|
|
<button type="button" onclick="handleSendAttachment('link')" class="flex items-center gap-2.5 p-2 rounded-xl text-xs font-bold text-job-dark hover:bg-job-bg w-full text-left transition-colors">
|
|
<div class="w-7 h-7 rounded-lg bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i class="ph-bold ph-link text-base"></i>
|
|
</div>
|
|
<span>Partager un lien de devis</span>
|
|
</button>
|
|
<button type="button" onclick="handleSendAttachment('doc')" class="flex items-center gap-2.5 p-2 rounded-xl text-xs font-bold text-job-dark hover:bg-job-bg w-full text-left transition-colors">
|
|
<div class="w-7 h-7 rounded-lg bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i class="ph-bold ph-file-text text-base"></i>
|
|
</div>
|
|
<span>Joindre un document PDF</span>
|
|
</button>
|
|
</div>
|
|
|
|
<form onsubmit="handleDesktopSendChatMessage(event)" class="flex items-center gap-2">
|
|
<!-- Bouton Pièces Jointes / Photos / Liens -->
|
|
<button type="button" onclick="toggleAttachmentMenu(event)" id="desktop-attach-btn" class="w-10 h-10 rounded-xl bg-job-bg hover:bg-job-sage-light text-gray-600 hover:text-job-sage flex items-center justify-center shrink-0 transition-colors" title="Ajouter une photo ou un lien">
|
|
<i class="ph-bold ph-paperclip text-lg"></i>
|
|
</button>
|
|
|
|
<!-- Bouton Proposer contrat -->
|
|
<button type="button" onclick="openProposeContractModal()" class="w-10 h-10 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center hover:bg-job-sage hover:text-white shrink-0 transition-colors" title="Proposer un contrat">
|
|
<i class="ph-bold ph-handshake text-lg"></i>
|
|
</button>
|
|
|
|
<!-- Champ texte -->
|
|
<input type="text" id="desktop-chat-input" placeholder="Écrivez votre message..." class="flex-grow bg-job-bg rounded-xl px-4 py-2.5 text-xs font-medium focus:outline-none focus:ring-1 focus:ring-job-sage text-job-dark placeholder:text-gray-400">
|
|
|
|
<!-- Bouton Envoyer -->
|
|
<button type="submit" class="w-10 h-10 rounded-xl bg-job-sage text-white flex items-center justify-center hover:bg-job-sage-dark shrink-0 transition-all active:scale-95 shadow-sm">
|
|
<i class="ph-bold ph-paper-plane-right text-lg"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Colonne 3 (Droite, 3 colonnes) : Fiche Annonce & Sécurité -->
|
|
<aside class="hidden lg:flex lg:col-span-3 flex-col h-full bg-white p-5 overflow-y-auto overscroll-contain hide-scroll" id="desktop-chat-ad-panel">
|
|
<!-- Injecté dynamiquement par JS -->
|
|
</aside>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Modal Tchat Interactif avec Escrow & Double Validation -->
|
|
<div id="chat-modal" class="fixed inset-0 z-50 bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-6">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-3xl md:h-[82vh] md:rounded-3xl mx-auto h-[90vh] rounded-t-[2.5rem] flex flex-col shadow-2xl overflow-hidden animate-in">
|
|
|
|
<!-- Chat Header -->
|
|
<div class="bg-white p-4 border-b border-job-gray/80 flex items-center justify-between shrink-0">
|
|
<div class="flex items-center gap-3">
|
|
<img loading="lazy" decoding="async" id="chat-header-avatar" src="" class="w-10 h-10 rounded-full object-cover border border-job-gray" alt="Avatar">
|
|
<div>
|
|
<div class="flex items-center gap-1.5">
|
|
<h3 id="chat-header-name" class="font-bold text-sm text-job-dark">Nom</h3>
|
|
<button type="button" onclick="openReportModal('conversation', document.getElementById('chat-header-name').textContent)" class="text-[10px] text-gray-400 hover:text-rose-600 inline-flex items-center gap-0.5" title="Signaler cette conversation"><i class="ph-bold ph-flag"></i> Signaler</button>
|
|
</div>
|
|
<span class="text-[11px] text-job-sage font-semibold flex items-center gap-1">
|
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span> En ligne
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<button onclick="closeChatModal()" class="w-8 h-8 rounded-full bg-job-bg flex items-center justify-center text-gray-500 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div id="chat-contract-banner" class="bg-white px-4 py-3 border-b border-job-gray shadow-sm shrink-0">
|
|
</div>
|
|
|
|
<div id="chat-messages-container" class="flex-grow p-4 overflow-y-auto space-y-3">
|
|
</div>
|
|
|
|
<div class="p-3 bg-white border-t border-job-gray/70 shrink-0">
|
|
<form onsubmit="handleSendChatMessage(event)" class="flex items-center gap-2">
|
|
<button type="button" onclick="openProposeContractModal()" class="w-10 h-10 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center hover:bg-job-sage hover:text-white shrink-0 transition-colors" title="Proposer un contrat">
|
|
<i class="ph-bold ph-handshake text-lg"></i>
|
|
</button>
|
|
<input type="text" id="chat-input-text" placeholder="Écrivez un message..." class="flex-grow bg-job-bg rounded-xl px-4 py-2.5 text-xs font-medium focus:outline-none focus:ring-1 focus:ring-job-sage">
|
|
<button type="submit" class="w-10 h-10 rounded-xl bg-job-sage text-white flex items-center justify-center hover:bg-job-sage-dark shrink-0">
|
|
<i class="ph-bold ph-paper-plane-right text-lg"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ================= VUE 5 : PROFIL & PASS ================= -->
|
|
<main id="view-profile" class="app-view px-6 pt-6 md:pt-10 !pb-0 max-w-4xl mx-auto">
|
|
<h1 class="text-3xl font-bold font-titre text-job-dark mb-6">Mon Compte</h1>
|
|
|
|
<!-- Carte Profil Connecté -->
|
|
<div class="bg-white rounded-3xl p-6 shadow-card border border-job-gray/70 flex flex-col items-center relative mb-6">
|
|
<button onclick="openEditProfileModal()" class="absolute top-4 right-4 w-9 h-9 bg-job-bg rounded-xl flex items-center justify-center text-gray-500 hover:text-job-sage transition-colors" title="Modifier mon profil">
|
|
<i class="ph-bold ph-pencil-simple text-base"></i>
|
|
</button>
|
|
|
|
<div class="relative mb-3">
|
|
<img loading="lazy" decoding="async" id="profile-avatar" src="" class="w-20 h-20 rounded-full object-cover border-4 border-white shadow-md bg-job-bg">
|
|
<span id="profile-avatar-badge" class="absolute bottom-0 right-0 w-6 h-6 bg-emerald-500 text-white rounded-full flex items-center justify-center border-2 border-white text-xs" title="Compte vérifié">
|
|
<i class="ph-fill ph-seal-check"></i>
|
|
</span>
|
|
</div>
|
|
|
|
<h2 id="profile-display-name" class="text-xl font-bold font-titre text-job-dark">Nom</h2>
|
|
<span id="profile-display-badge" class="text-xs text-gray-500 mb-2 flex items-center gap-1">
|
|
<i class="ph-fill ph-check-circle text-job-sage"></i> Identité vérifiée
|
|
</span>
|
|
|
|
<div class="flex items-center gap-2 mt-1">
|
|
<span class="flex items-center gap-1 bg-job-bg px-3 py-1 rounded-full text-xs font-bold text-job-dark border border-job-gray">
|
|
<i class="ph-fill ph-star text-amber-500"></i> 5.0 (18 avis)
|
|
</span>
|
|
<span id="profile-pass-pill" class="bg-amber-100 text-job-dark border border-amber-300 text-xs font-bold px-3 py-1 rounded-full">
|
|
Pass Gratuit
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- SECTION PASS & ABONNEMENTS RUNNER -->
|
|
<div class="bg-gradient-to-br from-[#1F2429] via-[#2A312B] to-[#1E2E22] text-white rounded-3xl p-5 shadow-elevated mb-6 relative overflow-hidden border border-job-sage/30">
|
|
<div class="absolute -right-8 -top-8 w-28 h-28 bg-job-sage/20 rounded-full blur-2xl pointer-events-none"></div>
|
|
<div class="flex justify-between items-start mb-3 relative z-10">
|
|
<div>
|
|
<div class="flex items-center gap-2 mb-1">
|
|
<span class="text-[10px] font-extrabold uppercase tracking-widest text-job-gold">Abonnement & Visibilité</span>
|
|
</div>
|
|
<h3 class="text-lg font-bold font-titre text-white flex items-center gap-2" id="pass-card-title">Pass Runner Actuel</h3>
|
|
</div>
|
|
</div>
|
|
<p class="text-xs text-gray-300 leading-relaxed mb-4 relative z-10" id="pass-card-desc">
|
|
Votre pass gratuit vous autorise 3 shorts simultanés et l'accès à toutes les prestations sécurisées.
|
|
</p>
|
|
<button onclick="openPassStoreModal()" class="w-full bg-job-dark hover:bg-black text-white font-bold text-xs py-3.5 rounded-2xl flex items-center justify-center gap-2 shadow-lg shadow-orange-500/20 transition-all active:scale-98 relative z-10">
|
|
<i class="ph-fill ph-lightning text-yellow-200 text-base"></i>
|
|
<span>Booster ma visibilité & Acheter un Pass</span>
|
|
</button>
|
|
<div id="pass-manage" class="relative z-10"></div>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-3xl shadow-card border border-job-gray/80 overflow-hidden divide-y divide-job-gray/60 mb-6">
|
|
<button onclick="navigate('my-ads')" class="w-full flex items-center justify-between p-4 hover:bg-job-bg/60 transition-colors text-left group">
|
|
<div class="flex items-center gap-3.5">
|
|
<div class="w-10 h-10 bg-job-sage-light rounded-xl flex items-center justify-center text-job-sage group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-megaphone text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<span class="font-bold text-sm text-job-dark block">Mes annonces en ligne</span>
|
|
<span class="text-[11px] text-gray-400" id="profile-ads-count">0 publication</span>
|
|
</div>
|
|
</div>
|
|
<i class="ph-bold ph-caret-right text-gray-400"></i>
|
|
</button>
|
|
|
|
<!-- Informations Personnelles (remplace Vérification & Coordonnées IBAN) -->
|
|
<button onclick="openPersonalInfoModal()" class="w-full flex items-center justify-between p-4 hover:bg-job-bg/60 transition-colors text-left group">
|
|
<div class="flex items-center gap-3.5">
|
|
<div class="w-10 h-10 bg-job-sage-light rounded-xl flex items-center justify-center text-job-sage group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-user-circle text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<span class="font-bold text-sm text-job-dark block">Informations personnelles</span>
|
|
<span class="text-[11px] text-gray-500 font-medium" id="profile-email-preview">christophe.vigneron@email.com</span>
|
|
</div>
|
|
</div>
|
|
<i class="ph-bold ph-caret-right text-gray-400"></i>
|
|
</button>
|
|
|
|
<!-- Transactions (Payées / Reçues) -->
|
|
<button onclick="navigate('transactions')" class="w-full flex items-center justify-between p-4 hover:bg-job-bg/60 transition-colors text-left group">
|
|
<div class="flex items-center gap-3.5">
|
|
<div class="w-10 h-10 bg-job-sage-light rounded-xl flex items-center justify-center text-job-sage group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-receipt text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<span class="font-bold text-sm text-job-dark block">Mes transactions</span>
|
|
<span class="text-[11px] text-gray-400">Paiements émis & reçus sécurisés</span>
|
|
</div>
|
|
</div>
|
|
<i class="ph-bold ph-caret-right text-gray-400"></i>
|
|
</button>
|
|
|
|
<button onclick="openFavoritesModal()" class="w-full flex items-center justify-between p-4 hover:bg-job-bg/60 transition-colors text-left group">
|
|
<div class="flex items-center gap-3.5">
|
|
<div class="w-10 h-10 bg-job-sage-light rounded-xl flex items-center justify-center text-job-sage group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-heart text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<span class="font-bold text-sm text-job-dark block">Mes favoris</span>
|
|
<span class="text-[11px] text-gray-400" id="profile-favorites-count">2 enregistrés</span>
|
|
</div>
|
|
</div>
|
|
<i class="ph-bold ph-caret-right text-gray-400"></i>
|
|
</button>
|
|
</div>
|
|
|
|
|
|
<!-- Footer Jobrunner (Profil) -->
|
|
<div class="jobrunner-footer-slot -mx-6 mt-8 md:mx-0"></div>
|
|
</main>
|
|
|
|
<!-- ================= VUE : MES TRANSACTIONS ================= -->
|
|
<main id="view-transactions" class="app-view px-6 pt-6 md:pt-10 pb-28 max-w-4xl mx-auto">
|
|
<div class="flex items-center gap-3 mb-5">
|
|
<button onclick="navigate('profile')" class="w-10 h-10 bg-white rounded-2xl flex items-center justify-center shadow-card text-job-dark hover:bg-job-bg transition-colors active:scale-95">
|
|
<i class="ph-bold ph-caret-left text-xl"></i>
|
|
</button>
|
|
<div>
|
|
<h1 class="text-2xl font-bold font-titre text-job-dark">Mes Transactions</h1>
|
|
<p class="text-gray-500 text-[11px]">Suivi des paiements émis et reçus avec séquestre</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Onglets de sélection (Payées par moi vs Qu'on m'a payées) -->
|
|
<div class="flex bg-job-bg p-1 rounded-2xl border border-job-gray/80 mb-4">
|
|
<button id="tab-tx-paid" onclick="switchTransactionsTab('paid')" class="flex-1 py-2.5 rounded-xl text-xs font-bold transition-all bg-white text-job-dark shadow-sm flex items-center justify-center gap-1.5">
|
|
<i class="ph-bold ph-arrow-up-right text-rose-500"></i> Paiements émis
|
|
</button>
|
|
<button id="tab-tx-received" onclick="switchTransactionsTab('received')" class="flex-1 py-2.5 rounded-xl text-xs font-bold transition-all text-gray-500 hover:text-job-dark flex items-center justify-center gap-1.5">
|
|
<i class="ph-bold ph-arrow-down-left text-job-sage"></i> Paiements reçus
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Carte synthèse volumes -->
|
|
<div id="transactions-summary-card" class="bg-white rounded-3xl p-4 shadow-card border border-job-gray/80 mb-4 flex justify-between items-center">
|
|
</div>
|
|
|
|
<!-- Liste des transactions -->
|
|
<div class="flex flex-col gap-3" id="transactions-list-container">
|
|
</div>
|
|
</main>
|
|
|
|
<main id="view-my-ads" class="app-view px-6 pt-6 md:pt-10 max-w-6xl mx-auto">
|
|
<div class="flex items-center gap-3 mb-6">
|
|
<button onclick="navigate('profile')" class="w-10 h-10 bg-white rounded-2xl flex items-center justify-center shadow-card text-job-dark hover:bg-job-bg transition-colors">
|
|
<i class="ph-bold ph-caret-left text-xl"></i>
|
|
</button>
|
|
<h1 class="text-2xl font-bold font-titre text-job-dark">Mes annonces</h1>
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6" id="my-ads-container">
|
|
</div>
|
|
</main>
|
|
|
|
<!-- ================= PAGE SHORTS PLEIN ECRAN ================= -->
|
|
<main id="view-shorts" class="app-view bg-black !p-0 h-[100dvh] fixed inset-0 z-[100] md:relative md:z-40 max-w-[480px] md:max-w-[450px] mx-auto md:rounded-3xl md:overflow-hidden md:my-2 md:h-[calc(100vh-84px)] md:border md:border-white/10">
|
|
|
|
<!-- Bouton Retour Fixe toujours au premier plan, en dehors du scroll -->
|
|
<button onclick="handleBackFromDetail()" class="absolute top-6 left-5 w-11 h-11 bg-black/60 backdrop-blur-md rounded-full flex items-center justify-center text-white z-50 border border-white/20 active:scale-90 shadow-xl transition-all" aria-label="Retour accueil">
|
|
<i class="ph-bold ph-caret-left text-2xl"></i>
|
|
</button>
|
|
|
|
<!-- Conteneur qui scrolle -->
|
|
<div id="shorts-scroll-container" class="w-full h-full overflow-y-scroll snap-y-mandatory hide-scroll">
|
|
<div id="shorts-container" class="w-full h-full">
|
|
<!-- Shorts injectés -->
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- ================= PAGE DETAIL PRESTATION ================= -->
|
|
<main id="view-runner" class="app-view bg-white !pb-0 min-h-screen relative z-20">
|
|
<!-- Bouton Retour Desktop -->
|
|
<div class="hidden md:flex items-center gap-2 text-sm font-bold text-gray-500 hover:text-job-dark cursor-pointer mb-2 pt-4 px-6 max-w-6xl mx-auto" onclick="handleBackFromDetail()">
|
|
<i class="ph-bold ph-arrow-left text-base"></i>
|
|
<span>Retour</span>
|
|
</div>
|
|
|
|
<div class="max-w-6xl mx-auto md:px-6 md:pb-12">
|
|
<div class="relative h-72 md:h-96 bg-job-dark md:rounded-3xl overflow-hidden shadow-card">
|
|
<img loading="lazy" decoding="async" id="detail-job-img" src="" alt="Prestation" class="w-full h-full object-cover brightness-95" onerror="this.src='https://placehold.co/600x400/D9E4DD/2B2B2B?text=Service'">
|
|
<div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-black/20 pointer-events-none"></div>
|
|
|
|
<button onclick="handleBackFromDetail()" class="md:hidden absolute top-8 left-5 w-10 h-10 bg-white/90 backdrop-blur-md rounded-2xl flex items-center justify-center shadow-lg text-job-dark active:scale-95 transition-transform z-10">
|
|
<i class="ph-bold ph-caret-left text-xl"></i>
|
|
</button>
|
|
|
|
<div class="absolute top-8 right-5 flex items-center gap-2 z-10">
|
|
<button onclick="shareCurrentDetailAd()" class="w-10 h-10 bg-white/90 backdrop-blur-md rounded-2xl flex items-center justify-center shadow-lg text-gray-600 hover:text-job-sage active:scale-95 transition-transform" title="Partager cette annonce">
|
|
<i class="ph-bold ph-share-network text-xl"></i>
|
|
</button>
|
|
<button id="detail-fav-btn" onclick="toggleDetailFavorite()" class="w-10 h-10 bg-white/90 backdrop-blur-md rounded-2xl flex items-center justify-center shadow-lg text-gray-500 active:scale-95 transition-transform" title="Ajouter aux favoris">
|
|
<i class="ph-bold ph-heart text-xl"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="absolute bottom-6 md:bottom-6 left-6 bg-white/95 backdrop-blur-md px-3.5 py-1.5 rounded-full shadow-lg font-bold text-xs text-job-sage flex items-center gap-1.5 z-10">
|
|
<i id="detail-cat-icon" class="ph-bold"></i>
|
|
<span id="detail-category">Bricolage</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="px-6 md:px-0 pt-6 pb-36 md:pb-8 rounded-t-[2.5rem] md:rounded-none bg-white -mt-8 md:mt-4 relative z-10 shadow-2xl md:shadow-none">
|
|
|
|
<div onclick="openPublicProfile(currentDetailRunnerId)" class="flex items-center gap-3.5 pb-5 border-b border-job-gray/80 mb-5 cursor-pointer hover:bg-job-bg/50 p-2 -mx-2 rounded-2xl transition-colors group">
|
|
<div class="relative shrink-0">
|
|
<img loading="lazy" decoding="async" id="detail-avatar" src="" class="w-14 h-14 rounded-2xl object-cover bg-job-bg border-2 border-job-gray shadow-sm group-hover:scale-105 transition-transform" alt="Avatar">
|
|
<div id="detail-badge-container"></div>
|
|
</div>
|
|
<div class="flex-grow">
|
|
<div class="flex items-center gap-2">
|
|
<h2 id="detail-name" class="text-lg font-bold font-titre text-job-dark group-hover:underline">Nom</h2>
|
|
<span id="detail-badge-text" class="text-[10px] font-bold px-2 py-0.5 rounded-md bg-gray-100 text-gray-500">Classique</span>
|
|
<span id="detail-seller-type" class="text-[10px] font-semibold text-gray-500"></span>
|
|
</div>
|
|
<div class="flex items-center gap-2 text-xs text-gray-500 mt-0.5">
|
|
<span class="flex items-center gap-0.5 text-job-dark font-bold">
|
|
<i class="ph-fill ph-star text-amber-500"></i>
|
|
<span id="detail-rating">4.9</span>
|
|
</span>
|
|
<span id="detail-reviews" class="text-gray-400 group-hover:underline">(42 avis)</span>
|
|
<span>•</span>
|
|
<span class="text-job-sage font-semibold flex items-center gap-1">
|
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span> En ligne
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<i class="ph-bold ph-caret-right text-xl text-gray-300 group-hover:text-job-sage transition-colors"></i>
|
|
</div>
|
|
|
|
<h1 id="detail-title" class="text-2xl md:text-3xl font-bold font-titre text-job-dark mb-4 leading-tight">
|
|
Titre
|
|
</h1>
|
|
|
|
<div class="grid grid-cols-2 md:grid-cols-4 gap-2.5 mb-6">
|
|
<div class="flex items-center gap-3 bg-job-bg/80 p-3 rounded-2xl border border-job-gray/60">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-tag text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<span class="text-[10px] uppercase font-bold text-gray-400 block">Tarif estimé</span>
|
|
<span id="detail-price-box" class="font-bold text-job-dark text-base">30€</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3 bg-job-bg/80 p-3 rounded-2xl border border-job-gray/60">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-shield-check text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<span class="text-[10px] uppercase font-bold text-gray-400 block">Paiement</span>
|
|
<span class="font-bold text-job-dark text-sm">Conservé jusqu'à validation</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3 bg-job-bg/80 p-3 rounded-2xl border border-job-gray/60">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-user-check text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<span class="text-[10px] uppercase font-bold text-gray-400 block">Vérification</span>
|
|
<span class="font-bold text-job-dark text-sm">Identité vérifiée</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3 bg-job-bg/80 p-3 rounded-2xl border border-job-gray/60">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-chat-centered-dots text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<span class="text-[10px] uppercase font-bold text-gray-400 block">Messagerie</span>
|
|
<span class="font-bold text-job-dark text-sm">Contrat Inclus</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-8">
|
|
<h3 class="font-bold font-titre text-base md:text-lg text-job-dark mb-2">Description de la prestation</h3>
|
|
<p class="text-gray-600 leading-relaxed text-sm md:text-base" id="detail-desc">
|
|
Description...
|
|
</p>
|
|
<button type="button" onclick="openReportModal('annonce', document.getElementById('detail-title').textContent)" class="mt-4 inline-flex items-center gap-1 text-[11px] text-gray-400 hover:text-rose-600 transition-colors">
|
|
<i class="ph-bold ph-flag"></i> Signaler cette annonce
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Bar Fixe Bas : Coulisse de réservation OU Gestion propre annonce -->
|
|
<div id="detail-action-bar" class="fixed bottom-0 left-0 w-full max-w-[480px] md:max-w-xl px-6 py-4 bg-white/95 backdrop-blur-md border-t border-job-gray/80 z-30 md:rounded-t-3xl md:shadow-2xl" style="transform: translateX(-50%); left: 50%;">
|
|
<!-- 1. Barre de swipe standard pour les annonces des tiers -->
|
|
<div id="swipe-reserve-track" class="w-full bg-job-sage rounded-2xl h-14 relative shadow-floating overflow-hidden select-none flex items-center p-2 group">
|
|
<div id="swipe-reserve-fill" class="absolute left-0 top-0 bottom-0 bg-job-sage-dark z-0 rounded-l-2xl w-0"></div>
|
|
<div class="absolute inset-0 flex items-center justify-center pointer-events-none z-10">
|
|
<span class="font-bold text-sm tracking-wide text-white/90 group-hover:text-white transition-colors flex items-center gap-2">
|
|
Glisser pour réserver <i class="ph-bold ph-arrows-out-line-horizontal text-lg opacity-60"></i>
|
|
</span>
|
|
</div>
|
|
<div id="swipe-reserve-knob" class="w-10 h-10 bg-[#F1EDE1] rounded-xl flex items-center justify-center overflow-hidden shadow-md z-20 cursor-grab active:cursor-grabbing shrink-0 relative" style="touch-action: none;">
|
|
<img loading="lazy" decoding="async" src="assets/img/logo-light.svg" class="w-full h-full object-contain object-center pointer-events-none select-none" alt="Jobrunner" onerror="handleLogoError(this, 'beige')">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 2. Barre alternative pour sa propre annonce (auto-réservation désactivée) -->
|
|
<div id="detail-own-ad-bar" class="hidden w-full items-center justify-between bg-job-bg rounded-2xl h-14 px-4 py-2 border border-job-sage/40 shadow-card">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-3 h-3 rounded-full bg-emerald-500 animate-pulse shrink-0"></div>
|
|
<div>
|
|
<span class="text-xs font-bold text-job-dark block leading-none">Votre annonce en ligne</span>
|
|
<span class="text-[10px] text-gray-500 font-medium">Auto-réservation désactivée</span>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="editOwnAd()" class="bg-job-sage hover:bg-job-sage-dark text-white text-xs font-bold px-3.5 py-2 rounded-xl transition-all shadow-xs flex items-center gap-1.5 active:scale-95 shrink-0">
|
|
<i class="ph-bold ph-note-pencil text-sm"></i>
|
|
<span>Modifier mon annonce</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- ================= VUE 6 : PROFIL PUBLIC D'UN PRESTATAIRE ================= -->
|
|
<main id="view-public-profile" class="app-view bg-white !pb-0 min-h-screen relative z-30 max-w-4xl mx-auto md:my-6 md:rounded-3xl md:shadow-card md:overflow-hidden">
|
|
<div class="relative h-40 bg-job-sage-dark">
|
|
<div class="absolute inset-0 bg-[url('https://images.unsplash.com/photo-1558904541-efa8c4a08931?w=600&auto=format&fit=crop&q=80')] opacity-30 object-cover bg-center"></div>
|
|
<button onclick="handleBackFromDetail()" class="absolute top-8 left-5 w-10 h-10 bg-white/90 backdrop-blur-md rounded-2xl flex items-center justify-center shadow-lg text-job-dark active:scale-95 transition-transform z-10">
|
|
<i class="ph-bold ph-caret-left text-xl"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="px-6 pt-0 pb-36 rounded-t-[2.5rem] bg-white -mt-10 relative z-10 shadow-2xl flex flex-col items-center">
|
|
<div class="relative -mt-12 mb-3">
|
|
<img loading="lazy" decoding="async" id="public-profile-avatar" src="" class="w-24 h-24 rounded-full object-cover border-4 border-white shadow-md bg-job-bg">
|
|
<span class="absolute bottom-0 right-0 w-7 h-7 bg-emerald-500 text-white rounded-full flex items-center justify-center border-2 border-white text-xs shadow-sm" title="Vérifié">
|
|
<i class="ph-fill ph-seal-check"></i>
|
|
</span>
|
|
</div>
|
|
|
|
<h2 id="public-profile-name" class="text-2xl font-bold font-titre text-job-dark mb-1">Nom</h2>
|
|
|
|
<div class="flex items-center justify-center gap-3 mb-4">
|
|
<span class="flex items-center gap-1 text-sm font-bold text-job-dark bg-job-bg px-3 py-1 rounded-full border border-job-gray">
|
|
<i class="ph-fill ph-star text-amber-500"></i> <span id="public-profile-rating">4.9</span>
|
|
</span>
|
|
<span id="public-profile-reviews" class="text-xs text-gray-500 font-medium">(0 avis)</span>
|
|
</div>
|
|
|
|
<p id="public-profile-desc" class="text-sm text-gray-600 text-center leading-relaxed mb-6 px-2">Description...</p>
|
|
|
|
<div class="w-full flex gap-2 mb-8">
|
|
<button onclick="startDirectChatFromPublic()" class="flex-1 bg-job-sage hover:bg-job-sage-dark text-white font-bold py-3.5 rounded-2xl shadow-floating transition-all flex justify-center items-center gap-2">
|
|
<i class="ph-bold ph-chat-circle-text text-lg"></i> Contacter
|
|
</button>
|
|
</div>
|
|
|
|
<div class="w-full mb-8">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h3 class="text-base font-bold font-titre text-job-dark">Ses prestations</h3>
|
|
<span class="text-[10px] font-bold text-job-sage uppercase tracking-wider">Expert</span>
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 w-full text-left" id="public-profile-ads">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- NOUVEAU: Section Avis Clients -->
|
|
<div class="w-full">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h3 class="text-base font-bold font-titre text-job-dark">Avis clients</h3>
|
|
<span class="text-xs font-bold text-gray-500" id="public-profile-reviews-count">0 avis</span>
|
|
</div>
|
|
<div class="flex flex-col gap-3" id="public-profile-reviews-list">
|
|
<!-- Injecté en JS -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- ================= BOTTOM NAVIGATION BAR ================= -->
|
|
<nav id="bottom-nav" class="fixed bottom-0 left-0 right-0 mx-auto w-full max-w-[480px] bg-white/95 backdrop-blur-md rounded-t-[1.75rem] shadow-nav border-t border-job-gray/60 flex justify-between items-center px-4 py-2.5 z-40 transition-transform duration-300 md:hidden">
|
|
<button onclick="navigate('home')" class="nav-btn flex flex-col items-center gap-1 text-job-sage w-[20%] py-1" data-target="home" aria-label="Accueil">
|
|
<i class="ph-fill ph-house text-2xl nav-icon transition-all"></i>
|
|
<span class="text-[10px] font-bold">Accueil</span>
|
|
</button>
|
|
<button onclick="navigate('search')" class="nav-btn flex flex-col items-center gap-1 text-gray-400 w-[20%] py-1" data-target="search" aria-label="Recherche">
|
|
<i class="ph ph-magnifying-glass text-2xl nav-icon transition-all"></i>
|
|
<span class="text-[10px] font-bold">Recherche</span>
|
|
</button>
|
|
|
|
<!-- Emplacement réserve pour équilibrer la grille -->
|
|
<div class="w-[20%] pointer-events-none" aria-hidden="true"></div>
|
|
|
|
<!-- Bouton central avec le plus centré au milieu de la barre -->
|
|
<button onclick="handlePublishClick()" class="absolute left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2 w-12 h-12 bg-job-sage hover:bg-job-sage-dark text-white rounded-full flex items-center justify-center shadow-md border-2 border-white transition-all active:scale-90 z-50 group shrink-0" data-target="add" aria-label="Publier une annonce">
|
|
<i class="ph-bold ph-plus text-2xl group-hover:rotate-90 transition-transform"></i>
|
|
</button>
|
|
|
|
<button onclick="handleMessagesClick()" class="nav-btn flex flex-col items-center gap-1 text-gray-400 w-[20%] py-1 relative" data-target="messages" aria-label="Messages">
|
|
<i class="ph ph-chat-circle text-2xl nav-icon transition-all"></i>
|
|
<span class="text-[10px] font-bold">Messages</span>
|
|
<span class="absolute top-1 right-5 w-2 h-2 bg-rose-500 border border-white rounded-full hidden" id="messages-dot"></span>
|
|
</button>
|
|
<button onclick="handleProfileClick()" class="nav-btn flex flex-col items-center gap-1 text-gray-400 w-[20%] py-1" data-target="profile" aria-label="Profil">
|
|
<i class="ph ph-user text-2xl nav-icon transition-all"></i>
|
|
<span class="text-[10px] font-bold">Profil</span>
|
|
</button>
|
|
</nav>
|
|
|
|
<!-- ================= MODALES SPECIALES ================= -->
|
|
|
|
<!-- MODALE INFORMATIONS LEGALES & SECURITE -->
|
|
<div id="legal-modal" class="fixed inset-0 z-[130] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-white w-full max-w-[540px] md:rounded-3xl md:my-auto mx-auto max-h-[90vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-hidden">
|
|
<div class="flex items-center justify-between pb-4 border-b border-job-gray/80 shrink-0">
|
|
<div class="flex items-center gap-2.5">
|
|
<div id="legal-modal-icon-container" class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i id="legal-modal-icon" class="ph-bold ph-shield-check text-xl"></i>
|
|
</div>
|
|
<h2 id="legal-modal-title" class="text-xl font-bold font-titre text-job-dark">Mentions Légales</h2>
|
|
</div>
|
|
<button onclick="closeLegalModal()" class="w-8 h-8 rounded-full bg-job-bg flex items-center justify-center text-gray-500 hover:text-job-dark transition-colors">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div id="legal-modal-content" class="flex-grow overflow-y-auto py-4 text-xs text-gray-600 space-y-3 leading-relaxed">
|
|
<!-- Contenu dynamique injecté par openLegalModal() -->
|
|
</div>
|
|
|
|
<div class="pt-4 border-t border-job-gray/80 shrink-0 flex justify-end">
|
|
<button onclick="closeLegalModal()" class="bg-job-dark hover:bg-black text-white px-5 py-2.5 rounded-xl text-xs font-bold transition-all shadow-sm">
|
|
Fermer
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 1 : AUTHENTIFICATION -->
|
|
<div id="auth-modal" class="fixed inset-0 z-[120] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-lg md:rounded-3xl md:my-auto mx-auto max-h-[92vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-y-auto">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<div class="flex items-center gap-2.5">
|
|
<img loading="lazy" decoding="async" src="assets/img/logo-light.svg" alt="Logo Jobrunner" class="w-9 h-9 object-contain object-center shrink-0" onerror="handleLogoError(this, 'beige')">
|
|
<h2 class="text-2xl font-bold font-titre text-job-dark">Créer un compte</h2>
|
|
</div>
|
|
<button onclick="closeAuthModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<form id="auth-form-register" class="space-y-3" onsubmit="handleKycRegister(event)">
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Prénom</label>
|
|
<input type="text" id="kyc-firstname" required placeholder="Alex" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Nom</label>
|
|
<input type="text" id="kyc-lastname" required placeholder="Dupont" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Date de naissance</label>
|
|
<input type="date" id="kyc-dob" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Adresse postale</label>
|
|
<input type="text" id="kyc-address" required placeholder="12 Avenue des Champs, 75008 Paris" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Compte bancaire (IBAN)</label>
|
|
<input type="text" id="kyc-iban" required placeholder="FR76 3000 4000 1234 5678 9012 345" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage font-mono">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Pièce d'identité</label>
|
|
<div onclick="simulateIdUpload()" class="w-full h-16 bg-white rounded-xl border border-dashed border-gray-300 hover:border-job-sage flex items-center justify-center cursor-pointer p-2 text-center transition-all">
|
|
<div id="id-upload-placeholder" class="flex items-center gap-2 text-gray-500">
|
|
<i class="ph-bold ph-identification-card text-2xl text-job-sage"></i>
|
|
<span class="text-xs font-bold">Ajouter une pièce d'identité</span>
|
|
</div>
|
|
<span id="id-upload-success" class="hidden text-xs text-job-sage font-bold flex items-center gap-1">
|
|
<i class="ph-fill ph-check-circle"></i> Pièce d'identité enregistrée
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Téléphone</label>
|
|
<input type="tel" id="kyc-phone" required placeholder="06 12 34 56 78" class="w-full bg-white rounded-xl px-3 py-2 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Email</label>
|
|
<input type="email" id="kyc-email" required placeholder="contact@domaine.fr" class="w-full bg-white rounded-xl px-3 py-2 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="kyc-code-step" class="hidden bg-job-sage-light p-3 rounded-xl border border-job-sage/40">
|
|
<div class="flex items-center gap-2 mb-2">
|
|
<span id="kyc-otp-loader-icon" class="inline-flex w-4 h-4 border-2 border-job-sage border-t-transparent rounded-full" style="animation: spin 0.8s linear infinite;"></span>
|
|
<span id="kyc-otp-label" class="text-xs font-bold text-job-dark">Code envoyé… réception dans 2s</span>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<input type="text" id="kyc-code-input" placeholder="• • • •" maxlength="6" readonly class="bg-white rounded-xl px-3 py-2 text-xs font-bold tracking-widest text-center border border-job-gray outline-none flex-grow transition-all">
|
|
</div>
|
|
<p class="text-[10px] text-gray-500 mt-1.5">Vérifiez le code reçu puis validez.</p>
|
|
</div>
|
|
|
|
<label class="flex items-start gap-2 text-[11px] text-gray-600 leading-snug cursor-pointer">
|
|
<input type="checkbox" id="kyc-cgu" required class="mt-0.5 accent-job-sage shrink-0">
|
|
<span>J'ai 18 ans ou plus, j'accepte les <a href="legal.html#cgu" target="_blank" rel="noopener" class="text-job-sage underline">conditions générales d'utilisation</a> et j'ai pris connaissance de la <a href="legal.html#confidentialite" target="_blank" rel="noopener" class="text-job-sage underline">politique de confidentialité</a>.</span>
|
|
</label>
|
|
|
|
<button type="submit" id="kyc-submit-btn" class="w-full bg-job-sage hover:bg-job-sage-dark text-white text-xs font-bold py-3.5 rounded-xl shadow-sm mt-2 transition-all">
|
|
Créer mon compte
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 2 : BOUTIQUE DES PASS RUNNER -->
|
|
<div id="pass-store-modal" class="fixed inset-0 z-[120] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-xl md:rounded-3xl md:my-auto mx-auto h-[90vh] md:h-auto md:max-h-[85vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-hidden">
|
|
<div class="flex items-center justify-between mb-4 shrink-0 pb-3 border-b border-gray-200/70">
|
|
<div class="flex items-center gap-3">
|
|
<div class="w-11 h-11 rounded-2xl bg-job-dark text-white flex items-center justify-center shadow-md shadow-orange-500/25 shrink-0">
|
|
<i class="ph-fill ph-rocket-launch text-2xl"></i>
|
|
</div>
|
|
<div>
|
|
<h2 class="text-xl md:text-2xl font-bold font-titre text-job-dark">Pass & Boost Visibilité</h2>
|
|
<p class="text-xs text-gray-500 font-medium">Multipliez vos contacts et hissez-vous au sommet des recherches</p>
|
|
</div>
|
|
</div>
|
|
<button onclick="closePassStoreModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark shadow-xs hover:bg-gray-100 transition-colors shrink-0">
|
|
<i class="ph-bold ph-x text-sm"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="space-y-3.5 overflow-y-auto hide-scroll pb-6 flex-grow pr-1">
|
|
<!-- PASS GRATUIT -->
|
|
<div class="bg-gradient-to-br from-white via-slate-50/60 to-gray-100/50 rounded-3xl p-4 border border-slate-200/90 shadow-xs relative hover:shadow-sm transition-all">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-slate-100 text-slate-700 flex items-center justify-center font-bold">
|
|
<i class="ph-fill ph-leaf text-lg text-job-sage"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Pass Gratuit</h3>
|
|
<span class="text-[10px] font-bold text-gray-400 block uppercase tracking-wider">🌱 Standard</span>
|
|
</div>
|
|
</div>
|
|
<span class="text-sm font-bold text-job-dark">0€ <span class="text-[10px] font-normal text-gray-400">/mois</span></span>
|
|
</div>
|
|
<ul class="text-[11px] text-gray-600 space-y-1 mb-3">
|
|
<li class="flex items-center gap-1.5"><i class="ph-bold ph-check text-job-sage"></i> <strong>3 Shorts</strong> max inclus</li>
|
|
<li class="flex items-center gap-1.5"><i class="ph-bold ph-check text-job-sage"></i> Classement standard dans les recherches</li>
|
|
</ul>
|
|
<button onclick="selectPass('free')" class="w-full py-2 rounded-xl border border-job-gray text-[11px] font-bold text-job-dark hover:bg-job-bg transition-colors" id="btn-pass-free">
|
|
Votre formule actuelle
|
|
</button>
|
|
</div>
|
|
|
|
<!-- PASS FLASH (BLEU) -->
|
|
<div class="bg-blue-50/40 rounded-3xl p-4 border border-blue-200 shadow-xs relative overflow-hidden transition-all hover:shadow-md hover:border-blue-300">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-blue-100 text-blue-600 flex items-center justify-center shadow-xs">
|
|
<i class="ph-fill ph-lightning text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Pass Flash</h3>
|
|
<span class="text-[10px] font-bold text-blue-600 block uppercase tracking-wider">⚡ Boost Flash (Bleu)</span>
|
|
</div>
|
|
</div>
|
|
<div class="text-right">
|
|
<span class="text-base font-black text-job-dark">2,99€</span>
|
|
<span class="text-[10px] font-medium text-blue-600/80 block">/mois</span>
|
|
</div>
|
|
</div>
|
|
<ul class="text-[11px] text-job-dark/80 space-y-1.5 mb-3 font-medium">
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-blue-500 text-sm"></i> <strong>4 Shorts</strong> max inclus</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-blue-500 text-sm"></i> Badge bleu Flash sur votre avatar</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-blue-500 text-sm"></i> Léger boost algorithmique des annonces</li>
|
|
</ul>
|
|
<button onclick="selectPass('flash')" class="w-full py-2.5 rounded-xl bg-blue-600 hover:bg-blue-700 text-white text-xs font-bold transition-all shadow-sm active:scale-98 flex items-center justify-center gap-1.5">
|
|
<span>Choisir le Pass Flash</span>
|
|
<i class="ph-bold ph-arrow-right"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- PASS MEDIUM (VERT) -->
|
|
<div class="bg-emerald-50/40 rounded-3xl p-4 border border-emerald-200 shadow-xs relative overflow-hidden transition-all hover:shadow-md hover:border-emerald-300">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-emerald-100 text-emerald-600 flex items-center justify-center shadow-xs">
|
|
<i class="ph-fill ph-rocket-launch text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Pass Medium</h3>
|
|
<span class="text-[10px] font-bold text-emerald-600 block uppercase tracking-wider">🚀 Boost Medium (Vert)</span>
|
|
</div>
|
|
</div>
|
|
<div class="text-right">
|
|
<span class="text-base font-black text-job-dark">5,99€</span>
|
|
<span class="text-[10px] font-medium text-emerald-600/80 block">/mois</span>
|
|
</div>
|
|
</div>
|
|
<ul class="text-[11px] text-job-dark/80 space-y-1.5 mb-3 font-medium">
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-emerald-500 text-sm"></i> <strong>5 Shorts</strong> max inclus</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-emerald-500 text-sm"></i> Badge vert Medium sur votre avatar</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-emerald-500 text-sm"></i> Remontée moyenne dans la recherche</li>
|
|
</ul>
|
|
<button onclick="selectPass('medium')" class="w-full py-2.5 rounded-xl bg-emerald-600 hover:bg-emerald-700 text-white text-xs font-bold transition-all shadow-sm active:scale-98 flex items-center justify-center gap-1.5">
|
|
<span>Choisir le Pass Medium</span>
|
|
<i class="ph-bold ph-arrow-right"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- PASS PRO (ROUGE) -->
|
|
<div class="bg-gradient-to-br from-rose-50 via-red-50/70 to-rose-100/60 rounded-3xl p-4 border-2 border-rose-400 shadow-md relative overflow-hidden ring-2 ring-rose-400/20 transition-all hover:shadow-xl">
|
|
<div class="absolute top-0 right-0 bg-gradient-to-r from-rose-600 to-red-600 text-white text-[9px] font-black px-3 py-1 rounded-bl-xl uppercase tracking-wider flex items-center gap-1 shadow-sm">
|
|
<i class="ph-fill ph-fire"></i> Le Plus Populaire
|
|
</div>
|
|
<div class="flex justify-between items-start mb-2 pr-28">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-rose-100 text-rose-600 flex items-center justify-center shadow-xs">
|
|
<i class="ph-fill ph-crown text-lg"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Pass Pro</h3>
|
|
<span class="text-[10px] font-bold text-rose-600 block uppercase tracking-wider">🔥 Boost Pro (Rouge)</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline justify-between mb-2">
|
|
<div class="text-[11px] text-job-dark/80 font-semibold">Idéal pour les artisans & pros actifs</div>
|
|
<div class="text-right">
|
|
<span class="text-lg font-black text-job-dark">9,99€</span>
|
|
<span class="text-[10px] font-medium text-rose-600/80">/mois</span>
|
|
</div>
|
|
</div>
|
|
<ul class="text-[11px] text-job-dark space-y-1.5 mb-3 font-semibold">
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-rose-600 text-sm"></i> <strong>6 Shorts</strong> max inclus</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-rose-600 text-sm"></i> <strong>Fort boost algorithmique</strong> dans les recherches</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-rose-600 text-sm"></i> Badge "Pro" rouge sur votre profil</li>
|
|
</ul>
|
|
<button onclick="selectPass('pro')" class="w-full py-2.5 rounded-xl bg-rose-600 hover:bg-rose-700 text-white text-xs font-bold transition-all shadow-md active:scale-98 flex items-center justify-center gap-1.5">
|
|
<i class="ph-fill ph-crown"></i>
|
|
<span>Souscrire au Pass Pro</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- PASS PREMIUM (NOIR / VIOLET) -->
|
|
<div class="bg-gradient-to-br from-[#090510] via-[#150a26] to-[#260e40] text-white rounded-3xl p-4.5 border-2 border-purple-500/80 shadow-xl relative overflow-hidden transition-all hover:shadow-2xl">
|
|
<div class="absolute top-0 right-0 bg-gradient-to-r from-purple-800 via-violet-700 to-fuchsia-700 text-white text-[9px] font-black px-3 py-1 rounded-bl-xl uppercase tracking-wider flex items-center gap-1 shadow-md">
|
|
<i class="ph-fill ph-diamond"></i> Position prioritaire
|
|
</div>
|
|
<div class="flex justify-between items-start mb-2 pr-28">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-10 h-10 rounded-xl bg-gradient-to-tr from-purple-900 via-violet-800 to-fuchsia-700 text-white flex items-center justify-center shadow-md">
|
|
<i class="ph-fill ph-diamond text-xl animate-pulse text-purple-200"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-white flex items-center gap-1.5">
|
|
Pass Premium
|
|
</h3>
|
|
<span class="text-[10px] font-bold text-purple-300 block uppercase tracking-wider">💎 Boost Noir / Violet</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline justify-between mb-2">
|
|
<div class="text-[11px] text-purple-200/90 font-medium">Dominez complètement votre secteur</div>
|
|
<div class="text-right">
|
|
<span class="text-lg font-black text-white">19,99€</span>
|
|
<span class="text-[10px] font-medium text-purple-300/80">/mois</span>
|
|
</div>
|
|
</div>
|
|
<ul class="text-[11px] text-purple-100 space-y-1.5 mb-3.5 font-medium">
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-purple-400 text-sm"></i> <strong>8 Shorts</strong> max inclus (Capacité Maximale)</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-purple-400 text-sm"></i> <strong>Position prioritaire</strong> dans votre catégorie & ville</li>
|
|
<li class="flex items-center gap-2"><i class="ph-fill ph-check-circle text-purple-400 text-sm"></i> Badge exclusif Noir / Violet sur votre profil</li>
|
|
</ul>
|
|
<button onclick="selectPass('premium')" class="w-full py-3 rounded-xl bg-gradient-to-r from-purple-900 via-violet-800 to-black hover:from-purple-800 hover:to-violet-900 text-white border border-purple-400/40 text-xs font-extrabold transition-all shadow-lg active:scale-98 flex items-center justify-center gap-2">
|
|
<i class="ph-fill ph-sparkle text-sm text-fuchsia-300"></i>
|
|
<span>Activer le Pass Premium</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- EXTRA SHORT OPTION -->
|
|
<div class="bg-gradient-to-r from-amber-100/90 via-orange-100/80 to-yellow-100/90 rounded-2xl p-4 border-2 border-amber-300/80 mt-2 flex items-center justify-between shadow-xs hover:shadow-md transition-all">
|
|
<div class="flex items-center gap-3">
|
|
<div class="w-10 h-10 rounded-xl bg-amber-400/40 text-amber-800 flex items-center justify-center shrink-0">
|
|
<i class="ph-fill ph-video-camera text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<span class="text-xs font-bold text-job-dark block font-titre">Besoin d'un Short en plus ?</span>
|
|
<span class="text-[11px] text-amber-800 font-medium">0.50€/mois par emplacement vidéo additionnel (Max 8)</span>
|
|
</div>
|
|
</div>
|
|
<button onclick="buyExtraShort()" class="w-10 h-10 rounded-2xl bg-gradient-to-tr from-amber-400 to-orange-400 text-job-dark flex items-center justify-center font-black text-xl shrink-0 shadow-md hover:scale-105 active:scale-95 transition-transform" title="Ajouter un Short">
|
|
<i class="ph-bold ph-plus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 3 : INFORMATIONS PERSONNELLES (remplace Vérification & IBAN) -->
|
|
<div id="edit-profile-modal" class="fixed inset-0 z-[120] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-lg md:rounded-3xl md:my-auto mx-auto max-h-[88vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-y-auto">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<div>
|
|
<h2 class="text-2xl font-bold font-titre text-job-dark">Informations personnelles</h2>
|
|
<p class="text-gray-500 text-xs">Gérez vos identifiants, coordonnées et sécurité</p>
|
|
</div>
|
|
<button onclick="closeEditProfileModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark active:scale-95 shadow-xs">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<form onsubmit="handleSaveProfile(event)" class="space-y-3">
|
|
<div class="flex flex-col items-center mb-3">
|
|
<div class="relative w-20 h-20 mb-1.5 cursor-pointer group" onclick="simulateProfileAvatarUpload()">
|
|
<img loading="lazy" decoding="async" id="edit-avatar-preview" src="" class="w-full h-full rounded-full object-cover border border-job-gray shadow-sm group-hover:opacity-70 transition-opacity">
|
|
<div class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
|
|
<div class="w-8 h-8 rounded-full bg-black/50 flex items-center justify-center text-white backdrop-blur-sm shadow-md">
|
|
<i class="ph-bold ph-camera"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="text-[10px] text-gray-500 font-bold uppercase tracking-wider">Modifier la photo</span>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Prénom</label>
|
|
<input type="text" id="edit-firstname" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Nom</label>
|
|
<input type="text" id="edit-lastname" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Adresse Email</label>
|
|
<input type="email" id="edit-email" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Numéro de téléphone</label>
|
|
<input type="tel" id="edit-phone" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
|
|
<!-- Mot de passe sécurisé et protégé comme LeBonCoin & Vinted -->
|
|
<div class="bg-job-bg/70 rounded-2xl p-3 border border-job-gray flex items-center justify-between">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-8 h-8 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-lock-key text-base"></i>
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-500">Mot de passe</label>
|
|
<span class="text-xs font-mono text-job-dark tracking-widest font-bold">••••••••••••</span>
|
|
<p class="text-[9px] text-gray-400">Protégé & chiffré</p>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="openChangePasswordModal()" class="text-xs font-bold text-job-sage hover:text-job-sage-dark bg-white hover:bg-job-bg px-3 py-1.5 rounded-xl border border-job-gray shadow-xs transition-all active:scale-95">
|
|
Modifier
|
|
</button>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Adresse / Ville principale</label>
|
|
<input type="text" id="edit-address" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">IBAN pour virements bancaires</label>
|
|
<input type="text" id="edit-iban" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none font-mono focus:border-job-sage">
|
|
</div>
|
|
|
|
<button type="submit" class="w-full bg-job-sage hover:bg-job-sage-dark text-white font-bold text-xs py-3.5 rounded-xl shadow-sm mt-1 transition-all active:scale-98">
|
|
Enregistrer mes modifications
|
|
</button>
|
|
</form>
|
|
|
|
<!-- Zone de Danger : Suppression de compte -->
|
|
<div class="mt-6 pt-4 border-t border-rose-200/80 bg-rose-50/60 p-4 rounded-2xl border border-rose-200">
|
|
<div class="flex items-center gap-2 mb-1.5 text-rose-700">
|
|
<i class="ph-bold ph-warning text-lg"></i>
|
|
<h4 class="text-xs font-bold uppercase tracking-wider">Suppression du compte</h4>
|
|
</div>
|
|
<p class="text-[11px] text-rose-800/80 mb-3 leading-relaxed">
|
|
Vous pouvez fermer définitivement votre compte Jobrunner. Cette action est irréversible et supprimera l'ensemble de vos données.
|
|
</p>
|
|
<button type="button" onclick="openDeleteAccountModal()" class="w-full bg-white hover:bg-rose-100 text-rose-600 border border-rose-300 font-bold text-xs py-2.5 rounded-xl transition-colors flex items-center justify-center gap-1.5 active:scale-95 shadow-xs">
|
|
<i class="ph-bold ph-trash"></i> Supprimer mon compte
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE SECURITE : MODIFICATION DE MOT DE PASSE -->
|
|
<div id="change-password-modal" class="fixed inset-0 z-[160] bg-black/70 backdrop-blur-sm hidden flex-col justify-center items-center px-4">
|
|
<div class="bg-white w-full max-w-[420px] rounded-3xl p-6 shadow-2xl border border-job-gray/80 animate-in">
|
|
<div class="flex items-center justify-between pb-3 border-b border-job-gray/80 mb-4">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i class="ph-bold ph-shield-check text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Modifier le mot de passe</h3>
|
|
<p class="text-[10px] text-gray-400">Sécurité renforcée LeBonCoin & Vinted</p>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="closeChangePasswordModal()" class="w-8 h-8 rounded-full bg-job-bg flex items-center justify-center text-gray-400 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="bg-amber-50/70 border border-amber-200/80 rounded-xl p-3 mb-4 flex items-start gap-2 text-[11px] text-job-dark leading-snug">
|
|
<i class="ph-fill ph-lock-key text-job-gold text-sm mt-0.5 shrink-0"></i>
|
|
<span>Pour votre sécurité, votre mot de passe actuel n'est jamais affiché en clair. Saisissez-le pour autoriser la modification.</span>
|
|
</div>
|
|
|
|
<form onsubmit="handleConfirmChangePassword(event)" class="space-y-3">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Mot de passe actuel</label>
|
|
<div class="relative flex items-center">
|
|
<input type="password" id="pw-current" required placeholder="Mot de passe actuel" class="w-full bg-job-bg rounded-xl px-3.5 py-2.5 pr-10 text-xs border border-job-gray outline-none focus:border-job-sage focus:bg-white transition-colors">
|
|
<button type="button" onclick="togglePasswordVisibility('pw-current', 'pw-cur-icon')" class="absolute right-3 text-gray-400 hover:text-job-dark">
|
|
<i id="pw-cur-icon" class="ph-bold ph-eye text-base"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Nouveau mot de passe</label>
|
|
<div class="relative flex items-center">
|
|
<input type="password" id="pw-new" required minlength="8" placeholder="Au moins 8 caractères" class="w-full bg-job-bg rounded-xl px-3.5 py-2.5 pr-10 text-xs border border-job-gray outline-none focus:border-job-sage focus:bg-white transition-colors">
|
|
<button type="button" onclick="togglePasswordVisibility('pw-new', 'pw-new-icon')" class="absolute right-3 text-gray-400 hover:text-job-dark">
|
|
<i id="pw-new-icon" class="ph-bold ph-eye text-base"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Confirmer le nouveau mot de passe</label>
|
|
<div class="relative flex items-center">
|
|
<input type="password" id="pw-confirm" required minlength="8" placeholder="Répétez le nouveau mot de passe" class="w-full bg-job-bg rounded-xl px-3.5 py-2.5 pr-10 text-xs border border-job-gray outline-none focus:border-job-sage focus:bg-white transition-colors">
|
|
<button type="button" onclick="togglePasswordVisibility('pw-confirm', 'pw-conf-icon')" class="absolute right-3 text-gray-400 hover:text-job-dark">
|
|
<i id="pw-conf-icon" class="ph-bold ph-eye text-base"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pt-2 flex items-center gap-2">
|
|
<button type="button" onclick="closeChangePasswordModal()" class="w-1/2 bg-job-bg hover:bg-gray-200 text-job-dark font-bold text-xs py-2.5 rounded-xl transition-colors">
|
|
Annuler
|
|
</button>
|
|
<button type="submit" class="w-1/2 bg-job-sage hover:bg-job-sage-dark text-white font-bold text-xs py-2.5 rounded-xl transition-all shadow-sm active:scale-95">
|
|
Valider
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE DE PARTAGE MULTI-CANAUX (WHATSAPP, LIEN, SMS, ETC.) -->
|
|
<div id="share-modal" class="fixed inset-0 z-[180] bg-black/70 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center p-0 md:p-4 animate-in">
|
|
<div class="bg-white w-full max-w-[440px] rounded-t-[2.5rem] md:rounded-3xl p-6 shadow-2xl border border-job-gray/80 flex flex-col">
|
|
<div class="flex items-center justify-between pb-3 border-b border-job-gray mb-4">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-9 h-9 rounded-xl bg-job-sage-light text-job-sage flex items-center justify-center">
|
|
<i class="ph-bold ph-share-network text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Partager ce Short</h3>
|
|
<p class="text-[11px] text-gray-400">Recommander cette prestation</p>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="closeShareModal()" class="w-8 h-8 rounded-full bg-job-bg flex items-center justify-center text-gray-400 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Aperçu du Short -->
|
|
<div class="flex items-center gap-3 p-3 bg-job-bg/70 rounded-2xl border border-job-gray/60 mb-5">
|
|
<img loading="lazy" decoding="async" id="share-preview-img" src="" class="w-12 h-16 object-cover rounded-xl border border-job-gray shrink-0" alt="Short preview">
|
|
<div class="overflow-hidden">
|
|
<h4 id="share-preview-title" class="font-bold text-xs text-job-dark truncate">Titre de la prestation</h4>
|
|
<p id="share-preview-author" class="text-[10px] text-gray-500 truncate">Par le prestataire</p>
|
|
<span class="inline-flex items-center gap-1 text-[9px] font-bold text-job-sage bg-emerald-50 px-2 py-0.5 rounded-full mt-1">
|
|
<i class="ph-fill ph-shield-check"></i> Paiement sécurisé
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Grille d'actions de partage -->
|
|
<div class="grid grid-cols-4 gap-2.5 mb-5 text-center">
|
|
<!-- WhatsApp -->
|
|
<button type="button" onclick="shareVia('whatsapp')" class="flex flex-col items-center gap-1.5 p-2 rounded-2xl hover:bg-job-bg transition-all active:scale-95 group">
|
|
<div class="w-12 h-12 rounded-2xl bg-emerald-500 text-white flex items-center justify-center text-2xl shadow-sm group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-whatsapp-logo"></i>
|
|
</div>
|
|
<span class="text-[11px] font-bold text-job-dark">WhatsApp</span>
|
|
</button>
|
|
|
|
<!-- Copier le lien -->
|
|
<button type="button" onclick="shareVia('copy')" class="flex flex-col items-center gap-1.5 p-2 rounded-2xl hover:bg-job-bg transition-all active:scale-95 group">
|
|
<div class="w-12 h-12 rounded-2xl bg-job-dark text-white flex items-center justify-center text-2xl shadow-sm group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-link"></i>
|
|
</div>
|
|
<span class="text-[11px] font-bold text-job-dark">Copier</span>
|
|
</button>
|
|
|
|
<!-- SMS -->
|
|
<button type="button" onclick="shareVia('sms')" class="flex flex-col items-center gap-1.5 p-2 rounded-2xl hover:bg-job-bg transition-all active:scale-95 group">
|
|
<div class="w-12 h-12 rounded-2xl bg-sky-500 text-white flex items-center justify-center text-2xl shadow-sm group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-chat-teardrop-text"></i>
|
|
</div>
|
|
<span class="text-[11px] font-bold text-job-dark">SMS</span>
|
|
</button>
|
|
|
|
<!-- Email / Autres -->
|
|
<button type="button" onclick="shareVia('more')" class="flex flex-col items-center gap-1.5 p-2 rounded-2xl hover:bg-job-bg transition-all active:scale-95 group">
|
|
<div class="w-12 h-12 rounded-2xl bg-job-sage text-white flex items-center justify-center text-2xl shadow-sm group-hover:scale-105 transition-transform">
|
|
<i class="ph-bold ph-dots-three text-2xl"></i>
|
|
</div>
|
|
<span class="text-[11px] font-bold text-job-dark">Plus</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Champ lien avec bouton copier intégré -->
|
|
<div class="flex items-center gap-2 bg-job-bg rounded-xl p-1.5 pl-3 border border-job-gray mb-3">
|
|
<input type="text" id="share-link-input" readonly class="bg-transparent text-xs text-gray-600 outline-none flex-grow font-mono truncate select-all">
|
|
<button type="button" onclick="shareVia('copy')" class="bg-white hover:bg-job-sage hover:text-white text-job-dark font-bold text-xs px-3 py-2 rounded-lg border border-job-gray shadow-xs transition-colors shrink-0">
|
|
Copier
|
|
</button>
|
|
</div>
|
|
|
|
<button type="button" onclick="closeShareModal()" class="w-full bg-job-bg hover:bg-gray-200 text-job-dark font-bold text-xs py-3 rounded-xl transition-colors">
|
|
Fermer
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE PREVISUALISATION DEVIS -->
|
|
<div id="devis-modal" class="fixed inset-0 z-[180] bg-black/70 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center p-0 md:p-4 animate-in">
|
|
<div class="bg-white w-full max-w-[500px] rounded-t-[2.5rem] md:rounded-3xl p-6 shadow-2xl border border-job-gray/80 flex flex-col max-h-[90vh] overflow-y-auto">
|
|
<div class="flex items-center justify-between pb-3 border-b border-job-gray/60 mb-4">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-10 h-10 rounded-2xl bg-job-sage-light text-job-sage flex items-center justify-center font-bold">
|
|
<i class="ph-bold ph-file-text text-xl"></i>
|
|
</div>
|
|
<div>
|
|
<h3 class="font-bold font-titre text-base text-job-dark">Devis & Cahier des charges</h3>
|
|
<span class="text-[10px] text-gray-500 font-mono" id="devis-modal-ref">Réf: DEV-2026-88</span>
|
|
</div>
|
|
</div>
|
|
<button type="button" onclick="closeDevisModal()" class="w-8 h-8 rounded-full bg-job-bg flex items-center justify-center text-gray-500 hover:text-job-dark transition-colors">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="space-y-3.5 text-xs text-job-dark">
|
|
<div class="bg-job-bg p-3.5 rounded-2xl border border-job-gray/60 space-y-1.5">
|
|
<div class="flex justify-between items-center text-gray-500 text-[11px]">
|
|
<span>Prestation</span>
|
|
<span class="font-bold text-job-dark">Dépannage & Intervention</span>
|
|
</div>
|
|
<div class="flex justify-between items-center text-gray-500 text-[11px]">
|
|
<span>Date d'émission</span>
|
|
<span class="font-bold text-job-dark">16 Septembre 2026</span>
|
|
</div>
|
|
<div class="flex justify-between items-center text-gray-500 text-[11px]">
|
|
<span>Paiement</span>
|
|
<span class="font-bold text-job-sage">Fonds conservés jusqu'à validation</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="border border-job-gray/60 rounded-2xl p-3.5 space-y-2">
|
|
<span class="text-[10px] font-bold text-gray-400 uppercase tracking-wider block">Détail des prestations</span>
|
|
<div class="flex justify-between items-center text-xs">
|
|
<span class="text-gray-600">Main d'œuvre qualifiée sur site (3h)</span>
|
|
<span class="font-bold text-job-dark">120,00 €</span>
|
|
</div>
|
|
<div class="flex justify-between items-center text-xs">
|
|
<span class="text-gray-600">Fournitures & consommables homologués</span>
|
|
<span class="font-bold text-job-dark">45,00 €</span>
|
|
</div>
|
|
<div class="flex justify-between items-center text-xs">
|
|
<span class="text-gray-600">Déplacement & diagnostic préalable</span>
|
|
<span class="font-bold text-job-dark">15,00 €</span>
|
|
</div>
|
|
<div class="border-t border-job-gray/60 pt-2 flex justify-between items-center text-sm font-extrabold text-job-dark">
|
|
<span>TOTAL TTC À CONSIGNER</span>
|
|
<span class="text-job-sage text-base">180,00 €</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-emerald-50 border border-emerald-200 rounded-2xl p-3 text-[11px] text-emerald-800 flex items-start gap-2">
|
|
<i class="ph-fill ph-shield-check text-job-sage text-base shrink-0 mt-0.5"></i>
|
|
<span>Paiement 100% protégé : les fonds restent bloqués sur compte de séquestre indépendant jusqu'à la fin de la mission et validation client.</span>
|
|
</div>
|
|
|
|
<div class="flex gap-2 pt-2">
|
|
<button type="button" onclick="closeDevisModal()" class="flex-1 py-3 rounded-xl bg-job-bg hover:bg-gray-200 text-gray-700 font-bold text-xs transition-colors">
|
|
Fermer
|
|
</button>
|
|
<button type="button" onclick="downloadTransactionReceipt('DEV-2026-88'); closeDevisModal();" class="flex-1 py-3 rounded-xl bg-job-sage hover:bg-job-sage-dark text-white font-bold text-xs transition-colors flex items-center justify-center gap-1.5 shadow-sm">
|
|
<i class="ph-bold ph-download-simple"></i>
|
|
<span>Télécharger le reçu</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE HAUTE SECURITE : CONFIRMATION SUPPRESSION DE COMPTE -->
|
|
<div id="delete-account-modal" class="fixed inset-0 z-[150] bg-black/75 backdrop-blur-sm hidden flex-col justify-center items-center px-4">
|
|
<div class="bg-white w-full max-w-[420px] rounded-3xl p-6 shadow-2xl border border-rose-200 animate-in">
|
|
<div class="w-14 h-14 rounded-full bg-rose-100 text-rose-600 flex items-center justify-center mx-auto mb-3">
|
|
<i class="ph-fill ph-warning-octagon text-3xl"></i>
|
|
</div>
|
|
<h3 class="text-xl font-bold font-titre text-job-dark text-center mb-2">Supprimer votre compte ?</h3>
|
|
|
|
<div class="bg-rose-50 border border-rose-200 rounded-2xl p-3.5 mb-4 text-[11px] text-rose-900 leading-relaxed">
|
|
<p class="font-bold mb-1.5 flex items-center gap-1">
|
|
<i class="ph-bold ph-shield-warning text-rose-600"></i> Attention : Action 100% irréversible
|
|
</p>
|
|
<p>Tout sera immédiatement et définitivement supprimé :</p>
|
|
<ul class="list-disc list-inside mt-1 space-y-0.5 text-rose-800">
|
|
<li>Vos annonces de service publiées</li>
|
|
<li>Toutes vos discussions et messages tchat</li>
|
|
<li>Vos contrats en cours et passés</li>
|
|
<li>Votre historique complet de transactions</li>
|
|
</ul>
|
|
<p class="font-semibold mt-2 text-rose-950">Aucune donnée ne pourra être récupérée par la suite.</p>
|
|
</div>
|
|
|
|
<form onsubmit="handleConfirmDeleteAccount(event)" class="space-y-3">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase tracking-wider text-gray-700 mb-1">
|
|
Saisissez votre mot de passe pour confirmer :
|
|
</label>
|
|
<input type="password" id="delete-confirm-password" placeholder="Mot de passe actuel" required class="w-full bg-job-bg rounded-xl px-3 py-2.5 text-xs border border-job-gray focus:border-rose-500 focus:outline-none font-medium">
|
|
<p id="delete-error-msg" class="hidden text-[10px] text-rose-600 font-bold mt-1"></p>
|
|
</div>
|
|
|
|
<div class="flex gap-2 pt-2">
|
|
<button type="button" onclick="closeDeleteAccountModal()" class="flex-1 py-3 rounded-xl border border-job-gray text-gray-700 font-bold text-xs hover:bg-job-bg active:scale-95 transition-all">
|
|
Annuler
|
|
</button>
|
|
<button type="submit" class="flex-1 py-3 rounded-xl bg-rose-600 text-white font-bold text-xs hover:bg-rose-700 shadow-md active:scale-95 transition-all flex items-center justify-center gap-1">
|
|
<i class="ph-bold ph-trash"></i> Confirmer
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE FILTRES AVANCES RECHERCHE -->
|
|
<div id="search-filters-modal" class="fixed inset-0 z-[125] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-xl md:rounded-3xl md:my-auto mx-auto max-h-[88vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-y-auto">
|
|
<div class="flex items-center justify-between pb-3 border-b border-job-gray/80 mb-4">
|
|
<div>
|
|
<h2 class="text-xl font-bold font-titre text-job-dark">Filtres de recherche</h2>
|
|
<p class="text-gray-500 text-[11px]">Affinez par lieu, rayon, prix et critères</p>
|
|
</div>
|
|
<button onclick="closeSearchFiltersModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark active:scale-95 shadow-xs">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="space-y-5">
|
|
<!-- 1. Localisation & Rayon -->
|
|
<div class="bg-white rounded-2xl p-4 border border-job-gray/70 shadow-xs">
|
|
<div class="flex items-center justify-between mb-2">
|
|
<label class="text-xs font-bold uppercase tracking-wider text-job-dark flex items-center gap-1.5">
|
|
<i class="ph-fill ph-map-pin text-job-sage"></i> Localisation
|
|
</label>
|
|
<button type="button" onclick="clearLocationFilter()" class="text-[10px] text-job-sage font-bold hover:underline">Toute la France</button>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<select id="filter-city-select" onchange="handleCityFilterChange(this.value)" class="w-full bg-job-bg rounded-xl px-3 py-2.5 text-xs font-semibold border border-job-gray outline-none focus:border-job-sage">
|
|
<option value="all">📍 Toute la France (Pas de restriction)</option>
|
|
<optgroup label="Île-de-France & Communes (75, 92, 93, 78, 95, 94)">
|
|
<option value="Paris">Paris (75)</option>
|
|
<option value="Boulogne-Billancourt">Boulogne-Billancourt (92)</option>
|
|
<option value="Saint-Denis">Saint-Denis (93)</option>
|
|
<option value="Versailles">Versailles (78)</option>
|
|
<option value="Montreuil">Montreuil (93)</option>
|
|
<option value="Nanterre">Nanterre (92)</option>
|
|
<option value="Créteil">Créteil (94)</option>
|
|
<option value="Argenteuil">Argenteuil (95)</option>
|
|
</optgroup>
|
|
<optgroup label="Auvergne-Rhône-Alpes (69, 38, 42, 74)">
|
|
<option value="Lyon">Lyon (69)</option>
|
|
<option value="Villeurbanne">Villeurbanne (69)</option>
|
|
<option value="Vénissieux">Vénissieux (69)</option>
|
|
<option value="Caluire-et-Cuire">Caluire-et-Cuire (69)</option>
|
|
<option value="Grenoble">Grenoble (38)</option>
|
|
<option value="Saint-Étienne">Saint-Étienne (42)</option>
|
|
<option value="Annecy">Annecy (74)</option>
|
|
</optgroup>
|
|
<optgroup label="PACA - Provence-Côte d'Azur (13, 06, 83)">
|
|
<option value="Marseille">Marseille (13)</option>
|
|
<option value="Aix-en-Provence">Aix-en-Provence (13)</option>
|
|
<option value="Aubagne">Aubagne (13)</option>
|
|
<option value="Nice">Nice (06)</option>
|
|
<option value="Antibes">Antibes (06)</option>
|
|
<option value="Cannes">Cannes (06)</option>
|
|
<option value="Toulon">Toulon (83)</option>
|
|
</optgroup>
|
|
<optgroup label="Nouvelle-Aquitaine (33, 17, 64, 87)">
|
|
<option value="Bordeaux">Bordeaux (33)</option>
|
|
<option value="Mérignac">Mérignac (33)</option>
|
|
<option value="Pessac">Pessac (33)</option>
|
|
<option value="La Rochelle">La Rochelle (17)</option>
|
|
<option value="Pau">Pau (64)</option>
|
|
<option value="Limoges">Limoges (87)</option>
|
|
</optgroup>
|
|
<optgroup label="Occitanie (31, 34, 30)">
|
|
<option value="Toulouse">Toulouse (31)</option>
|
|
<option value="Colomiers">Colomiers (31)</option>
|
|
<option value="Tournefeuille">Tournefeuille (31)</option>
|
|
<option value="Montpellier">Montpellier (34)</option>
|
|
<option value="Nîmes">Nîmes (30)</option>
|
|
</optgroup>
|
|
<optgroup label="Hauts-de-France (59, 80, 62)">
|
|
<option value="Lille">Lille (59)</option>
|
|
<option value="Roubaix">Roubaix (59)</option>
|
|
<option value="Tourcoing">Tourcoing (59)</option>
|
|
<option value="Villeneuve-d'Ascq">Villeneuve-d'Ascq (59)</option>
|
|
<option value="Amiens">Amiens (80)</option>
|
|
</optgroup>
|
|
<optgroup label="Pays de la Loire & Bretagne (44, 49, 35, 29)">
|
|
<option value="Nantes">Nantes (44)</option>
|
|
<option value="Rezé">Rezé (44)</option>
|
|
<option value="Saint-Herblain">Saint-Herblain (44)</option>
|
|
<option value="Angers">Angers (49)</option>
|
|
<option value="Rennes">Rennes (35)</option>
|
|
<option value="Brest">Brest (29)</option>
|
|
</optgroup>
|
|
<optgroup label="Grand Est & Normandie (67, 51, 76)">
|
|
<option value="Strasbourg">Strasbourg (67)</option>
|
|
<option value="Schiltigheim">Schiltigheim (67)</option>
|
|
<option value="Reims">Reims (51)</option>
|
|
<option value="Rouen">Rouen (76)</option>
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Rayon en kilomètres -->
|
|
<div>
|
|
<div class="flex justify-between items-center text-xs mb-1.5 font-bold">
|
|
<span class="text-gray-600">Rayon géographique</span>
|
|
<span id="filter-radius-label" class="text-job-sage bg-job-sage-light px-2 py-0.5 rounded-md">Max 50 km</span>
|
|
</div>
|
|
<input type="range" id="filter-radius-slider" min="5" max="100" step="5" value="50" oninput="updateRadiusLabel(this.value)" class="w-full accent-job-sage cursor-pointer">
|
|
<div class="flex justify-between text-[10px] text-gray-400 mt-1">
|
|
<span>5 km</span>
|
|
<span>25 km</span>
|
|
<span>50 km</span>
|
|
<span>100 km</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 2. Budget & Tarifs -->
|
|
<div class="bg-white rounded-2xl p-4 border border-job-gray/70 shadow-xs">
|
|
<label class="text-xs font-bold uppercase tracking-wider text-job-dark flex items-center gap-1.5 mb-2.5">
|
|
<i class="ph-bold ph-currency-eur text-job-sage"></i> Prix / Budget
|
|
</label>
|
|
<div class="grid grid-cols-2 gap-2 mb-3">
|
|
<div>
|
|
<span class="text-[10px] text-gray-500 font-bold block mb-1">Prix minimum (€)</span>
|
|
<input type="number" id="filter-price-min" placeholder="0 €" min="0" class="w-full bg-job-bg rounded-xl px-3 py-2 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
<div>
|
|
<span class="text-[10px] text-gray-500 font-bold block mb-1">Prix maximum (€)</span>
|
|
<input type="number" id="filter-price-max" placeholder="Illimité" min="0" class="w-full bg-job-bg rounded-xl px-3 py-2 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Type de facturation -->
|
|
<div>
|
|
<span class="text-[10px] text-gray-500 font-bold block mb-1.5">Type de facturation</span>
|
|
<div class="grid grid-cols-3 gap-1.5">
|
|
<button type="button" onclick="selectPricingFilterUnit('all')" id="btn-unit-all" class="py-2 text-[11px] font-bold rounded-xl border bg-job-sage text-white border-job-sage transition-all">Tous</button>
|
|
<button type="button" onclick="selectPricingFilterUnit('h')" id="btn-unit-h" class="py-2 text-[11px] font-bold rounded-xl border bg-job-bg text-gray-600 border-job-gray transition-all">À l'heure (€/h)</button>
|
|
<button type="button" onclick="selectPricingFilterUnit('forfait')" id="btn-unit-forfait" class="py-2 text-[11px] font-bold rounded-xl border bg-job-bg text-gray-600 border-job-gray transition-all">Au forfait</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 3. Critères & Qualité -->
|
|
<div class="bg-white rounded-2xl p-4 border border-job-gray/70 shadow-xs space-y-2.5">
|
|
<label class="text-xs font-bold uppercase tracking-wider text-job-dark block mb-1">Garanties & Statut</label>
|
|
|
|
<label class="flex items-center justify-between cursor-pointer py-1">
|
|
<span class="text-xs font-semibold text-gray-700 flex items-center gap-1.5">
|
|
<i class="ph-fill ph-star text-amber-500"></i> Prestataires Recommandés uniquement
|
|
</span>
|
|
<input type="checkbox" id="filter-only-recommended" class="w-4 h-4 accent-job-sage rounded cursor-pointer">
|
|
</label>
|
|
|
|
<label class="flex items-center justify-between cursor-pointer py-1">
|
|
<span class="text-xs font-semibold text-gray-700 flex items-center gap-1.5">
|
|
<i class="ph-fill ph-diamond text-indigo-500"></i> Pass Pro & Premium uniquement
|
|
</span>
|
|
<input type="checkbox" id="filter-only-pro-pass" class="w-4 h-4 accent-job-sage rounded cursor-pointer">
|
|
</label>
|
|
|
|
<label class="flex items-center justify-between cursor-pointer py-1">
|
|
<span class="text-xs font-semibold text-gray-700 flex items-center gap-1.5">
|
|
<i class="ph-fill ph-video-camera text-rose-500"></i> Avec vidéo / Short de réalisation
|
|
</span>
|
|
<input type="checkbox" id="filter-only-video" class="w-4 h-4 accent-job-sage rounded cursor-pointer">
|
|
</label>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex gap-2 pt-1">
|
|
<button type="button" onclick="resetAllFiltersFromModal()" class="flex-1 py-3 rounded-2xl border border-job-gray text-gray-700 font-bold text-xs hover:bg-job-bg transition-colors">
|
|
Réinitialiser tout
|
|
</button>
|
|
<button type="button" onclick="applyFiltersFromModal()" class="flex-1 py-3 rounded-2xl bg-job-sage text-white font-bold text-xs hover:bg-job-sage-dark shadow-floating transition-all active:scale-95">
|
|
Appliquer les filtres
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 4 : PROPOSER UN CONTRAT DANS LE TCHAT -->
|
|
<div id="contract-modal" class="fixed inset-0 z-[130] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-xl md:rounded-3xl md:my-auto mx-auto max-h-[80vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-y-auto">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h2 class="text-xl font-bold font-titre text-job-dark">Proposer un Contrat Sécurisé</h2>
|
|
<button onclick="closeProposeContractModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
<form onsubmit="handleProposeContract(event)" class="space-y-3">
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Description de la mission</label>
|
|
<input type="text" id="contract-title-input" required placeholder="Ex: Réparation chauffe-eau et pose raccord" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none">
|
|
</div>
|
|
<div>
|
|
<label class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Montant total convenu (€)</label>
|
|
<input type="number" id="contract-amount-input" required min="5" placeholder="180" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none font-bold">
|
|
</div>
|
|
<p class="text-[11px] text-gray-500">Une fois proposé, le prestataire et le client devront tous les deux valider le contrat avant le blocage des fonds.</p>
|
|
<button type="submit" class="w-full bg-job-sage hover:bg-job-sage-dark text-white font-bold text-xs py-3 rounded-xl shadow-sm">
|
|
Envoyer le contrat dans le tchat
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 5 : FAVORIS -->
|
|
<div id="favorites-modal" class="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4">
|
|
<div class="bg-job-bg w-full max-w-[480px] md:max-w-2xl md:rounded-3xl md:my-auto mx-auto max-h-[85vh] rounded-t-[2.5rem] flex flex-col shadow-2xl p-6 overflow-hidden">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h2 class="text-2xl font-bold font-titre text-job-dark">Mes Favoris</h2>
|
|
<button onclick="closeFavoritesModal()" class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-gray-500 hover:text-job-dark">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
<div id="favorites-list-container" class="flex-grow overflow-y-auto space-y-3 pr-1 hide-scroll">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- MODALE 7 : CONFIRMATION SÉQUESTRE -->
|
|
<div id="escrow-confirm-modal" class="fixed inset-0 z-[140] bg-black/70 backdrop-blur-sm hidden flex-col items-center justify-center p-6">
|
|
<div class="bg-white w-full max-w-[380px] rounded-3xl shadow-2xl p-6 flex flex-col gap-4 animate-in">
|
|
<div class="flex flex-col items-center text-center gap-2">
|
|
<div class="w-16 h-16 bg-amber-100 rounded-2xl flex items-center justify-center">
|
|
<i class="ph-bold ph-lock-key text-job-gold text-3xl"></i>
|
|
</div>
|
|
<h3 class="text-xl font-bold font-titre text-job-dark">Confirmer le séquestre</h3>
|
|
<p class="text-xs text-gray-500 leading-relaxed">Les fonds seront <strong>bloqués de façon sécurisée</strong> et libérés uniquement après validation des deux parties.</p>
|
|
</div>
|
|
<div class="bg-job-bg rounded-2xl p-4 border border-job-gray">
|
|
<div class="flex justify-between items-start mb-2 gap-4">
|
|
<span class="text-[10px] text-gray-500 font-bold uppercase tracking-wider shrink-0">Mission</span>
|
|
<span class="text-xs font-bold text-job-dark text-right leading-tight" id="escrow-confirm-title">—</span>
|
|
</div>
|
|
<div class="flex justify-between items-center border-t border-job-gray pt-2">
|
|
<span class="text-[10px] text-gray-500 font-bold uppercase tracking-wider">Montant bloqué</span>
|
|
<span class="text-base font-extrabold text-job-dark" id="escrow-confirm-amount">—</span>
|
|
</div>
|
|
</div>
|
|
<div id="escrow-loader" class="hidden flex-col items-center gap-3 py-3">
|
|
<div class="w-10 h-10 border-4 border-job-sage border-t-transparent rounded-full" style="animation: spin 0.8s linear infinite;"></div>
|
|
<span class="text-xs text-gray-500 font-medium">Sécurisation bancaire en cours…</span>
|
|
</div>
|
|
<div id="escrow-confirm-actions" class="flex gap-2">
|
|
<button onclick="closeEscrowConfirmModal()" class="flex-1 py-3 rounded-2xl border border-job-gray text-job-dark text-sm font-bold hover:bg-job-bg transition-colors active:scale-95">
|
|
Annuler
|
|
</button>
|
|
<button onclick="confirmEscrowPayment()" class="flex-1 py-3 rounded-2xl bg-job-dark text-white text-sm font-bold hover:bg-black transition-colors flex items-center justify-center gap-1.5 active:scale-95">
|
|
<i class="ph-bold ph-lock-key"></i> Bloquer les fonds
|
|
</button>
|
|
</div>
|
|
<p class="text-[10px] text-center text-gray-400"><i class="ph-fill ph-shield-check text-job-sage"></i> Sécurisé par Jobrunner Escrow™ — NFR 2025</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
// ================= CONFIGURATION & CONSTANTES GLOBALES =================
|
|
const ENABLE_SHORTS = true;
|
|
const SOCIAL_LINKS = {
|
|
instagram: 'https://instagram.com/jobrunner.fr',
|
|
whatsapp: '#',
|
|
discord: '#'
|
|
};
|
|
let editingAdId = null;
|
|
|
|
// État utilisateur et authentification
|
|
let currentUser = {
|
|
isLoggedIn: true,
|
|
firstName: "Christophe",
|
|
lastName: "Vigneron",
|
|
email: "christophe.vigneron@email.com",
|
|
phone: "06 12 34 56 78",
|
|
password: "SecretJob2026!",
|
|
address: "14 Rue de Rivoli, 75001 Paris",
|
|
dob: "1998-05-14",
|
|
iban: "FR76 3000 4000 1234 5678 9012 345",
|
|
isAdult: true,
|
|
idVerified: true,
|
|
passType: 'free',
|
|
extraShorts: 0,
|
|
shortsUsed: 1,
|
|
rating: 4.9,
|
|
reviews: 18,
|
|
avatar: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=150&auto=format&fit=crop&q=80"
|
|
};
|
|
|
|
// Données des Transactions (Payées vs Reçues)
|
|
let activeTransactionsTab = 'paid';
|
|
let userTransactions = [
|
|
{
|
|
id: 101,
|
|
type: 'paid', // Payé par moi
|
|
title: "Remplacement chauffe-eau 150L & raccord",
|
|
partyName: "Sarah B.",
|
|
partyAvatar: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100&auto=format&fit=crop&q=80",
|
|
amount: 280,
|
|
date: "Aujourd'hui, 11:20",
|
|
status: 'escrow',
|
|
statusLabel: "Fonds bloqués sur Séquestre",
|
|
invoiceRef: "TRX-2026-0914"
|
|
},
|
|
{
|
|
id: 102,
|
|
type: 'paid',
|
|
title: "Réparation PC/Mac & Récupération SSD",
|
|
partyName: "Julien D.",
|
|
partyAvatar: "https://images.unsplash.com/photo-1599566150163-29194dcaad36?w=100&auto=format&fit=crop&q=80",
|
|
amount: 140,
|
|
date: "08 sept. 2026",
|
|
status: 'completed',
|
|
statusLabel: "Service validé & Débloqué",
|
|
invoiceRef: "TRX-2026-0891"
|
|
},
|
|
{
|
|
id: 103,
|
|
type: 'paid',
|
|
title: "Montage cuisine complète & meubles",
|
|
partyName: "Alexandre M.",
|
|
partyAvatar: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&auto=format&fit=crop&q=80",
|
|
amount: 420,
|
|
date: "24 août 2026",
|
|
status: 'completed',
|
|
statusLabel: "Prestation terminée",
|
|
invoiceRef: "TRX-2026-0812"
|
|
},
|
|
{
|
|
id: 201,
|
|
type: 'received', // Reçu par moi
|
|
title: "Dépannage plomberie express & joints",
|
|
partyName: "Marc V.",
|
|
partyAvatar: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=100&auto=format&fit=crop&q=80",
|
|
amount: 190,
|
|
date: "Hier, 16:45",
|
|
status: 'completed',
|
|
statusLabel: "Virement crédité sur IBAN",
|
|
invoiceRef: "VIR-2026-0412"
|
|
},
|
|
{
|
|
id: 202,
|
|
type: 'received',
|
|
title: "Conseil & diagnostic réseau Wi-Fi",
|
|
partyName: "Élodie P.",
|
|
partyAvatar: "https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100&auto=format&fit=crop&q=80",
|
|
amount: 95,
|
|
date: "02 sept. 2026",
|
|
status: 'completed',
|
|
statusLabel: "Virement crédité sur IBAN",
|
|
invoiceRef: "VIR-2026-0398"
|
|
}
|
|
];
|
|
|
|
// État des filtres de recherche façon Leboncoin / Vinted
|
|
let searchFilters = {
|
|
query: '',
|
|
city: 'all',
|
|
radiusKm: 50,
|
|
priceMin: null,
|
|
priceMax: null,
|
|
unit: 'all', // 'all', 'h', 'forfait'
|
|
onlyRecommended: false,
|
|
onlyProPass: false,
|
|
onlyVideo: false,
|
|
sortBy: 'relevance'
|
|
};
|
|
|
|
const categoriesData = [
|
|
{ id: 'brico', name: 'Bricolage', icon: 'ph-hammer', titles: ['Montage cuisine complète & meubles', 'Pose verrière & cloisons', 'Rénovation peinture appartement', 'Serrurerie & pose portes blindées'] },
|
|
{ id: 'plomb', name: 'Plomberie', icon: 'ph-drop', titles: ['Remplacement chaudière & chauffe-eau', 'Recherche fuite & tuyauterie cuivre', 'Pose baignoire & douche italienne', 'Débouchage haute pression'] },
|
|
{ id: 'elec', name: 'Électricité', icon: 'ph-lightning', titles: ['Remise aux normes tableau électrique', 'Installation domotique complète', 'Pose bornes de recharge VE', 'Rénovation éclairage LED salon'] },
|
|
{ id: 'info', name: 'Informatique', icon: 'ph-laptop', titles: ['Réparation PC/Mac & récupération SSD', 'Câblage réseau & Baie de brassage', 'Configuration télétravail sécurisé', 'Développement site web pro'] },
|
|
{ id: 'jardin', name: 'Jardinage', icon: 'ph-flower-tulip', titles: ['Création jardin & terrasse bois', 'Élagage gros arbres sécurisé', 'Pose gazon rouleau & arrosage', 'Entretien annuel espaces verts'] },
|
|
{ id: 'menage', name: 'Ménage', icon: 'ph-broom', titles: ['Remise en état après travaux lourds', 'Nettoyage moquettes & canapés vapeur', 'Ménage complet état des lieux', 'Entretien vitres grande hauteur'] },
|
|
{ id: 'trans', name: 'Transport', icon: 'ph-truck', titles: ['Déménagement complet camion 20m3', 'Transport piano & objets lourds', 'Débarras cave & gravats chantier', 'Navette express Île-de-France'] },
|
|
{ id: 'photo', name: 'Photo/Vidéo', icon: 'ph-camera', titles: ['Tournage vidéo publicitaire 4K', 'Prises de vue drone certifié DGAC', 'Shooting corporate dirigeants', 'Montage vidéo dynamique'] },
|
|
{ id: 'sport', name: 'Sport', icon: 'ph-soccer-ball', titles: ['Coaching sportif perte de poids', 'Préparation marathon & nutrition', 'Cours de boxe à domicile', 'Renforcement musculaire postural'] },
|
|
{ id: 'cours', name: 'Cours', icon: 'ph-book-open', titles: ['Prépa concours Maths Sup / Éco', 'Cours intensif Anglais TOEIC', 'Coaching prise de parole publique', 'Soutien scolaire lycée'] }
|
|
];
|
|
|
|
const sampleShortVideos = [
|
|
{ id: 'v1', label: 'Chantier Rénovation', url: 'https://assets.mixkit.co/videos/preview/mixkit-hands-of-a-carpenter-measuring-a-piece-of-wood-43336-large.mp4', poster: 'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=500&auto=format&fit=crop&q=80' },
|
|
{ id: 'v2', label: 'Soudure Plomberie', url: 'https://assets.mixkit.co/videos/preview/mixkit-welder-working-with-sparks-flying-around-42862-large.mp4', poster: 'https://images.unsplash.com/photo-1504148455328-c376907d081c?w=500&auto=format&fit=crop&q=80' },
|
|
{ id: 'v3', label: 'Installation Élec', url: 'https://assets.mixkit.co/videos/preview/mixkit-close-up-of-hands-working-on-a-circuit-board-42861-large.mp4', poster: 'https://images.unsplash.com/photo-1621905251189-08b45d6a269e?w=500&auto=format&fit=crop&q=80' }
|
|
];
|
|
|
|
let runners = [];
|
|
let myUserAds = [];
|
|
let favoriteIds = new Set([1, 4]);
|
|
let currentDetailRunnerId = null;
|
|
let viewHistory = ['home'];
|
|
let previousView = 'home';
|
|
let uploadedMockPhoto = null;
|
|
let selectedShortVideoUrl = sampleShortVideos[0].url;
|
|
|
|
let conversations = [
|
|
{
|
|
id: 1,
|
|
runnerId: 2,
|
|
name: "Sarah B.",
|
|
avatar: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100&auto=format&fit=crop&q=80",
|
|
lastMsg: "Le contrat de 280 € est en attente d'acceptation mutuelle.",
|
|
time: "11:15",
|
|
timestamp: Date.now() - (1000 * 60 * 35),
|
|
unread: true,
|
|
contract: {
|
|
status: 'proposed',
|
|
title: "Remplacement chauffe-eau 150L & pose réducteur",
|
|
amount: 280,
|
|
runnerAccepted: true,
|
|
clientAccepted: false,
|
|
runnerDone: false,
|
|
clientDone: false
|
|
},
|
|
messages: [
|
|
{ sender: 'them', text: "Bonjour Christophe ! J'ai préparé la proposition pour votre chauffe-eau." },
|
|
{ sender: 'them', text: "Voici le contrat sécurisé ci-dessus. Il suffit de cliquer sur 'Accepter le service'." }
|
|
]
|
|
},
|
|
{
|
|
id: 2,
|
|
runnerId: 5,
|
|
name: "Julien D.",
|
|
avatar: "https://images.unsplash.com/photo-1599566150163-29194dcaad36?w=100&auto=format&fit=crop&q=80",
|
|
lastMsg: "Service validé et paiement de 1 450 € versé !",
|
|
time: "Hier",
|
|
timestamp: Date.now() - (1000 * 60 * 60 * 22),
|
|
unread: false,
|
|
contract: {
|
|
status: 'completed',
|
|
title: "Rénovation peinture salon 45m2",
|
|
amount: 1450,
|
|
runnerAccepted: true,
|
|
clientAccepted: true,
|
|
runnerDone: true,
|
|
clientDone: true
|
|
},
|
|
messages: [
|
|
{ sender: 'them', text: "Le chantier est complètement achevé et nettoyé." },
|
|
{ sender: 'me', text: "Super travail Julien, j'ai validé la fin de mission." }
|
|
]
|
|
},
|
|
{
|
|
id: 3,
|
|
runnerId: 3,
|
|
name: "Maxime L.",
|
|
avatar: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&auto=format&fit=crop&q=80",
|
|
lastMsg: "Paiement séquestre de 450 € en cours de sécurisation.",
|
|
time: "Il y a 3 jours",
|
|
timestamp: Date.now() - (1000 * 60 * 60 * 70),
|
|
unread: false,
|
|
contract: {
|
|
status: 'escrow_paid',
|
|
title: "Mise en conformité tableau électrique",
|
|
amount: 450,
|
|
runnerAccepted: true,
|
|
clientAccepted: true,
|
|
runnerDone: false,
|
|
clientDone: false
|
|
},
|
|
messages: [
|
|
{ sender: 'them', text: "Bonjour Christophe, devis vérifié et conforme." },
|
|
{ sender: 'me', text: "Les fonds sont sécurisés sous séquestre. À lundi !" }
|
|
]
|
|
}
|
|
];
|
|
|
|
function generateData() {
|
|
let idCounter = 1;
|
|
const categorySelect = document.getElementById('add-category');
|
|
categorySelect.innerHTML = '';
|
|
|
|
const firstNames = ['Alexandre', 'Sarah', 'Julien', 'Camille', 'Maxime', 'Léa', 'Antoine', 'Chloé', 'Thomas', 'Inès'];
|
|
const lastNames = ['Martin', 'Bernard', 'Dubois', 'Thomas', 'Robert', 'Richard', 'Petit', 'Durand', 'Leroy', 'Moreau'];
|
|
const passTypes = ['free', 'free', 'flash', 'medium', 'pro', 'premium'];
|
|
|
|
const avatarUrls = [
|
|
'https://images.unsplash.com/photo-1599566150163-29194dcaad36?w=150&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=150&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1527980965255-d3b416303d12?w=150&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=150&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&auto=format&fit=crop&q=80',
|
|
];
|
|
|
|
const reviewTexts = [
|
|
"Travail impeccable, je recommande vivement ! Super boulot.",
|
|
"Très professionnel, ponctuel et efficace. Artisan de confiance.",
|
|
"Prestation de qualité, mais un peu de retard sur le planning.",
|
|
"Parfait, rien à redire. Personne très sympathique.",
|
|
"Super communication et résultat au top. Je referai appel à lui.",
|
|
"Très bon rapport qualité/prix. Chantier propre à la fin."
|
|
];
|
|
|
|
const categoryPricing = {
|
|
brico: [
|
|
{ price: 45, unit: 'h' },
|
|
{ price: 180, unit: 'forfait' },
|
|
{ price: 420, unit: 'forfait' },
|
|
{ price: 1250, unit: 'forfait' }
|
|
],
|
|
plomb: [
|
|
{ price: 60, unit: 'h' },
|
|
{ price: 140, unit: 'forfait' },
|
|
{ price: 290, unit: 'forfait' },
|
|
{ price: 850, unit: 'forfait' }
|
|
],
|
|
elec: [
|
|
{ price: 55, unit: 'h' },
|
|
{ price: 220, unit: 'forfait' },
|
|
{ price: 490, unit: 'forfait' },
|
|
{ price: 1450, unit: 'forfait' }
|
|
],
|
|
info: [
|
|
{ price: 40, unit: 'h' },
|
|
{ price: 95, unit: 'forfait' },
|
|
{ price: 240, unit: 'forfait' },
|
|
{ price: 620, unit: 'forfait' }
|
|
],
|
|
jardin: [
|
|
{ price: 32, unit: 'h' },
|
|
{ price: 120, unit: 'forfait' },
|
|
{ price: 280, unit: 'forfait' },
|
|
{ price: 560, unit: 'forfait' }
|
|
],
|
|
menage: [
|
|
{ price: 22, unit: 'h' },
|
|
{ price: 75, unit: 'forfait' },
|
|
{ price: 140, unit: 'forfait' },
|
|
{ price: 220, unit: 'forfait' }
|
|
],
|
|
trans: [
|
|
{ price: 48, unit: 'h' },
|
|
{ price: 160, unit: 'forfait' },
|
|
{ price: 350, unit: 'forfait' },
|
|
{ price: 750, unit: 'forfait' }
|
|
],
|
|
photo: [
|
|
{ price: 70, unit: 'h' },
|
|
{ price: 320, unit: 'forfait' },
|
|
{ price: 650, unit: 'forfait' },
|
|
{ price: 1350, unit: 'forfait' }
|
|
],
|
|
sport: [
|
|
{ price: 35, unit: 'h' },
|
|
{ price: 50, unit: 'h' },
|
|
{ price: 180, unit: 'forfait' },
|
|
{ price: 340, unit: 'forfait' }
|
|
],
|
|
cours: [
|
|
{ price: 28, unit: 'h' },
|
|
{ price: 40, unit: 'h' },
|
|
{ price: 120, unit: 'forfait' },
|
|
{ price: 250, unit: 'forfait' }
|
|
]
|
|
};
|
|
|
|
categoriesData.forEach((cat, index) => {
|
|
const opt = document.createElement('option');
|
|
opt.value = cat.id;
|
|
opt.textContent = cat.name;
|
|
categorySelect.appendChild(opt);
|
|
|
|
for (let i = 0; i < 4; i++) {
|
|
const fName = firstNames[(index * 2 + i) % firstNames.length];
|
|
const lName = lastNames[(index * 3 + i) % lastNames.length];
|
|
const name = `${fName} ${lName.charAt(0)}.`;
|
|
const title = cat.titles[i % cat.titles.length];
|
|
|
|
const ratingNum = 4.2 + Math.random() * 0.8;
|
|
const rating = ratingNum.toFixed(1);
|
|
const reviewsCount = Math.floor(Math.random() * 60) + 5;
|
|
|
|
const priceInfo = categoryPricing[cat.id] ? categoryPricing[cat.id][i % 4] : { price: 45 + (i * 20), unit: 'h' };
|
|
const price = priceInfo.price;
|
|
const unit = priceInfo.unit;
|
|
|
|
const pass = passTypes[(index + i) % passTypes.length];
|
|
const isRec = (ratingNum >= 4.8 && reviewsCount > 15);
|
|
|
|
const categoryImages = {
|
|
brico: 'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=500&auto=format&fit=crop&q=80',
|
|
plomb: 'https://images.unsplash.com/photo-1504148455328-c376907d081c?w=500&auto=format&fit=crop&q=80',
|
|
elec: 'https://images.unsplash.com/photo-1621905251189-08b45d6a269e?w=500&auto=format&fit=crop&q=80',
|
|
info: 'https://images.unsplash.com/photo-1597872200969-2b65d56bd16b?w=500&auto=format&fit=crop&q=80',
|
|
jardin: 'https://images.unsplash.com/photo-1558904541-efa8c4a08931?w=500&auto=format&fit=crop&q=80',
|
|
menage: 'https://images.unsplash.com/photo-1581578731548-c64695cc6952?w=500&auto=format&fit=crop&q=80',
|
|
trans: 'https://images.unsplash.com/photo-1600518464441-9154a4dea21b?w=500&auto=format&fit=crop&q=80',
|
|
photo: 'https://images.unsplash.com/photo-1516035069371-29a1b244cc32?w=500&auto=format&fit=crop&q=80',
|
|
sport: 'https://images.unsplash.com/photo-1517838277536-f5f99be501cd?w=500&auto=format&fit=crop&q=80',
|
|
cours: 'https://images.unsplash.com/photo-1497633762265-9d179a990aa6?w=500&auto=format&fit=crop&q=80'
|
|
};
|
|
|
|
const videoItem = sampleShortVideos[(index + i) % sampleShortVideos.length];
|
|
const randomAvatar = avatarUrls[Math.floor(Math.random() * avatarUrls.length)];
|
|
|
|
// Génération des avis simulés
|
|
let reviewsList = [];
|
|
let numRev = Math.min(reviewsCount, 6);
|
|
for(let j = 0; j < numRev; j++) {
|
|
reviewsList.push({
|
|
name: firstNames[Math.floor(Math.random() * firstNames.length)] + " " + lastNames[Math.floor(Math.random() * lastNames.length)].charAt(0) + ".",
|
|
rating: (Math.random() > 0.2 ? 5 : 4),
|
|
text: reviewTexts[Math.floor(Math.random() * reviewTexts.length)],
|
|
date: "Il y a " + (Math.floor(Math.random() * 20) + 1) + " jours"
|
|
});
|
|
}
|
|
|
|
const frenchCities = [
|
|
// Île-de-France (Paris + communes de proximité)
|
|
{ city: 'Paris', dept: '75', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Boulogne-Billancourt', dept: '92', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Saint-Denis', dept: '93', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Versailles', dept: '78', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Montreuil', dept: '93', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Nanterre', dept: '92', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Créteil', dept: '94', region: 'Île-de-France', cluster: 'Paris' },
|
|
{ city: 'Argenteuil', dept: '95', region: 'Île-de-France', cluster: 'Paris' },
|
|
// Auvergne-Rhône-Alpes (Lyon + communes)
|
|
{ city: 'Lyon', dept: '69', region: 'Auvergne-Rhône-Alpes', cluster: 'Lyon' },
|
|
{ city: 'Villeurbanne', dept: '69', region: 'Auvergne-Rhône-Alpes', cluster: 'Lyon' },
|
|
{ city: 'Vénissieux', dept: '69', region: 'Auvergne-Rhône-Alpes', cluster: 'Lyon' },
|
|
{ city: 'Caluire-et-Cuire', dept: '69', region: 'Auvergne-Rhône-Alpes', cluster: 'Lyon' },
|
|
{ city: 'Grenoble', dept: '38', region: 'Auvergne-Rhône-Alpes', cluster: 'Grenoble' },
|
|
{ city: 'Saint-Étienne', dept: '42', region: 'Auvergne-Rhône-Alpes', cluster: 'Saint-Étienne' },
|
|
{ city: 'Annecy', dept: '74', region: 'Auvergne-Rhône-Alpes', cluster: 'Annecy' },
|
|
// PACA (Marseille & Nice + communes)
|
|
{ city: 'Marseille', dept: '13', region: 'PACA', cluster: 'Marseille' },
|
|
{ city: 'Aix-en-Provence', dept: '13', region: 'PACA', cluster: 'Marseille' },
|
|
{ city: 'Aubagne', dept: '13', region: 'PACA', cluster: 'Marseille' },
|
|
{ city: 'Nice', dept: '06', region: 'PACA', cluster: 'Nice' },
|
|
{ city: 'Antibes', dept: '06', region: 'PACA', cluster: 'Nice' },
|
|
{ city: 'Cannes', dept: '06', region: 'PACA', cluster: 'Nice' },
|
|
{ city: 'Toulon', dept: '83', region: 'PACA', cluster: 'Toulon' },
|
|
// Nouvelle-Aquitaine (Bordeaux + communes)
|
|
{ city: 'Bordeaux', dept: '33', region: 'Nouvelle-Aquitaine', cluster: 'Bordeaux' },
|
|
{ city: 'Mérignac', dept: '33', region: 'Nouvelle-Aquitaine', cluster: 'Bordeaux' },
|
|
{ city: 'Pessac', dept: '33', region: 'Nouvelle-Aquitaine', cluster: 'Bordeaux' },
|
|
{ city: 'La Rochelle', dept: '17', region: 'Nouvelle-Aquitaine', cluster: 'La Rochelle' },
|
|
{ city: 'Pau', dept: '64', region: 'Nouvelle-Aquitaine', cluster: 'Pau' },
|
|
{ city: 'Limoges', dept: '87', region: 'Nouvelle-Aquitaine', cluster: 'Limoges' },
|
|
// Occitanie (Toulouse + communes)
|
|
{ city: 'Toulouse', dept: '31', region: 'Occitanie', cluster: 'Toulouse' },
|
|
{ city: 'Colomiers', dept: '31', region: 'Occitanie', cluster: 'Toulouse' },
|
|
{ city: 'Tournefeuille', dept: '31', region: 'Occitanie', cluster: 'Toulouse' },
|
|
{ city: 'Montpellier', dept: '34', region: 'Occitanie', cluster: 'Montpellier' },
|
|
{ city: 'Nîmes', dept: '30', region: 'Occitanie', cluster: 'Nîmes' },
|
|
// Hauts-de-France (Lille + communes)
|
|
{ city: 'Lille', dept: '59', region: 'Hauts-de-France', cluster: 'Lille' },
|
|
{ city: 'Roubaix', dept: '59', region: 'Hauts-de-France', cluster: 'Lille' },
|
|
{ city: 'Tourcoing', dept: '59', region: 'Hauts-de-France', cluster: 'Lille' },
|
|
{ city: 'Villeneuve-d\'Ascq', dept: '59', region: 'Hauts-de-France', cluster: 'Lille' },
|
|
{ city: 'Amiens', dept: '80', region: 'Hauts-de-France', cluster: 'Amiens' },
|
|
// Pays de la Loire & Bretagne
|
|
{ city: 'Nantes', dept: '44', region: 'Pays de la Loire', cluster: 'Nantes' },
|
|
{ city: 'Rezé', dept: '44', region: 'Pays de la Loire', cluster: 'Nantes' },
|
|
{ city: 'Saint-Herblain', dept: '44', region: 'Pays de la Loire', cluster: 'Nantes' },
|
|
{ city: 'Angers', dept: '49', region: 'Pays de la Loire', cluster: 'Angers' },
|
|
{ city: 'Rennes', dept: '35', region: 'Bretagne', cluster: 'Rennes' },
|
|
{ city: 'Brest', dept: '29', region: 'Bretagne', cluster: 'Brest' },
|
|
// Grand Est & Normandie
|
|
{ city: 'Strasbourg', dept: '67', region: 'Grand Est', cluster: 'Strasbourg' },
|
|
{ city: 'Schiltigheim', dept: '67', region: 'Grand Est', cluster: 'Strasbourg' },
|
|
{ city: 'Reims', dept: '51', region: 'Grand Est', cluster: 'Reims' },
|
|
{ city: 'Rouen', dept: '76', region: 'Normandie', cluster: 'Rouen' }
|
|
];
|
|
const selectedCityObj = frenchCities[(index * 2 + i) % frenchCities.length];
|
|
const distanceSteps = [1, 3, 5, 8, 12, 16, 22, 34, 45];
|
|
const runnerDistance = distanceSteps[(index * 3 + i) % distanceSteps.length];
|
|
|
|
// Statut déclaré par le Runner (Code de la consommation D111-8 II)
|
|
const sellerType = (pass === 'pro' || pass === 'premium' || i % 3 !== 0) ? 'pro' : 'particulier';
|
|
|
|
runners.push({
|
|
id: idCounter++,
|
|
name: name,
|
|
title: title,
|
|
categoryId: cat.id,
|
|
categoryName: cat.name,
|
|
categoryIcon: cat.icon,
|
|
rating: rating,
|
|
reviews: reviewsCount,
|
|
reviewsList: reviewsList,
|
|
price: price,
|
|
time: unit,
|
|
passType: pass,
|
|
sellerType: sellerType,
|
|
isRecommended: isRec,
|
|
city: selectedCityObj.city,
|
|
cluster: selectedCityObj.cluster,
|
|
department: selectedCityObj.dept,
|
|
region: selectedCityObj.region,
|
|
distanceKm: runnerDistance,
|
|
location: `${selectedCityObj.city} (${runnerDistance} km)`,
|
|
avatar: randomAvatar,
|
|
jobImage: categoryImages[cat.id],
|
|
hasShort: (i % 2 === 0),
|
|
shortVideo: videoItem.url,
|
|
likes: Math.floor(Math.random() * 320) + 25,
|
|
desc: `Bonjour, je suis ${name}. ${sellerType === 'pro' ? 'Professionnel' : 'Particulier'}, j'interviens à ${selectedCityObj.city} et alentours. Je vous accompagne pour vos projets de "${title.toLowerCase()}". Devis gratuit et paiement via Jobrunner.`
|
|
});
|
|
}
|
|
});
|
|
|
|
const passRank = { premium: 5, pro: 4, medium: 3, flash: 2, free: 1 };
|
|
runners.sort((a, b) => {
|
|
if (passRank[a.passType] !== passRank[b.passType]) {
|
|
return passRank[b.passType] - passRank[a.passType];
|
|
}
|
|
if (a.isRecommended !== b.isRecommended) {
|
|
return a.isRecommended ? -1 : 1;
|
|
}
|
|
return parseFloat(b.rating) - parseFloat(a.rating);
|
|
});
|
|
}
|
|
|
|
function renderHeaderAuth() {
|
|
const container = document.getElementById('header-auth-container');
|
|
const desktopContainer = document.getElementById('desktop-auth-container');
|
|
const guestBanner = document.getElementById('home-guest-banner');
|
|
const greeting = document.getElementById('home-greeting');
|
|
|
|
if (currentUser.isLoggedIn) {
|
|
if (greeting) greeting.innerHTML = `Bonjour, <span class="text-job-sage whitespace-nowrap">${currentUser.firstName} !</span>`;
|
|
if (guestBanner) guestBanner.classList.add('hidden');
|
|
if (container) {
|
|
container.innerHTML = `
|
|
<button onclick="navigate('profile')" class="flex items-center justify-center bg-white rounded-full p-0.5 shadow-card border border-job-gray/80 active:scale-95 transition-all" title="Mon Profil">
|
|
<img loading="lazy" decoding="async" src="${currentUser.avatar}" class="w-10 h-10 rounded-full object-cover shadow-sm shrink-0" alt="Profil">
|
|
</button>
|
|
`;
|
|
}
|
|
if (desktopContainer) {
|
|
desktopContainer.innerHTML = `
|
|
<button onclick="navigate('profile')" class="nav-btn flex items-center gap-2 bg-white hover:bg-job-bg px-2.5 py-1.5 rounded-full border border-job-gray/80 shadow-xs transition-all active:scale-95 shrink-0" data-target="profile" title="Profil">
|
|
<img loading="lazy" decoding="async" src="${currentUser.avatar}" class="w-6 h-6 rounded-full object-cover shadow-xs shrink-0" alt="Profil">
|
|
<span class="text-xs font-bold text-job-dark">Profil</span>
|
|
</button>
|
|
`;
|
|
}
|
|
}
|
|
}
|
|
|
|
function renderCategories() {
|
|
const homeContainer = document.getElementById('home-categories-container');
|
|
const searchGrid = document.getElementById('search-categories-grid');
|
|
|
|
if (homeContainer) homeContainer.innerHTML = '';
|
|
if (searchGrid) searchGrid.innerHTML = '';
|
|
|
|
if (homeContainer) {
|
|
const allPill = document.createElement('button');
|
|
allPill.className = "flex items-center gap-2 bg-job-sage text-white px-4 py-2.5 rounded-full shadow-card font-bold text-xs shrink-0 active:scale-95 transition-all";
|
|
allPill.innerHTML = `<i class="ph-bold ph-sparkle text-sm"></i> Tout`;
|
|
allPill.onclick = () => { resetFilters(); navigate('search'); };
|
|
homeContainer.appendChild(allPill);
|
|
}
|
|
|
|
categoriesData.forEach(cat => {
|
|
if (homeContainer) {
|
|
const pill = document.createElement('button');
|
|
pill.className = "flex items-center gap-2 bg-white text-job-dark hover:bg-job-sage hover:text-white px-4 py-2.5 rounded-full shadow-card font-semibold text-xs shrink-0 transition-all border border-job-gray/70 active:scale-95";
|
|
pill.innerHTML = `<i class="ph-bold ${cat.icon} text-base"></i> ${cat.name}`;
|
|
pill.onclick = () => { filterRunnersByCategory(cat.id); navigate('search'); };
|
|
homeContainer.appendChild(pill);
|
|
}
|
|
|
|
if (searchGrid) {
|
|
const gridItem = document.createElement('button');
|
|
gridItem.className = "flex flex-col items-center justify-center gap-1.5 bg-white rounded-2xl p-3 shadow-card hover:border-job-sage border border-job-gray/70 transition-all active:scale-95 text-center group";
|
|
gridItem.innerHTML = `
|
|
<div class="w-10 h-10 rounded-xl bg-job-bg group-hover:bg-job-sage-light text-job-sage flex items-center justify-center transition-colors">
|
|
<i class="ph-bold ${cat.icon} text-xl"></i>
|
|
</div>
|
|
<span class="text-[10px] font-bold text-job-dark leading-tight">${cat.name}</span>
|
|
`;
|
|
gridItem.onclick = () => filterRunnersByCategory(cat.id);
|
|
searchGrid.appendChild(gridItem);
|
|
}
|
|
});
|
|
}
|
|
|
|
function createRunnerCard(runner, isOwnAd = false) {
|
|
const timeDisplay = runner.time === 'forfait' ? 'au forfait' : `/${runner.time}`;
|
|
const isFav = favoriteIds.has(runner.id);
|
|
const formattedPrice = runner.price >= 1000 ? runner.price.toLocaleString('fr-FR') : runner.price;
|
|
|
|
let badgeHtml = '';
|
|
let passBadge = '';
|
|
let cardAccentClass = '';
|
|
|
|
if (runner.passType === 'premium') {
|
|
badgeHtml = `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-gradient-to-tr from-black via-purple-950 to-purple-800 border-2 border-purple-400 rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Premium (Noir / Violet)"><i class="ph-fill ph-diamond text-purple-200 text-[8px]"></i></div>`;
|
|
passBadge = `<span class="inline-flex items-center gap-0.5 bg-gradient-to-r from-gray-950 via-purple-950 to-indigo-950 text-purple-200 border border-purple-400/50 text-[8px] font-black uppercase px-1.5 py-0.5 rounded-md shadow-xs ml-1.5"><i class="ph-fill ph-diamond text-[9px] text-fuchsia-400"></i> PREMIUM</span>`;
|
|
cardAccentClass = 'ring-1 ring-purple-400/50 bg-gradient-to-r from-purple-50/25 to-white';
|
|
} else if (runner.passType === 'pro') {
|
|
badgeHtml = `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-rose-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Pro (Rouge)"><i class="ph-fill ph-crown text-white text-[8px]"></i></div>`;
|
|
passBadge = `<span class="inline-flex items-center gap-0.5 bg-rose-600 text-white text-[8px] font-black uppercase px-1.5 py-0.5 rounded-md shadow-xs ml-1.5"><i class="ph-fill ph-crown text-[9px]"></i> PRO</span>`;
|
|
cardAccentClass = 'ring-1 ring-rose-300/60 bg-gradient-to-r from-rose-50/20 to-white';
|
|
} else if (runner.passType === 'medium') {
|
|
badgeHtml = `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-emerald-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Medium (Vert)"><i class="ph-fill ph-rocket-launch text-white text-[8px]"></i></div>`;
|
|
passBadge = `<span class="inline-flex items-center gap-0.5 bg-emerald-600 text-white text-[8px] font-black uppercase px-1.5 py-0.5 rounded-md shadow-xs ml-1.5"><i class="ph-fill ph-rocket-launch text-[9px]"></i> MEDIUM</span>`;
|
|
cardAccentClass = 'ring-1 ring-emerald-300/60 bg-gradient-to-r from-emerald-50/20 to-white';
|
|
} else if (runner.passType === 'flash') {
|
|
badgeHtml = `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-blue-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Flash (Bleu)"><i class="ph-fill ph-lightning text-white text-[8px]"></i></div>`;
|
|
passBadge = `<span class="inline-flex items-center gap-0.5 bg-blue-600 text-white text-[8px] font-black uppercase px-1.5 py-0.5 rounded-md shadow-xs ml-1.5"><i class="ph-fill ph-lightning text-[9px]"></i> FLASH</span>`;
|
|
cardAccentClass = 'ring-1 ring-blue-300/60 bg-gradient-to-r from-blue-50/20 to-white';
|
|
} else if (runner.isRecommended) {
|
|
badgeHtml = `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-amber-400 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Recommandé"><i class="ph-fill ph-star text-white text-[8px]"></i></div>`;
|
|
}
|
|
|
|
// Classement payant : mention obligatoire (Code de la consommation L121-4 25°, D111-8)
|
|
const sponsoredLabel = (passBadge || runner.isBoosted) ? `<span class="text-[9px] font-semibold text-gray-400 ml-1.5" title="Annonce mise en avant contre rémunération">Sponsorisé</span>` : '';
|
|
const boostBadge = (passBadge || (runner.isBoosted ? `<span class="inline-flex items-center gap-0.5 bg-gradient-to-r from-amber-500 to-orange-500 text-white text-[8px] font-black uppercase px-1.5 py-0.5 rounded-md shadow-xs ml-1.5"><i class="ph-fill ph-lightning text-[9px]"></i> BOOST</span>` : '')) + sponsoredLabel;
|
|
const finalRingClass = cardAccentClass || (runner.isBoosted ? 'ring-1 ring-amber-300/80 bg-gradient-to-r from-amber-50/20 to-white' : '');
|
|
|
|
return `
|
|
<div class="bg-white rounded-3xl p-3 shadow-card flex gap-3.5 cursor-pointer hover:shadow-elevated transition-all border border-job-gray/70 relative overflow-hidden active:scale-[0.99] ${finalRingClass}" onclick="openProfile(${runner.id})">
|
|
|
|
<div class="relative w-28 h-28 shrink-0 rounded-2xl overflow-hidden bg-job-bg">
|
|
<img loading="lazy" decoding="async" src="${runner.jobImage}" alt="${runner.title}" class="w-full h-full object-cover transition-transform duration-500 hover:scale-105" onerror="this.src='https://placehold.co/200x200/E7ECE5/7A8E76?text=Job'">
|
|
</div>
|
|
|
|
<div class="flex-grow flex flex-col justify-between py-0.5 overflow-hidden">
|
|
<div>
|
|
<div class="flex justify-between items-center mb-0.5 pr-6">
|
|
<div class="flex items-center flex-wrap">
|
|
<span class="text-[10px] font-extrabold text-job-sage uppercase tracking-wider">${runner.categoryName}</span>
|
|
${boostBadge}
|
|
</div>
|
|
<span class="text-[10px] text-gray-500 font-medium flex items-center gap-1 bg-job-bg px-1.5 py-0.2 rounded-md">
|
|
<i class="ph-fill ph-map-pin text-job-sage"></i> ${runner.city || 'Paris'} (${runner.distanceKm || 12} km)
|
|
</span>
|
|
</div>
|
|
<h3 class="font-bold text-sm text-job-dark leading-snug line-clamp-2">${runner.title}</h3>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="flex items-center gap-2 mb-1.5">
|
|
<div class="relative">
|
|
<img loading="lazy" decoding="async" src="${runner.avatar}" class="w-5 h-5 rounded-full object-cover border border-job-gray" alt="${runner.name}">
|
|
${badgeHtml}
|
|
</div>
|
|
<span class="text-[11px] text-gray-500 font-medium truncate">${runner.name}</span>${runner.sellerType ? `<span class="text-[10px] text-gray-400 shrink-0">· ${runner.sellerType === 'particulier' ? 'Particulier' : 'Pro'}</span>` : ''}
|
|
<div class="flex items-center text-[11px] font-bold ml-auto bg-job-bg px-2 py-0.5 rounded-md text-job-dark">
|
|
<i class="ph-fill ph-star text-amber-500 mr-1 text-xs"></i> ${runner.rating}
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline justify-between">
|
|
<div class="font-bold text-job-dark text-base">
|
|
${formattedPrice} € <span class="text-[11px] text-gray-400 font-normal">${timeDisplay}</span>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-1">
|
|
<button class="text-gray-400 hover:text-job-sage p-1 transition-colors active:scale-90" title="Partager cette annonce" onclick="event.stopPropagation(); openShareModal('${runner.title.replace(/'/g, "\\'")}', '${runner.name.replace(/'/g, "\\'")}', '${runner.jobImage}', ${runner.id})">
|
|
<i class="ph-bold ph-share-network text-base"></i>
|
|
</button>
|
|
${isOwnAd ? `
|
|
<button class="text-rose-500 hover:text-rose-700 text-xs font-bold p-1" onclick="event.stopPropagation(); deleteOwnAd(${runner.id})">
|
|
<i class="ph-bold ph-trash"></i>
|
|
</button>
|
|
` : `
|
|
<button class="text-gray-400 hover:text-rose-500 p-1 active:scale-90 transition-transform" onclick="event.stopPropagation(); toggleFavorite(${runner.id})">
|
|
<i class="${isFav ? 'ph-fill ph-heart text-rose-500' : 'ph-bold ph-heart'} text-base"></i>
|
|
</button>
|
|
`}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
function renderShortsPreview() {
|
|
const section = document.getElementById('home-shorts-section');
|
|
if (typeof ENABLE_SHORTS !== 'undefined' && !ENABLE_SHORTS) {
|
|
if (section) section.classList.add('hidden');
|
|
return;
|
|
}
|
|
if (section) section.classList.remove('hidden');
|
|
|
|
const container = document.getElementById('home-shorts-container');
|
|
if (!container) return;
|
|
container.innerHTML = '';
|
|
|
|
const withShorts = runners.filter(r => r.hasShort).slice(0, 8);
|
|
|
|
withShorts.forEach((runner, idx) => {
|
|
const item = document.createElement('button');
|
|
item.type = 'button';
|
|
item.className = "cursor-pointer shrink-0 snap-start text-left appearance-none bg-transparent border-0 p-0 block focus:outline-none select-none active:opacity-85 transition-opacity";
|
|
item.style.touchAction = "manipulation";
|
|
item.onclick = (e) => {
|
|
e.preventDefault();
|
|
openShortAtIndex(idx);
|
|
};
|
|
item.innerHTML = `
|
|
<div class="relative w-[116px] h-44 rounded-[1.25rem] overflow-hidden group-hover:scale-[1.02] transition-transform shadow-card bg-job-dark pointer-events-none select-none">
|
|
<img loading="lazy" decoding="async" src="${runner.jobImage}" class="absolute inset-0 w-full h-full object-cover brightness-[0.70]" alt="${runner.title}">
|
|
<div class="absolute inset-0 bg-gradient-to-t from-black/80 via-black/10 to-transparent"></div>
|
|
<div class="absolute top-2.5 left-2.5 bg-black/50 backdrop-blur-md text-white text-[9px] font-bold px-2 py-1 rounded-lg flex items-center gap-1 border border-white/10">
|
|
<i class="ph-fill ph-play text-rose-500 text-xs"></i> Short
|
|
</div>
|
|
<div class="absolute bottom-3 left-3 right-3 text-white">
|
|
<h4 class="font-bold text-xs leading-tight line-clamp-2 drop-shadow-md mb-1">${runner.title}</h4>
|
|
<p class="text-[9px] text-gray-300 truncate">${runner.name}</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
container.appendChild(item);
|
|
});
|
|
}
|
|
|
|
function renderFullscreenShorts() {
|
|
if (typeof ENABLE_SHORTS !== 'undefined' && !ENABLE_SHORTS) return;
|
|
const container = document.getElementById('shorts-container');
|
|
if (!container) return;
|
|
container.innerHTML = '';
|
|
|
|
const shortItems = runners.filter(r => r.hasShort).slice(0, 8);
|
|
|
|
shortItems.forEach(runner => {
|
|
const reel = document.createElement('div');
|
|
reel.className = "w-full h-full min-h-full snap-start snap-always relative bg-black overflow-hidden shrink-0 select-none cursor-pointer";
|
|
|
|
// Double tap (mobile) et double clic (PC) pour liker comme sur Instagram
|
|
let lastTap = 0;
|
|
let lastTouchPos = null;
|
|
|
|
reel.addEventListener('touchstart', (e) => {
|
|
if (e.touches && e.touches[0]) {
|
|
lastTouchPos = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
|
|
}
|
|
}, { passive: true });
|
|
|
|
reel.addEventListener('touchend', (e) => {
|
|
const now = Date.now();
|
|
if (now - lastTap < 350 && now - lastTap > 60) {
|
|
const touchPoint = (e.changedTouches && e.changedTouches[0]) ? e.changedTouches[0] : (lastTouchPos || e);
|
|
handleShortDoubleClick(touchPoint, reel, runner.likes);
|
|
}
|
|
lastTap = now;
|
|
});
|
|
reel.addEventListener('dblclick', (e) => {
|
|
handleShortDoubleClick(e, reel, runner.likes);
|
|
});
|
|
|
|
let badgeHtml = '';
|
|
if (runner.passType === 'premium') {
|
|
badgeHtml = `<span class="bg-gradient-to-r from-gray-950 to-purple-950 border border-purple-400/50 text-purple-200 text-[9px] font-bold px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-sm"><i class="ph-fill ph-diamond text-fuchsia-400"></i> Premium</span>`;
|
|
} else if (runner.passType === 'pro') {
|
|
badgeHtml = `<span class="bg-rose-600 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-sm"><i class="ph-fill ph-crown"></i> Pro</span>`;
|
|
} else if (runner.passType === 'medium') {
|
|
badgeHtml = `<span class="bg-emerald-600 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-sm"><i class="ph-fill ph-rocket-launch"></i> Medium</span>`;
|
|
} else if (runner.passType === 'flash') {
|
|
badgeHtml = `<span class="bg-blue-600 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-sm"><i class="ph-fill ph-lightning"></i> Flash</span>`;
|
|
} else if (runner.isRecommended) {
|
|
badgeHtml = `<span class="bg-amber-400 text-job-dark text-[9px] font-bold px-1.5 py-0.5 rounded-md flex items-center gap-1 shadow-sm"><i class="ph-fill ph-star"></i> Recommandé</span>`;
|
|
}
|
|
|
|
reel.innerHTML = `
|
|
<video class="absolute inset-0 w-full h-full object-cover opacity-85 pointer-events-none" loop muted playsinline autoplay preload="metadata" src="${runner.shortVideo}" poster="${runner.jobImage}"></video>
|
|
|
|
<!-- Gradient positionné plus bas pour mieux voir la vidéo -->
|
|
<div class="absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent pointer-events-none"></div>
|
|
|
|
<!-- Infos relevées pour être parfaitement visibles sur mobile et ajustées sur PC -->
|
|
<div class="absolute bottom-20 md:bottom-5 left-4 right-16 z-10 text-white">
|
|
|
|
<div class="flex items-center gap-2 mb-2 bg-white/10 backdrop-blur-md w-max px-3 py-1 rounded-full border border-white/20">
|
|
<img loading="lazy" decoding="async" src="${runner.avatar}" class="w-5 h-5 rounded-full object-cover">
|
|
<span class="font-bold text-xs">${runner.name}</span>
|
|
${badgeHtml}
|
|
</div>
|
|
<h2 class="font-bold font-titre text-lg leading-tight mb-1.5 text-white drop-shadow">${runner.title}</h2>
|
|
<p class="text-[11px] text-gray-200 line-clamp-2 mb-3 leading-relaxed">${runner.desc}</p>
|
|
|
|
<div class="flex items-center gap-2">
|
|
<button onclick="openProfile(${runner.id})" class="bg-job-sage hover:bg-job-sage-dark text-white px-4 py-2 rounded-full font-bold text-[11px] flex items-center gap-1.5 shadow-floating transition-all active:scale-95">
|
|
Réserver <i class="ph-bold ph-arrow-right"></i>
|
|
</button>
|
|
<span class="text-xs font-bold text-white bg-black/50 px-2.5 py-1.5 rounded-full border border-white/20 shadow-sm">
|
|
${runner.price.toLocaleString('fr-FR')} €<span class="text-[10px] font-normal">/${runner.time}</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Boutons d'action relevés pour éviter la troncature sur mobile et PC -->
|
|
<div class="absolute bottom-20 md:bottom-5 right-3 z-10 flex flex-col gap-3.5 items-center text-white">
|
|
<button class="like-btn flex flex-col items-center gap-1 active:scale-125 transition-transform" onclick="toggleShortLike(this, ${runner.likes})">
|
|
<div class="w-11 h-11 rounded-full bg-black/50 backdrop-blur-md border border-white/20 flex items-center justify-center text-white">
|
|
<i class="ph-bold ph-heart text-xl heart-icon"></i>
|
|
</div>
|
|
<span class="text-[9px] font-bold like-counter">${runner.likes}</span>
|
|
</button>
|
|
|
|
<button class="flex flex-col items-center gap-1 active:scale-110 transition-transform" onclick="startDirectChatFromShort(${runner.id})">
|
|
<div class="w-11 h-11 rounded-full bg-black/50 backdrop-blur-md border border-white/20 flex items-center justify-center text-white">
|
|
<i class="ph-bold ph-chat-circle text-xl"></i>
|
|
</div>
|
|
<span class="text-[9px] font-bold">Contrat</span>
|
|
</button>
|
|
|
|
<button class="flex flex-col items-center gap-1 active:scale-110 transition-transform" onclick="openShareModal('${runner.title.replace(/'/g, "\\'")}', '${runner.name.replace(/'/g, "\\'")}', '${runner.jobImage}', ${runner.id})">
|
|
<div class="w-11 h-11 rounded-full bg-black/50 backdrop-blur-md border border-white/20 flex items-center justify-center text-white">
|
|
<i class="ph-bold ph-share-network text-xl"></i>
|
|
</div>
|
|
<span class="text-[9px] font-bold">Partage</span>
|
|
</button>
|
|
</div>
|
|
`;
|
|
container.appendChild(reel);
|
|
});
|
|
}
|
|
|
|
function handleShortDoubleClick(event, reelElement, initialCount) {
|
|
if (event && event.target && typeof event.target.closest === 'function') {
|
|
if (event.target.closest('button') || event.target.closest('a')) return;
|
|
}
|
|
|
|
const likeBtn = reelElement.querySelector('.like-btn');
|
|
if (likeBtn) {
|
|
const heart = likeBtn.querySelector('.heart-icon');
|
|
const counter = likeBtn.querySelector('.like-counter');
|
|
if (heart && !heart.classList.contains('ph-fill')) {
|
|
heart.className = 'ph-fill ph-heart text-xl text-rose-500 heart-icon';
|
|
if (counter) counter.textContent = initialCount + 1;
|
|
}
|
|
}
|
|
|
|
// Calcul précis de l'emplacement du clic ou tap (exactement là où l'utilisateur a cliqué)
|
|
let clientX = null;
|
|
let clientY = null;
|
|
if (event) {
|
|
if (event.clientX !== undefined) {
|
|
clientX = event.clientX;
|
|
clientY = event.clientY;
|
|
} else if (event.touches && event.touches[0]) {
|
|
clientX = event.touches[0].clientX;
|
|
clientY = event.touches[0].clientY;
|
|
} else if (event.changedTouches && event.changedTouches[0]) {
|
|
clientX = event.changedTouches[0].clientX;
|
|
clientY = event.changedTouches[0].clientY;
|
|
}
|
|
}
|
|
|
|
// Petit coeur animé avec effet de rebond dynamique façon Instagram au point cliqué
|
|
const popHeart = document.createElement('div');
|
|
popHeart.className = 'absolute z-50 select-none insta-heart-anim';
|
|
popHeart.innerHTML = '<i class="ph-fill ph-heart text-5xl text-rose-500 drop-shadow-[0_4px_22px_rgba(244,63,94,0.95)]"></i>';
|
|
|
|
if (clientX !== null && clientY !== null) {
|
|
const rect = reelElement.getBoundingClientRect();
|
|
const posX = clientX - rect.left;
|
|
const posY = clientY - rect.top;
|
|
popHeart.style.left = `${posX}px`;
|
|
popHeart.style.top = `${posY}px`;
|
|
} else {
|
|
popHeart.style.left = '50%';
|
|
popHeart.style.top = '50%';
|
|
}
|
|
|
|
reelElement.appendChild(popHeart);
|
|
setTimeout(() => {
|
|
popHeart.remove();
|
|
}, 850);
|
|
}
|
|
|
|
function navigateShorts(direction) {
|
|
const scrollContainer = document.getElementById('shorts-scroll-container');
|
|
if (!scrollContainer) return;
|
|
|
|
const reels = scrollContainer.querySelectorAll('.snap-start');
|
|
if (!reels || reels.length === 0) return;
|
|
|
|
const h = scrollContainer.clientHeight || window.innerHeight;
|
|
const currentScroll = scrollContainer.scrollTop;
|
|
const currentIndex = Math.round(currentScroll / h);
|
|
|
|
let targetIndex = currentIndex;
|
|
if (direction === 'down' || direction === 'next') {
|
|
targetIndex = Math.min(reels.length - 1, currentIndex + 1);
|
|
} else if (direction === 'up' || direction === 'prev') {
|
|
targetIndex = Math.max(0, currentIndex - 1);
|
|
}
|
|
|
|
if (targetIndex !== currentIndex && reels[targetIndex]) {
|
|
reels[targetIndex].scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
const allVideos = scrollContainer.querySelectorAll('video');
|
|
allVideos.forEach((v, idx) => {
|
|
if (idx === targetIndex) {
|
|
v.currentTime = 0;
|
|
v.play().catch(() => {});
|
|
} else {
|
|
v.pause();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
// Navigation clavier pour les Shorts (Flèches Haut / Bas sur PC)
|
|
window.addEventListener('keydown', (e) => {
|
|
const shortsView = document.getElementById('view-shorts');
|
|
if (!shortsView || !shortsView.classList.contains('active')) return;
|
|
if (document.activeElement && (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA')) return;
|
|
|
|
if (e.key === 'ArrowDown' || e.key === 'PageDown') {
|
|
e.preventDefault();
|
|
navigateShorts('down');
|
|
} else if (e.key === 'ArrowUp' || e.key === 'PageUp') {
|
|
e.preventDefault();
|
|
navigateShorts('up');
|
|
}
|
|
});
|
|
|
|
function openShortAtIndex(index) {
|
|
navigate('shorts');
|
|
setTimeout(() => {
|
|
const scrollContainer = document.getElementById('shorts-scroll-container');
|
|
if (scrollContainer) {
|
|
const reels = scrollContainer.querySelectorAll('.snap-start');
|
|
if (reels && reels[index]) {
|
|
reels[index].scrollIntoView({ behavior: 'instant', block: 'start' });
|
|
const vid = reels[index].querySelector('video');
|
|
if (vid) {
|
|
vid.currentTime = 0;
|
|
vid.play().catch(() => {});
|
|
}
|
|
} else {
|
|
const targetScroll = index * (scrollContainer.clientHeight || window.innerHeight);
|
|
scrollContainer.scrollTo({ top: targetScroll, behavior: 'instant' });
|
|
}
|
|
}
|
|
}, 60);
|
|
}
|
|
|
|
function initShortsSnapBehavior() {
|
|
const scrollContainer = document.getElementById('shorts-scroll-container');
|
|
if (!scrollContainer) return;
|
|
|
|
let isSnapping = false;
|
|
let scrollTimer = null;
|
|
|
|
scrollContainer.addEventListener('scroll', () => {
|
|
if (isSnapping) return;
|
|
clearTimeout(scrollTimer);
|
|
scrollTimer = setTimeout(() => {
|
|
const h = scrollContainer.clientHeight || window.innerHeight;
|
|
const currentScroll = scrollContainer.scrollTop;
|
|
const index = currentScroll / h;
|
|
const frac = index % 1;
|
|
|
|
let targetIndex;
|
|
if (frac > 0.40) {
|
|
targetIndex = Math.ceil(index);
|
|
} else {
|
|
targetIndex = Math.floor(index);
|
|
}
|
|
|
|
const targetScroll = targetIndex * h;
|
|
if (Math.abs(scrollContainer.scrollTop - targetScroll) > 4) {
|
|
isSnapping = true;
|
|
scrollContainer.scrollTo({ top: targetScroll, behavior: 'smooth' });
|
|
setTimeout(() => { isSnapping = false; }, 300);
|
|
}
|
|
}, 50);
|
|
}, { passive: true });
|
|
}
|
|
|
|
function displaySearchResults(results, title) {
|
|
const container = document.getElementById('search-results-container');
|
|
const titleEl = document.getElementById('search-results-title');
|
|
const countEl = document.getElementById('results-count');
|
|
|
|
titleEl.textContent = title;
|
|
countEl.textContent = results.length;
|
|
|
|
if (results.length === 0) {
|
|
container.innerHTML = `
|
|
<div class="text-center py-12 bg-white rounded-3xl p-6 border border-job-gray">
|
|
<div class="w-14 h-14 bg-job-bg rounded-2xl mx-auto flex items-center justify-center text-gray-400 mb-3">
|
|
<i class="ph-bold ph-magnifying-glass text-2xl"></i>
|
|
</div>
|
|
<h3 class="font-bold text-base text-job-dark mb-1 font-titre">Aucun résultat trouvé</h3>
|
|
<p class="text-gray-400 text-xs mb-4">Essayez d'autres termes ou parcourez les catégories.</p>
|
|
<button onclick="resetFilters()" class="text-job-sage bg-job-sage-light px-4 py-2 rounded-xl text-xs font-bold">
|
|
Toutes les annonces
|
|
</button>
|
|
</div>`;
|
|
} else {
|
|
container.innerHTML = results.map(r => createRunnerCard(r)).join('');
|
|
}
|
|
}
|
|
|
|
function filterRunnersByCategory(catId) {
|
|
const category = categoriesData.find(c => c.id === catId);
|
|
const filtered = runners.filter(r => r.categoryId === catId);
|
|
displaySearchResults(filtered, `Catégorie : ${category.name}`);
|
|
document.getElementById('search-input').value = '';
|
|
document.getElementById('clear-search-btn').classList.add('hidden');
|
|
navigate('search');
|
|
}
|
|
|
|
function openSearchFiltersModal(focusTab = null) {
|
|
const modal = document.getElementById('search-filters-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
|
|
// Synchroniser les champs du formulaire avec searchFilters
|
|
document.getElementById('filter-city-select').value = searchFilters.city;
|
|
document.getElementById('filter-radius-slider').value = searchFilters.radiusKm;
|
|
updateRadiusLabel(searchFilters.radiusKm);
|
|
document.getElementById('filter-price-min').value = searchFilters.priceMin || '';
|
|
document.getElementById('filter-price-max').value = searchFilters.priceMax || '';
|
|
selectPricingFilterUnit(searchFilters.unit, false);
|
|
document.getElementById('filter-only-recommended').checked = searchFilters.onlyRecommended;
|
|
document.getElementById('filter-only-pro-pass').checked = searchFilters.onlyProPass;
|
|
document.getElementById('filter-only-video').checked = searchFilters.onlyVideo;
|
|
}
|
|
|
|
function closeSearchFiltersModal() {
|
|
const modal = document.getElementById('search-filters-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
function updateRadiusLabel(val) {
|
|
searchFilters.radiusKm = parseInt(val, 10);
|
|
const label = document.getElementById('filter-radius-label');
|
|
if (label) label.textContent = `Max ${val} km`;
|
|
}
|
|
|
|
function handleCityFilterChange(city) {
|
|
searchFilters.city = city;
|
|
}
|
|
|
|
function clearLocationFilter() {
|
|
searchFilters.city = 'all';
|
|
document.getElementById('filter-city-select').value = 'all';
|
|
triggerCustomModal("Localisation : Toute la France", "info");
|
|
}
|
|
|
|
function selectPricingFilterUnit(unit, triggerFilter = false) {
|
|
searchFilters.unit = unit;
|
|
const btnAll = document.getElementById('btn-unit-all');
|
|
const btnH = document.getElementById('btn-unit-h');
|
|
const btnForfait = document.getElementById('btn-unit-forfait');
|
|
|
|
[btnAll, btnH, btnForfait].forEach(b => {
|
|
if (!b) return;
|
|
b.className = "py-2 text-[11px] font-bold rounded-xl border bg-job-bg text-gray-600 border-job-gray transition-all";
|
|
});
|
|
|
|
if (unit === 'h' && btnH) {
|
|
btnH.className = "py-2 text-[11px] font-bold rounded-xl border bg-job-sage text-white border-job-sage transition-all";
|
|
} else if (unit === 'forfait' && btnForfait) {
|
|
btnForfait.className = "py-2 text-[11px] font-bold rounded-xl border bg-job-sage text-white border-job-sage transition-all";
|
|
} else if (btnAll) {
|
|
btnAll.className = "py-2 text-[11px] font-bold rounded-xl border bg-job-sage text-white border-job-sage transition-all";
|
|
}
|
|
|
|
if (triggerFilter) filterRunners();
|
|
}
|
|
|
|
function togglePricingTypeFilter() {
|
|
const sequence = ['all', 'h', 'forfait'];
|
|
const currentIndex = sequence.indexOf(searchFilters.unit);
|
|
const nextUnit = sequence[(currentIndex + 1) % sequence.length];
|
|
selectPricingFilterUnit(nextUnit, true);
|
|
}
|
|
|
|
function toggleRecommendedFilter() {
|
|
searchFilters.onlyRecommended = !searchFilters.onlyRecommended;
|
|
const chip = document.getElementById('chip-rec');
|
|
if (searchFilters.onlyRecommended) {
|
|
chip.classList.add('bg-job-sage', 'text-white', 'border-job-sage');
|
|
chip.classList.remove('bg-white', 'text-gray-700', 'border-job-gray');
|
|
} else {
|
|
chip.classList.remove('bg-job-sage', 'text-white', 'border-job-sage');
|
|
chip.classList.add('bg-white', 'text-gray-700', 'border-job-gray');
|
|
}
|
|
filterRunners();
|
|
}
|
|
|
|
function applyFiltersFromModal() {
|
|
searchFilters.city = document.getElementById('filter-city-select').value;
|
|
searchFilters.radiusKm = parseInt(document.getElementById('filter-radius-slider').value, 10);
|
|
|
|
const minVal = document.getElementById('filter-price-min').value.trim();
|
|
searchFilters.priceMin = minVal ? parseFloat(minVal) : null;
|
|
|
|
const maxVal = document.getElementById('filter-price-max').value.trim();
|
|
searchFilters.priceMax = maxVal ? parseFloat(maxVal) : null;
|
|
|
|
searchFilters.onlyRecommended = document.getElementById('filter-only-recommended').checked;
|
|
searchFilters.onlyProPass = document.getElementById('filter-only-pro-pass').checked;
|
|
searchFilters.onlyVideo = document.getElementById('filter-only-video').checked;
|
|
|
|
closeSearchFiltersModal();
|
|
filterRunners();
|
|
triggerCustomModal("Filtres appliqués !", "check");
|
|
}
|
|
|
|
function applySearchSort(sortVal) {
|
|
searchFilters.sortBy = sortVal;
|
|
filterRunners();
|
|
}
|
|
|
|
function updateFilterChipsUI() {
|
|
const chipLocationLabel = document.getElementById('chip-location-label');
|
|
const chipPriceLabel = document.getElementById('chip-price-label');
|
|
const chipUnitLabel = document.getElementById('chip-unit-label');
|
|
const chipRec = document.getElementById('chip-rec');
|
|
const badge = document.getElementById('search-filters-badge');
|
|
|
|
let activeCount = 0;
|
|
|
|
if (searchFilters.city !== 'all') {
|
|
chipLocationLabel.textContent = `${searchFilters.city} (≤ ${searchFilters.radiusKm}km)`;
|
|
document.getElementById('chip-location').classList.add('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
activeCount++;
|
|
} else {
|
|
chipLocationLabel.textContent = 'Toute la France';
|
|
document.getElementById('chip-location').classList.remove('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
}
|
|
|
|
if (searchFilters.priceMax) {
|
|
chipPriceLabel.textContent = `Max ${searchFilters.priceMax} €`;
|
|
document.getElementById('chip-price').classList.add('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
activeCount++;
|
|
} else if (searchFilters.priceMin) {
|
|
chipPriceLabel.textContent = `Min ${searchFilters.priceMin} €`;
|
|
document.getElementById('chip-price').classList.add('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
activeCount++;
|
|
} else {
|
|
chipPriceLabel.textContent = 'Prix max';
|
|
document.getElementById('chip-price').classList.remove('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
}
|
|
|
|
if (searchFilters.unit !== 'all') {
|
|
chipUnitLabel.textContent = searchFilters.unit === 'h' ? 'Tarif: €/h' : 'Tarif: Forfait';
|
|
document.getElementById('chip-unit').classList.add('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
activeCount++;
|
|
} else {
|
|
chipUnitLabel.textContent = 'Tarif: Tous';
|
|
document.getElementById('chip-unit').classList.remove('border-job-sage', 'text-job-sage-dark', 'font-bold');
|
|
}
|
|
|
|
if (searchFilters.onlyRecommended) {
|
|
chipRec.classList.add('bg-job-sage', 'text-white', 'border-job-sage');
|
|
chipRec.classList.remove('bg-white', 'text-gray-700', 'border-job-gray');
|
|
activeCount++;
|
|
} else {
|
|
chipRec.classList.remove('bg-job-sage', 'text-white', 'border-job-sage');
|
|
chipRec.classList.add('bg-white', 'text-gray-700', 'border-job-gray');
|
|
}
|
|
|
|
if (searchFilters.onlyProPass) activeCount++;
|
|
if (searchFilters.onlyVideo) activeCount++;
|
|
|
|
if (activeCount > 0) {
|
|
badge.textContent = activeCount;
|
|
badge.classList.remove('hidden');
|
|
badge.classList.add('flex');
|
|
} else {
|
|
badge.classList.add('hidden');
|
|
badge.classList.remove('flex');
|
|
}
|
|
}
|
|
|
|
function filterRunners() {
|
|
const input = document.getElementById('search-input');
|
|
const clearBtn = document.getElementById('clear-search-btn');
|
|
const query = input.value.trim().toLowerCase();
|
|
searchFilters.query = query;
|
|
|
|
if (query.length > 0) {
|
|
clearBtn.classList.remove('hidden');
|
|
} else {
|
|
clearBtn.classList.add('hidden');
|
|
}
|
|
|
|
updateFilterChipsUI();
|
|
|
|
let filtered = runners.filter(r => {
|
|
// Filtre texte
|
|
if (query) {
|
|
const matchText = r.title.toLowerCase().includes(query) ||
|
|
r.categoryName.toLowerCase().includes(query) ||
|
|
r.name.toLowerCase().includes(query) ||
|
|
r.desc.toLowerCase().includes(query) ||
|
|
(r.city && r.city.toLowerCase().includes(query)) ||
|
|
(r.cluster && r.cluster.toLowerCase().includes(query)) ||
|
|
(r.department && r.department.toLowerCase().includes(query)) ||
|
|
(r.region && r.region.toLowerCase().includes(query));
|
|
if (!matchText) return false;
|
|
}
|
|
|
|
// Filtre ville & rayon géographique
|
|
if (searchFilters.city !== 'all') {
|
|
const filterCity = searchFilters.city.toLowerCase();
|
|
const isSameCity = r.city && r.city.toLowerCase() === filterCity;
|
|
const isSameCluster = r.cluster && r.cluster.toLowerCase() === filterCity;
|
|
const isSameDept = r.department && r.department.toLowerCase() === filterCity;
|
|
const isSameRegion = r.region && r.region.toLowerCase().includes(filterCity);
|
|
const isMatchLocation = isSameCity || isSameCluster || isSameDept || isSameRegion;
|
|
const isWithinRadius = (r.distanceKm || 0) <= searchFilters.radiusKm;
|
|
if (!isMatchLocation || !isWithinRadius) return false;
|
|
}
|
|
|
|
// Filtre prix min
|
|
if (searchFilters.priceMin !== null && r.price < searchFilters.priceMin) return false;
|
|
|
|
// Filtre prix max
|
|
if (searchFilters.priceMax !== null && r.price > searchFilters.priceMax) return false;
|
|
|
|
// Filtre type de tarification
|
|
if (searchFilters.unit !== 'all') {
|
|
if (searchFilters.unit === 'h' && r.time !== 'h') return false;
|
|
if (searchFilters.unit === 'forfait' && r.time !== 'forfait') return false;
|
|
}
|
|
|
|
// Filtre recommandés
|
|
if (searchFilters.onlyRecommended && !r.isRecommended) return false;
|
|
|
|
// Filtre Pass Pro & Premium
|
|
if (searchFilters.onlyProPass && !(r.passType === 'pro' || r.passType === 'premium')) return false;
|
|
|
|
// Filtre vidéo
|
|
if (searchFilters.onlyVideo && !r.hasShort) return false;
|
|
|
|
return true;
|
|
});
|
|
|
|
// Tri dynamique
|
|
const sortMode = searchFilters.sortBy;
|
|
filtered.sort((a, b) => {
|
|
if (sortMode === 'price_asc') return a.price - b.price;
|
|
if (sortMode === 'price_desc') return b.price - a.price;
|
|
if (sortMode === 'rating') return parseFloat(b.rating) - parseFloat(a.rating);
|
|
if (sortMode === 'distance') return (a.distanceKm || 0) - (b.distanceKm || 0);
|
|
|
|
// Pertinence par défaut
|
|
const passRank = { premium: 5, pro: 4, medium: 3, flash: 2, free: 1 };
|
|
const scoreA = ((passRank[a.passType] || 1) * 12) + (a.isRecommended ? 8 : 0) + (parseFloat(a.rating) * 3) + (a.reviews / 10);
|
|
const scoreB = ((passRank[b.passType] || 1) * 12) + (b.isRecommended ? 8 : 0) + (parseFloat(b.rating) * 3) + (b.reviews / 10);
|
|
return scoreB - scoreA;
|
|
});
|
|
|
|
let subtitle = "Toutes les annonces";
|
|
if (query) subtitle = `Résultats pour "${query}"`;
|
|
else if (searchFilters.city !== 'all') subtitle = `Annonces proches de ${searchFilters.city}`;
|
|
|
|
displaySearchResults(filtered, subtitle);
|
|
}
|
|
|
|
function clearSearch() {
|
|
document.getElementById('search-input').value = '';
|
|
document.getElementById('clear-search-btn').classList.add('hidden');
|
|
searchFilters.query = '';
|
|
filterRunners();
|
|
}
|
|
|
|
function resetAllFilters() {
|
|
clearSearch();
|
|
searchFilters = {
|
|
query: '',
|
|
city: 'all',
|
|
radiusKm: 50,
|
|
priceMin: null,
|
|
priceMax: null,
|
|
unit: 'all',
|
|
onlyRecommended: false,
|
|
onlyProPass: false,
|
|
onlyVideo: false,
|
|
sortBy: 'relevance'
|
|
};
|
|
const sortSelect = document.getElementById('search-sort-select');
|
|
if (sortSelect) sortSelect.value = 'relevance';
|
|
filterRunners();
|
|
triggerCustomModal("Filtres réinitialisés.", "info");
|
|
}
|
|
|
|
function resetAllFiltersFromModal() {
|
|
resetAllFilters();
|
|
closeSearchFiltersModal();
|
|
}
|
|
|
|
function resetFilters() {
|
|
resetAllFilters();
|
|
}
|
|
|
|
function initShortVideoPicker() {
|
|
const picker = document.getElementById('short-video-picker');
|
|
picker.innerHTML = '';
|
|
|
|
sampleShortVideos.forEach((vid, i) => {
|
|
const btn = document.createElement('div');
|
|
btn.className = `cursor-pointer rounded-xl overflow-hidden border-2 relative h-20 group ${i === 0 ? 'border-job-sage' : 'border-job-gray'}`;
|
|
btn.onclick = () => {
|
|
document.querySelectorAll('#short-video-picker > div').forEach(d => d.className = "cursor-pointer rounded-xl overflow-hidden border-2 border-job-gray relative h-20 group");
|
|
btn.className = "cursor-pointer rounded-xl overflow-hidden border-2 border-job-sage relative h-20 group";
|
|
selectedShortVideoUrl = vid.url;
|
|
triggerCustomModal(`Vidéo "${vid.label}" sélectionnée pour le Short`, "check");
|
|
};
|
|
btn.innerHTML = `
|
|
<img loading="lazy" decoding="async" src="${vid.poster}" class="w-full h-full object-cover">
|
|
<div class="absolute inset-0 bg-black/40 flex items-center justify-center text-white">
|
|
<i class="ph-fill ph-play-circle text-xl"></i>
|
|
</div>
|
|
<span class="absolute bottom-1 left-1 right-1 text-[8px] font-bold text-white truncate text-center">${vid.label}</span>
|
|
`;
|
|
picker.appendChild(btn);
|
|
});
|
|
}
|
|
|
|
function toggleShortUploadOption() {
|
|
const isShort = document.getElementById('add-is-short').checked;
|
|
const videoBox = document.getElementById('short-video-container');
|
|
const notice = document.getElementById('shorts-quota-notice');
|
|
|
|
const maxAllowed = getMaxShorts();
|
|
|
|
if (isShort) {
|
|
// Si l'utilisateur est sur le Pass Gratuit et a déjà 3 shorts utilisés
|
|
if ((!currentUser.passType || currentUser.passType === 'free') && currentUser.shortsUsed >= 3) {
|
|
document.getElementById('add-is-short').checked = false;
|
|
triggerCustomModal("Limite de 3 Shorts atteinte avec le Pass Gratuit. Choisissez un Boost pour débloquer plus de Shorts !", "info");
|
|
openPassStoreModal();
|
|
return;
|
|
}
|
|
|
|
if (currentUser.shortsUsed >= maxAllowed) {
|
|
document.getElementById('add-is-short').checked = false;
|
|
triggerCustomModal(`Quota atteint (${maxAllowed} shorts max). Passez au niveau supérieur pour débloquer plus de Shorts !`, "info");
|
|
openPassStoreModal();
|
|
return;
|
|
}
|
|
videoBox.classList.remove('hidden');
|
|
if (notice) notice.textContent = `Short actif pour cette annonce`;
|
|
initShortVideoPicker();
|
|
} else {
|
|
videoBox.classList.add('hidden');
|
|
if (notice) notice.textContent = `Format vertical 9:16`;
|
|
}
|
|
}
|
|
|
|
function simulatePhotoUpload() {
|
|
const samplePhotos = [
|
|
'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=500&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1504148455328-c376907d081c?w=500&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1621905251189-08b45d6a269e?w=500&auto=format&fit=crop&q=80'
|
|
];
|
|
uploadedMockPhoto = samplePhotos[Math.floor(Math.random() * samplePhotos.length)];
|
|
|
|
const preview = document.getElementById('upload-preview');
|
|
const placeholder = document.getElementById('upload-placeholder');
|
|
const badge = document.getElementById('upload-badge');
|
|
|
|
preview.src = uploadedMockPhoto;
|
|
preview.classList.remove('hidden');
|
|
placeholder.classList.add('hidden');
|
|
badge.classList.remove('hidden');
|
|
|
|
triggerCustomModal("Photo de l'annonce chargée avec succès !", "check");
|
|
}
|
|
|
|
function resetAddAdForm() {
|
|
editingAdId = null;
|
|
const form = document.getElementById('add-ad-form');
|
|
if (form) form.reset();
|
|
const sellerWarning = document.getElementById('add-seller-warning');
|
|
if (sellerWarning) sellerWarning.classList.add('hidden');
|
|
const heading = document.getElementById('add-view-heading');
|
|
const subheading = document.getElementById('add-view-subheading');
|
|
const submitLabel = document.getElementById('add-submit-label');
|
|
const submitIcon = document.getElementById('add-submit-icon');
|
|
|
|
if (heading) heading.textContent = "Déposer une annonce";
|
|
if (subheading) subheading.textContent = "Proposez vos prestations ou chantiers en toute sérénité.";
|
|
if (submitLabel) submitLabel.textContent = "Publier l'annonce maintenant";
|
|
if (submitIcon) submitIcon.className = "ph-bold ph-paper-plane-tilt text-lg";
|
|
|
|
const preview = document.getElementById('upload-preview');
|
|
const placeholder = document.getElementById('upload-placeholder');
|
|
const badge = document.getElementById('upload-badge');
|
|
const videoContainer = document.getElementById('short-video-container');
|
|
const suggestedBox = document.getElementById('add-suggested-pricing-box');
|
|
|
|
if (preview) preview.classList.add('hidden');
|
|
if (placeholder) placeholder.classList.remove('hidden');
|
|
if (badge) badge.classList.add('hidden');
|
|
if (videoContainer) videoContainer.classList.add('hidden');
|
|
if (suggestedBox) suggestedBox.classList.add('hidden');
|
|
uploadedMockPhoto = null;
|
|
}
|
|
|
|
function handleAddAd(event) {
|
|
event.preventDefault();
|
|
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour déposer une annonce.");
|
|
return;
|
|
}
|
|
|
|
const title = document.getElementById('add-title').value.trim();
|
|
const catId = document.getElementById('add-category').value;
|
|
const price = parseInt(document.getElementById('add-price').value, 10);
|
|
const time = document.getElementById('add-time').value;
|
|
const desc = document.getElementById('add-desc').value.trim();
|
|
const isShort = document.getElementById('add-is-short').checked;
|
|
const isBoosted = document.getElementById('add-is-boosted') ? document.getElementById('add-is-boosted').checked : (currentUser.passType && currentUser.passType !== 'free');
|
|
|
|
const category = categoriesData.find(c => c.id === catId) || categoriesData[0];
|
|
|
|
// Mode modification d'une annonce existante (editOwnAd)
|
|
const sellerTypeInput = document.querySelector('input[name="add-seller-type"]:checked');
|
|
const sellerType = sellerTypeInput ? sellerTypeInput.value : undefined;
|
|
|
|
if (editingAdId) {
|
|
const adToUpdate = myUserAds.find(a => a.id === editingAdId) || runners.find(r => r.id === editingAdId);
|
|
if (adToUpdate) {
|
|
adToUpdate.sellerType = sellerType;
|
|
adToUpdate.title = title;
|
|
adToUpdate.categoryId = category.id;
|
|
adToUpdate.categoryName = category.name;
|
|
adToUpdate.categoryIcon = category.icon;
|
|
adToUpdate.price = price;
|
|
adToUpdate.time = time;
|
|
adToUpdate.desc = desc;
|
|
if (uploadedMockPhoto) adToUpdate.jobImage = uploadedMockPhoto;
|
|
adToUpdate.hasShort = isShort;
|
|
if (isShort && selectedShortVideoUrl) adToUpdate.shortVideo = selectedShortVideoUrl;
|
|
}
|
|
|
|
const runnerMatch = runners.find(r => r.id === editingAdId);
|
|
if (runnerMatch && runnerMatch !== adToUpdate) {
|
|
runnerMatch.sellerType = sellerType;
|
|
runnerMatch.title = title;
|
|
runnerMatch.categoryId = category.id;
|
|
runnerMatch.categoryName = category.name;
|
|
runnerMatch.categoryIcon = category.icon;
|
|
runnerMatch.price = price;
|
|
runnerMatch.time = time;
|
|
runnerMatch.desc = desc;
|
|
if (uploadedMockPhoto) runnerMatch.jobImage = uploadedMockPhoto;
|
|
runnerMatch.hasShort = isShort;
|
|
}
|
|
|
|
triggerCustomModal("Annonce modifiée avec succès !", "check");
|
|
resetAddAdForm();
|
|
updateHomeRecs();
|
|
renderShortsPreview();
|
|
renderFullscreenShorts();
|
|
renderProfileAds();
|
|
navigate('my-ads');
|
|
return;
|
|
}
|
|
|
|
if (isShort) {
|
|
currentUser.shortsUsed++;
|
|
updateProfilePassUI();
|
|
}
|
|
|
|
const newAd = {
|
|
id: Date.now(),
|
|
name: `${currentUser.firstName} ${currentUser.lastName.charAt(0)}.`,
|
|
title: title,
|
|
categoryId: category.id,
|
|
categoryName: category.name,
|
|
categoryIcon: category.icon,
|
|
rating: currentUser.rating.toString(),
|
|
reviews: currentUser.reviews,
|
|
reviewsList: [], // Initialise vide pour ses propres annonces
|
|
price: price,
|
|
time: time,
|
|
passType: currentUser.passType,
|
|
sellerType: sellerType,
|
|
isRecommended: (currentUser.rating >= 4.8 && currentUser.reviews > 15),
|
|
city: 'Paris',
|
|
cluster: 'Paris',
|
|
department: '75',
|
|
region: 'Île-de-France',
|
|
distanceKm: 2,
|
|
location: 'Paris (2 km)',
|
|
avatar: currentUser.avatar,
|
|
jobImage: uploadedMockPhoto || 'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=500&auto=format&fit=crop&q=80',
|
|
hasShort: isShort,
|
|
shortVideo: isShort ? selectedShortVideoUrl : null,
|
|
likes: 1,
|
|
desc: desc,
|
|
isOwnAd: true
|
|
};
|
|
|
|
const passRank = { premium: 5, pro: 4, medium: 3, flash: 2, free: 1 };
|
|
const newAdRank = passRank[newAd.passType];
|
|
|
|
let insertIndex = runners.findIndex(r => passRank[r.passType] < newAdRank);
|
|
|
|
if (insertIndex === -1 && newAd.isRecommended) {
|
|
insertIndex = runners.findIndex(r => passRank[r.passType] === newAdRank && !r.isRecommended);
|
|
}
|
|
|
|
if (insertIndex !== -1) {
|
|
runners.splice(insertIndex, 0, newAd);
|
|
} else {
|
|
runners.push(newAd);
|
|
}
|
|
|
|
myUserAds.unshift(newAd);
|
|
|
|
triggerCustomModal(isBoosted ? "⚡ Annonce publiée et BOOSTÉE en 1ère position !" : "Votre annonce est publiée avec succès !", "check");
|
|
resetAddAdForm();
|
|
|
|
updateHomeRecs();
|
|
renderShortsPreview();
|
|
renderFullscreenShorts();
|
|
renderProfileAds();
|
|
navigate('my-ads');
|
|
}
|
|
|
|
function deleteOwnAd(id) {
|
|
const adToDelete = myUserAds.find(ad => ad.id === id) || runners.find(ad => ad.id === id);
|
|
const hadShort = adToDelete && adToDelete.hasShort === true;
|
|
|
|
myUserAds = myUserAds.filter(ad => ad.id !== id);
|
|
runners = runners.filter(ad => ad.id !== id);
|
|
|
|
if (hadShort) {
|
|
if (currentUser.shortsUsed > 0) {
|
|
currentUser.shortsUsed--;
|
|
}
|
|
updateProfilePassUI();
|
|
renderShortsPreview();
|
|
renderFullscreenShorts();
|
|
}
|
|
|
|
triggerCustomModal("Annonce retirée du catalogue.", "info");
|
|
renderProfileAds();
|
|
updateHomeRecs();
|
|
}
|
|
|
|
function renderProfileAds() {
|
|
const container = document.getElementById('my-ads-container');
|
|
const countLabel = document.getElementById('profile-ads-count');
|
|
countLabel.textContent = `${myUserAds.length} publication${myUserAds.length > 1 ? 's' : ''}`;
|
|
|
|
if (myUserAds.length === 0) {
|
|
container.innerHTML = `
|
|
<div class="text-center py-12 bg-white rounded-3xl p-6 border border-job-gray shadow-card">
|
|
<div class="w-14 h-14 bg-job-bg rounded-2xl mx-auto flex items-center justify-center text-job-sage mb-3">
|
|
<i class="ph-bold ph-megaphone text-2xl"></i>
|
|
</div>
|
|
<h3 class="font-bold text-base text-job-dark font-titre mb-1">Aucune annonce publiée</h3>
|
|
<p class="text-xs text-gray-400 mb-5">Proposez vos prestations ou chantiers pour recevoir des demandes de contrat.</p>
|
|
<button onclick="navigate('add')" class="bg-job-sage text-white font-bold text-xs px-5 py-3 rounded-xl shadow-floating">
|
|
Créer ma première annonce
|
|
</button>
|
|
</div>`;
|
|
} else {
|
|
container.innerHTML = myUserAds.map(ad => createRunnerCard(ad, true)).join('');
|
|
}
|
|
}
|
|
|
|
function updateHomeRecs() {
|
|
const homeRecs = document.getElementById('home-recommendations-container');
|
|
// Classement algorithmique par pertinence (Score : Pass + Recommandé + Avis + Note)
|
|
const sortedByRelevance = [...runners].sort((a, b) => {
|
|
const passRank = { premium: 5, pro: 4, medium: 3, flash: 2, free: 1 };
|
|
const scoreA = ((passRank[a.passType] || 1) * 12) + (a.isRecommended ? 8 : 0) + (parseFloat(a.rating) * 3) + (a.reviews / 10);
|
|
const scoreB = ((passRank[b.passType] || 1) * 12) + (b.isRecommended ? 8 : 0) + (parseFloat(b.rating) * 3) + (b.reviews / 10);
|
|
return scoreB - scoreA;
|
|
});
|
|
const featured = sortedByRelevance.slice(0, 6);
|
|
homeRecs.innerHTML = featured.map(r => createRunnerCard(r)).join('');
|
|
}
|
|
|
|
function navigate(viewId, isBack = false) {
|
|
const protectedViews = ['add', 'messages', 'profile', 'my-ads', 'transactions'];
|
|
if (protectedViews.includes(viewId) && !currentUser.isLoggedIn) {
|
|
const actionNames = {
|
|
add: "déposer une annonce",
|
|
messages: "accéder à votre messagerie et contrats",
|
|
profile: "consulter votre profil et gérer vos pass",
|
|
'my-ads': "consulter vos annonces",
|
|
transactions: "consulter l'historique de vos transactions"
|
|
};
|
|
openAuthModal(`Veuillez vous connecter pour ${actionNames[viewId]}.`);
|
|
return;
|
|
}
|
|
|
|
const activeView = document.querySelector('.app-view.active');
|
|
const currentViewId = activeView ? activeView.id.replace('view-', '') : null;
|
|
if (activeView && activeView.id !== `view-${viewId}`) {
|
|
previousView = currentViewId;
|
|
}
|
|
|
|
// Gestion de l'historique en pile (Stack) pour éviter toute boucle infinie de retour
|
|
if (!isBack) {
|
|
const mainTabs = ['home', 'search', 'add', 'messages', 'profile'];
|
|
if (mainTabs.includes(viewId)) {
|
|
viewHistory = [viewId];
|
|
} else {
|
|
if (viewHistory[viewHistory.length - 1] !== viewId) {
|
|
viewHistory.push(viewId);
|
|
}
|
|
}
|
|
}
|
|
|
|
document.querySelectorAll('.app-view').forEach(v => v.classList.remove('active'));
|
|
|
|
const bottomNav = document.getElementById('bottom-nav');
|
|
if (viewId === 'shorts' || viewId === 'runner' || viewId === 'public-profile') {
|
|
bottomNav.style.transform = 'translateY(110%)';
|
|
} else {
|
|
bottomNav.style.transform = 'translateY(0)';
|
|
}
|
|
|
|
const target = document.getElementById(`view-${viewId}`);
|
|
if (target) {
|
|
target.classList.add('active');
|
|
window.scrollTo({ top: 0, behavior: 'instant' });
|
|
}
|
|
|
|
if (viewId === 'transactions') {
|
|
renderTransactionsList();
|
|
}
|
|
|
|
if (viewId === 'messages') {
|
|
renderMessagesList();
|
|
renderDesktopMessenger();
|
|
}
|
|
|
|
document.querySelectorAll('.nav-btn').forEach(btn => {
|
|
const icon = btn.querySelector('.nav-icon');
|
|
if (btn.dataset.target === viewId) {
|
|
btn.classList.remove('text-gray-400', 'text-gray-500');
|
|
btn.classList.add('text-job-sage');
|
|
if (icon) {
|
|
icon.classList.remove('ph');
|
|
icon.classList.add('ph-fill', 'scale-110');
|
|
}
|
|
} else {
|
|
btn.classList.remove('text-job-sage');
|
|
btn.classList.add('text-gray-500');
|
|
if (icon) {
|
|
icon.classList.remove('ph-fill', 'scale-110');
|
|
icon.classList.add('ph');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function handlePublishClick() {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour déposer une annonce.");
|
|
} else {
|
|
if (editingAdId) resetAddAdForm();
|
|
navigate('add');
|
|
}
|
|
}
|
|
|
|
function handleMessagesClick() {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour consulter vos messages et contrats.");
|
|
} else {
|
|
navigate('messages');
|
|
}
|
|
}
|
|
|
|
function handleProfileClick() {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour voir votre profil et vos pass.");
|
|
} else {
|
|
navigate('profile');
|
|
}
|
|
}
|
|
|
|
function openProfile(id) {
|
|
const runner = runners.find(r => r.id === id);
|
|
if (!runner) return;
|
|
|
|
currentDetailRunnerId = id;
|
|
document.getElementById('detail-job-img').src = runner.jobImage;
|
|
document.getElementById('detail-avatar').src = runner.avatar;
|
|
document.getElementById('detail-name').textContent = runner.name;
|
|
document.getElementById('detail-title').textContent = runner.title;
|
|
document.getElementById('detail-rating').textContent = runner.rating;
|
|
document.getElementById('detail-reviews').textContent = `(${runner.reviews} avis)`;
|
|
document.getElementById('detail-category').textContent = runner.categoryName;
|
|
const sellerTypeEl = document.getElementById('detail-seller-type');
|
|
if (sellerTypeEl) sellerTypeEl.textContent = runner.sellerType ? (runner.sellerType === 'particulier' ? '· Particulier' : '· Professionnel') : '';
|
|
document.getElementById('detail-cat-icon').className = `ph-bold ${runner.categoryIcon}`;
|
|
|
|
const timeDisplay = runner.time === 'forfait' ? 'au forfait' : `/${runner.time}`;
|
|
const formatted = runner.price >= 1000 ? runner.price.toLocaleString('fr-FR') : runner.price;
|
|
document.getElementById('detail-price-box').innerHTML = `${formatted} € <span class="text-xs font-normal text-gray-500">${timeDisplay}</span>`;
|
|
document.getElementById('detail-desc').textContent = runner.desc;
|
|
|
|
const badgeContainer = document.getElementById('detail-badge-container');
|
|
const badgeText = document.getElementById('detail-badge-text');
|
|
|
|
if (runner.passType === 'premium') {
|
|
badgeContainer.innerHTML = `<div class="absolute -bottom-1 -right-1 w-5 h-5 bg-gradient-to-tr from-black via-purple-950 to-purple-800 border-2 border-purple-400 rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Premium"><i class="ph-fill ph-diamond text-purple-200 text-[10px]"></i></div>`;
|
|
badgeText.innerHTML = `<i class="ph-fill ph-diamond text-fuchsia-400"></i> Pass Premium`;
|
|
badgeText.className = "text-[10px] font-bold px-2.5 py-0.5 rounded-md bg-gradient-to-r from-gray-950 to-purple-950 text-purple-200 border border-purple-500/40 flex items-center gap-1";
|
|
} else if (runner.passType === 'pro') {
|
|
badgeContainer.innerHTML = `<div class="absolute -bottom-1 -right-1 w-5 h-5 bg-rose-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Pro"><i class="ph-fill ph-crown text-white text-[10px]"></i></div>`;
|
|
badgeText.innerHTML = `<i class="ph-fill ph-crown text-rose-600"></i> Pass Pro`;
|
|
badgeText.className = "text-[10px] font-bold px-2.5 py-0.5 rounded-md bg-rose-50 text-rose-700 border border-rose-200 flex items-center gap-1";
|
|
} else if (runner.passType === 'medium') {
|
|
badgeContainer.innerHTML = `<div class="absolute -bottom-1 -right-1 w-5 h-5 bg-emerald-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Medium"><i class="ph-fill ph-rocket-launch text-white text-[10px]"></i></div>`;
|
|
badgeText.innerHTML = `<i class="ph-fill ph-rocket-launch text-emerald-600"></i> Pass Medium`;
|
|
badgeText.className = "text-[10px] font-bold px-2.5 py-0.5 rounded-md bg-emerald-50 text-emerald-700 border border-emerald-200 flex items-center gap-1";
|
|
} else if (runner.passType === 'flash') {
|
|
badgeContainer.innerHTML = `<div class="absolute -bottom-1 -right-1 w-5 h-5 bg-blue-600 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10" title="Pass Flash"><i class="ph-fill ph-lightning text-white text-[10px]"></i></div>`;
|
|
badgeText.innerHTML = `<i class="ph-fill ph-lightning text-blue-600"></i> Pass Flash`;
|
|
badgeText.className = "text-[10px] font-bold px-2.5 py-0.5 rounded-md bg-blue-50 text-blue-700 border border-blue-200 flex items-center gap-1";
|
|
} else if (runner.isRecommended) {
|
|
badgeContainer.innerHTML = `<div class="absolute -bottom-1 -right-1 w-5 h-5 bg-amber-400 border-2 border-white rounded-full flex items-center justify-center shadow-sm z-10"><i class="ph-fill ph-star text-white text-[10px]"></i></div>`;
|
|
badgeText.innerHTML = `<i class="ph-fill ph-star"></i> Artisan Recommandé`;
|
|
badgeText.className = "text-[10px] font-bold px-2 py-0.5 rounded-md bg-amber-100 text-amber-800 flex items-center gap-1";
|
|
} else {
|
|
badgeContainer.innerHTML = ``;
|
|
badgeText.innerHTML = `Classique`;
|
|
badgeText.className = "text-[10px] font-bold px-2 py-0.5 rounded-md bg-gray-100 text-gray-500";
|
|
}
|
|
|
|
updateDetailFavoriteIcon();
|
|
|
|
// Gestion de sa propre annonce : masquer le swipe de réservation et afficher le badge/bouton
|
|
const isOwnAd = myUserAds.some(a => a.id === id) || (runner.isOwnAd === true);
|
|
const swipeTrack = document.getElementById('swipe-reserve-track');
|
|
const ownAdBar = document.getElementById('detail-own-ad-bar');
|
|
if (isOwnAd) {
|
|
if (swipeTrack) swipeTrack.classList.add('hidden');
|
|
if (ownAdBar) {
|
|
ownAdBar.classList.remove('hidden');
|
|
ownAdBar.classList.add('flex');
|
|
}
|
|
} else {
|
|
if (swipeTrack) swipeTrack.classList.remove('hidden');
|
|
if (ownAdBar) {
|
|
ownAdBar.classList.add('hidden');
|
|
ownAdBar.classList.remove('flex');
|
|
}
|
|
}
|
|
|
|
navigate('runner');
|
|
}
|
|
|
|
function editOwnAd(adId) {
|
|
const targetId = adId || currentDetailRunnerId || (myUserAds.length > 0 ? myUserAds[0].id : null);
|
|
const ad = myUserAds.find(a => a.id === targetId) || runners.find(r => r.id === targetId && (r.isOwnAd || myUserAds.some(m => m.id === r.id)));
|
|
|
|
if (!ad) {
|
|
triggerCustomModal("Gestion de votre annonce : vous pouvez gérer ou modifier votre annonce depuis cet onglet.", "info");
|
|
navigate('my-ads');
|
|
return;
|
|
}
|
|
|
|
editingAdId = ad.id;
|
|
|
|
document.querySelectorAll('input[name="add-seller-type"]').forEach(r => { r.checked = (r.value === ad.sellerType); });
|
|
const sellerWarning = document.getElementById('add-seller-warning');
|
|
if (sellerWarning) sellerWarning.classList.toggle('hidden', ad.sellerType !== 'particulier');
|
|
|
|
// Pré-remplir le formulaire view-add
|
|
const titleInput = document.getElementById('add-title');
|
|
const catSelect = document.getElementById('add-category');
|
|
const priceInput = document.getElementById('add-price');
|
|
const timeSelect = document.getElementById('add-time');
|
|
const descInput = document.getElementById('add-desc');
|
|
const isShortCheck = document.getElementById('add-is-short');
|
|
const heading = document.getElementById('add-view-heading');
|
|
const subheading = document.getElementById('add-view-subheading');
|
|
const submitLabel = document.getElementById('add-submit-label');
|
|
const submitIcon = document.getElementById('add-submit-icon');
|
|
|
|
if (titleInput) titleInput.value = ad.title || '';
|
|
if (catSelect) catSelect.value = ad.categoryId || 'brico';
|
|
if (priceInput) priceInput.value = ad.price || '';
|
|
if (timeSelect) timeSelect.value = ad.time || 'forfait';
|
|
if (descInput) descInput.value = ad.desc || '';
|
|
if (isShortCheck) isShortCheck.checked = Boolean(ad.hasShort);
|
|
|
|
if (heading) heading.textContent = "Modifier mon annonce";
|
|
if (subheading) subheading.textContent = "Mettez à jour les informations, tarifs ou visuels de votre annonce.";
|
|
if (submitLabel) submitLabel.textContent = "Enregistrer les modifications";
|
|
if (submitIcon) submitIcon.className = "ph-bold ph-check-circle text-lg";
|
|
|
|
// Visuel photo
|
|
if (ad.jobImage) {
|
|
uploadedMockPhoto = ad.jobImage;
|
|
const preview = document.getElementById('upload-preview');
|
|
const placeholder = document.getElementById('upload-placeholder');
|
|
const badge = document.getElementById('upload-badge');
|
|
if (preview) {
|
|
preview.src = ad.jobImage;
|
|
preview.classList.remove('hidden');
|
|
}
|
|
if (placeholder) placeholder.classList.add('hidden');
|
|
if (badge) badge.classList.remove('hidden');
|
|
}
|
|
|
|
// Calcul du prix conseillé dynamique
|
|
updateSuggestedPrice();
|
|
|
|
navigate('add');
|
|
triggerCustomModal("Mode édition : modifiez votre annonce puis validez.", "info");
|
|
}
|
|
|
|
function handleBackFromDetail() {
|
|
if (viewHistory.length > 1) {
|
|
viewHistory.pop(); // Dépile la vue active actuelle (ex: 'public-profile' ou 'runner')
|
|
const targetView = viewHistory[viewHistory.length - 1];
|
|
navigate(targetView, true);
|
|
} else {
|
|
viewHistory = ['home'];
|
|
navigate('home', true);
|
|
}
|
|
}
|
|
|
|
function handleReserveClick() {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour réserver ce service.");
|
|
return;
|
|
}
|
|
if (!currentDetailRunnerId) return;
|
|
|
|
const runner = runners.find(r => r.id === currentDetailRunnerId);
|
|
if (!runner) return;
|
|
|
|
if (myUserAds.some(a => a.id === runner.id) || runner.isOwnAd) {
|
|
triggerCustomModal("Action impossible : vous ne pouvez pas réserver votre propre annonce.", "info");
|
|
return;
|
|
}
|
|
|
|
const autoMsg = `Bonjour ${runner.name} ! Je suis vivement intéressé(e) par votre prestation "${runner.title}". Seriez-vous disponible prochainement pour en discuter et convenir d'un rendez-vous ?`;
|
|
|
|
let conv = conversations.find(c => c.runnerId === runner.id);
|
|
if (!conv) {
|
|
conv = {
|
|
id: Date.now(),
|
|
runnerId: runner.id,
|
|
name: runner.name,
|
|
avatar: runner.avatar,
|
|
lastMsg: autoMsg,
|
|
time: "À l'instant",
|
|
timestamp: Date.now(),
|
|
unread: false,
|
|
contract: {
|
|
status: 'proposed',
|
|
title: runner.title,
|
|
amount: runner.price,
|
|
runnerAccepted: true,
|
|
clientAccepted: false,
|
|
runnerDone: false,
|
|
clientDone: false
|
|
},
|
|
messages: [
|
|
{ sender: 'them', text: `Bonjour ! Je suis ${runner.name}. Bienvenue sur mon profil Jobrunner !` },
|
|
{ sender: 'me', text: autoMsg }
|
|
]
|
|
};
|
|
conversations.unshift(conv);
|
|
} else {
|
|
conv.messages.push({ sender: 'me', text: autoMsg });
|
|
conv.lastMsg = autoMsg;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
}
|
|
|
|
sortConversations();
|
|
renderMessagesList();
|
|
if (window.innerWidth >= 768) {
|
|
navigate('messages');
|
|
renderDesktopMessenger(conv.id);
|
|
} else {
|
|
openChatModal(conv.id);
|
|
}
|
|
triggerCustomModal(`Message automatique envoyé à ${runner.name} !`, "check");
|
|
|
|
setTimeout(() => {
|
|
const reply = `Bonjour ${currentUser.firstName}, merci pour votre message ! Je suis disponible cette semaine pour réaliser "${runner.title}". Les conditions sont prêtes ci-dessus.`;
|
|
conv.messages.push({ sender: 'them', text: reply });
|
|
conv.lastMsg = reply;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
sortConversations();
|
|
renderMessagesList();
|
|
if (window.innerWidth >= 768) {
|
|
renderDesktopMessenger();
|
|
}
|
|
if (activeChatConversationId === conv.id) {
|
|
appendChatMessage('them', reply);
|
|
}
|
|
}, 1400);
|
|
}
|
|
|
|
function toggleFavorite(id) {
|
|
if (favoriteIds.has(id)) {
|
|
favoriteIds.delete(id);
|
|
} else {
|
|
favoriteIds.add(id);
|
|
}
|
|
updateFavoriteCounter();
|
|
updateHomeRecs();
|
|
filterRunners();
|
|
}
|
|
|
|
function toggleDetailFavorite() {
|
|
if (currentDetailRunnerId) {
|
|
toggleFavorite(currentDetailRunnerId);
|
|
updateDetailFavoriteIcon();
|
|
}
|
|
}
|
|
|
|
function updateDetailFavoriteIcon() {
|
|
const favBtn = document.getElementById('detail-fav-btn');
|
|
const icon = favBtn.querySelector('i');
|
|
if (favoriteIds.has(currentDetailRunnerId)) {
|
|
icon.className = 'ph-fill ph-heart text-rose-500 text-xl';
|
|
} else {
|
|
icon.className = 'ph-bold ph-heart text-gray-500 text-xl';
|
|
}
|
|
}
|
|
|
|
function updateFavoriteCounter() {
|
|
const countEl = document.getElementById('profile-favorites-count');
|
|
if (countEl) {
|
|
countEl.textContent = `${favoriteIds.size} enregistré${favoriteIds.size > 1 ? 's' : ''}`;
|
|
}
|
|
}
|
|
|
|
function openFavoritesModal() {
|
|
const modal = document.getElementById('favorites-modal');
|
|
const list = document.getElementById('favorites-list-container');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
|
|
const favRunners = runners.filter(r => favoriteIds.has(r.id));
|
|
if (favRunners.length === 0) {
|
|
list.innerHTML = `
|
|
<div class="text-center py-8 text-gray-400 text-xs">
|
|
<i class="ph-bold ph-heart-break text-3xl mb-2 text-gray-300"></i>
|
|
<p>Aucun favori enregistré.</p>
|
|
</div>`;
|
|
} else {
|
|
list.innerHTML = favRunners.map(r => createRunnerCard(r)).join('');
|
|
}
|
|
}
|
|
|
|
function closeFavoritesModal() {
|
|
const modal = document.getElementById('favorites-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
function renderMessagesList() {
|
|
const container = document.getElementById('messages-list-container');
|
|
container.innerHTML = '';
|
|
|
|
if (!conversations || conversations.length === 0) {
|
|
container.innerHTML = `
|
|
<div class="text-center py-10 bg-white rounded-2xl border border-dashed border-job-gray text-gray-400 text-xs">
|
|
<i class="ph-bold ph-chat-circle-dots text-3xl mb-1 text-gray-300"></i>
|
|
<p>Aucune discussion pour le moment.</p>
|
|
</div>`;
|
|
return;
|
|
}
|
|
|
|
conversations.forEach(conv => {
|
|
const card = document.createElement('div');
|
|
// Format compact, soigné style Leboncoin / Vinted
|
|
card.className = "bg-white rounded-2xl p-2.5 px-3 shadow-xs border border-job-gray/70 flex items-center gap-3 cursor-pointer hover:bg-job-bg/70 transition-all active:scale-[0.99] relative";
|
|
card.onclick = () => openChatModal(conv.id);
|
|
|
|
let contractBadge = '';
|
|
if (conv.contract) {
|
|
if (conv.contract.status === 'completed') {
|
|
contractBadge = '<span class="text-[9px] bg-emerald-100 text-emerald-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">Payé</span>';
|
|
} else if (conv.contract.status === 'escrow_paid') {
|
|
contractBadge = '<span class="text-[9px] bg-sky-100 text-sky-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">Séquestre</span>';
|
|
} else if (conv.contract.status === 'both_accepted') {
|
|
contractBadge = '<span class="text-[9px] bg-amber-100 text-amber-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">À payer</span>';
|
|
} else {
|
|
contractBadge = '<span class="text-[9px] bg-gray-100 text-gray-700 font-bold px-1.5 py-0.2 rounded-md shrink-0">Contrat</span>';
|
|
}
|
|
}
|
|
|
|
const unreadDot = conv.unread ? `<span class="w-2 h-2 bg-rose-500 rounded-full shrink-0 shadow-xs"></span>` : '';
|
|
|
|
card.innerHTML = `
|
|
<div class="relative shrink-0">
|
|
<img loading="lazy" decoding="async" src="${conv.avatar}" class="w-11 h-11 rounded-full object-cover border border-job-gray" alt="${conv.name}">
|
|
<span class="absolute bottom-0 right-0 w-3 h-3 bg-emerald-500 border-2 border-white rounded-full"></span>
|
|
</div>
|
|
<div class="flex-grow min-w-0 pr-1">
|
|
<div class="flex justify-between items-center mb-0.5">
|
|
<h3 class="font-bold text-xs text-job-dark truncate ${conv.unread ? 'font-extrabold text-black' : 'text-gray-700'}">${conv.name}</h3>
|
|
<div class="flex items-center gap-1.5 shrink-0 ml-2">
|
|
<span class="text-[10px] text-gray-400 font-medium">${conv.time}</span>
|
|
${unreadDot}
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-1.5">
|
|
${contractBadge}
|
|
<p class="text-[11px] truncate ${conv.unread ? 'font-bold text-job-dark' : 'text-gray-500'}">${conv.lastMsg}</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
container.appendChild(card);
|
|
});
|
|
}
|
|
|
|
function renderChatContractBanner(conv) {
|
|
const banner = document.getElementById('chat-contract-banner');
|
|
if (!conv.contract) {
|
|
banner.innerHTML = `
|
|
<div class="flex items-center justify-between text-xs text-gray-500">
|
|
<span>Aucun contrat en cours.</span>
|
|
<button onclick="openProposeContractModal()" class="text-job-sage font-bold hover:underline flex items-center gap-1">
|
|
<i class="ph-bold ph-plus-circle"></i> Créer contrat
|
|
</button>
|
|
</div>`;
|
|
return;
|
|
}
|
|
|
|
const c = conv.contract;
|
|
const formatted = c.amount.toLocaleString('fr-FR');
|
|
|
|
let statusHtml = '';
|
|
|
|
if (c.status === 'proposed') {
|
|
statusHtml = `
|
|
<div class="bg-job-sage-light/60 p-3 rounded-2xl border border-job-sage/40">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div>
|
|
<span class="text-[10px] font-bold text-job-sage-dark uppercase tracking-wider block">Contrat de Service Proposé</span>
|
|
<h4 class="font-bold text-xs text-job-dark leading-tight">${c.title}</h4>
|
|
</div>
|
|
<span class="text-sm font-extrabold text-job-dark bg-white px-2 py-0.5 rounded-lg border border-job-gray shadow-sm">${formatted} €</span>
|
|
</div>
|
|
<div class="grid grid-cols-2 gap-2 text-[10px] mb-2 font-bold">
|
|
<div class="flex items-center gap-1 ${c.runnerAccepted ? 'text-job-sage' : 'text-gray-400'}">
|
|
<i class="${c.runnerAccepted ? 'ph-fill ph-check-circle' : 'ph ph-circle'} text-sm"></i> Accord Prestataire
|
|
</div>
|
|
<div class="flex items-center gap-1 ${c.clientAccepted ? 'text-job-sage' : 'text-gray-400'}">
|
|
<i class="${c.clientAccepted ? 'ph-fill ph-check-circle' : 'ph ph-circle'} text-sm"></i> Accord Client (Vous)
|
|
</div>
|
|
</div>
|
|
${!c.clientAccepted ? `
|
|
<button onclick="acceptContractAsClient(${conv.id})" class="w-full bg-job-sage text-white text-xs font-bold py-2 rounded-xl hover:bg-job-sage-dark transition-all flex items-center justify-center gap-1.5 shadow-sm">
|
|
<i class="ph-bold ph-check"></i> Accepter le service (${formatted} €)
|
|
</button>
|
|
` : `
|
|
<span class="block text-center text-[10px] text-job-sage font-bold bg-white/70 py-1.5 rounded-xl">
|
|
Service accepté ! En attente du paiement séquestre.
|
|
</span>
|
|
`}
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'both_accepted') {
|
|
statusHtml = `
|
|
<div class="bg-amber-50 p-3 rounded-2xl border border-amber-200">
|
|
<div class="flex justify-between items-center mb-2">
|
|
<span class="text-[10px] font-bold text-amber-800 uppercase tracking-wider">Service accepté par les deux parties</span>
|
|
<span class="font-extrabold text-xs text-job-dark">${formatted} €</span>
|
|
</div>
|
|
<p class="text-[11px] text-job-dark mb-2">Pour engager la prestation en toute sécurité, confirmez le paiement bloqué sur séquestre.</p>
|
|
<button onclick="payAndLockEscrow(${conv.id})" class="w-full bg-job-dark text-white text-xs font-bold py-2 rounded-xl hover:bg-black transition-all flex items-center justify-center gap-1.5 shadow-sm">
|
|
<i class="ph-bold ph-lock-key"></i> Bloquer les fonds (${formatted} €)
|
|
</button>
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'escrow_paid') {
|
|
statusHtml = `
|
|
<div class="bg-sky-50 p-3 rounded-2xl border border-sky-200">
|
|
<div class="flex justify-between items-center mb-1.5">
|
|
<span class="text-[10px] font-bold text-sky-800 uppercase tracking-wider">Fonds sécurisés sur Séquestre (${formatted} €)</span>
|
|
<span class="text-[10px] bg-sky-200 text-job-dark px-2 py-0.5 rounded-full font-bold">En cours</span>
|
|
</div>
|
|
<p class="text-[11px] text-job-dark mb-2.5">Quand la mission est finie, les DEUX parties doivent cliquer pour débloquer le virement bancaire.</p>
|
|
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<button onclick="confirmServiceDoneByRunner(${conv.id})" class="py-2 px-1 text-[10px] font-bold rounded-xl border ${c.runnerDone ? 'bg-emerald-500 text-white border-emerald-600' : 'bg-white text-gray-700 border-job-gray'}">
|
|
${c.runnerDone ? '✓ Prestataire : Fait' : 'Prestataire : Service fait'}
|
|
</button>
|
|
<button onclick="confirmServiceDoneByClient(${conv.id})" class="py-2 px-1 text-[10px] font-bold rounded-xl border ${c.clientDone ? 'bg-emerald-500 text-white border-emerald-600' : 'bg-white text-job-dark border-job-gray hover:bg-job-bg'}">
|
|
${c.clientDone ? '✓ Client : Fait' : 'Client : Valider & Libérer'}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'completed') {
|
|
statusHtml = `
|
|
<div class="bg-emerald-50 p-3 rounded-2xl border border-emerald-200 text-center">
|
|
<div class="flex items-center justify-center gap-1.5 text-emerald-800 font-bold text-xs mb-1">
|
|
<i class="ph-fill ph-check-circle text-base"></i> Prestation validée & Paiement versé !
|
|
</div>
|
|
<p class="text-[10px] text-job-sage">Le virement de ${formatted} € a été déclenché vers le compte bancaire enregistré.</p>
|
|
<p class="text-[10px] text-gray-500 mt-0.5">Ces sommes peuvent être imposables et soumises à cotisations : <a href="https://www.impots.gouv.fr" target="_blank" rel="noopener" class="underline">impots.gouv.fr</a> · <a href="https://www.urssaf.fr" target="_blank" rel="noopener" class="underline">urssaf.fr</a></p>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
banner.innerHTML = statusHtml;
|
|
}
|
|
|
|
let activeChatConversationId = null;
|
|
|
|
function openChatModal(convId) {
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (!conv) return;
|
|
|
|
conv.unread = false;
|
|
updateMessagesNotification();
|
|
|
|
activeChatConversationId = convId;
|
|
document.getElementById('chat-header-name').textContent = conv.name;
|
|
document.getElementById('chat-header-avatar').src = conv.avatar;
|
|
|
|
renderChatContractBanner(conv);
|
|
renderMessagesList();
|
|
|
|
const messagesContainer = document.getElementById('chat-messages-container');
|
|
messagesContainer.innerHTML = '';
|
|
|
|
conv.messages.forEach(msg => {
|
|
appendChatMessage(msg.sender, msg.text, false);
|
|
});
|
|
|
|
const modal = document.getElementById('chat-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
|
}
|
|
|
|
function closeChatModal() {
|
|
const modal = document.getElementById('chat-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
activeChatConversationId = null;
|
|
}
|
|
|
|
function appendChatMessage(sender, text, scroll = true) {
|
|
const container = document.getElementById('chat-messages-container');
|
|
const bubble = document.createElement('div');
|
|
|
|
if (sender === 'me') {
|
|
bubble.className = "flex justify-end";
|
|
bubble.innerHTML = `
|
|
<div class="bg-job-sage text-white rounded-2xl rounded-tr-sm px-4 py-2.5 max-w-[80%] text-xs shadow-sm font-medium">
|
|
${text}
|
|
</div>`;
|
|
} else {
|
|
bubble.className = "flex justify-start";
|
|
bubble.innerHTML = `
|
|
<div class="bg-white text-job-dark border border-job-gray rounded-2xl rounded-tl-sm px-4 py-2.5 max-w-[80%] text-xs shadow-sm font-medium">
|
|
${text}
|
|
</div>`;
|
|
}
|
|
container.appendChild(bubble);
|
|
if (scroll) {
|
|
container.scrollTop = container.scrollHeight;
|
|
}
|
|
}
|
|
|
|
function handleSendChatMessage(e) {
|
|
e.preventDefault();
|
|
const input = document.getElementById('chat-input-text');
|
|
const text = input.value.trim();
|
|
if (!text || !activeChatConversationId) return;
|
|
|
|
appendChatMessage('me', text);
|
|
input.value = '';
|
|
|
|
const conv = conversations.find(c => c.id === activeChatConversationId);
|
|
if (conv) {
|
|
conv.messages.push({ sender: 'me', text: text });
|
|
conv.lastMsg = text;
|
|
conv.time = "À l'instant";
|
|
renderMessagesList();
|
|
}
|
|
|
|
setTimeout(() => {
|
|
const replies = [
|
|
"C'est bien noté ! Je valide les détails du contrat.",
|
|
"Parfait Christophe, tout est conforme aux normes.",
|
|
"Entendu, le devis et les conditions de paiement séquestré me conviennent !"
|
|
];
|
|
const reply = replies[Math.floor(Math.random() * replies.length)];
|
|
appendChatMessage('them', reply);
|
|
if (conv) {
|
|
conv.messages.push({ sender: 'them', text: reply });
|
|
conv.lastMsg = reply;
|
|
renderMessagesList();
|
|
}
|
|
}, 1000);
|
|
}
|
|
|
|
function acceptContractAsClient(convId) {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour accepter ce contrat.");
|
|
return;
|
|
}
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (!conv || !conv.contract) return;
|
|
|
|
conv.contract.clientAccepted = true;
|
|
if (conv.contract.runnerAccepted && conv.contract.clientAccepted) {
|
|
conv.contract.status = 'both_accepted';
|
|
conv.lastMsg = "Accord mutuel conclu ! Paiement séquestre en attente.";
|
|
triggerCustomModal("Accord mutuel enregistré ! Veuillez maintenant sécuriser le paiement.", "check");
|
|
}
|
|
renderChatContractBanner(conv);
|
|
renderMessagesList();
|
|
renderDesktopMessenger();
|
|
}
|
|
|
|
function payAndLockEscrow(convId) {
|
|
// Ouvre la modale de confirmation avant de bloquer les fonds
|
|
openEscrowConfirmModal(convId);
|
|
}
|
|
|
|
function confirmServiceDoneByRunner(convId) {
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (!conv || !conv.contract) return;
|
|
|
|
conv.contract.runnerDone = true;
|
|
triggerCustomModal("Le prestataire a déclaré le service effectué.", "info");
|
|
checkEscrowRelease(conv);
|
|
}
|
|
|
|
function confirmServiceDoneByClient(convId) {
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (!conv || !conv.contract) return;
|
|
|
|
conv.contract.clientDone = true;
|
|
triggerCustomModal("Vous avez validé la conformité de la prestation !", "check");
|
|
checkEscrowRelease(conv);
|
|
}
|
|
|
|
function checkEscrowRelease(conv) {
|
|
if (conv.contract.runnerDone && conv.contract.clientDone) {
|
|
conv.contract.status = 'completed';
|
|
conv.lastMsg = `Paiement débloqué et versé au prestataire sur l'IBAN !`;
|
|
triggerCustomModal(`🎉 Les 2 parties ont validé : ${conv.contract.amount} € débloqués et versés par virement !`, "check");
|
|
}
|
|
renderChatContractBanner(conv);
|
|
renderMessagesList();
|
|
renderDesktopMessenger();
|
|
}
|
|
|
|
function startDirectChat() {
|
|
if (!currentDetailRunnerId) return;
|
|
openDirectChatWithRunner(currentDetailRunnerId);
|
|
}
|
|
|
|
function startDirectChatFromShort(runnerId) {
|
|
openDirectChatWithRunner(runnerId);
|
|
}
|
|
|
|
function openDirectChatWithRunner(runnerId) {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour contacter ce prestataire et négocier un contrat.");
|
|
return;
|
|
}
|
|
|
|
const runner = runners.find(r => r.id === runnerId);
|
|
if (!runner) return;
|
|
|
|
let conv = conversations.find(c => c.runnerId === runnerId);
|
|
if (!conv) {
|
|
conv = {
|
|
id: Date.now(),
|
|
runnerId: runner.id,
|
|
name: runner.name,
|
|
avatar: runner.avatar,
|
|
lastMsg: `Demande de prestation : ${runner.title}`,
|
|
time: "À l'instant",
|
|
timestamp: Date.now(),
|
|
unread: false,
|
|
contract: {
|
|
status: 'proposed',
|
|
title: runner.title,
|
|
amount: runner.price,
|
|
runnerAccepted: true,
|
|
clientAccepted: false,
|
|
runnerDone: false,
|
|
clientDone: false
|
|
},
|
|
messages: [
|
|
{ sender: 'them', text: `Bonjour ! Je suis ${runner.name}. Je vous ai préparé une proposition pour "${runner.title}".` }
|
|
]
|
|
};
|
|
conversations.unshift(conv);
|
|
} else {
|
|
conv.timestamp = Date.now();
|
|
}
|
|
|
|
sortConversations();
|
|
renderMessagesList();
|
|
|
|
if (window.innerWidth >= 768) {
|
|
navigate('messages');
|
|
renderDesktopMessenger(conv.id);
|
|
} else {
|
|
openChatModal(conv.id);
|
|
}
|
|
}
|
|
|
|
function openProposeContractModal() {
|
|
if (!activeChatConversationId && desktopActiveConvId) {
|
|
activeChatConversationId = desktopActiveConvId;
|
|
}
|
|
document.getElementById('contract-modal').classList.remove('hidden');
|
|
document.getElementById('contract-modal').classList.add('flex');
|
|
}
|
|
|
|
function closeProposeContractModal() {
|
|
document.getElementById('contract-modal').classList.add('hidden');
|
|
document.getElementById('contract-modal').classList.remove('flex');
|
|
}
|
|
|
|
function handleProposeContract(e) {
|
|
e.preventDefault();
|
|
const title = document.getElementById('contract-title-input').value.trim();
|
|
const amount = parseInt(document.getElementById('contract-amount-input').value, 10);
|
|
|
|
const targetId = activeChatConversationId || desktopActiveConvId;
|
|
if (!targetId) return;
|
|
const conv = conversations.find(c => c.id === targetId);
|
|
if (conv) {
|
|
conv.contract = {
|
|
status: 'proposed',
|
|
title: title,
|
|
amount: amount,
|
|
runnerAccepted: true,
|
|
clientAccepted: false,
|
|
runnerDone: false,
|
|
clientDone: false
|
|
};
|
|
conv.lastMsg = `Nouveau contrat de ${amount} € soumis.`;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
sortConversations();
|
|
renderChatContractBanner(conv);
|
|
renderMessagesList();
|
|
renderDesktopMessenger();
|
|
triggerCustomModal("Nouveau contrat soumis avec succès dans le tchat !", "check");
|
|
}
|
|
closeProposeContractModal();
|
|
}
|
|
|
|
// ====== GESTION DE LA MESSAGERIE DESKTOP 3 COLONNES ======
|
|
let desktopActiveConvId = null;
|
|
|
|
function sortConversations() {
|
|
conversations.sort((a, b) => {
|
|
const timeA = a.timestamp || a.id;
|
|
const timeB = b.timestamp || b.id;
|
|
return timeB - timeA;
|
|
});
|
|
}
|
|
|
|
function markCurrentDesktopChatRead() {
|
|
const convId = desktopActiveConvId || activeChatConversationId;
|
|
if (!convId) return;
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (conv && conv.unread) {
|
|
conv.unread = false;
|
|
updateMessagesNotification();
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
}
|
|
}
|
|
|
|
function selectDesktopConversation(convId) {
|
|
desktopActiveConvId = convId;
|
|
activeChatConversationId = convId;
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (conv && conv.unread) {
|
|
conv.unread = false;
|
|
updateMessagesNotification();
|
|
}
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
}
|
|
|
|
function renderDesktopMessenger(targetConvId = null) {
|
|
sortConversations();
|
|
|
|
const listContainer = document.getElementById('desktop-conversations-list');
|
|
const countEl = document.getElementById('desktop-conv-count');
|
|
const avatarEl = document.getElementById('desktop-chat-avatar');
|
|
const nameEl = document.getElementById('desktop-chat-name');
|
|
const messagesEl = document.getElementById('desktop-chat-messages');
|
|
const adPanelEl = document.getElementById('desktop-chat-ad-panel');
|
|
|
|
if (!listContainer) return;
|
|
|
|
if (targetConvId) {
|
|
desktopActiveConvId = targetConvId;
|
|
activeChatConversationId = targetConvId;
|
|
} else if (!desktopActiveConvId || !conversations.some(c => c.id === desktopActiveConvId)) {
|
|
desktopActiveConvId = (conversations.length > 0) ? conversations[0].id : null;
|
|
activeChatConversationId = desktopActiveConvId;
|
|
}
|
|
|
|
// Marquer la discussion active comme lue dès qu'on va dessus
|
|
if (desktopActiveConvId) {
|
|
const activeConv = conversations.find(c => c.id === desktopActiveConvId);
|
|
if (activeConv && activeConv.unread) {
|
|
activeConv.unread = false;
|
|
updateMessagesNotification();
|
|
}
|
|
}
|
|
|
|
if (countEl) {
|
|
countEl.textContent = `${conversations.length} discussion${conversations.length > 1 ? 's' : ''}`;
|
|
}
|
|
|
|
if (conversations.length === 0) {
|
|
listContainer.innerHTML = `
|
|
<div class="p-8 text-center text-gray-400 text-xs">
|
|
<i class="ph-bold ph-chat-circle-dots text-3xl mb-2 text-gray-300"></i>
|
|
<p>Aucune discussion pour le moment.</p>
|
|
</div>`;
|
|
if (nameEl) nameEl.textContent = "Aucune discussion";
|
|
if (avatarEl) avatarEl.src = "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=100&auto=format&fit=crop&q=80";
|
|
if (messagesEl) messagesEl.innerHTML = '';
|
|
if (adPanelEl) adPanelEl.innerHTML = '';
|
|
return;
|
|
}
|
|
|
|
// 1. Colonne Gauche : Liste des discussions (triée de la plus récente en haut à la plus vieille en bas)
|
|
listContainer.innerHTML = '';
|
|
conversations.forEach(conv => {
|
|
const isActive = conv.id === desktopActiveConvId;
|
|
const item = document.createElement('div');
|
|
item.className = `p-3.5 px-4 flex items-center gap-3 cursor-pointer transition-all border-b border-job-gray/50 relative ${
|
|
isActive ? 'bg-job-sage-light/60 border-l-4 border-l-job-sage' : 'hover:bg-job-bg/60'
|
|
}`;
|
|
item.onclick = () => selectDesktopConversation(conv.id);
|
|
|
|
let contractBadge = '';
|
|
if (conv.contract) {
|
|
if (conv.contract.status === 'completed') {
|
|
contractBadge = '<span class="text-[9px] bg-emerald-100 text-emerald-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">Payé</span>';
|
|
} else if (conv.contract.status === 'escrow_paid') {
|
|
contractBadge = '<span class="text-[9px] bg-sky-100 text-sky-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">Séquestre</span>';
|
|
} else if (conv.contract.status === 'both_accepted') {
|
|
contractBadge = '<span class="text-[9px] bg-amber-100 text-amber-800 font-bold px-1.5 py-0.2 rounded-md shrink-0">À payer</span>';
|
|
} else {
|
|
contractBadge = '<span class="text-[9px] bg-gray-100 text-gray-700 font-bold px-1.5 py-0.2 rounded-md shrink-0">Contrat</span>';
|
|
}
|
|
}
|
|
|
|
const unreadDot = conv.unread ? `<span class="w-2 h-2 bg-rose-500 rounded-full shrink-0 shadow-xs"></span>` : '';
|
|
|
|
item.innerHTML = `
|
|
<div class="relative shrink-0">
|
|
<img loading="lazy" decoding="async" src="${conv.avatar}" class="w-11 h-11 rounded-full object-cover border border-job-gray shadow-xs" alt="${conv.name}">
|
|
<span class="absolute bottom-0 right-0 w-3 h-3 bg-emerald-500 border-2 border-white rounded-full"></span>
|
|
</div>
|
|
<div class="flex-grow min-w-0 pr-1">
|
|
<div class="flex justify-between items-center mb-0.5">
|
|
<h3 class="font-bold text-xs truncate ${conv.unread ? 'font-extrabold text-black' : (isActive ? 'text-job-dark font-extrabold' : 'text-gray-800')}">${conv.name}</h3>
|
|
<div class="flex items-center gap-1.5 shrink-0 ml-2">
|
|
<span class="text-[10px] text-gray-400 font-medium">${conv.time}</span>
|
|
${unreadDot}
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-1.5">
|
|
${contractBadge}
|
|
<p class="text-[11px] truncate ${conv.unread ? 'font-bold text-job-dark' : 'text-gray-500'}">${conv.lastMsg}</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
listContainer.appendChild(item);
|
|
});
|
|
|
|
// 2. Colonne Centrale : Conversation active & messages
|
|
const activeConv = conversations.find(c => c.id === desktopActiveConvId) || conversations[0];
|
|
if (activeConv) {
|
|
if (avatarEl) avatarEl.src = activeConv.avatar;
|
|
if (nameEl) nameEl.textContent = activeConv.name;
|
|
|
|
// Bannière contrat
|
|
renderDesktopContractBanner(activeConv);
|
|
|
|
// Messages
|
|
if (messagesEl) {
|
|
messagesEl.innerHTML = '';
|
|
activeConv.messages.forEach(msg => {
|
|
const row = document.createElement('div');
|
|
if (msg.sender === 'me') {
|
|
row.className = "flex justify-end";
|
|
if (msg.attachment) {
|
|
row.innerHTML = renderDesktopAttachmentBubble('me', msg);
|
|
} else {
|
|
row.innerHTML = `
|
|
<div class="bg-job-sage text-white rounded-2xl rounded-tr-sm px-4 py-2.5 max-w-[78%] text-xs shadow-xs font-medium leading-relaxed break-words">
|
|
${msg.text}
|
|
</div>`;
|
|
}
|
|
} else {
|
|
row.className = "flex justify-start";
|
|
if (msg.attachment) {
|
|
row.innerHTML = renderDesktopAttachmentBubble('them', msg);
|
|
} else {
|
|
row.innerHTML = `
|
|
<div class="bg-white text-job-dark border border-job-gray rounded-2xl rounded-tl-sm px-4 py-2.5 max-w-[78%] text-xs shadow-xs font-medium leading-relaxed break-words">
|
|
${msg.text}
|
|
</div>`;
|
|
}
|
|
}
|
|
messagesEl.appendChild(row);
|
|
});
|
|
messagesEl.scrollTop = messagesEl.scrollHeight;
|
|
}
|
|
|
|
// 3. Colonne Droite : Fiche Annonce & Sécurité Séquestre
|
|
if (adPanelEl) {
|
|
const runner = runners.find(r => r.id === activeConv.runnerId);
|
|
if (runner) {
|
|
adPanelEl.innerHTML = `
|
|
<div class="flex flex-col h-full">
|
|
<div class="flex items-center justify-between pb-3 mb-3.5 border-b border-job-gray/70 shrink-0">
|
|
<span class="text-xs font-bold uppercase tracking-wider text-gray-500">Annonce liée</span>
|
|
<span class="text-[10px] font-bold bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded-full flex items-center gap-1">
|
|
<i class="ph-fill ph-check-circle"></i> Vérifiée
|
|
</span>
|
|
</div>
|
|
<div class="rounded-2xl overflow-hidden border border-job-gray shadow-xs mb-3.5 group cursor-pointer bg-white shrink-0" onclick="openProfile(${runner.id})">
|
|
<div class="relative aspect-video w-full overflow-hidden bg-job-bg">
|
|
<img loading="lazy" decoding="async" src="${runner.jobImage}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" alt="${runner.title}">
|
|
<span class="absolute top-2.5 left-2.5 bg-white/95 backdrop-blur-md text-job-dark text-[10px] font-bold px-2 py-0.5 rounded-full flex items-center gap-1 shadow-xs">
|
|
<i class="ph-fill ph-tag text-job-sage"></i> ${runner.categoryName}
|
|
</span>
|
|
</div>
|
|
<div class="p-3.5">
|
|
<h4 class="font-bold text-xs text-job-dark line-clamp-2 mb-1.5 group-hover:text-job-sage transition-colors leading-snug">${runner.title}</h4>
|
|
<div class="flex items-baseline gap-1.5 mb-1.5">
|
|
<span class="text-base font-extrabold text-job-dark font-titre">${runner.price} €</span>
|
|
<span class="text-xs text-gray-400 font-medium">${runner.time === 'forfait' ? 'au forfait' : '/ ' + runner.time}</span>
|
|
</div>
|
|
<div class="flex items-center gap-1 text-xs text-amber-500 font-bold">
|
|
<i class="ph-fill ph-star text-xs"></i>
|
|
<span class="text-job-dark">${runner.rating}</span>
|
|
<span class="text-gray-400 font-normal text-[11px]">(${runner.reviews} avis)</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Séquestre & Garantie Jobrunner -->
|
|
<div class="bg-job-sage-light/50 border border-job-sage/40 rounded-2xl p-3.5 mb-3.5 space-y-2 shrink-0">
|
|
<div class="flex items-center gap-2 text-job-sage-dark font-bold text-xs">
|
|
<i class="ph-fill ph-shield-check text-base text-job-sage"></i>
|
|
<span>Paiement conservé jusqu'à validation</span>
|
|
</div>
|
|
<p class="text-[11px] text-gray-600 leading-relaxed">
|
|
Vos fonds restent sous séquestre sécurisé. Aucun centime n'est versé tant que vous et l'artisan n'avez pas validé la fin des travaux.
|
|
</p>
|
|
<div class="flex items-center gap-1.5 text-[10px] text-job-sage-dark font-semibold pt-0.5">
|
|
<i class="ph-bold ph-lock-key text-xs"></i>
|
|
<span>Paiement sécurisé</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
} else {
|
|
adPanelEl.innerHTML = `
|
|
<div class="flex flex-col h-full">
|
|
<div class="flex items-center justify-between pb-3 mb-4 border-b border-job-gray/70">
|
|
<span class="text-xs font-bold uppercase tracking-wider text-gray-500">Mission en cours</span>
|
|
</div>
|
|
<div class="bg-white rounded-2xl p-4 border border-job-gray shadow-xs mb-4">
|
|
<h4 class="font-bold text-xs text-job-dark mb-2">Prestation personnalisée</h4>
|
|
<p class="text-xs text-gray-500 mb-3">Échanges directs avec le prestataire.</p>
|
|
</div>
|
|
<div class="bg-job-sage-light/50 border border-job-sage/40 rounded-2xl p-3.5 mb-4 space-y-2">
|
|
<div class="flex items-center gap-2 text-job-sage-dark font-bold text-xs">
|
|
<i class="ph-fill ph-shield-check text-base text-job-sage"></i>
|
|
<span>Sécurité Jobrunner</span>
|
|
</div>
|
|
<p class="text-[11px] text-gray-600 leading-relaxed">
|
|
Toutes les transactions effectuées via Jobrunner bénéficient de la protection par compte séquestre.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function renderDesktopAttachmentBubble(sender, msg) {
|
|
const att = msg.attachment;
|
|
const isMe = sender === 'me';
|
|
const bgClass = isMe ? 'bg-job-sage text-white' : 'bg-white text-job-dark border border-job-gray';
|
|
|
|
if (att.type === 'photo') {
|
|
return `
|
|
<div class="${bgClass} rounded-2xl ${isMe ? 'rounded-tr-sm' : 'rounded-tl-sm'} p-2 max-w-[78%] shadow-xs">
|
|
<img loading="lazy" decoding="async" src="${att.url}" class="rounded-xl w-full max-h-48 object-cover mb-1.5 shadow-xs" alt="Photo jointe">
|
|
<p class="text-[11px] font-semibold px-1 ${isMe ? 'text-white/90' : 'text-gray-600'}">${att.caption || 'Photo jointe'}</p>
|
|
</div>`;
|
|
} else if (att.type === 'link') {
|
|
const devisRef = att.devisRef || 'DEV-2026-88';
|
|
return `
|
|
<div class="${bgClass} rounded-2xl ${isMe ? 'rounded-tr-sm' : 'rounded-tl-sm'} p-3 max-w-[78%] shadow-xs">
|
|
<div class="flex items-center gap-2 mb-1.5 font-bold text-xs ${isMe ? 'text-white' : 'text-job-dark'}">
|
|
<i class="ph-bold ph-link text-sm"></i>
|
|
<span>${att.title}</span>
|
|
</div>
|
|
<p class="text-[11px] mb-2 ${isMe ? 'text-white/80' : 'text-gray-500'}">${att.desc}</p>
|
|
<button type="button" onclick="openDevisModal('${devisRef}')" class="inline-flex items-center gap-1.5 text-[11px] font-bold px-3 py-1.5 rounded-lg transition-all active:scale-95 ${isMe ? 'bg-white text-job-sage hover:bg-white/90' : 'bg-job-dark text-white hover:bg-black'}">
|
|
<span>Consulter le devis</span>
|
|
<i class="ph-bold ph-arrow-square-out text-xs"></i>
|
|
</button>
|
|
</div>`;
|
|
} else if (att.type === 'doc') {
|
|
return `
|
|
<div class="${bgClass} rounded-2xl ${isMe ? 'rounded-tr-sm' : 'rounded-tl-sm'} p-3 max-w-[78%] shadow-xs">
|
|
<div class="flex items-center gap-2.5">
|
|
<div class="w-8 h-8 rounded-lg ${isMe ? 'bg-white/20 text-white' : 'bg-job-sage-light text-job-sage'} flex items-center justify-center shrink-0">
|
|
<i class="ph-bold ph-file-pdf text-lg"></i>
|
|
</div>
|
|
<div class="min-w-0 flex-grow">
|
|
<h5 class="text-xs font-bold truncate ${isMe ? 'text-white' : 'text-job-dark'}">${att.name}</h5>
|
|
<span class="text-[10px] ${isMe ? 'text-white/75' : 'text-gray-400'}">${att.size}</span>
|
|
</div>
|
|
<button type="button" onclick="triggerCustomModal('Téléchargement du document sécurisé...', 'check')" class="p-1.5 rounded-lg hover:bg-white/20 transition-colors">
|
|
<i class="ph-bold ph-download-simple text-sm"></i>
|
|
</button>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
return `<div class="${bgClass} rounded-2xl px-4 py-2.5 text-xs">${msg.text}</div>`;
|
|
}
|
|
|
|
function renderDesktopContractBanner(conv) {
|
|
const banner = document.getElementById('desktop-chat-contract-banner');
|
|
if (!banner) return;
|
|
if (!conv || !conv.contract) {
|
|
banner.innerHTML = `
|
|
<div class="flex items-center justify-between text-xs text-gray-500 py-1">
|
|
<span class="flex items-center gap-1.5"><i class="ph ph-info text-gray-400"></i> Aucun contrat en cours pour le moment.</span>
|
|
<button onclick="openProposeContractModal()" class="text-job-sage font-bold hover:underline flex items-center gap-1 text-xs">
|
|
<i class="ph-bold ph-plus-circle"></i> Proposer un contrat
|
|
</button>
|
|
</div>`;
|
|
return;
|
|
}
|
|
|
|
const c = conv.contract;
|
|
const formatted = c.amount.toLocaleString('fr-FR');
|
|
|
|
let statusHtml = '';
|
|
if (c.status === 'proposed') {
|
|
statusHtml = `
|
|
<div class="bg-job-sage-light/60 p-3 rounded-2xl border border-job-sage/40">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div>
|
|
<span class="text-[10px] font-bold text-job-sage-dark uppercase tracking-wider block">Contrat de Service Proposé</span>
|
|
<h4 class="font-bold text-xs text-job-dark leading-tight">${c.title}</h4>
|
|
</div>
|
|
<span class="text-sm font-extrabold text-job-dark bg-white px-2.5 py-0.5 rounded-lg border border-job-gray shadow-xs">${formatted} €</span>
|
|
</div>
|
|
<div class="grid grid-cols-2 gap-2 text-[10px] mb-2 font-bold">
|
|
<div class="flex items-center gap-1 ${c.runnerAccepted ? 'text-job-sage' : 'text-gray-400'}">
|
|
<i class="${c.runnerAccepted ? 'ph-fill ph-check-circle' : 'ph ph-circle'} text-sm"></i> Accord Prestataire
|
|
</div>
|
|
<div class="flex items-center gap-1 ${c.clientAccepted ? 'text-job-sage' : 'text-gray-400'}">
|
|
<i class="${c.clientAccepted ? 'ph-fill ph-check-circle' : 'ph ph-circle'} text-sm"></i> Accord Client (Vous)
|
|
</div>
|
|
</div>
|
|
${!c.clientAccepted ? `
|
|
<button onclick="acceptContractAsClient(${conv.id})" class="w-full bg-job-sage text-white text-xs font-bold py-2 rounded-xl hover:bg-job-sage-dark transition-all flex items-center justify-center gap-1.5 shadow-xs">
|
|
<i class="ph-bold ph-check"></i> Accepter le service (${formatted} €)
|
|
</button>
|
|
` : `
|
|
<span class="block text-center text-[10px] text-job-sage font-bold bg-white/70 py-1.5 rounded-xl">
|
|
Service accepté ! En attente du paiement séquestre.
|
|
</span>
|
|
`}
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'both_accepted') {
|
|
statusHtml = `
|
|
<div class="bg-amber-50 p-3 rounded-2xl border border-amber-200">
|
|
<div class="flex justify-between items-center mb-1.5">
|
|
<span class="text-[10px] font-bold text-amber-800 uppercase tracking-wider">Service accepté par les deux parties</span>
|
|
<span class="font-extrabold text-xs text-job-dark">${formatted} €</span>
|
|
</div>
|
|
<p class="text-[11px] text-job-dark mb-2">Pour engager la prestation en toute sécurité, confirmez le paiement bloqué sur séquestre.</p>
|
|
<button onclick="payAndLockEscrow(${conv.id})" class="w-full bg-job-dark text-white text-xs font-bold py-2 rounded-xl hover:bg-black transition-all flex items-center justify-center gap-1.5 shadow-xs">
|
|
<i class="ph-bold ph-lock-key"></i> Bloquer les fonds (${formatted} €)
|
|
</button>
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'escrow_paid') {
|
|
statusHtml = `
|
|
<div class="bg-sky-50 p-3 rounded-2xl border border-sky-200">
|
|
<div class="flex justify-between items-center mb-1.5">
|
|
<span class="text-[10px] font-bold text-sky-800 uppercase tracking-wider">Fonds sécurisés sur Séquestre (${formatted} €)</span>
|
|
<span class="text-[10px] bg-sky-200 text-job-dark px-2 py-0.5 rounded-full font-bold">En cours</span>
|
|
</div>
|
|
<p class="text-[11px] text-job-dark mb-2">Quand la mission est finie, les DEUX parties doivent cliquer pour débloquer le virement bancaire.</p>
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<button onclick="confirmServiceDoneByRunner(${conv.id})" class="py-1.5 px-2 text-[10px] font-bold rounded-xl border ${c.runnerDone ? 'bg-emerald-500 text-white border-emerald-600' : 'bg-white text-gray-700 border-job-gray'}">
|
|
${c.runnerDone ? '✓ Prestataire : Fait' : 'Prestataire : Service fait'}
|
|
</button>
|
|
<button onclick="confirmServiceDoneByClient(${conv.id})" class="py-1.5 px-2 text-[10px] font-bold rounded-xl border ${c.clientDone ? 'bg-emerald-500 text-white border-emerald-600' : 'bg-white text-job-dark border-job-gray hover:bg-job-bg'}">
|
|
${c.clientDone ? '✓ Client : Fait' : 'Client : Valider & Libérer'}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
} else if (c.status === 'completed') {
|
|
statusHtml = `
|
|
<div class="bg-emerald-50 p-3 rounded-2xl border border-emerald-200 text-center">
|
|
<div class="flex items-center justify-center gap-1.5 text-emerald-800 font-bold text-xs mb-1">
|
|
<i class="ph-fill ph-check-circle text-base"></i> Prestation validée & Paiement versé !
|
|
</div>
|
|
<p class="text-[10px] text-job-sage">Le virement de ${formatted} € a été déclenché vers le compte bancaire enregistré.</p>
|
|
<p class="text-[10px] text-gray-500 mt-0.5">Ces sommes peuvent être imposables et soumises à cotisations : <a href="https://www.impots.gouv.fr" target="_blank" rel="noopener" class="underline">impots.gouv.fr</a> · <a href="https://www.urssaf.fr" target="_blank" rel="noopener" class="underline">urssaf.fr</a></p>
|
|
</div>
|
|
`;
|
|
}
|
|
banner.innerHTML = statusHtml;
|
|
}
|
|
|
|
function handleDesktopSendChatMessage(e) {
|
|
if (e) e.preventDefault();
|
|
const input = document.getElementById('desktop-chat-input');
|
|
if (!input) return;
|
|
const text = input.value.trim();
|
|
if (!text || !desktopActiveConvId) return;
|
|
|
|
const conv = conversations.find(c => c.id === desktopActiveConvId);
|
|
if (!conv) return;
|
|
|
|
conv.messages.push({ sender: 'me', text: text });
|
|
conv.lastMsg = text;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
input.value = '';
|
|
|
|
sortConversations();
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
|
|
setTimeout(() => {
|
|
const replies = [
|
|
"C'est bien noté ! Je valide les détails du contrat.",
|
|
"Parfait Christophe, tout est conforme aux normes.",
|
|
"Entendu, le devis et les conditions de paiement séquestré me conviennent !"
|
|
];
|
|
const reply = replies[Math.floor(Math.random() * replies.length)];
|
|
conv.messages.push({ sender: 'them', text: reply });
|
|
conv.lastMsg = reply;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
sortConversations();
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
}, 1000);
|
|
}
|
|
|
|
function toggleAttachmentMenu(e) {
|
|
if (e) e.stopPropagation();
|
|
const menu = document.getElementById('desktop-attach-menu');
|
|
if (menu) {
|
|
menu.classList.toggle('hidden');
|
|
menu.classList.toggle('flex');
|
|
}
|
|
}
|
|
|
|
function handleSendAttachment(type) {
|
|
toggleAttachmentMenu();
|
|
if (!desktopActiveConvId) return;
|
|
const conv = conversations.find(c => c.id === desktopActiveConvId);
|
|
if (!conv) return;
|
|
|
|
let attachmentContent = null;
|
|
let previewText = '';
|
|
|
|
if (type === 'photo') {
|
|
const photos = [
|
|
'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=500&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1504148455328-c376907d081c?w=500&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1621905251189-08b45d6a269e?w=500&auto=format&fit=crop&q=80'
|
|
];
|
|
attachmentContent = {
|
|
type: 'photo',
|
|
url: photos[Math.floor(Math.random() * photos.length)],
|
|
caption: 'Photo du chantier / de l\'équipement'
|
|
};
|
|
previewText = "📷 Photo jointe";
|
|
} else if (type === 'link') {
|
|
attachmentContent = {
|
|
type: 'link',
|
|
url: '#devis-preview',
|
|
devisRef: 'DEV-2026-88',
|
|
title: 'Devis détaillé & cahier des charges',
|
|
desc: 'Consulter le récapitulatif du devis'
|
|
};
|
|
previewText = "🔗 Devis #DEV-2026-88 partagé";
|
|
} else if (type === 'doc') {
|
|
attachmentContent = {
|
|
type: 'doc',
|
|
name: 'Cahier_des_charges_technique.pdf',
|
|
size: '1.4 Mo'
|
|
};
|
|
previewText = "📄 Document PDF joint";
|
|
}
|
|
|
|
conv.messages.push({
|
|
sender: 'me',
|
|
text: previewText,
|
|
attachment: attachmentContent
|
|
});
|
|
conv.lastMsg = previewText;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
sortConversations();
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
triggerCustomModal("Pièce jointe envoyée avec succès !", "check");
|
|
|
|
setTimeout(() => {
|
|
const reply = "Bien reçu pour la pièce jointe ! J'étudie cela immédiatement.";
|
|
conv.messages.push({ sender: 'them', text: reply });
|
|
conv.lastMsg = reply;
|
|
conv.time = "À l'instant";
|
|
conv.timestamp = Date.now();
|
|
sortConversations();
|
|
renderDesktopMessenger();
|
|
renderMessagesList();
|
|
}, 1200);
|
|
}
|
|
|
|
function openProfileFromActiveChat() {
|
|
const conv = conversations.find(c => c.id === desktopActiveConvId);
|
|
if (conv && conv.runnerId) {
|
|
openPublicProfile(conv.runnerId);
|
|
} else {
|
|
triggerCustomModal("Profil non disponible pour cette discussion.", "info");
|
|
}
|
|
}
|
|
|
|
function openDevisModal(ref) {
|
|
const modal = document.getElementById('devis-modal');
|
|
if (!modal) return;
|
|
const refEl = document.getElementById('devis-modal-ref');
|
|
if (refEl && ref) refEl.textContent = `Réf: ${ref}`;
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeDevisModal() {
|
|
const modal = document.getElementById('devis-modal');
|
|
if (!modal) return;
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
// ====== GESTION DYNAMIQUE DES DERNIÈRES RECHERCHES ======
|
|
let recentSearches = [
|
|
"Plomberie d'urgence",
|
|
"Peinture intérieure",
|
|
"Chauffe-eau",
|
|
"Électricité & normes",
|
|
"Ménage & repassage",
|
|
"Déménagement"
|
|
];
|
|
try {
|
|
const savedRecent = localStorage.getItem('jr_recent_searches');
|
|
if (savedRecent) {
|
|
const parsed = JSON.parse(savedRecent);
|
|
if (Array.isArray(parsed) && parsed.length > 0) recentSearches = parsed;
|
|
}
|
|
} catch(e) {}
|
|
|
|
function renderRecentSearches() {
|
|
const container = document.getElementById('home-recent-searches');
|
|
if (!container) return;
|
|
|
|
if (!recentSearches || recentSearches.length === 0) {
|
|
container.innerHTML = `<span class="text-xs text-gray-400 italic py-1">Aucune recherche récente enregistrée.</span>`;
|
|
return;
|
|
}
|
|
|
|
container.innerHTML = recentSearches.map((tag, idx) => {
|
|
const escapedTag = tag.replace(/'/g, "\\'");
|
|
return `
|
|
<div class="relative inline-flex items-center group/tag shrink-0">
|
|
<button type="button" onclick="quickSearchTag('${escapedTag}')" class="pl-3.5 pr-7 py-1.5 rounded-full text-xs font-semibold bg-white border border-job-gray text-gray-700 hover:border-job-sage hover:text-job-sage flex items-center gap-1.5 shadow-xs transition-all active:scale-95">
|
|
<i class="ph-fill ph-magnifying-glass text-gray-400 text-xs"></i>
|
|
<span>${tag}</span>
|
|
</button>
|
|
<button type="button" onclick="event.stopPropagation(); removeRecentSearch(${idx})" class="absolute right-1.5 top-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-gray-100 hover:bg-rose-100 text-gray-400 hover:text-rose-600 flex items-center justify-center transition-colors text-[10px]" title="Supprimer cette recherche">
|
|
<i class="ph-bold ph-x"></i>
|
|
</button>
|
|
</div>
|
|
`;
|
|
}).join('');
|
|
}
|
|
|
|
function addRecentSearch(query) {
|
|
if (!query || typeof query !== 'string') return;
|
|
const clean = query.trim();
|
|
if (clean.length < 2) return;
|
|
|
|
recentSearches = recentSearches.filter(s => s.toLowerCase() !== clean.toLowerCase());
|
|
recentSearches.unshift(clean);
|
|
if (recentSearches.length > 8) {
|
|
recentSearches = recentSearches.slice(0, 8);
|
|
}
|
|
try {
|
|
localStorage.setItem('jr_recent_searches', JSON.stringify(recentSearches));
|
|
} catch(e) {}
|
|
renderRecentSearches();
|
|
}
|
|
|
|
function removeRecentSearch(idx) {
|
|
if (idx >= 0 && idx < recentSearches.length) {
|
|
recentSearches.splice(idx, 1);
|
|
try {
|
|
localStorage.setItem('jr_recent_searches', JSON.stringify(recentSearches));
|
|
} catch(e) {}
|
|
renderRecentSearches();
|
|
}
|
|
}
|
|
|
|
function quickSearchTag(tag) {
|
|
const input = document.getElementById('search-input');
|
|
const topSearch = document.getElementById('desktop-top-search');
|
|
if (input) {
|
|
input.value = tag;
|
|
searchFilters.query = tag.toLowerCase();
|
|
}
|
|
if (topSearch) topSearch.value = tag;
|
|
const clearBtn = document.getElementById('clear-search-btn');
|
|
if (clearBtn) clearBtn.classList.remove('hidden');
|
|
addRecentSearch(tag);
|
|
navigate('search');
|
|
filterRunners();
|
|
}
|
|
|
|
function submitSearch() {
|
|
const input = document.getElementById('search-input');
|
|
const topSearch = document.getElementById('desktop-top-search');
|
|
const val = (input && input.value ? input.value : (topSearch ? topSearch.value : '')).trim();
|
|
if (val.length >= 2) {
|
|
addRecentSearch(val);
|
|
}
|
|
filterRunners();
|
|
}
|
|
|
|
function handleDesktopTopSearch(val) {
|
|
const input = document.getElementById('search-input');
|
|
if (input) input.value = val;
|
|
searchFilters.query = (val || '').toLowerCase();
|
|
const clearBtn = document.getElementById('clear-search-btn');
|
|
if (clearBtn) {
|
|
if (val && val.length > 0) clearBtn.classList.remove('hidden');
|
|
else clearBtn.classList.add('hidden');
|
|
}
|
|
if (val && val.length > 0) {
|
|
const activeView = document.querySelector('.app-view.active');
|
|
if (activeView && activeView.id !== 'view-search') {
|
|
navigate('search');
|
|
}
|
|
}
|
|
filterRunners();
|
|
}
|
|
|
|
document.addEventListener('click', (e) => {
|
|
const menu = document.getElementById('desktop-attach-menu');
|
|
const btn = document.getElementById('desktop-attach-btn');
|
|
if (menu && !menu.classList.contains('hidden')) {
|
|
if (!menu.contains(e.target) && btn && !btn.contains(e.target)) {
|
|
menu.classList.add('hidden');
|
|
menu.classList.remove('flex');
|
|
}
|
|
}
|
|
});
|
|
|
|
function openAuthModal(reason = '') {
|
|
const modal = document.getElementById('auth-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
|
|
// Mise à jour du profil enregistré dans la modale
|
|
const savedName = document.getElementById('auth-saved-name');
|
|
const savedEmail = document.getElementById('auth-saved-email');
|
|
const savedAvatar = document.getElementById('auth-saved-avatar');
|
|
if (savedName && currentUser.firstName) {
|
|
savedName.textContent = `${currentUser.firstName} ${currentUser.lastName}`;
|
|
if (savedEmail) savedEmail.textContent = currentUser.email || 'profil@jobrunner.app';
|
|
if (savedAvatar) savedAvatar.src = currentUser.avatar || 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=100&auto=format&fit=crop&q=80';
|
|
}
|
|
|
|
if (reason) {
|
|
triggerCustomModal(reason, "info");
|
|
}
|
|
}
|
|
|
|
function closeAuthModal() {
|
|
const modal = document.getElementById('auth-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
// Âge minimum pour créer un compte (CGU, article 2.1)
|
|
const MIN_AGE = 18;
|
|
function checkAgeRequirement() {
|
|
const dobInput = document.getElementById('kyc-dob');
|
|
if (!dobInput || !dobInput.value) return true;
|
|
const dob = new Date(dobInput.value + 'T00:00:00');
|
|
const now = new Date();
|
|
let age = now.getFullYear() - dob.getFullYear();
|
|
if (now.getMonth() < dob.getMonth() || (now.getMonth() === dob.getMonth() && now.getDate() < dob.getDate())) age--;
|
|
return age >= MIN_AGE;
|
|
}
|
|
|
|
function simulateIdUpload() {
|
|
document.getElementById('id-upload-placeholder').classList.add('hidden');
|
|
document.getElementById('id-upload-success').classList.remove('hidden');
|
|
triggerCustomModal("Pièce d'identité enregistrée avec succès.", "check");
|
|
|
|
const codeStep = document.getElementById('kyc-code-step');
|
|
if (codeStep) codeStep.classList.remove('hidden');
|
|
|
|
const otpLabel = document.getElementById('kyc-otp-label');
|
|
const otpInput = document.getElementById('kyc-code-input');
|
|
const otpLoaderIcon = document.getElementById('kyc-otp-loader-icon');
|
|
|
|
if (otpInput) {
|
|
otpInput.value = '';
|
|
otpInput.setAttribute('readonly', true);
|
|
}
|
|
if (otpLabel) otpLabel.textContent = 'Code envoyé… réception dans 2s';
|
|
|
|
setTimeout(() => {
|
|
if (otpInput) {
|
|
otpInput.value = '4829';
|
|
otpInput.removeAttribute('readonly');
|
|
otpInput.classList.add('border-job-sage', 'bg-job-sage-light/30');
|
|
}
|
|
if (otpLoaderIcon) otpLoaderIcon.style.animation = 'none';
|
|
if (otpLabel) {
|
|
otpLabel.textContent = '✓ Code reçu par SMS — vérifiez et validez';
|
|
otpLabel.className = 'text-xs font-bold text-job-sage';
|
|
}
|
|
triggerCustomModal("Code reçu et pré-rempli. Cliquez sur Créer mon compte.", "check");
|
|
}, 1800);
|
|
}
|
|
|
|
function handleKycRegister(e) {
|
|
e.preventDefault();
|
|
|
|
if (!checkAgeRequirement()) {
|
|
triggerCustomModal("Jobrunner est réservé aux personnes de 18 ans et plus.", "info");
|
|
return;
|
|
}
|
|
|
|
// Vérification du code OTP si l'étape est visible
|
|
const codeStep = document.getElementById('kyc-code-step');
|
|
if (codeStep && !codeStep.classList.contains('hidden')) {
|
|
const otpCode = document.getElementById('kyc-code-input').value.trim();
|
|
if (otpCode !== '4829') {
|
|
triggerCustomModal("Code de vérification incorrect. Vérifiez le code reçu.", "info");
|
|
const otpInput = document.getElementById('kyc-code-input');
|
|
otpInput.value = '';
|
|
otpInput.classList.add('border-rose-400');
|
|
otpInput.focus();
|
|
return;
|
|
}
|
|
}
|
|
|
|
currentUser.isLoggedIn = true;
|
|
currentUser.firstName = document.getElementById('kyc-firstname').value.trim();
|
|
currentUser.lastName = document.getElementById('kyc-lastname').value.trim();
|
|
currentUser.email = document.getElementById('kyc-email').value.trim();
|
|
currentUser.phone = document.getElementById('kyc-phone').value.trim();
|
|
currentUser.address = document.getElementById('kyc-address').value.trim();
|
|
currentUser.iban = document.getElementById('kyc-iban').value.trim();
|
|
currentUser.idVerified = true;
|
|
|
|
saveSession();
|
|
renderHeaderAuth();
|
|
updateProfilePassUI();
|
|
updateMessagesNotification();
|
|
closeAuthModal();
|
|
triggerCustomModal(`Félicitations ${currentUser.firstName} ! Votre compte est créé.`, "check");
|
|
navigate('profile');
|
|
}
|
|
|
|
// ====== SESSION PERSISTENCE (localStorage + token 24h) ======
|
|
function saveSession() {
|
|
try {
|
|
const tokenPayload = {
|
|
v: 1,
|
|
uid: 'jr_' + (currentUser.email || 'anon').replace(/[^a-z0-9]/gi, '').substring(0, 16),
|
|
iat: Date.now(),
|
|
exp: Date.now() + (24 * 60 * 60 * 1000)
|
|
};
|
|
localStorage.setItem('jobrunner_session', btoa(JSON.stringify(tokenPayload)));
|
|
localStorage.setItem('jobrunner_user', JSON.stringify({
|
|
firstName: currentUser.firstName,
|
|
lastName: currentUser.lastName,
|
|
email: currentUser.email,
|
|
phone: currentUser.phone,
|
|
address: currentUser.address,
|
|
iban: currentUser.iban,
|
|
avatar: currentUser.avatar,
|
|
passType: currentUser.passType,
|
|
rating: currentUser.rating,
|
|
reviews: currentUser.reviews,
|
|
idVerified: true,
|
|
shortsUsed: currentUser.shortsUsed,
|
|
extraShorts: currentUser.extraShorts
|
|
}));
|
|
} catch(e) { /* localStorage peut être bloqué */ }
|
|
}
|
|
|
|
function restoreSession() {
|
|
try {
|
|
const raw = localStorage.getItem('jobrunner_session');
|
|
if (!raw) return false;
|
|
const token = JSON.parse(atob(raw));
|
|
if (!token.v || Date.now() > token.exp) { clearSession(); return false; }
|
|
const savedUser = localStorage.getItem('jobrunner_user');
|
|
if (savedUser) {
|
|
const u = JSON.parse(savedUser);
|
|
Object.assign(currentUser, u, { isLoggedIn: true, idVerified: true });
|
|
}
|
|
return true;
|
|
} catch(e) {
|
|
clearSession();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function clearSession() {
|
|
try {
|
|
localStorage.removeItem('jobrunner_session');
|
|
localStorage.removeItem('jobrunner_user');
|
|
} catch(e) {}
|
|
}
|
|
|
|
// ====== ESCROW CONFIRMATION MODAL ======
|
|
let pendingEscrowConvId = null;
|
|
|
|
function openEscrowConfirmModal(convId) {
|
|
if (!currentUser.isLoggedIn) {
|
|
openAuthModal("Connectez-vous pour sécuriser le paiement.");
|
|
return;
|
|
}
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (!conv || !conv.contract) return;
|
|
pendingEscrowConvId = convId;
|
|
|
|
document.getElementById('escrow-confirm-title').textContent = conv.contract.title;
|
|
document.getElementById('escrow-confirm-amount').textContent = conv.contract.amount.toLocaleString('fr-FR') + ' €';
|
|
document.getElementById('escrow-loader').classList.add('hidden');
|
|
document.getElementById('escrow-loader').style.display = '';
|
|
document.getElementById('escrow-confirm-actions').classList.remove('hidden');
|
|
|
|
const modal = document.getElementById('escrow-confirm-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeEscrowConfirmModal() {
|
|
const modal = document.getElementById('escrow-confirm-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
pendingEscrowConvId = null;
|
|
}
|
|
|
|
function confirmEscrowPayment() {
|
|
if (!pendingEscrowConvId) return;
|
|
const convId = pendingEscrowConvId;
|
|
|
|
// Affichage loader bancaire
|
|
const loaderEl = document.getElementById('escrow-loader');
|
|
const actionsEl = document.getElementById('escrow-confirm-actions');
|
|
loaderEl.classList.remove('hidden');
|
|
loaderEl.style.display = 'flex';
|
|
actionsEl.classList.add('hidden');
|
|
|
|
// Délai bancaire simulé
|
|
setTimeout(() => {
|
|
const conv = conversations.find(c => c.id === convId);
|
|
if (conv && conv.contract) {
|
|
const txId = 'JR-' + Date.now().toString(36).toUpperCase().substring(0, 8);
|
|
conv.contract.status = 'escrow_paid';
|
|
conv.contract.txId = txId;
|
|
conv.lastMsg = `Séquestre actif — ${conv.contract.amount.toLocaleString('fr-FR')} € sécurisés`;
|
|
|
|
// Reçu automatique dans le tchat
|
|
conv.messages.push({
|
|
sender: 'them',
|
|
text: `🔒 Jobrunner Escrow — Fonds de ${conv.contract.amount.toLocaleString('fr-FR')} € consignés. Réf: ${txId}. Les deux parties doivent valider la fin de mission pour déclencher le virement bancaire.`
|
|
});
|
|
|
|
closeEscrowConfirmModal();
|
|
triggerCustomModal(`🔒 Séquestre confirmé ! Réf : ${txId}`, "check");
|
|
renderChatContractBanner(conv);
|
|
renderMessagesList();
|
|
|
|
// Rafraîchit le tchat ouvert si applicable
|
|
if (activeChatConversationId === convId) {
|
|
appendChatMessage('them', `🔒 Fonds sécurisés. Réf : ${txId}`);
|
|
}
|
|
}
|
|
}, 1800);
|
|
}
|
|
|
|
function openPassStoreModal() {
|
|
document.getElementById('pass-store-modal').classList.remove('hidden');
|
|
document.getElementById('pass-store-modal').classList.add('flex');
|
|
}
|
|
|
|
function closePassStoreModal() {
|
|
document.getElementById('pass-store-modal').classList.add('hidden');
|
|
document.getElementById('pass-store-modal').classList.remove('flex');
|
|
}
|
|
|
|
function selectPass(type) {
|
|
// Récapitulatif, acceptation des CGV et demande d'exécution immédiate avant paiement (legal-actions)
|
|
if (type !== 'free' && typeof openPassCheckout === 'function' && !selectPass.confirmed) {
|
|
closePassStoreModal();
|
|
openPassCheckout(type);
|
|
return;
|
|
}
|
|
selectPass.confirmed = false;
|
|
if (type === 'free' && currentUser.passType !== 'free' && typeof openPassResiliation === 'function') {
|
|
closePassStoreModal();
|
|
openPassResiliation();
|
|
return;
|
|
}
|
|
currentUser.passType = type;
|
|
updateProfilePassUI();
|
|
closePassStoreModal();
|
|
|
|
const names = {
|
|
free: "Pass Gratuit (3 Shorts)",
|
|
flash: "Pass Flash (4 Shorts)",
|
|
medium: "Pass Medium (5 Shorts)",
|
|
pro: "Pass Pro (6 Shorts)",
|
|
premium: "Pass Premium (8 Shorts)"
|
|
};
|
|
|
|
triggerCustomModal(`Merci pour votre achat : ${names[type]} activé !`, "check");
|
|
}
|
|
|
|
function getMaxShorts() {
|
|
const baseShorts = { free: 3, flash: 4, medium: 5, pro: 6, premium: 8 };
|
|
let total = baseShorts[currentUser.passType] + currentUser.extraShorts;
|
|
return total > 8 ? 8 : total;
|
|
}
|
|
|
|
function buyExtraShort() {
|
|
if (getMaxShorts() >= 8) {
|
|
triggerCustomModal("Limite absolue atteinte : 8 shorts maximum.", "info");
|
|
return;
|
|
}
|
|
if (typeof openPassCheckout === 'function' && !buyExtraShort.confirmed) {
|
|
openPassCheckout('short');
|
|
return;
|
|
}
|
|
buyExtraShort.confirmed = false;
|
|
currentUser.extraShorts++;
|
|
updateProfilePassUI();
|
|
triggerCustomModal("Merci pour votre achat : +1 Short vidéo ajouté !", "check");
|
|
}
|
|
|
|
function updateProfilePassUI() {
|
|
const passPill = document.getElementById('profile-pass-pill');
|
|
const passCardTitle = document.getElementById('pass-card-title');
|
|
const passCardDesc = document.getElementById('pass-card-desc');
|
|
const shortsIndicator = document.getElementById('pass-shorts-indicator');
|
|
const publishBadge = document.getElementById('user-active-pass-badge');
|
|
|
|
document.getElementById('profile-avatar').src = currentUser.avatar;
|
|
const avatarBadge = document.getElementById('profile-avatar-badge');
|
|
|
|
const max = getMaxShorts();
|
|
if (shortsIndicator) shortsIndicator.textContent = `${currentUser.shortsUsed}/${max} Shorts`;
|
|
|
|
if (currentUser.passType === 'premium') {
|
|
passPill.innerHTML = `<i class="ph-fill ph-diamond text-fuchsia-400"></i> Pass Premium`;
|
|
passPill.className = "flex items-center gap-1 bg-gradient-to-r from-gray-950 via-purple-950 to-indigo-950 text-purple-200 border border-purple-400/50 text-xs font-bold px-3 py-1 rounded-full shadow-sm";
|
|
passCardTitle.innerHTML = `Pass Premium <i class="ph-fill ph-diamond text-purple-400"></i>`;
|
|
passCardDesc.textContent = "Position prioritaire, badge diamant noir / violet sur votre profil et visibilité maximale.";
|
|
if (publishBadge) publishBadge.textContent = "Pass Premium (Noir / Violet)";
|
|
if (avatarBadge) {
|
|
avatarBadge.className = "absolute bottom-0 right-0 w-6 h-6 bg-gradient-to-tr from-black via-purple-950 to-purple-800 border-2 border-purple-400 text-purple-200 rounded-full flex items-center justify-center text-xs shadow-sm";
|
|
avatarBadge.innerHTML = `<i class="ph-fill ph-diamond"></i>`;
|
|
avatarBadge.title = "Pass Premium";
|
|
}
|
|
} else if (currentUser.passType === 'pro') {
|
|
passPill.innerHTML = `<i class="ph-fill ph-crown"></i> Pass Pro`;
|
|
passPill.className = "flex items-center gap-1 bg-rose-600 text-white text-xs font-bold px-3 py-1 rounded-full shadow-sm";
|
|
passCardTitle.innerHTML = `Pass Pro Actif <i class="ph-fill ph-crown text-rose-500"></i>`;
|
|
passCardDesc.textContent = "Fort boost algorithmique de toutes vos annonces (Badge Rouge).";
|
|
if (publishBadge) publishBadge.textContent = "Pass Pro (Rouge)";
|
|
if (avatarBadge) {
|
|
avatarBadge.className = "absolute bottom-0 right-0 w-6 h-6 bg-rose-600 text-white rounded-full flex items-center justify-center border-2 border-white text-xs shadow-sm";
|
|
avatarBadge.innerHTML = `<i class="ph-fill ph-crown"></i>`;
|
|
avatarBadge.title = "Pass Pro";
|
|
}
|
|
} else if (currentUser.passType === 'medium') {
|
|
passPill.innerHTML = `<i class="ph-fill ph-rocket-launch"></i> Pass Medium`;
|
|
passPill.className = "flex items-center gap-1 bg-emerald-600 text-white text-xs font-bold px-3 py-1 rounded-full shadow-sm";
|
|
passCardTitle.innerHTML = `Pass Medium Actif <i class="ph-fill ph-rocket-launch text-emerald-500"></i>`;
|
|
passCardDesc.textContent = "Remontée moyenne dans la recherche assurée (Badge Vert).";
|
|
if (publishBadge) publishBadge.textContent = "Pass Medium (Vert)";
|
|
if (avatarBadge) {
|
|
avatarBadge.className = "absolute bottom-0 right-0 w-6 h-6 bg-emerald-600 text-white rounded-full flex items-center justify-center border-2 border-white text-xs shadow-sm";
|
|
avatarBadge.innerHTML = `<i class="ph-fill ph-rocket-launch"></i>`;
|
|
avatarBadge.title = "Pass Medium";
|
|
}
|
|
} else if (currentUser.passType === 'flash') {
|
|
passPill.innerHTML = `<i class="ph-fill ph-lightning"></i> Pass Flash`;
|
|
passPill.className = "flex items-center gap-1 bg-blue-600 text-white text-xs font-bold px-3 py-1 rounded-full shadow-sm";
|
|
passCardTitle.innerHTML = `Pass Flash Actif <i class="ph-fill ph-lightning text-blue-500"></i>`;
|
|
passCardDesc.textContent = "Léger boost par rapport aux annonces gratuites (Badge Bleu).";
|
|
if (publishBadge) publishBadge.textContent = "Pass Flash (Bleu)";
|
|
if (avatarBadge) {
|
|
avatarBadge.className = "absolute bottom-0 right-0 w-6 h-6 bg-blue-600 text-white rounded-full flex items-center justify-center border-2 border-white text-xs shadow-sm";
|
|
avatarBadge.innerHTML = `<i class="ph-fill ph-lightning"></i>`;
|
|
avatarBadge.title = "Pass Flash";
|
|
}
|
|
} else {
|
|
passPill.textContent = "Pass Gratuit";
|
|
passPill.className = "bg-job-bg text-job-dark text-xs font-bold px-3 py-1 rounded-full border border-job-gray";
|
|
passCardTitle.textContent = "Pass Runner Gratuit";
|
|
passCardDesc.textContent = "Classement standard. Sécurisez vos paiements sereinement.";
|
|
if (publishBadge) publishBadge.textContent = "Pass Gratuit";
|
|
if (avatarBadge) {
|
|
avatarBadge.className = "absolute bottom-0 right-0 w-6 h-6 bg-emerald-500 text-white rounded-full flex items-center justify-center border-2 border-white text-xs";
|
|
avatarBadge.innerHTML = `<i class="ph-fill ph-seal-check"></i>`;
|
|
avatarBadge.title = "Compte vérifié";
|
|
}
|
|
}
|
|
|
|
document.getElementById('profile-display-name').textContent = `${currentUser.firstName} ${currentUser.lastName}`;
|
|
const emailPrev = document.getElementById('profile-email-preview');
|
|
if (emailPrev) emailPrev.textContent = currentUser.email || 'Non renseigné';
|
|
}
|
|
|
|
let temporaryEditAvatar = null;
|
|
function simulateProfileAvatarUpload() {
|
|
const avatars = [
|
|
'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=200&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200&auto=format&fit=crop&q=80',
|
|
'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=200&auto=format&fit=crop&q=80'
|
|
];
|
|
temporaryEditAvatar = avatars[Math.floor(Math.random() * avatars.length)];
|
|
document.getElementById('edit-avatar-preview').src = temporaryEditAvatar;
|
|
triggerCustomModal("Nouvelle photo chargée !", "check");
|
|
}
|
|
|
|
function openPersonalInfoModal() {
|
|
openEditProfileModal();
|
|
}
|
|
|
|
function closePersonalInfoModal() {
|
|
closeEditProfileModal();
|
|
}
|
|
|
|
function openEditProfileModal() {
|
|
document.getElementById('edit-avatar-preview').src = currentUser.avatar;
|
|
document.getElementById('edit-firstname').value = currentUser.firstName;
|
|
document.getElementById('edit-lastname').value = currentUser.lastName;
|
|
document.getElementById('edit-email').value = currentUser.email;
|
|
document.getElementById('edit-phone').value = currentUser.phone;
|
|
const pwdEl = document.getElementById('edit-password');
|
|
if (pwdEl) pwdEl.value = currentUser.password || 'SecretJob2026!';
|
|
document.getElementById('edit-address').value = currentUser.address;
|
|
document.getElementById('edit-iban').value = currentUser.iban;
|
|
|
|
const modal = document.getElementById('edit-profile-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeEditProfileModal() {
|
|
const modal = document.getElementById('edit-profile-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
temporaryEditAvatar = null;
|
|
}
|
|
|
|
function openChangePasswordModal() {
|
|
const modal = document.getElementById('change-password-modal');
|
|
if (!modal) return;
|
|
const cur = document.getElementById('pw-current');
|
|
const nw = document.getElementById('pw-new');
|
|
const conf = document.getElementById('pw-confirm');
|
|
if (cur) cur.value = '';
|
|
if (nw) nw.value = '';
|
|
if (conf) conf.value = '';
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeChangePasswordModal() {
|
|
const modal = document.getElementById('change-password-modal');
|
|
if (!modal) return;
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
function handleConfirmChangePassword(e) {
|
|
e.preventDefault();
|
|
const curVal = document.getElementById('pw-current') ? document.getElementById('pw-current').value : '';
|
|
const newVal = document.getElementById('pw-new') ? document.getElementById('pw-new').value : '';
|
|
const confVal = document.getElementById('pw-confirm') ? document.getElementById('pw-confirm').value : '';
|
|
|
|
const currentActual = currentUser.password || 'SecretJob2026!';
|
|
if (curVal !== currentActual) {
|
|
triggerCustomModal("Le mot de passe actuel saisi est incorrect.", "warning");
|
|
return;
|
|
}
|
|
if (newVal.length < 8) {
|
|
triggerCustomModal("Le nouveau mot de passe doit contenir au moins 8 caractères.", "warning");
|
|
return;
|
|
}
|
|
if (newVal !== confVal) {
|
|
triggerCustomModal("Les deux nouveaux mots de passe ne correspondent pas.", "warning");
|
|
return;
|
|
}
|
|
|
|
currentUser.password = newVal;
|
|
closeChangePasswordModal();
|
|
triggerCustomModal("Mot de passe mis à jour avec succès !", "check");
|
|
}
|
|
|
|
function togglePasswordVisibility(inputId, iconId) {
|
|
const input = document.getElementById(inputId);
|
|
const icon = document.getElementById(iconId);
|
|
if (!input || !icon) return;
|
|
if (input.type === 'password') {
|
|
input.type = 'text';
|
|
icon.className = 'ph-bold ph-eye-slash text-base text-job-sage';
|
|
} else {
|
|
input.type = 'password';
|
|
icon.className = 'ph-bold ph-eye text-base text-gray-400';
|
|
}
|
|
}
|
|
|
|
function openDeleteAccountModal() {
|
|
const modal = document.getElementById('delete-account-modal');
|
|
const pwdInput = document.getElementById('delete-confirm-password');
|
|
const errorMsg = document.getElementById('delete-error-msg');
|
|
if (pwdInput) pwdInput.value = '';
|
|
if (errorMsg) errorMsg.classList.add('hidden');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeDeleteAccountModal() {
|
|
const modal = document.getElementById('delete-account-modal');
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
function handleConfirmDeleteAccount(e) {
|
|
e.preventDefault();
|
|
const pwdInput = document.getElementById('delete-confirm-password');
|
|
const pwd = pwdInput ? pwdInput.value.trim() : '';
|
|
const errorMsg = document.getElementById('delete-error-msg');
|
|
|
|
if (!pwd) {
|
|
if (errorMsg) {
|
|
errorMsg.textContent = "Veuillez renseigner votre mot de passe actuel.";
|
|
errorMsg.classList.remove('hidden');
|
|
}
|
|
return;
|
|
}
|
|
|
|
// Suppression définitive et irréversible de toutes les données du compte
|
|
currentUser.isLoggedIn = false;
|
|
currentUser.firstName = "Visiteur";
|
|
currentUser.lastName = "";
|
|
currentUser.email = "";
|
|
currentUser.phone = "";
|
|
currentUser.address = "";
|
|
currentUser.iban = "";
|
|
currentUser.password = "";
|
|
|
|
// Purge des annonces créées par l'utilisateur
|
|
myUserAds = [];
|
|
runners = runners.filter(r => !r.isOwnAd);
|
|
|
|
// Nettoyage des conversations et favoris
|
|
conversations = [];
|
|
favoriteIds.clear();
|
|
|
|
// Nettoyage du token de session
|
|
localStorage.removeItem('jobrunner_user_session');
|
|
|
|
closeDeleteAccountModal();
|
|
closeEditProfileModal();
|
|
|
|
// Actualisation des vues
|
|
renderHeaderAuth();
|
|
updateHomeRecs();
|
|
filterRunners();
|
|
renderMessagesList();
|
|
updateMessagesNotification();
|
|
updateFavoriteCounter();
|
|
|
|
navigate('home');
|
|
triggerCustomModal("Votre compte et l'intégralité de vos données ont été définitivement supprimés.", "info");
|
|
}
|
|
|
|
function openEditProfileModal() {
|
|
document.getElementById('edit-avatar-preview').src = currentUser.avatar;
|
|
document.getElementById('edit-firstname').value = currentUser.firstName;
|
|
document.getElementById('edit-lastname').value = currentUser.lastName;
|
|
document.getElementById('edit-address').value = currentUser.address || 'Paris';
|
|
const bioEl = document.getElementById('edit-bio');
|
|
if (bioEl) bioEl.value = currentUser.bio || 'Prestataire passionné et réactif sur Jobrunner.';
|
|
|
|
const modal = document.getElementById('edit-profile-modal');
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function handleSaveProfile(e) {
|
|
e.preventDefault();
|
|
if (temporaryEditAvatar) currentUser.avatar = temporaryEditAvatar;
|
|
currentUser.firstName = document.getElementById('edit-firstname').value.trim();
|
|
currentUser.lastName = document.getElementById('edit-lastname').value.trim();
|
|
currentUser.address = document.getElementById('edit-address').value.trim();
|
|
const bioEl = document.getElementById('edit-bio');
|
|
if (bioEl) currentUser.bio = bioEl.value.trim();
|
|
|
|
updateProfilePassUI();
|
|
renderHeaderAuth();
|
|
closeEditProfileModal();
|
|
triggerCustomModal("Profil public mis à jour avec succès !", "check");
|
|
}
|
|
|
|
// ================= TARIF CONSEILLÉ DYNAMIQUE =================
|
|
const SUGGESTED_PRICING = {
|
|
brico: { h: { min: 25, max: 45 }, forfait: { min: 80, max: 350 } },
|
|
plomb: { h: { min: 45, max: 80 }, forfait: { min: 120, max: 450 } },
|
|
elec: { h: { min: 40, max: 75 }, forfait: { min: 100, max: 500 } },
|
|
info: { h: { min: 35, max: 70 }, forfait: { min: 60, max: 300 } },
|
|
jardin: { h: { min: 20, max: 35 }, forfait: { min: 70, max: 280 } },
|
|
menage: { h: { min: 15, max: 25 }, forfait: { min: 50, max: 180 } },
|
|
trans: { h: { min: 30, max: 55 }, forfait: { min: 90, max: 400 } },
|
|
photo: { h: { min: 50, max: 100 }, forfait: { min: 150, max: 600 } },
|
|
sport: { h: { min: 30, max: 60 }, forfait: { min: 120, max: 350 } },
|
|
cours: { h: { min: 20, max: 45 }, forfait: { min: 80, max: 250 } }
|
|
};
|
|
|
|
function updateSuggestedPrice() {
|
|
const titleInput = document.getElementById('add-title');
|
|
const catSelect = document.getElementById('add-category');
|
|
const timeSelect = document.getElementById('add-time');
|
|
const box = document.getElementById('add-suggested-pricing-box');
|
|
const textEl = document.getElementById('add-suggested-pricing-text');
|
|
if (!box || !textEl) return;
|
|
|
|
const title = titleInput ? titleInput.value.trim() : '';
|
|
// N'afficher QUE si le titre a été renseigné (au moins 3 caractères)
|
|
if (!title || title.length < 3) {
|
|
box.classList.add('hidden');
|
|
return;
|
|
}
|
|
|
|
const cat = catSelect ? catSelect.value : 'brico';
|
|
const timeType = timeSelect ? timeSelect.value : 'forfait';
|
|
|
|
const pricingTable = SUGGESTED_PRICING[cat] || { h: { min: 25, max: 50 }, forfait: { min: 80, max: 300 } };
|
|
let minPrice = 0;
|
|
let maxPrice = 0;
|
|
let suffix = '';
|
|
|
|
if (timeType === 'h') {
|
|
minPrice = pricingTable.h ? pricingTable.h.min : 25;
|
|
maxPrice = pricingTable.h ? pricingTable.h.max : 50;
|
|
suffix = '/h';
|
|
} else if (timeType === 'j') {
|
|
minPrice = (pricingTable.h ? pricingTable.h.min : 25) * 7;
|
|
maxPrice = (pricingTable.h ? pricingTable.h.max : 50) * 7;
|
|
suffix = '/jour';
|
|
} else {
|
|
minPrice = pricingTable.forfait ? pricingTable.forfait.min : 80;
|
|
maxPrice = pricingTable.forfait ? pricingTable.forfait.max : 350;
|
|
suffix = 'au forfait';
|
|
}
|
|
|
|
// Ajustement selon le contexte / mots-clés du titre renseigné
|
|
const lowerTitle = title.toLowerCase();
|
|
if (lowerTitle.includes('complet') || lowerTitle.includes('renovation') || lowerTitle.includes('rénovation') || lowerTitle.includes('cuisine') || lowerTitle.includes('salle de bain')) {
|
|
minPrice = Math.round(minPrice * 1.3);
|
|
maxPrice = Math.round(maxPrice * 1.5);
|
|
} else if (lowerTitle.includes('urgence') || lowerTitle.includes('fuite') || lowerTitle.includes('panne') || lowerTitle.includes('serrure')) {
|
|
minPrice = Math.round(minPrice * 1.2);
|
|
maxPrice = Math.round(maxPrice * 1.3);
|
|
} else if (lowerTitle.includes('petit') || lowerTitle.includes('simple') || lowerTitle.includes('aide') || lowerTitle.includes('montage')) {
|
|
minPrice = Math.max(15, Math.round(minPrice * 0.8));
|
|
maxPrice = Math.round(maxPrice * 0.85);
|
|
}
|
|
|
|
textEl.innerHTML = `Tarif conseillé : entre <strong class="text-job-dark font-bold">${minPrice} €</strong> et <strong class="text-job-dark font-bold">${maxPrice} €</strong> <span class="text-gray-500 font-medium">${suffix}</span> (basé sur les prestations similaires).`;
|
|
box.classList.remove('hidden');
|
|
}
|
|
|
|
// ================= GESTION DES TRANSACTIONS =================
|
|
function switchTransactionsTab(type) {
|
|
activeTransactionsTab = type;
|
|
const tabPaid = document.getElementById('tab-tx-paid');
|
|
const tabReceived = document.getElementById('tab-tx-received');
|
|
|
|
if (type === 'paid') {
|
|
tabPaid.className = "flex-1 py-2.5 rounded-xl text-xs font-bold transition-all bg-white text-job-dark shadow-sm flex items-center justify-center gap-1.5";
|
|
tabReceived.className = "flex-1 py-2.5 rounded-xl text-xs font-bold transition-all text-gray-500 hover:text-job-dark flex items-center justify-center gap-1.5";
|
|
} else {
|
|
tabReceived.className = "flex-1 py-2.5 rounded-xl text-xs font-bold transition-all bg-white text-job-dark shadow-sm flex items-center justify-center gap-1.5";
|
|
tabPaid.className = "flex-1 py-2.5 rounded-xl text-xs font-bold transition-all text-gray-500 hover:text-job-dark flex items-center justify-center gap-1.5";
|
|
}
|
|
renderTransactionsList();
|
|
}
|
|
|
|
function renderTransactionsList() {
|
|
const container = document.getElementById('transactions-list-container');
|
|
const summary = document.getElementById('transactions-summary-card');
|
|
if (!container || !summary) return;
|
|
|
|
const filteredTx = userTransactions.filter(t => t.type === activeTransactionsTab);
|
|
const totalAmount = filteredTx.reduce((sum, t) => sum + t.amount, 0);
|
|
|
|
if (activeTransactionsTab === 'paid') {
|
|
summary.innerHTML = `
|
|
<div>
|
|
<span class="text-[10px] uppercase tracking-wider font-bold text-gray-400 block">Total Dépensé (Prestations payées)</span>
|
|
<div class="text-xl font-extrabold text-job-dark mt-0.5">${totalAmount.toLocaleString('fr-FR')} €</div>
|
|
</div>
|
|
<span class="text-xs bg-rose-50 text-rose-700 font-bold px-3 py-1.5 rounded-full border border-rose-200 flex items-center gap-1">
|
|
<i class="ph-bold ph-arrow-up-right"></i> ${filteredTx.length} paiement${filteredTx.length > 1 ? 's' : ''}
|
|
</span>
|
|
`;
|
|
} else {
|
|
summary.innerHTML = `
|
|
<div>
|
|
<span class="text-[10px] uppercase tracking-wider font-bold text-gray-400 block">Total Encaissé (Vos prestations)</span>
|
|
<div class="text-xl font-extrabold text-job-sage mt-0.5">+${totalAmount.toLocaleString('fr-FR')} €</div>
|
|
</div>
|
|
<span class="text-xs bg-emerald-50 text-job-sage font-bold px-3 py-1.5 rounded-full border border-emerald-200 flex items-center gap-1">
|
|
<i class="ph-bold ph-arrow-down-left"></i> ${filteredTx.length} encaissement${filteredTx.length > 1 ? 's' : ''}
|
|
</span>
|
|
`;
|
|
}
|
|
|
|
if (filteredTx.length === 0) {
|
|
container.innerHTML = `
|
|
<div class="text-center py-12 bg-white rounded-3xl border border-dashed border-job-gray text-gray-400 text-xs">
|
|
<i class="ph-bold ph-receipt text-3xl mb-1.5 text-gray-300"></i>
|
|
<p>Aucune transaction enregistrée pour le moment.</p>
|
|
</div>
|
|
`;
|
|
return;
|
|
}
|
|
|
|
container.innerHTML = filteredTx.map(tx => {
|
|
const isPaid = tx.type === 'paid';
|
|
const amountDisplay = isPaid ? `-${tx.amount.toLocaleString('fr-FR')} €` : `+${tx.amount.toLocaleString('fr-FR')} €`;
|
|
const amountClass = isPaid ? 'text-job-dark' : 'text-job-sage font-extrabold';
|
|
|
|
let statusBadge = '';
|
|
if (tx.status === 'escrow') {
|
|
statusBadge = `<span class="text-[9px] bg-sky-100 text-sky-800 font-bold px-2 py-0.5 rounded-full flex items-center gap-1"><i class="ph-bold ph-lock-key"></i> ${tx.statusLabel}</span>`;
|
|
} else {
|
|
statusBadge = `<span class="text-[9px] bg-emerald-100 text-emerald-800 font-bold px-2 py-0.5 rounded-full flex items-center gap-1"><i class="ph-bold ph-check-circle"></i> ${tx.statusLabel}</span>`;
|
|
}
|
|
|
|
return `
|
|
<div class="bg-white rounded-3xl p-4 shadow-card border border-job-gray/80 flex flex-col gap-2.5">
|
|
<div class="flex justify-between items-start">
|
|
<div class="flex items-center gap-3">
|
|
<img loading="lazy" decoding="async" src="${tx.partyAvatar}" class="w-10 h-10 rounded-full object-cover border border-job-gray">
|
|
<div>
|
|
<h3 class="font-bold text-xs text-job-dark leading-tight">${tx.title}</h3>
|
|
<span class="text-[10px] text-gray-500">${isPaid ? 'Prestataire :' : 'Client :'} <strong>${tx.partyName}</strong> • ${tx.date}</span>
|
|
</div>
|
|
</div>
|
|
<div class="text-right shrink-0">
|
|
<span class="text-sm font-extrabold ${amountClass} block">${amountDisplay}</span>
|
|
<span class="text-[9px] text-gray-400 font-mono">${tx.invoiceRef}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-between border-t border-job-gray/60 pt-2 text-[11px]">
|
|
${statusBadge}
|
|
<button onclick="downloadTransactionReceipt('${tx.invoiceRef}')" class="text-job-sage hover:text-job-sage-dark font-bold text-[10px] flex items-center gap-1 hover:underline">
|
|
<i class="ph-bold ph-download-simple"></i> Reçu PDF
|
|
</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}).join('');
|
|
}
|
|
|
|
function downloadTransactionReceipt(ref) {
|
|
const tx = (typeof userTransactions !== 'undefined') ? userTransactions.find(t => t.invoiceRef === ref) : null;
|
|
const title = tx ? tx.title : 'Prestation de service';
|
|
const amount = tx ? `${tx.amount} €` : '180,00 €';
|
|
const date = tx ? tx.date : '16 Septembre 2026';
|
|
const party = tx ? tx.partyName : 'Artisan Jobrunner Partenaire';
|
|
const status = tx ? (tx.status === 'completed' ? 'Paiement Sécurisé Libéré' : (tx.status === 'escrow' ? 'Fonds Bloqués sous Séquestre' : 'Remboursé')) : 'Fonds Bloqués sous Séquestre';
|
|
|
|
const receiptHtml = `<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Reçu Officiel - ${ref}</title>
|
|
<style>
|
|
body { font-family: 'Segoe UI', Arial, sans-serif; background: #F4F2EC; color: #1F221E; padding: 40px 20px; margin: 0; }
|
|
.receipt-card { max-width: 650px; margin: 0 auto; background: #ffffff; border-radius: 20px; padding: 32px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); border: 1px solid #E5E1D8; }
|
|
.header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #F4F2EC; padding-bottom: 20px; margin-bottom: 24px; }
|
|
.logo-title { font-size: 24px; font-weight: 800; color: #1F221E; letter-spacing: -0.5px; }
|
|
.logo-title span { color: #7A8E76; }
|
|
.badge { background: #EBF2EA; color: #43603E; padding: 6px 14px; border-radius: 9999px; font-weight: 700; font-size: 12px; }
|
|
.ref { font-family: monospace; color: #666; font-size: 13px; margin-top: 4px; }
|
|
.details-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
|
|
.details-table td { padding: 12px 0; border-bottom: 1px solid #F4F2EC; font-size: 14px; }
|
|
.details-table td.label { color: #666; font-weight: 500; }
|
|
.details-table td.val { text-align: right; font-weight: 700; color: #1F221E; }
|
|
.total-row td { border-bottom: none; font-size: 18px; padding-top: 18px; font-weight: 800; }
|
|
.escrow-box { background: #F9F8F5; border-radius: 14px; padding: 18px; border-left: 4px solid #7A8E76; margin-bottom: 24px; font-size: 12px; line-height: 1.6; color: #444; }
|
|
.footer { text-align: center; font-size: 11px; color: #888; border-top: 1px solid #F4F2EC; padding-top: 18px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="receipt-card">
|
|
<div class="header">
|
|
<div>
|
|
<div class="logo-title">JOB<span>RUNNER</span></div>
|
|
<div class="ref">Réf. transaction : ${ref}</div>
|
|
</div>
|
|
<span class="badge">PAIEMENT SÉCURISÉ</span>
|
|
</div>
|
|
<table class="details-table">
|
|
<tr><td class="label">Objet de la prestation</td><td class="val">${title}</td></tr>
|
|
<tr><td class="label">Bénéficiaire / Partenaire</td><td class="val">${party}</td></tr>
|
|
<tr><td class="label">Date d'émission</td><td class="val">${date}</td></tr>
|
|
<tr><td class="label">Statut du paiement</td><td class="val">${status}</td></tr>
|
|
<tr class="total-row"><td class="label">Montant total</td><td class="val" style="color: #7A8E76;">${amount}</td></tr>
|
|
</table>
|
|
<div class="escrow-box">
|
|
<strong>Protection Acheteur & Vendeur Jobrunner :</strong><br>
|
|
Les fonds sont conservés par le prestataire de paiement jusqu'à la validation de la prestation par les deux parties. En cas de contestation, les fonds restent conservés pendant la recherche d'une solution amiable (article 7 des CGU).
|
|
</div>
|
|
<div class="footer">
|
|
Jobrunner • Récapitulatif de transaction généré par la Plateforme. Ce document n'est pas une facture.
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>`;
|
|
|
|
const blob = new Blob([receiptHtml], { type: 'text/html;charset=utf-8' });
|
|
const url = URL.createObjectURL(blob);
|
|
const a = document.createElement('a');
|
|
a.href = url;
|
|
a.download = `Recu_Jobrunner_${ref}.html`;
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
document.body.removeChild(a);
|
|
setTimeout(() => URL.revokeObjectURL(url), 1500);
|
|
|
|
triggerCustomModal(`Reçu officiel ${ref} téléchargé avec succès !`, "check");
|
|
}
|
|
|
|
function toggleShortLike(button, initialCount) {
|
|
const heart = button.querySelector('.heart-icon');
|
|
const counter = button.querySelector('.like-counter');
|
|
const isLiked = heart.classList.contains('ph-fill');
|
|
|
|
if (isLiked) {
|
|
heart.className = 'ph-bold ph-heart text-xl text-white heart-icon';
|
|
counter.textContent = initialCount;
|
|
} else {
|
|
heart.className = 'ph-fill ph-heart text-xl text-rose-500 heart-icon';
|
|
counter.textContent = initialCount + 1;
|
|
}
|
|
}
|
|
|
|
let currentShareData = {
|
|
title: '',
|
|
author: '',
|
|
url: ''
|
|
};
|
|
|
|
function openShareModal(title, author, image, runnerId) {
|
|
currentShareData.title = title || 'Prestation sur Jobrunner';
|
|
currentShareData.author = author || 'Jobrunner';
|
|
currentShareData.url = window.location.origin + window.location.pathname + (runnerId ? `?short=${runnerId}` : '');
|
|
|
|
const modal = document.getElementById('share-modal');
|
|
if (!modal) return;
|
|
|
|
const titleEl = document.getElementById('share-preview-title');
|
|
const authorEl = document.getElementById('share-preview-author');
|
|
const imgEl = document.getElementById('share-preview-img');
|
|
const linkInput = document.getElementById('share-link-input');
|
|
|
|
if (titleEl) titleEl.textContent = currentShareData.title;
|
|
if (authorEl) authorEl.textContent = `Par ${currentShareData.author}`;
|
|
if (imgEl) imgEl.src = image || 'https://images.unsplash.com/photo-1581783342308-f792dbdd27c5?w=200';
|
|
if (linkInput) linkInput.value = currentShareData.url;
|
|
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeShareModal() {
|
|
const modal = document.getElementById('share-modal');
|
|
if (!modal) return;
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
|
|
function shareVia(channel) {
|
|
const shareText = `Regarde ce short "${currentShareData.title}" sur Jobrunner : ${currentShareData.url}`;
|
|
|
|
if (channel === 'whatsapp') {
|
|
const waUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(shareText)}`;
|
|
window.open(waUrl, '_blank');
|
|
} else if (channel === 'sms') {
|
|
const smsUrl = `sms:?body=${encodeURIComponent(shareText)}`;
|
|
window.location.href = smsUrl;
|
|
} else if (channel === 'copy') {
|
|
copyShareLink();
|
|
} else if (channel === 'more') {
|
|
if (navigator.share) {
|
|
navigator.share({
|
|
title: currentShareData.title,
|
|
text: `Découvre ce short sur Jobrunner :`,
|
|
url: currentShareData.url
|
|
}).catch(() => {});
|
|
} else {
|
|
const mailUrl = `mailto:?subject=${encodeURIComponent(currentShareData.title)}&body=${encodeURIComponent(shareText)}`;
|
|
window.location.href = mailUrl;
|
|
}
|
|
}
|
|
}
|
|
|
|
function copyShareLink() {
|
|
const linkInput = document.getElementById('share-link-input');
|
|
if (linkInput) {
|
|
linkInput.select();
|
|
}
|
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
navigator.clipboard.writeText(currentShareData.url).then(() => {
|
|
triggerCustomModal("Lien copié dans le presse-papier !", "check");
|
|
}).catch(() => {
|
|
triggerCustomModal("Lien copié !", "check");
|
|
});
|
|
} else {
|
|
try {
|
|
document.execCommand('copy');
|
|
triggerCustomModal("Lien copié dans le presse-papier !", "check");
|
|
} catch (e) {
|
|
triggerCustomModal("Lien copié !", "check");
|
|
}
|
|
}
|
|
}
|
|
|
|
function shareListing(title) {
|
|
openShareModal(title, 'Jobrunner', '', null);
|
|
}
|
|
|
|
function shareCurrentDetailAd() {
|
|
const runner = runners.find(r => r.id === currentDetailRunnerId);
|
|
if (runner) {
|
|
openShareModal(runner.title, runner.name, runner.jobImage, runner.id);
|
|
}
|
|
}
|
|
|
|
function triggerCustomModal(message, type = 'check') {
|
|
const modal = document.getElementById('custom-modal');
|
|
const text = document.getElementById('modal-text');
|
|
const icon = document.getElementById('modal-icon');
|
|
const container = document.getElementById('modal-icon-container');
|
|
|
|
text.textContent = message;
|
|
|
|
if (type === 'heart') {
|
|
icon.className = 'ph-fill ph-heart text-rose-400 text-lg';
|
|
container.className = 'w-6 h-6 rounded-full bg-rose-500/20 text-rose-400 flex items-center justify-center shrink-0';
|
|
} else if (type === 'info') {
|
|
icon.className = 'ph-bold ph-info text-sky-400 text-lg';
|
|
container.className = 'w-6 h-6 rounded-full bg-sky-500/20 text-sky-400 flex items-center justify-center shrink-0';
|
|
} else {
|
|
icon.className = 'ph-fill ph-check-circle text-job-sage text-lg';
|
|
container.className = 'w-6 h-6 rounded-full bg-job-sage/30 text-job-sage flex items-center justify-center shrink-0';
|
|
}
|
|
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
|
|
if (window.toastTimeout) clearTimeout(window.toastTimeout);
|
|
window.toastTimeout = setTimeout(() => {
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}, 3200);
|
|
}
|
|
|
|
function initSwipeButton() {
|
|
const swipeTrack = document.getElementById('swipe-reserve-track');
|
|
const swipeKnob = document.getElementById('swipe-reserve-knob');
|
|
const swipeFill = document.getElementById('swipe-reserve-fill');
|
|
|
|
if (!swipeTrack || !swipeKnob) return;
|
|
|
|
let isDragging = false;
|
|
let currentX = 0;
|
|
|
|
const getMaxTranslate = () => swipeTrack.offsetWidth - swipeKnob.offsetWidth - 16;
|
|
|
|
const setKnobPos = (pos) => {
|
|
currentX = pos;
|
|
swipeKnob.style.transform = `translateX(${pos}px)`;
|
|
if (swipeFill) {
|
|
swipeFill.style.width = pos <= 0 ? '0px' : `${pos + 20}px`;
|
|
}
|
|
};
|
|
|
|
const completeSwipe = () => {
|
|
const max = getMaxTranslate();
|
|
swipeKnob.style.transition = 'transform 0.22s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
if (swipeFill) swipeFill.style.transition = 'width 0.22s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
setKnobPos(max);
|
|
|
|
setTimeout(() => {
|
|
handleReserveClick();
|
|
setTimeout(() => {
|
|
swipeKnob.style.transition = 'transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
if (swipeFill) swipeFill.style.transition = 'width 0.4s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
setKnobPos(0);
|
|
}, 800);
|
|
}, 200);
|
|
};
|
|
|
|
const resetToZero = () => {
|
|
swipeKnob.style.transition = 'transform 0.35s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
if (swipeFill) swipeFill.style.transition = 'width 0.35s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
setKnobPos(0);
|
|
};
|
|
|
|
const startDrag = (clientX) => {
|
|
isDragging = true;
|
|
const trackRect = swipeTrack.getBoundingClientRect();
|
|
const maxTranslate = getMaxTranslate();
|
|
let targetX = clientX - trackRect.left - (swipeKnob.offsetWidth / 2);
|
|
if (targetX < 0) targetX = 0;
|
|
if (targetX > maxTranslate) targetX = maxTranslate;
|
|
|
|
swipeKnob.style.transition = 'transform 0.12s ease-out';
|
|
if (swipeFill) swipeFill.style.transition = 'width 0.12s ease-out';
|
|
setKnobPos(targetX);
|
|
};
|
|
|
|
const moveDrag = (clientX) => {
|
|
if (!isDragging) return;
|
|
const trackRect = swipeTrack.getBoundingClientRect();
|
|
const maxTranslate = getMaxTranslate();
|
|
|
|
let newX = clientX - trackRect.left - (swipeKnob.offsetWidth / 2);
|
|
if (newX < 0) newX = 0;
|
|
if (newX > maxTranslate) newX = maxTranslate;
|
|
|
|
swipeKnob.style.transition = 'none';
|
|
if (swipeFill) swipeFill.style.transition = 'none';
|
|
setKnobPos(newX);
|
|
|
|
if (newX >= maxTranslate - 2) {
|
|
isDragging = false;
|
|
completeSwipe();
|
|
}
|
|
};
|
|
|
|
const endDrag = () => {
|
|
if (!isDragging) return;
|
|
isDragging = false;
|
|
const maxTranslate = getMaxTranslate();
|
|
|
|
// Si dépassé 85% au relâchement -> valide automatiquement !
|
|
if (currentX >= maxTranslate * 0.85) {
|
|
completeSwipe();
|
|
} else {
|
|
// Sinon retourne immédiatement à 0 (ne reste jamais au milieu !)
|
|
resetToZero();
|
|
}
|
|
};
|
|
|
|
swipeTrack.addEventListener('mousedown', (e) => {
|
|
startDrag(e.clientX);
|
|
});
|
|
|
|
swipeTrack.addEventListener('touchstart', (e) => {
|
|
if (e.touches && e.touches.length > 0) {
|
|
startDrag(e.touches[0].clientX);
|
|
}
|
|
}, { passive: true });
|
|
|
|
document.addEventListener('mousemove', (e) => {
|
|
if (isDragging) moveDrag(e.clientX);
|
|
});
|
|
|
|
document.addEventListener('touchmove', (e) => {
|
|
if (isDragging && e.touches && e.touches.length > 0) {
|
|
if (e.cancelable) e.preventDefault();
|
|
moveDrag(e.touches[0].clientX);
|
|
}
|
|
}, { passive: false });
|
|
|
|
document.addEventListener('mouseup', endDrag);
|
|
document.addEventListener('touchend', endDrag);
|
|
document.addEventListener('touchcancel', endDrag);
|
|
}
|
|
|
|
let currentPublicProfileId = null;
|
|
|
|
function openPublicProfile(runnerId) {
|
|
const runner = runners.find(r => r.id === runnerId);
|
|
if(!runner) return;
|
|
|
|
currentPublicProfileId = runnerId;
|
|
document.getElementById('public-profile-avatar').src = runner.avatar;
|
|
document.getElementById('public-profile-name').textContent = runner.name;
|
|
document.getElementById('public-profile-rating').textContent = runner.rating;
|
|
document.getElementById('public-profile-reviews').textContent = `(${runner.reviews} avis vérifiés)`;
|
|
document.getElementById('public-profile-desc').textContent = runner.desc;
|
|
|
|
const runnerAds = runners.filter(r => r.id === runnerId || r.name === runner.name);
|
|
const container = document.getElementById('public-profile-ads');
|
|
container.innerHTML = runnerAds.map(ad => createRunnerCard(ad)).join('');
|
|
|
|
// Affichage des avis clients comme sur LBC
|
|
const reviewsContainer = document.getElementById('public-profile-reviews-list');
|
|
document.getElementById('public-profile-reviews-count').textContent = `${runner.reviews} avis`;
|
|
|
|
if (runner.reviewsList && runner.reviewsList.length > 0) {
|
|
reviewsContainer.innerHTML = runner.reviewsList.map(rev => `
|
|
<div class="bg-job-bg rounded-2xl p-4 border border-job-gray/70">
|
|
<div class="flex justify-between items-start mb-1.5">
|
|
<span class="font-bold text-sm text-job-dark">${rev.name}</span>
|
|
<span class="text-[10px] font-medium text-gray-500">${rev.date}</span>
|
|
</div>
|
|
<div class="flex text-amber-500 text-[10px] mb-2 gap-0.5">
|
|
${Array(5).fill(0).map((_, i) => `<i class="${i < rev.rating ? 'ph-fill' : 'ph'} ph-star"></i>`).join('')}
|
|
</div>
|
|
<p class="text-xs text-gray-600 leading-relaxed font-medium">"${rev.text}"</p>
|
|
</div>
|
|
`).join('');
|
|
} else {
|
|
reviewsContainer.innerHTML = `<p class="text-xs text-gray-500 text-center italic py-6 bg-job-bg rounded-2xl border border-dashed border-job-gray">Aucun avis pour le moment.</p>`;
|
|
}
|
|
|
|
navigate('public-profile');
|
|
}
|
|
|
|
function startDirectChatFromPublic() {
|
|
if(currentPublicProfileId) openDirectChatWithRunner(currentPublicProfileId);
|
|
}
|
|
|
|
function updateMessagesNotification() {
|
|
const dot = document.getElementById('messages-dot');
|
|
const desktopDot = document.getElementById('desktop-messages-dot');
|
|
// Ne pas afficher de notification si l'utilisateur n'est pas connecté
|
|
if (!currentUser.isLoggedIn) {
|
|
if (dot) dot.classList.add('hidden');
|
|
if (desktopDot) desktopDot.classList.add('hidden');
|
|
return;
|
|
}
|
|
const hasUnread = conversations.some(c => c.unread);
|
|
if (hasUnread) {
|
|
if (dot) dot.classList.remove('hidden');
|
|
if (desktopDot) desktopDot.classList.remove('hidden');
|
|
} else {
|
|
if (dot) dot.classList.add('hidden');
|
|
if (desktopDot) desktopDot.classList.add('hidden');
|
|
}
|
|
}
|
|
|
|
// ====== MODALE INFORMATIONS LEGALES & SECURITE ======
|
|
function openLegalModal(type) {
|
|
const modal = document.getElementById('legal-modal');
|
|
const titleEl = document.getElementById('legal-modal-title');
|
|
const iconEl = document.getElementById('legal-modal-icon');
|
|
const contentEl = document.getElementById('legal-modal-content');
|
|
if (!modal || !titleEl || !iconEl || !contentEl) return;
|
|
|
|
// Les documents légaux complets sont dans legal.html (un onglet par document)
|
|
const LEGAL_DOCS = ['fonctionnement', 'mentions', 'cgu', 'cgv', 'confidentialite', 'cookies'];
|
|
if (LEGAL_DOCS.includes(type)) {
|
|
window.location.href = 'legal.html#' + type;
|
|
return;
|
|
}
|
|
|
|
let title = "Mentions Légales";
|
|
let icon = "ph-bold ph-file-text text-xl";
|
|
let html = "";
|
|
|
|
if (type === 'securite-sequestre') {
|
|
title = "Paiement sécurisé";
|
|
icon = "ph-bold ph-shield-check text-xl";
|
|
html = `
|
|
<div class="p-3 bg-job-sage-light/60 rounded-xl border border-job-sage/30 mb-3">
|
|
<span class="font-bold text-job-sage-dark block mb-1 text-xs flex items-center gap-1.5">
|
|
<i class="ph-fill ph-lock-key"></i> Fonds conservés jusqu'à la validation
|
|
</span>
|
|
<p class="text-[11px] text-job-dark leading-snug">
|
|
Les paiements sont traités par un prestataire de paiement agréé. Le prestataire n'est payé qu'une fois la prestation validée.
|
|
</p>
|
|
</div>
|
|
<div class="space-y-2.5">
|
|
<div class="border-b border-job-gray/60 pb-2">
|
|
<h4 class="font-bold text-job-dark text-xs mb-1">1. Paiement à la réservation</h4>
|
|
<p class="text-gray-600 text-[11px]">Le montant convenu est payé à la réservation et conservé par le prestataire de paiement.</p>
|
|
</div>
|
|
<div class="border-b border-job-gray/60 pb-2">
|
|
<h4 class="font-bold text-job-dark text-xs mb-1">2. Double validation</h4>
|
|
<p class="text-gray-600 text-[11px]">Le prestataire déclare la prestation réalisée, puis vous confirmez sa bonne exécution. Les fonds lui sont alors versés.</p>
|
|
</div>
|
|
<div class="border-b border-job-gray/60 pb-2">
|
|
<h4 class="font-bold text-job-dark text-xs mb-1">3. En cas de désaccord</h4>
|
|
<p class="text-gray-600 text-[11px]">Vous pouvez contester avant la fin du délai de validation : les fonds restent conservés pendant la recherche d'une solution amiable.</p>
|
|
</div>
|
|
<div>
|
|
<h4 class="font-bold text-job-dark text-xs mb-1">4. Badges de vérification</h4>
|
|
<p class="text-gray-600 text-[11px]">Le badge « Identité vérifiée » indique que le prestataire a fait vérifier sa pièce d'identité. Il ne garantit pas la qualité de la prestation.</p>
|
|
</div>
|
|
<p class="text-[11px] text-gray-500 pt-1">Détails : <a href="legal.html#cgu/cgu-paiement" class="text-job-sage underline">article 6 des CGU</a>.</p>
|
|
</div>
|
|
`;
|
|
} else if (type === 'qui-sommes-nous') {
|
|
title = "Qui sommes-nous ?";
|
|
icon = "ph-bold ph-sparkle text-xl";
|
|
html = `
|
|
<div class="space-y-3">
|
|
<div>
|
|
<h4 class="font-bold text-job-dark text-xs mb-0.5">Notre mission</h4>
|
|
<p class="text-[11px] text-gray-600 leading-relaxed">
|
|
Créée en France, <strong>Jobrunner</strong> est née d'un constat simple : la recherche d'un prestataire ou d'un artisan est trop souvent source de stress (acomptes envolés, devis non respectés, retards de paiement pour les professionnels).
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<h4 class="font-bold text-job-dark text-xs mb-0.5">La réponse Jobrunner</h4>
|
|
<p class="text-[11px] text-gray-600 leading-relaxed">
|
|
Nous réunissons la convivialité et la réactivité des plateformes modernes avec un <strong>paiement conservé jusqu'à la validation</strong> de la prestation par les deux parties. Le client ne paie le prestataire qu'une fois le travail validé, et le prestataire sait que le montant a été réglé avant de commencer.
|
|
</p>
|
|
</div>
|
|
<div class="p-2.5 bg-job-bg rounded-xl border border-job-gray text-[11px] text-gray-700 italic">
|
|
« Jobrunner, trouvez, réservez, fait. » — Une équipe à taille humaine à votre écoute au quotidien.
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
titleEl.textContent = title;
|
|
iconEl.className = icon;
|
|
contentEl.innerHTML = html;
|
|
modal.classList.remove('hidden');
|
|
modal.classList.add('flex');
|
|
}
|
|
|
|
function closeLegalModal() {
|
|
const modal = document.getElementById('legal-modal');
|
|
if (modal) {
|
|
modal.classList.add('hidden');
|
|
modal.classList.remove('flex');
|
|
}
|
|
}
|
|
|
|
// ====== FOOTER JOBRUNNER UNIFIE (ACCUEIL, RECHERCHE, PROFIL) ======
|
|
function renderFooters() {
|
|
const footerHTML = `
|
|
<footer class="bg-job-dark text-gray-300 rounded-t-2xl md:rounded-3xl p-5 sm:p-6 md:p-8 pb-20 md:pb-8 shadow-2xl border-t border-white/5 font-sans text-xs">
|
|
<div class="max-w-7xl mx-auto">
|
|
<!-- Grille principale 4 colonnes compacte -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 lg:gap-8 pb-6 border-b border-white/10">
|
|
|
|
<!-- 1. Colonne : Présentation & Mission -->
|
|
<div class="space-y-2.5">
|
|
<div class="flex items-center gap-2">
|
|
<img loading="lazy" decoding="async" src="assets/img/logo-light.svg" alt="Logo Jobrunner" class="w-8 h-8 object-contain object-center select-none shrink-0" onerror="handleLogoError(this, 'sage')">
|
|
<span class="font-titre text-xl font-black tracking-tight text-white">Job<span class="text-job-sage">runner</span></span>
|
|
</div>
|
|
<p class="text-[11px] text-gray-400 leading-relaxed">
|
|
Plateforme française de mise en relation de confiance pour vos services et travaux avec paiement séquestre.
|
|
</p>
|
|
<div class="pt-0.5">
|
|
<span class="inline-block text-[10px] font-semibold text-job-sage bg-job-sage/15 border border-job-sage/30 px-2.5 py-1 rounded-full">
|
|
✨ Jobrunner, trouvez, réservez, fait.
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center gap-1.5 text-[10px] text-gray-400">
|
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"></span>
|
|
<span>Plateforme 100% opérationnelle en France 🇫🇷</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 2. Colonne : Sécurisation & Garanties -->
|
|
<div class="space-y-2">
|
|
<h3 class="font-titre font-bold text-xs text-white flex items-center gap-1.5">
|
|
<i class="ph-bold ph-shield-check text-job-sage text-sm"></i>
|
|
Sécurité & Séquestre
|
|
</h3>
|
|
<ul class="space-y-1.5 text-[11px] text-gray-400">
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('securite-sequestre')" class="hover:text-white transition-colors text-left flex items-start gap-1.5 group">
|
|
<i class="ph-fill ph-check-circle text-job-sage shrink-0 mt-0.5 group-hover:scale-110 transition-transform"></i>
|
|
<span>Paiement conservé jusqu'à validation</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('securite-sequestre')" class="hover:text-white transition-colors text-left flex items-start gap-1.5 group">
|
|
<i class="ph-fill ph-check-circle text-job-sage shrink-0 mt-0.5 group-hover:scale-110 transition-transform"></i>
|
|
<span>Double accord mutuel de fin de mission</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('securite-sequestre')" class="hover:text-white transition-colors text-left flex items-start gap-1.5 group">
|
|
<i class="ph-fill ph-check-circle text-job-sage shrink-0 mt-0.5 group-hover:scale-110 transition-transform"></i>
|
|
<span>Vérification d'identité des prestataires (KYC)</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('securite-sequestre')" class="hover:text-white transition-colors text-left flex items-start gap-1.5 group">
|
|
<i class="ph-fill ph-check-circle text-job-sage shrink-0 mt-0.5 group-hover:scale-110 transition-transform"></i>
|
|
<span>Médiation litiges & support client 7j/7</span>
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- 3. Colonne : Rejoindre sur les réseaux -->
|
|
<div class="space-y-2">
|
|
<h3 class="font-titre font-bold text-xs text-white flex items-center gap-1.5">
|
|
<i class="ph-bold ph-share-network text-job-sage text-sm"></i>
|
|
Nous rejoindre
|
|
</h3>
|
|
<p class="text-[11px] text-gray-400">Échangez avec la communauté et l'équipe :</p>
|
|
<div class="flex flex-col gap-1.5 pt-0.5">
|
|
<!-- Discord -->
|
|
<a href="${SOCIAL_LINKS.discord}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-2 p-1.5 px-2.5 rounded-lg bg-white/5 hover:bg-white/10 border border-white/10 text-white text-[11px] font-semibold transition-all group active:scale-95">
|
|
<div class="w-6 h-6 rounded bg-[#5865F2]/20 text-[#5865F2] group-hover:bg-[#5865F2] group-hover:text-white flex items-center justify-center transition-colors shrink-0">
|
|
<i class="ph-bold ph-discord-logo text-sm"></i>
|
|
</div>
|
|
<div class="flex-grow min-w-0">
|
|
<span class="block text-white group-hover:text-job-sage transition-colors font-bold leading-none">Discord Jobrunner</span>
|
|
<span class="block text-[9px] text-gray-400">Entraide & communauté</span>
|
|
</div>
|
|
<i class="ph-bold ph-arrow-up-right text-gray-400 group-hover:text-white text-[10px]"></i>
|
|
</a>
|
|
|
|
<!-- WhatsApp -->
|
|
<a href="${SOCIAL_LINKS.whatsapp}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-2 p-1.5 px-2.5 rounded-lg bg-white/5 hover:bg-white/10 border border-white/10 text-white text-[11px] font-semibold transition-all group active:scale-95">
|
|
<div class="w-6 h-6 rounded bg-[#25D366]/20 text-[#25D366] group-hover:bg-[#25D366] group-hover:text-white flex items-center justify-center transition-colors shrink-0">
|
|
<i class="ph-bold ph-whatsapp-logo text-sm"></i>
|
|
</div>
|
|
<div class="flex-grow min-w-0">
|
|
<span class="block text-white group-hover:text-[#25D366] transition-colors font-bold leading-none">WhatsApp Direct</span>
|
|
<span class="block text-[9px] text-gray-400">Support & alertes</span>
|
|
</div>
|
|
<i class="ph-bold ph-arrow-up-right text-gray-400 group-hover:text-white text-[10px]"></i>
|
|
</a>
|
|
|
|
<!-- Instagram -->
|
|
<a href="${SOCIAL_LINKS.instagram}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-2 p-1.5 px-2.5 rounded-lg bg-white/5 hover:bg-white/10 border border-white/10 text-white text-[11px] font-semibold transition-all group active:scale-95">
|
|
<div class="w-6 h-6 rounded bg-[#E4405F]/20 text-[#E4405F] group-hover:bg-[#E4405F] group-hover:text-white flex items-center justify-center transition-colors shrink-0">
|
|
<i class="ph-bold ph-instagram-logo text-sm"></i>
|
|
</div>
|
|
<div class="flex-grow min-w-0">
|
|
<span class="block text-white group-hover:text-[#E4405F] transition-colors font-bold leading-none">Instagram</span>
|
|
<span class="block text-[9px] text-gray-400">@jobrunner.fr</span>
|
|
</div>
|
|
<i class="ph-bold ph-arrow-up-right text-gray-400 group-hover:text-white text-[10px]"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 4. Colonne : Mentions Légales & Qui sommes-nous -->
|
|
<div class="space-y-2">
|
|
<h3 class="font-titre font-bold text-xs text-white flex items-center gap-1.5">
|
|
<i class="ph-bold ph-scales text-job-sage text-sm"></i>
|
|
Informations Légales
|
|
</h3>
|
|
<ul class="space-y-1.5 text-[11px] text-gray-400">
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('qui-sommes-nous')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Qui sommes-nous ?</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('fonctionnement')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Comment fonctionne Jobrunner</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('mentions')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Mentions Légales</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('cgu')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Conditions Générales d'Utilisation (CGU)</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('cgv')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Conditions Générales de Vente (Pass & Boosts)</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('confidentialite')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Politique de Confidentialité (RGPD)</span>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<button type="button" onclick="openLegalModal('cookies')" class="hover:text-white hover:underline transition-colors text-left flex items-center gap-1">
|
|
<i class="ph-bold ph-caret-right text-[9px] text-job-sage"></i>
|
|
<span>Gestion des cookies & traceurs</span>
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="pt-1">
|
|
<span class="text-[9px] text-gray-500 uppercase font-bold tracking-wider block mb-0.5">Paiements sécurisés</span>
|
|
<div class="flex items-center gap-2 text-gray-400 text-base">
|
|
<i class="ph-bold ph-credit-card" title="Carte Bancaire"></i>
|
|
<i class="ph-bold ph-bank" title="Virement Séquestre"></i>
|
|
<i class="ph-bold ph-device-mobile" title="Apple Pay / Google Pay"></i>
|
|
<i class="ph-bold ph-lock-key" title="Chiffrement SSL 256-bit"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Barre basse Copyright & Avertissement légal -->
|
|
<div class="pt-4 flex flex-col md:flex-row items-center justify-between gap-2.5 text-[11px] text-gray-500">
|
|
<div class="flex flex-col sm:flex-row items-center gap-1.5 text-center md:text-left">
|
|
<span>© 2026 Jobrunner Inc. Tous droits réservés.</span>
|
|
<span class="hidden sm:inline">•</span>
|
|
<span>Plateforme de mise en relation avec paiement conservé jusqu'à validation.</span>
|
|
</div>
|
|
<div class="flex items-center gap-2 text-[10px] text-gray-400">
|
|
<span class="flex items-center gap-1">
|
|
<i class="ph-fill ph-shield-check text-job-sage"></i> Paiement sécurisé
|
|
</span>
|
|
<span>•</span>
|
|
<span>Conforme RGPD 🇪🇺</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
`;
|
|
|
|
document.querySelectorAll('.jobrunner-footer-slot').forEach(el => {
|
|
el.innerHTML = footerHTML;
|
|
});
|
|
}
|
|
|
|
// La barre de navigation basse reste visible en permanence sur mobile
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
// Restauration de session (localStorage token 24h)
|
|
const sessionRestored = restoreSession();
|
|
|
|
generateData();
|
|
renderHeaderAuth();
|
|
renderCategories();
|
|
renderRecentSearches();
|
|
renderFooters();
|
|
renderShortsPreview();
|
|
renderFullscreenShorts();
|
|
initShortsSnapBehavior();
|
|
initSwipeButton();
|
|
updateHomeRecs();
|
|
displaySearchResults(runners, "Toutes les annonces");
|
|
renderProfileAds();
|
|
sortConversations();
|
|
renderMessagesList();
|
|
renderDesktopMessenger();
|
|
updateProfilePassUI();
|
|
updateMessagesNotification();
|
|
|
|
if (sessionRestored) {
|
|
setTimeout(() => {
|
|
triggerCustomModal(`Bon retour, ${currentUser.firstName} ! Session restaurée.`, "check");
|
|
}, 600);
|
|
}
|
|
});
|
|
</script>
|
|
<!-- ====== CONFORMITÉ : achat de Pass, résiliation, rétractation, signalement (voir legal.html) ====== -->
|
|
<div id="legal-sheet" class="fixed inset-0 z-[140] bg-black/60 backdrop-blur-sm hidden flex-col justify-end md:justify-center md:items-center md:p-4" role="dialog" aria-modal="true" aria-labelledby="legal-sheet-title">
|
|
<div class="bg-job-bg w-full md:max-w-md rounded-t-3xl md:rounded-3xl p-5 max-h-[90vh] overflow-y-auto shadow-elevated">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h2 id="legal-sheet-title" class="text-lg font-bold font-titre text-job-dark"></h2>
|
|
<button type="button" onclick="closeLegalSheet()" class="w-9 h-9 rounded-full bg-white border border-job-gray flex items-center justify-center text-job-dark" aria-label="Fermer"><i class="ph-bold ph-x"></i></button>
|
|
</div>
|
|
<form id="legal-sheet-form" class="space-y-3 text-xs text-gray-600 leading-relaxed" novalidate>
|
|
<div id="legal-sheet-body" class="space-y-3"></div>
|
|
<button type="submit" id="legal-sheet-submit" class="w-full bg-job-sage hover:bg-job-sage-dark text-white text-xs font-bold py-3.5 rounded-xl transition-all"></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
'use strict';
|
|
// Offres vendues aux Runners (prix TTC affichés dans la boutique)
|
|
const OFFERS = {
|
|
flash: { name: 'Pass Flash', price: 2.99 },
|
|
medium: { name: 'Pass Medium', price: 5.99 },
|
|
pro: { name: 'Pass Pro', price: 9.99 },
|
|
premium: { name: 'Pass Premium', price: 19.99 },
|
|
short: { name: 'Emplacement vidéo supplémentaire', price: 0.50 }
|
|
};
|
|
const DAY = 24 * 60 * 60 * 1000;
|
|
const RETRACTATION_DAYS = 14;
|
|
|
|
const euro = n => n.toLocaleString('fr-FR', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + ' €';
|
|
const fmtDate = t => new Date(t).toLocaleDateString('fr-FR', { day: 'numeric', month: 'long', year: 'numeric' });
|
|
const addMonth = t => { const d = new Date(t); d.setMonth(d.getMonth() + 1); return d.getTime(); };
|
|
const esc = str => String(str == null ? '' : str).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
const checkbox = (name, html, required) => `<label class="flex items-start gap-2 cursor-pointer"><input type="checkbox" name="${name}" ${required ? 'required' : ''} class="mt-0.5 accent-job-sage shrink-0"><span>${html}</span></label>`;
|
|
|
|
// ---------- Modale générique ----------
|
|
let onSubmit = null;
|
|
const sheet = document.getElementById('legal-sheet');
|
|
const form = document.getElementById('legal-sheet-form');
|
|
|
|
function openSheet(title, bodyHtml, submitLabel, handler, danger) {
|
|
document.getElementById('legal-sheet-title').textContent = title;
|
|
document.getElementById('legal-sheet-body').innerHTML = bodyHtml;
|
|
const btn = document.getElementById('legal-sheet-submit');
|
|
btn.textContent = submitLabel;
|
|
btn.className = danger
|
|
? 'w-full bg-job-dark hover:bg-black text-white text-xs font-bold py-3.5 rounded-xl transition-all'
|
|
: 'w-full bg-job-sage hover:bg-job-sage-dark text-white text-xs font-bold py-3.5 rounded-xl transition-all';
|
|
onSubmit = handler;
|
|
sheet.classList.remove('hidden');
|
|
sheet.classList.add('flex');
|
|
}
|
|
window.closeLegalSheet = function () {
|
|
sheet.classList.add('hidden');
|
|
sheet.classList.remove('flex');
|
|
form.reset();
|
|
onSubmit = null;
|
|
};
|
|
form.addEventListener('submit', function (e) {
|
|
e.preventDefault();
|
|
if (!form.checkValidity()) { form.reportValidity(); return; }
|
|
const handler = onSubmit;
|
|
const data = new FormData(form);
|
|
closeLegalSheet();
|
|
if (handler) handler(data);
|
|
});
|
|
|
|
function state() {
|
|
if (!Array.isArray(currentUser.pendingOrders)) currentUser.pendingOrders = [];
|
|
return currentUser;
|
|
}
|
|
|
|
// ---------- Achat d'un Pass ou d'un emplacement vidéo ----------
|
|
function activate(type, at) {
|
|
const u = state();
|
|
if (type === 'short') {
|
|
buyExtraShort.confirmed = true;
|
|
buyExtraShort();
|
|
} else {
|
|
u.passSubscribedAt = at;
|
|
u.passCancelAt = null;
|
|
selectPass.confirmed = true;
|
|
selectPass(type);
|
|
}
|
|
}
|
|
|
|
window.openPassCheckout = function (type) {
|
|
const o = OFFERS[type];
|
|
if (!o) return;
|
|
const body = `
|
|
<div class="bg-white rounded-2xl border border-job-gray p-4">
|
|
<div class="flex justify-between gap-3 font-bold text-job-dark text-sm"><span>${o.name}</span><span class="shrink-0">${euro(o.price)} / mois</span></div>
|
|
<ul class="mt-2 space-y-1 text-[11px] text-gray-500 list-disc pl-4">
|
|
<li>Prix TTC, renouvelé chaque mois.</li>
|
|
<li>Résiliable à tout moment depuis « Mon Pass », effet à la fin du mois en cours.</li>
|
|
<li>Vos annonces portent la mention « Sponsorisé ». Aucun nombre de contacts ni aucune position précise n'est garanti.</li>
|
|
</ul>
|
|
</div>
|
|
${checkbox('cgv', `J'accepte les <a href="legal.html#cgv" target="_blank" rel="noopener" class="text-job-sage underline">conditions générales de vente</a>.`, true)}
|
|
${checkbox('immediate', `Je demande que le service commence immédiatement, avant la fin du délai de rétractation de 14 jours. Si je me rétracte, je paierai la part du service déjà fournie.`, false)}
|
|
<p class="text-[11px] text-gray-400">Sans cette demande, le service démarrera à la fin du délai de rétractation.</p>`;
|
|
openSheet('Récapitulatif de commande', body, `Payer ${euro(o.price)}`, function (data) {
|
|
const now = Date.now();
|
|
if (data.get('immediate')) {
|
|
activate(type, now);
|
|
} else {
|
|
const startsAt = now + RETRACTATION_DAYS * DAY;
|
|
state().pendingOrders.push({ type, orderedAt: now, startsAt });
|
|
renderPassManage();
|
|
triggerCustomModal(`Merci pour votre achat : ${o.name}, activation le ${fmtDate(startsAt)}.`, 'check');
|
|
}
|
|
});
|
|
};
|
|
|
|
// ---------- Résiliation « en trois clics » (Code de la consommation L215-1-1) ----------
|
|
window.openPassResiliation = function () {
|
|
const u = state();
|
|
const o = OFFERS[u.passType];
|
|
if (!o) return;
|
|
const endAt = addMonth(u.passSubscribedAt || Date.now());
|
|
const body = `
|
|
<div class="bg-white rounded-2xl border border-job-gray p-4 space-y-1">
|
|
<div class="flex justify-between font-bold text-job-dark text-sm"><span>${o.name}</span><span>${euro(o.price)} / mois</span></div>
|
|
<p class="text-[11px] text-gray-500">Votre Pass reste actif jusqu'au <strong>${fmtDate(endAt)}</strong>, puis ne sera plus renouvelé. Le mois en cours n'est pas remboursé.</p>
|
|
</div>`;
|
|
openSheet('Résilier votre contrat', body, 'Confirmer la résiliation', function () {
|
|
u.passCancelAt = endAt;
|
|
renderPassManage();
|
|
triggerCustomModal(`Résiliation confirmée : votre ${o.name} reste actif jusqu'au ${fmtDate(endAt)}.`, 'check');
|
|
}, true);
|
|
};
|
|
|
|
// ---------- Rétractation (Code de la consommation L221-18, L221-25) ----------
|
|
window.openPassRetractation = function () {
|
|
const u = state();
|
|
const o = OFFERS[u.passType];
|
|
if (!o || !u.passSubscribedAt) return;
|
|
const daysUsed = Math.max(1, Math.ceil((Date.now() - u.passSubscribedAt) / DAY));
|
|
const refund = Math.max(0, Math.round((o.price - o.price * daysUsed / 30) * 100) / 100);
|
|
const body = `
|
|
<div class="bg-white rounded-2xl border border-job-gray p-4 space-y-1">
|
|
<div class="font-bold text-job-dark text-sm">${o.name}, souscrit le ${fmtDate(u.passSubscribedAt)}</div>
|
|
<p class="text-[11px] text-gray-500">Le service a commencé à votre demande : la part déjà fournie (${daysUsed} jour${daysUsed > 1 ? 's' : ''}) reste due.</p>
|
|
<p class="text-[11px] text-gray-500">Montant remboursé : <strong>${euro(refund)}</strong>, sous 14 jours, par le même moyen de paiement.</p>
|
|
</div>`;
|
|
openSheet('Se rétracter', body, 'Confirmer la rétractation', function () {
|
|
u.passType = 'free';
|
|
u.passSubscribedAt = null;
|
|
u.passCancelAt = null;
|
|
updateProfilePassUI();
|
|
triggerCustomModal(`Rétractation enregistrée : ${euro(refund)} vous seront remboursés.`, 'check');
|
|
}, true);
|
|
};
|
|
|
|
window.cancelPendingOrder = function (index) {
|
|
const u = state();
|
|
const order = u.pendingOrders[index];
|
|
if (!order) return;
|
|
const o = OFFERS[order.type];
|
|
openSheet('Se rétracter', `<p>Votre commande « ${o.name} » du ${fmtDate(order.orderedAt)} n'a pas encore commencé. Elle sera annulée et intégralement remboursée (${euro(o.price)}), sous 14 jours.</p>`, 'Confirmer la rétractation', function () {
|
|
u.pendingOrders.splice(index, 1);
|
|
renderPassManage();
|
|
triggerCustomModal(`Rétractation enregistrée : ${euro(o.price)} vous seront remboursés.`, 'check');
|
|
}, true);
|
|
};
|
|
|
|
// ---------- Zone « Mon Pass » ----------
|
|
function renderPassManage() {
|
|
const box = document.getElementById('pass-manage');
|
|
if (!box) return;
|
|
const u = state();
|
|
const now = Date.now();
|
|
|
|
// Commandes dont le délai est écoulé : retirées de la liste avant activation (évite toute réentrée)
|
|
const due = u.pendingOrders.filter(order => order.startsAt <= now);
|
|
if (due.length) {
|
|
u.pendingOrders = u.pendingOrders.filter(order => order.startsAt > now);
|
|
due.forEach(order => activate(order.type, order.startsAt));
|
|
return;
|
|
}
|
|
// Résiliation arrivée à échéance : retour au Pass gratuit
|
|
if (u.passCancelAt && now >= u.passCancelAt && u.passType !== 'free') {
|
|
u.passType = 'free'; u.passSubscribedAt = null; u.passCancelAt = null;
|
|
originalUpdate();
|
|
}
|
|
|
|
const btn = 'flex-1 border border-white/25 text-white/85 hover:bg-white/10 text-[11px] font-semibold py-2 rounded-xl transition-colors';
|
|
let html = '';
|
|
if (u.passType !== 'free' && OFFERS[u.passType]) {
|
|
const actions = [];
|
|
if (u.passCancelAt) {
|
|
html += `<p class="text-[11px] text-gray-300 mt-3">Résiliation enregistrée : actif jusqu'au ${fmtDate(u.passCancelAt)}.</p>`;
|
|
} else {
|
|
actions.push(`<button type="button" onclick="openPassResiliation()" class="${btn}">Résilier votre contrat</button>`);
|
|
}
|
|
if (u.passSubscribedAt && now - u.passSubscribedAt < RETRACTATION_DAYS * DAY) {
|
|
actions.push(`<button type="button" onclick="openPassRetractation()" class="${btn}">Se rétracter</button>`);
|
|
}
|
|
if (actions.length) html += `<div class="flex gap-2 mt-3">${actions.join('')}</div>`;
|
|
}
|
|
u.pendingOrders.forEach((order, i) => {
|
|
html += `<div class="flex items-center justify-between gap-2 mt-3 text-[11px] text-gray-300"><span>${esc(OFFERS[order.type].name)} : activation le ${fmtDate(order.startsAt)}</span><button type="button" onclick="cancelPendingOrder(${i})" class="${btn} flex-none px-3">Se rétracter</button></div>`;
|
|
});
|
|
box.innerHTML = html;
|
|
}
|
|
window.renderPassManage = renderPassManage;
|
|
|
|
const originalUpdate = updateProfilePassUI;
|
|
updateProfilePassUI = function () { originalUpdate(); renderPassManage(); };
|
|
|
|
// ---------- Signalement de contenu (règlement (UE) 2022/2065, article 16) ----------
|
|
const REPORT_KINDS = { annonce: "l'annonce", profil: 'le profil', conversation: 'la conversation avec', avis: "l'avis", short: 'la vidéo' };
|
|
window.openReportModal = function (kind, label) {
|
|
const u = typeof currentUser !== 'undefined' ? currentUser : {};
|
|
const reasons = ['Arnaque ou fraude', 'Demande de paiement hors de Jobrunner', 'Faux avis ou fausse annonce', 'Contenu haineux, violent ou harcèlement', "Atteinte à la vie privée ou au droit à l'image", 'Contrefaçon', 'Autre contenu illicite'];
|
|
const body = `
|
|
<p>Vous signalez ${REPORT_KINDS[kind] || 'le contenu'} <strong class="text-job-dark">« ${esc((label || '').trim())} »</strong>.</p>
|
|
<label class="block"><span class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Motif</span>
|
|
<select name="reason" required class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage">
|
|
<option value="">Choisir un motif</option>${reasons.map(r => `<option>${esc(r)}</option>`).join('')}
|
|
</select></label>
|
|
<label class="block"><span class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Explication</span>
|
|
<textarea name="details" required minlength="10" rows="3" placeholder="Expliquez en quoi ce contenu est illicite ou contraire aux CGU." class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage"></textarea></label>
|
|
<label class="block"><span class="block text-[10px] font-bold uppercase text-gray-600 mb-1">Votre e-mail</span>
|
|
<input type="email" name="email" required value="${esc(u.email)}" class="w-full bg-white rounded-xl px-3 py-2.5 text-xs border border-job-gray outline-none focus:border-job-sage"></label>
|
|
${checkbox('goodfaith', "Je déclare de bonne foi que les informations de ce signalement sont exactes et complètes.", true)}
|
|
<p class="text-[11px] text-gray-400">Contenu pédocriminel ou terroriste : vous pouvez aussi le signaler sur <a href="https://www.internet-signalement.gouv.fr" target="_blank" rel="noopener" class="underline">internet-signalement.gouv.fr</a>. Voir l'<a href="legal.html#cgu/cgu-contenus" target="_blank" rel="noopener" class="underline">article 9 des CGU</a>.</p>`;
|
|
openSheet('Signaler un contenu', body, 'Envoyer le signalement', function (data) {
|
|
if (!Array.isArray(u.reports)) u.reports = [];
|
|
u.reports.push({ kind, label, reason: data.get('reason'), details: data.get('details'), email: data.get('email'), at: Date.now() });
|
|
triggerCustomModal('Signalement reçu. Vous serez informé de la décision prise.', 'check');
|
|
});
|
|
};
|
|
|
|
renderPassManage();
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html> |