diff --git a/app/Http/Controllers/CandidateController.php b/app/Http/Controllers/CandidateController.php index 16818d9..f343603 100644 --- a/app/Http/Controllers/CandidateController.php +++ b/app/Http/Controllers/CandidateController.php @@ -116,6 +116,19 @@ class CandidateController extends Controller return back()->with('success', 'Documents mis à jour avec succès.'); } + public function updateNotes(Request $request, Candidate $candidate) + { + $request->validate([ + 'notes' => 'nullable|string', + ]); + + $candidate->update([ + 'notes' => $request->notes, + ]); + + return back()->with('success', 'Notes mises à jour avec succès.'); + } + public function resetPassword(Candidate $candidate) { $password = Str::random(10); diff --git a/app/Models/Candidate.php b/app/Models/Candidate.php index feba303..277e31f 100644 --- a/app/Models/Candidate.php +++ b/app/Models/Candidate.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Attributes\Fillable; use Illuminate\Database\Eloquent\Factories\HasFactory; -#[Fillable(['user_id', 'phone', 'linkedin_url', 'status'])] +#[Fillable(['user_id', 'phone', 'linkedin_url', 'status', 'notes'])] class Candidate extends Model { use HasFactory; diff --git a/database/migrations/2026_03_20_090804_add_notes_to_candidates_table.php b/database/migrations/2026_03_20_090804_add_notes_to_candidates_table.php new file mode 100644 index 0000000..135654b --- /dev/null +++ b/database/migrations/2026_03_20_090804_add_notes_to_candidates_table.php @@ -0,0 +1,28 @@ +longText('notes')->nullable()->after('status'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('candidates', function (Blueprint $table) { + $table->dropColumn('notes'); + }); + } +}; diff --git a/resources/js/Pages/Admin/Candidates/Show.vue b/resources/js/Pages/Admin/Candidates/Show.vue index 46e6dee..0f93519 100644 --- a/resources/js/Pages/Admin/Candidates/Show.vue +++ b/resources/js/Pages/Admin/Candidates/Show.vue @@ -23,6 +23,10 @@ const docForm = useForm({ _method: 'PUT' // For file upload via PUT in Laravel }); +const notesForm = useForm({ + notes: props.candidate.notes || '' +}); + const openAttempts = ref([]); const toggleAttempt = (id) => { @@ -71,6 +75,12 @@ const updateDocuments = () => { }); }; +const saveNotes = () => { + notesForm.patch(route('admin.candidates.update-notes', props.candidate.id), { + preserveScroll: true, + }); +}; + const openPreview = (doc) => { selectedDocument.value = doc; }; @@ -204,6 +214,42 @@ const openPreview = (doc) => {