feat: Gestion des secteurs et migration v3.0.4+304

- Ajout système complet de gestion des secteurs avec contours géographiques
- Import des contours départementaux depuis GeoJSON
- API REST pour la gestion des secteurs (/api/sectors)
- Service de géolocalisation pour déterminer les secteurs
- Migration base de données avec tables x_departements_contours et sectors_adresses
- Interface Flutter pour visualisation et gestion des secteurs
- Ajout thème sombre dans l'application
- Corrections diverses et optimisations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
pierre
2025-08-07 11:01:45 +02:00
parent 3bbc599ab4
commit 1018b86537
620 changed files with 120502 additions and 91396 deletions

2
web/.env-deploy-geosector-dev Normal file → Executable file
View File

@@ -2,7 +2,7 @@
HOST_SSH_HOST=195.154.80.116 # Adresse IP du serveur hôte
HOST_SSH_USER=pierre # Utilisateur SSH sur le serveur hôte
HOST_SSH_PORT=22 # Port SSH du serveur hôte
HOST_SSH_KEY=/Users/pierre/.ssh/id_rsa_mbpi # Clé SSH privée pour accéder au serveur hôte
HOST_SSH_KEY=/home/pierre/.ssh/id_rsa_mbpi # Clé SSH privée pour accéder au serveur hôte
# Configuration du conteneur Incus hébergeant cette application
CT_PROJECT_NAME=default # Nom du projet Incus où se trouve le conteneur

34
web/CLAUDE.md Executable file
View File

@@ -0,0 +1,34 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Build Commands
- Development: `npm run dev` - Start Vite development server with hot-reload
- Build: `npm run build` - Build production-ready static files to `dist/` directory
- Preview: `npm run preview` - Preview production build locally
## Project Structure
This is a Svelte + Vite + TailwindCSS project without SvelteKit. Key characteristics:
- Pure Svelte application with custom client-side routing
- TailwindCSS for styling with custom Figtree font family
- No server-side rendering or API routes
- Static site deployment via `deploy-web.sh`
## Architecture Overview
- **Routing**: Custom client-side routing implemented in `App.svelte` using browser history API
- **Pages**: Located in `src/pages/` - each page is a Svelte component
- **Components**: Reusable components in `src/components/`
- **Services**: Business logic in `src/lib/` (analytics, cookies)
- **Styling**: TailwindCSS with configuration in `tailwind.config.js`
- **Assets**: Static assets in `public/` (fonts, images, icons)
## Development Workflow
- Pages are added to `src/pages/` and imported in `App.svelte`
- Route handling is done through the `activePage` state variable
- Cookie consent and analytics tracking are integrated throughout
- Static deployment copies `dist/` contents to production server
## Deployment
- Production deployment script: `deploy-web.sh`
- Builds and packages the application for deployment to Incus container
- Environment variables loaded from `.env-deploy-geosector-dev`

0
web/README.md Normal file → Executable file
View File

View File

@@ -2,7 +2,7 @@
# Script de déploiement de Geosector Web
cd /Users/pierre/dev/geosector/web
cd /home/pierre/dev/geosector/web
# Vérifier si .env.deploy existe
ENV_FILE=".env-deploy-geosector-dev"
@@ -52,6 +52,12 @@ SERVER_DIR="server"
LOCAL_DEPLOY_DIR="deploy"
DEPLOY_PACKAGE="$APP_NAME-deploy.tar.gz"
# 0. Nettoyer et réinstaller les dépendances si nécessaire
if [ ! -d "node_modules" ] || [ ! -f "package-lock.json" ]; then
echo "=== Installation des dépendances ==="
npm install
fi
# 1. Build du frontend principal
echo "=== Construction du frontend principal ==="
npm run build

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
web/deploy/favicon-16.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
web/deploy/favicon-32.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
web/deploy/favicon-64.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

0
web/deploy/favicon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
web/deploy/fonts/Figtree-VariableFont_wght.ttf Normal file → Executable file
View File

0
web/deploy/fonts/Kallisto-Bold.otf Normal file → Executable file
View File

0
web/deploy/fonts/Kallisto-Medium.otf Normal file → Executable file
View File

0
web/deploy/fonts/Kallisto-Thin.otf Normal file → Executable file
View File

0
web/deploy/icons/Icon-152.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

0
web/deploy/icons/Icon-167.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

0
web/deploy/icons/Icon-180.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
web/deploy/icons/Icon-192.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
web/deploy/icons/Icon-512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

0
web/deploy/icons/Icon-maskable-192.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
web/deploy/icons/Icon-maskable-512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

0
web/deploy/images/Logo-geosector-horizontal.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

0
web/deploy/images/Logo-geosector-vertical.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

0
web/deploy/images/app-screenshot.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

0
web/deploy/images/geosector-icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

0
web/deploy/images/geosector-logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 342 KiB

After

Width:  |  Height:  |  Size: 342 KiB

0
web/deploy/images/geosector-logo.svg Normal file → Executable file
View File

0
web/deploy/images/icon-geosector.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

4
web/deploy/index.html Normal file → Executable file
View File

@@ -11,8 +11,8 @@
<meta name="keywords" content="geosector, distribution, logistique, optimisation, tournées, livraison" />
<link rel="preload" href="/fonts/Figtree-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin />
<title>Geosector - Gestion efficace de vos distributions</title>
<script type="module" crossorigin src="/assets/index-DOjj7eym.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C15RTrFl.css">
<script type="module" crossorigin src="/assets/index-CMFopX_9.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-WF7yUNnB.css">
</head>
<body>
<div id="app"></div>

0
web/deploy/vite.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

65
web/dist/assets/index-CMFopX_9.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@@ -11,8 +11,8 @@
<meta name="keywords" content="geosector, distribution, logistique, optimisation, tournées, livraison" />
<link rel="preload" href="/fonts/Figtree-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin />
<title>Geosector - Gestion efficace de vos distributions</title>
<script type="module" crossorigin src="/assets/index-DOjj7eym.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C15RTrFl.css">
<script type="module" crossorigin src="/assets/index-CMFopX_9.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-WF7yUNnB.css">
</head>
<body>
<div id="app"></div>

BIN
web/geosector-deploy.tar.gz Normal file → Executable file

Binary file not shown.

0
web/index.html Normal file → Executable file
View File

0
web/jsconfig.json Normal file → Executable file
View File

View File

@@ -9,7 +9,7 @@ fi
HOST_IP="195.154.80.116"
HOST_USER=root
HOST_KEY=/Users/pierre/.ssh/id_rsa_mbpi
HOST_KEY=/home/pierre/.ssh/id_rsa_mbpi
HOST_PORT=22
SOURCE_CONTAINER=$1

639
web/package-lock.json generated Normal file → Executable file

File diff suppressed because it is too large Load Diff

0
web/package.json Normal file → Executable file
View File

0
web/postcss.config.js Normal file → Executable file
View File

0
web/public/.htaccess Normal file → Executable file
View File

0
web/public/favicon-16.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
web/public/favicon-32.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
web/public/favicon-64.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

0
web/public/favicon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
web/public/fonts/Figtree-VariableFont_wght.ttf Normal file → Executable file
View File

0
web/public/fonts/Kallisto-Bold.otf Normal file → Executable file
View File

0
web/public/fonts/Kallisto-Medium.otf Normal file → Executable file
View File

0
web/public/fonts/Kallisto-Thin.otf Normal file → Executable file
View File

0
web/public/icons/Icon-152.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

0
web/public/icons/Icon-167.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

0
web/public/icons/Icon-180.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
web/public/icons/Icon-192.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
web/public/icons/Icon-512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

0
web/public/icons/Icon-maskable-192.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

0
web/public/icons/Icon-maskable-512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

0
web/public/images/Logo-geosector-horizontal.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

0
web/public/images/Logo-geosector-vertical.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

0
web/public/images/app-screenshot.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

0
web/public/images/geosector-icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

0
web/public/images/geosector-logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 342 KiB

After

Width:  |  Height:  |  Size: 342 KiB

0
web/public/images/geosector-logo.svg Normal file → Executable file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

0
web/public/images/icon-geosector.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
web/public/vite.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
web/src/App.svelte Normal file → Executable file
View File

0
web/src/app.css Normal file → Executable file
View File

0
web/src/assets/svelte.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
web/src/components/CookieConsent.svelte Normal file → Executable file
View File

0
web/src/components/Footer.svelte Normal file → Executable file
View File

36
web/src/components/Header.svelte Normal file → Executable file
View File

@@ -36,11 +36,14 @@
function changePage(page) {
activePage = page;
window.history.pushState({}, '', `/${page}`);
// Déclencher un événement popstate pour que App.svelte mette à jour la page
window.dispatchEvent(new PopStateEvent('popstate'));
closeMobileMenu();
}
// Fonctions pour le menu mobile
function toggleMobileMenu() {
function toggleMobileMenu(event) {
event.stopPropagation();
mobileMenuOpen = !mobileMenuOpen;
}
@@ -69,7 +72,10 @@
}
};
document.addEventListener('click', handleClickOutside);
// Ajouter un petit délai pour éviter les conflits avec le clic du bouton
setTimeout(() => {
document.addEventListener('click', handleClickOutside);
}, 100);
return () => {
document.removeEventListener('click', handleClickOutside);
@@ -89,7 +95,7 @@
</div>
<!-- Burger menu pour mobile -->
<button id="burger-button" class="xl:hidden z-50" on:click={toggleMobileMenu}>
<button id="burger-button" class="xl:hidden z-50" on:click|stopPropagation={toggleMobileMenu}>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-[#002C66]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
{#if mobileMenuOpen}
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
@@ -117,7 +123,7 @@
<div class="flex gap-3 items-center">
<a
href="{baseAppUrl}/login/user"
href="{baseAppUrl}/?action=login&type=user"
class="border-2 border-[#4CAF50] text-[#4CAF50] hover:bg-[#4CAF50] hover:text-white font-medium py-1.5 px-3 rounded-full transition-colors"
on:click={() => {
sessionStorage.setItem('loginType', 'user');
@@ -126,7 +132,7 @@
Connexion Utilisateur
</a>
<a
href="{baseAppUrl}/login/admin"
href="{baseAppUrl}/?action=login&type=admin"
class="border-2 border-red-600 text-red-600 hover:bg-red-600 hover:text-white font-medium py-1.5 px-3 rounded-full transition-colors"
on:click={() => {
sessionStorage.setItem('loginType', 'admin');
@@ -134,23 +140,15 @@
>
Connexion Administrateur
</a>
<a href="{baseAppUrl}/register" class="bg-[#E3170A] hover:bg-red-700 text-white font-medium py-2 px-4 rounded-full transition-colors"> S'inscrire </a>
<a href="{baseAppUrl}/?action=register" class="bg-[#E3170A] hover:bg-red-700 text-white font-medium py-2 px-4 rounded-full transition-colors"> S'inscrire </a>
</div>
</div>
</div>
</div>
<!-- Menu mobile -->
<div id="mobile-menu" class={`fixed top-0 right-0 h-screen w-4/5 max-w-xs bg-white shadow-lg transform transition-transform duration-300 ease-in-out z-40 ${mobileMenuOpen ? 'translate-x-0' : 'translate-x-full'}`}>
<div class="p-6">
<div class="flex justify-end mb-8">
<button on:click={closeMobileMenu} class="text-gray-600" aria-label="Fermer le menu">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div id="mobile-menu" class={`xl:hidden fixed top-0 right-0 h-screen w-4/5 max-w-xs bg-white shadow-lg transform transition-transform duration-300 ease-in-out z-40 ${mobileMenuOpen ? 'translate-x-0' : 'translate-x-full'}`}>
<div class="p-6 pt-20">
<nav class="mb-8">
<ul class="space-y-4">
<li>
@@ -167,7 +165,7 @@
<div class="space-y-4">
<a
href="{baseAppUrl}/login/user"
href="{baseAppUrl}/?action=login&type=user"
class="block w-full border-2 border-[#4CAF50] text-[#4CAF50] hover:bg-[#4CAF50] hover:text-white font-medium py-2 px-4 rounded-full transition-colors text-center mb-3"
on:click={() => {
sessionStorage.setItem('loginType', 'user');
@@ -176,7 +174,7 @@
Connexion Utilisateur
</a>
<a
href="{baseAppUrl}/login/admin"
href="{baseAppUrl}/?action=login&type=admin"
class="block w-full border-2 border-red-600 text-red-600 hover:bg-red-600 hover:text-white font-medium py-2 px-4 rounded-full transition-colors text-center mb-3"
on:click={() => {
sessionStorage.setItem('loginType', 'admin');
@@ -184,7 +182,7 @@
>
Connexion Administrateur
</a>
<a href="{baseAppUrl}/register" class="block w-full bg-[#E3170A] hover:bg-red-700 text-white font-medium py-2 px-4 rounded-full transition-colors text-center"> S'inscrire </a>
<a href="{baseAppUrl}/?action=register" class="block w-full bg-[#E3170A] hover:bg-red-700 text-white font-medium py-2 px-4 rounded-full transition-colors text-center"> S'inscrire </a>
</div>
</div>
</div>

0
web/src/lib/Counter.svelte Normal file → Executable file
View File

0
web/src/lib/analyticsService.js Normal file → Executable file
View File

0
web/src/lib/cookieService.js Normal file → Executable file
View File

0
web/src/main.js Normal file → Executable file
View File

0
web/src/pages/Accueil.svelte Normal file → Executable file
View File

0
web/src/pages/ConditionsUtilisation.svelte Normal file → Executable file
View File

0
web/src/pages/Contact.svelte Normal file → Executable file
View File

0
web/src/pages/Fonctionnalites.svelte Normal file → Executable file
View File

0
web/src/pages/MentionsLegales.svelte Normal file → Executable file
View File

0
web/src/pages/PolitiqueConfidentialite.svelte Normal file → Executable file
View File

0
web/src/vite-env.d.ts vendored Normal file → Executable file
View File

0
web/svelte.config.js Normal file → Executable file
View File

0
web/tailwind.config.js Normal file → Executable file
View File

0
web/vite.config.js Normal file → Executable file
View File