diff --git a/app/Http/Controllers/CandidateController.php b/app/Http/Controllers/CandidateController.php index d92ef69..61e7975 100644 --- a/app/Http/Controllers/CandidateController.php +++ b/app/Http/Controllers/CandidateController.php @@ -55,6 +55,27 @@ class CandidateController extends Controller ]); } + public function map() + { + $candidates = Candidate::with(['user', 'jobPosition']) + ->whereNotNull('city') + ->where('city', '!=', '') + ->get() + ->map(function($c) { + return [ + 'id' => $c->id, + 'name' => $c->user->name, + 'city' => $c->city, + 'job' => $c->jobPosition?->title, + 'score' => $c->weighted_score + ]; + }); + + return \Inertia\Inertia::render('Admin/Candidates/Map', [ + 'candidates' => $candidates + ]); + } + public function updateOrder(Request $request) { $request->validate([ @@ -286,6 +307,8 @@ class CandidateController extends Controller $this->storeDocument($candidate, $file, $type); } + + public function toggleSelection(Candidate $candidate) { $candidate->update([ diff --git a/package-lock.json b/package-lock.json index 4788559..b6b7bc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "@tailwindcss/typography": "^0.5.19", "chart.js": "^4.5.1", "date-fns": "^4.1.0", + "leaflet": "^1.9.4", "marked": "^17.0.4", "vuedraggable": "^4.1.0" }, @@ -1937,6 +1938,12 @@ "vite": "^8.0.0" } }, + "node_modules/leaflet": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz", + "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", + "license": "BSD-2-Clause" + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", diff --git a/package.json b/package.json index 8da98a9..e872127 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@tailwindcss/typography": "^0.5.19", "chart.js": "^4.5.1", "date-fns": "^4.1.0", + "leaflet": "^1.9.4", "marked": "^17.0.4", "vuedraggable": "^4.1.0" } diff --git a/resources/js/Layouts/AdminLayout.vue b/resources/js/Layouts/AdminLayout.vue index ff4235f..f7beed9 100644 --- a/resources/js/Layouts/AdminLayout.vue +++ b/resources/js/Layouts/AdminLayout.vue @@ -55,6 +55,11 @@ const navItems = [ label: 'Selection', icon: 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z', }, + { + route: 'admin.candidates.map', + label: 'Carte', + icon: 'M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z M15 11a3 3 0 11-6 0 3 3 0 016 0z', + }, ]; const superAdminItems = [ diff --git a/resources/js/Pages/Admin/Candidates/Map.vue b/resources/js/Pages/Admin/Candidates/Map.vue new file mode 100644 index 0000000..05ad13b --- /dev/null +++ b/resources/js/Pages/Admin/Candidates/Map.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/routes/web.php b/routes/web.php index 8d3fa31..18017c8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -80,6 +80,7 @@ Route::middleware('auth')->group(function () { Route::middleware('admin')->prefix('admin')->name('admin.')->group(function () { Route::get('/comparative', [\App\Http\Controllers\CandidateController::class, 'comparative'])->name('comparative'); Route::get('/candidates/selected', [\App\Http\Controllers\CandidateController::class, 'selectedCandidates'])->name('candidates.selected'); + Route::get('/candidates/map', [\App\Http\Controllers\CandidateController::class, 'map'])->name('candidates.map'); Route::post('/candidates/update-order', [\App\Http\Controllers\CandidateController::class, 'updateOrder'])->name('candidates.update-order'); Route::resource('candidates', \App\Http\Controllers\CandidateController::class)->only(['index', 'store', 'show', 'destroy', 'update']); Route::patch('/candidates/{candidate}/notes', [\App\Http\Controllers\CandidateController::class, 'updateNotes'])->name('candidates.update-notes');