From 351b9064af9274f931641666f657ee3407261242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Wed, 1 Jul 2026 17:43:22 +0300 Subject: [PATCH] feat: integrate Quill editor for internship journal entries, add retroactive field support, and enforce future date restrictions --- .../InternApplicationResource.php | 14 ++- app/Http/Controllers/CareerController.php | 13 +- app/Models/InternshipJournalEntry.php | 5 + ...e_fields_to_internship_journal_entries.php | 28 +++++ .../front/career/intern_dashboard.blade.php | 119 ++++++++++++++++-- resources/views/front/career/print.blade.php | 18 ++- resources/views/front/career/verify.blade.php | 22 +++- 7 files changed, 197 insertions(+), 22 deletions(-) create mode 100644 database/migrations/2026_07_01_180002_add_retroactive_fields_to_internship_journal_entries.php diff --git a/app/Filament/Admin/Resources/InternApplications/InternApplicationResource.php b/app/Filament/Admin/Resources/InternApplications/InternApplicationResource.php index fca75f2..ecdafc7 100644 --- a/app/Filament/Admin/Resources/InternApplications/InternApplicationResource.php +++ b/app/Filament/Admin/Resources/InternApplications/InternApplicationResource.php @@ -203,12 +203,22 @@ class InternApplicationResource extends Resource foreach ($days as $d) { $dayNum = $d['day_number']; $dateF = $d['formatted_date']; - $content = isset($saved[$dayNum]) ? $saved[$dayNum]->content : ''; + $entry = $saved->get($dayNum); + $content = $entry ? $entry->content : ''; + $isRetro = $entry ? $entry->is_retroactive : false; + $updatedAt = $entry ? $entry->updated_at->format('d.m.Y H:i') : null; $html .= '
'; $html .= '
'; $html .= ' ' . $dayNum . '. Gün Raporu'; - $html .= ' ' . $dateF . ''; + if ($isRetro) { + $html .= ' GERİYE DÖNÜK KAYIT'; + } + if ($updatedAt) { + $html .= ' Son Güncelleme: ' . $updatedAt . ''; + } else { + $html .= ' ' . $dateF . ''; + } $html .= '
'; $html .= '
' . ($content ? e($content) : 'Rapor yazılmamış') . '
'; $html .= '
'; diff --git a/app/Http/Controllers/CareerController.php b/app/Http/Controllers/CareerController.php index 91b4785..627b265 100644 --- a/app/Http/Controllers/CareerController.php +++ b/app/Http/Controllers/CareerController.php @@ -472,21 +472,32 @@ class CareerController extends Controller ]); $dateObj = \Carbon\Carbon::parse($request->date); + + // 1. Prevent future entries + if ($dateObj->isFuture()) { + return response()->json(['success' => false, 'message' => 'İleriye dönük staj günleri için defter doldurulamaz.'], 422); + } + + // 2. Prevent weekend entries if ($dateObj->isWeekend()) { return response()->json(['success' => false, 'message' => 'Hafta sonu günlerine staj günlüğü girilemez.'], 422); } + // 3. Determine if retroactive + $isRetroactive = $dateObj->lt(\Carbon\Carbon::today()); + $entry = \App\Models\InternshipJournalEntry::updateOrCreate([ 'career_application_id' => $intern->id, 'day_number' => $request->day_number, 'date' => $request->date, ], [ 'content' => $request->content, + 'is_retroactive' => $isRetroactive, ]); return response()->json([ 'success' => true, - 'message' => $request->day_number . '. Gün kaydı başarıyla kaydedildi.', + 'message' => $request->day_number . '. Gün kaydı başarıyla kaydedildi.' . ($isRetroactive ? ' (Geriye Dönük Kayıt)' : ''), 'entry' => $entry ]); } diff --git a/app/Models/InternshipJournalEntry.php b/app/Models/InternshipJournalEntry.php index dbbb949..8afa936 100644 --- a/app/Models/InternshipJournalEntry.php +++ b/app/Models/InternshipJournalEntry.php @@ -14,6 +14,11 @@ class InternshipJournalEntry extends Model 'day_number', 'date', 'content', + 'is_retroactive', + ]; + + protected $casts = [ + 'is_retroactive' => 'boolean', ]; /** diff --git a/database/migrations/2026_07_01_180002_add_retroactive_fields_to_internship_journal_entries.php b/database/migrations/2026_07_01_180002_add_retroactive_fields_to_internship_journal_entries.php new file mode 100644 index 0000000..c0169d6 --- /dev/null +++ b/database/migrations/2026_07_01_180002_add_retroactive_fields_to_internship_journal_entries.php @@ -0,0 +1,28 @@ +boolean('is_retroactive')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('internship_journal_entries', function (Blueprint $table) { + $table->dropColumn('is_retroactive'); + }); + } +}; diff --git a/resources/views/front/career/intern_dashboard.blade.php b/resources/views/front/career/intern_dashboard.blade.php index a8bcfca..dc57a8a 100644 --- a/resources/views/front/career/intern_dashboard.blade.php +++ b/resources/views/front/career/intern_dashboard.blade.php @@ -722,14 +722,20 @@
-
+ + +
- +
+
+
-
@@ -789,6 +795,8 @@
@push('styles') + +