From 0e558fd1dcddfa1b3bbb0f8d73e07fb0815a80d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 26 Jun 2026 15:54:21 +0300 Subject: [PATCH] feat: implement intern admin portal with login and dashboard management functionality --- app/Http/Controllers/CareerController.php | 97 +++++- .../front/career/admin_dashboard.blade.php | 279 ++++++++++++++++++ .../views/front/career/admin_login.blade.php | 87 ++++++ routes/web.php | 7 + 4 files changed, 467 insertions(+), 3 deletions(-) create mode 100644 resources/views/front/career/admin_dashboard.blade.php create mode 100644 resources/views/front/career/admin_login.blade.php diff --git a/app/Http/Controllers/CareerController.php b/app/Http/Controllers/CareerController.php index 52e1afa..ea056ac 100644 --- a/app/Http/Controllers/CareerController.php +++ b/app/Http/Controllers/CareerController.php @@ -223,11 +223,18 @@ class CareerController extends Controller public function downloadMarkdown() { - if (!session()->has('intern_id')) { - return redirect()->route('intern.login')->with('error', 'Lütfen önce giriş yapın.'); + if (request()->has('intern_id') && auth()->check() && auth()->user()->hasRole('super_admin')) { + $internId = request('intern_id'); + } else { + if (!session()->has('intern_id')) { + return redirect()->route('intern.login')->with('error', 'Lütfen önce giriş yapın.'); + } + $internId = session('intern_id'); } - $intern = CareerApplication::findOrFail(session('intern_id')); + + $intern = CareerApplication::findOrFail($internId); $repo = $intern->github_repo; + if (!$repo) { return redirect()->back()->with('error', 'Lütfen önce Github deposunu tanımlayın.'); } @@ -328,4 +335,88 @@ class CareerController extends Controller ] ]); } + + public function internAdminLoginForm() + { + if (auth()->check() && auth()->user()->hasRole('super_admin')) { + return redirect()->route('intern.admin.dashboard'); + } + return view('front.career.admin_login', [ + 'meta' => [ + 'title' => 'Yönetici Girişi - Staj Takip', + 'description' => 'Stajyerleri yönetmek için giriş yapın.', + ] + ]); + } + + public function internAdminLogin(Request $request) + { + $request->validate([ + 'email' => 'required|email', + 'password' => 'required|string', + ]); + + if (auth()->attempt($request->only('email', 'password'))) { + if (auth()->user()->hasRole('super_admin')) { + return redirect()->route('intern.admin.dashboard')->with('success', 'Yönetici girişi başarıyla gerçekleştirildi.'); + } + + auth()->logout(); + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors([ + 'email' => 'Bu panele erişmek için super_admin yetkinizin olması gerekir.', + ]); + } + + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors([ + 'email' => 'Girdiğiniz bilgiler eşleşmedi veya hatalı.', + ]); + } + + public function internAdminDashboard() + { + if (!auth()->check() || !auth()->user()->hasRole('super_admin')) { + return redirect()->route('intern.admin.login')->with('error', 'Lütfen önce yönetici olarak giriş yapın.'); + } + + $allInterns = CareerApplication::where('type', 'internship') + ->orderBy('created_at', 'desc') + ->get(); + + $ganttInterns = CareerApplication::where('type', 'internship') + ->where('status', 'accepted') + ->whereNotNull('internship_start_date') + ->whereNotNull('internship_end_date') + ->orderBy('internship_start_date', 'asc') + ->get() + ->map(function ($intern) { + return [ + 'id' => $intern->id, + 'parentId' => 0, + 'title' => $intern->name, + 'start' => $intern->internship_start_date, + 'end' => $intern->internship_end_date, + 'progress' => 100 + ]; + }); + + return view('front.career.admin_dashboard', [ + 'allInterns' => $allInterns, + 'ganttInterns' => $ganttInterns, + 'meta' => [ + 'title' => 'Staj Yönetici Paneli', + 'description' => 'Stajyer bilgilerini ve takvimlerini izleyin.', + ] + ]); + } + + public function internAdminLogout() + { + auth()->logout(); + return redirect()->route('intern.admin.login')->with('success', 'Yönetici oturumu sonlandırıldı.'); + } } + diff --git a/resources/views/front/career/admin_dashboard.blade.php b/resources/views/front/career/admin_dashboard.blade.php new file mode 100644 index 0000000..f13c9b9 --- /dev/null +++ b/resources/views/front/career/admin_dashboard.blade.php @@ -0,0 +1,279 @@ +@extends('layouts.site') + +@section('content') +
+
+
+ + +
+
+ Yönetici Paneli +

Hoş Geldiniz, Yöneticimiz

+

Stajyer başvurularını, takvimlerini ve proje depolarını buradan takip edebilirsiniz.

+
+
+ + + Ana Sayfa + +
+ @csrf + +
+
+
+ + +
+
+
+ +
+
+ Toplam Stajyer + {{ $allInterns->count() }} +
+
+ +
+
+ +
+
+ Kabul Edilen + {{ $allInterns->where('status', 'accepted')->count() }} +
+
+ +
+
+ +
+
+ Evrak Bekleyen + {{ $allInterns->where('status', 'waiting_document')->count() }} +
+
+ +
+
+ +
+
+ Git Tanımlayan + {{ $allInterns->whereNotNull('github_repo')->count() }} +
+
+
+ + +
+
+

+ + Stajyer Gantt Şeması ve Takvimi +

+ DevExtreme Görünümü +
+ + @if($ganttInterns->isEmpty()) +
+ +

Tarihleri belirlenmiş onaylı stajyer bulunamadı.

+
+ @else + +
+
+
+ @endif +
+ + +
+

+ + Stajyer Listesi ve Detaylı Takip +

+ +
+ + + + + + + + + + + + + @foreach($allInterns as $intern) + + + + + + + + + + + + + + + + + + + + @endforeach + +
StajyerStaj TarihleriDurumBelgelerGitHub & RepoKayıt Tarihi
+
{{ $intern->name }}
+
+ {{ $intern->email }} + @if($intern->phone) + {{ $intern->phone }} + @endif +
+
+ @if($intern->internship_start_date && $intern->internship_end_date) +
+ {{ \Carbon\Carbon::parse($intern->internship_start_date)->format('d.m.Y') }} - {{ \Carbon\Carbon::parse($intern->internship_end_date)->format('d.m.Y') }} + {{ $intern->internship_total_days }} İş Günü +
+ @else + Belirlenmemiş + @endif +
+ + @if($intern->status === 'accepted') Kabul Edildi + @elseif($intern->status === 'rejected') Reddedildi + @elseif($intern->status === 'reviewed') İncelendi + @elseif($intern->status === 'waiting_document') Evrak Bekleniyor + @else Beklemede @endif + + +
+ @if($intern->cv_path) + + CV + + @endif + + @if($intern->to_be_signed_internship_form_path) + + İmzalanacak Form + + @endif + + @if($intern->signed_internship_form_path) + + İmzalı Form + + @endif +
+
+ @if($intern->github_repo) + + @else + Tanımlanmamış + @endif + + {{ \Carbon\Carbon::parse($intern->created_at)->format('d.m.Y H:i') }} +
+
+
+ +
+
+
+@endsection + +@push('styles') + + + + + + +@if(!$ganttInterns->isEmpty()) + + + + +@endif +@endpush diff --git a/resources/views/front/career/admin_login.blade.php b/resources/views/front/career/admin_login.blade.php new file mode 100644 index 0000000..98af613 --- /dev/null +++ b/resources/views/front/career/admin_login.blade.php @@ -0,0 +1,87 @@ +@extends('layouts.site') + +@section('content') +
+
+
+
+
+
+ +
+

Yönetici Girişi

+

Staj takip sistemini yönetmek için e-posta ve şifrenizle giriş yapın.

+
+ + @if($errors->any()) +
+
+
+ +
+
+

+ {{ $errors->first() }} +

+
+
+
+ @endif + + @if(session('success')) +
+
+
+ +
+
+

+ {{ session('success') }} +

+
+
+
+ @endif + +
+ @csrf + +
+ +
+ + + + +
+
+ +
+ +
+ + + + +
+
+ + +
+
+
+
+
+ +@push('styles') + + +@endpush +@endsection diff --git a/routes/web.php b/routes/web.php index 7edf8e8..0c3aa8e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -125,6 +125,13 @@ Route::get('/stajyer/gunluk-indir', [\App\Http\Controllers\CareerController::cla Route::get('/staj-dogrulama/{code}', [\App\Http\Controllers\CareerController::class, 'verifyCertificate'])->name('internship.verify'); Route::post('/stajyer/cikis', [\App\Http\Controllers\CareerController::class, 'internLogout'])->name('intern.logout'); +// Intern Admin Portal +Route::get('/stajyer/admin/giris', [\App\Http\Controllers\CareerController::class, 'internAdminLoginForm'])->name('intern.admin.login'); +Route::post('/stajyer/admin/giris', [\App\Http\Controllers\CareerController::class, 'internAdminLogin'])->name('intern.admin.login.submit'); +Route::get('/stajyer/admin/panel', [\App\Http\Controllers\CareerController::class, 'internAdminDashboard'])->name('intern.admin.dashboard'); +Route::post('/stajyer/admin/cikis', [\App\Http\Controllers\CareerController::class, 'internAdminLogout'])->name('intern.admin.logout'); + + // Payment Process Route::post('/payment/process', [\App\Http\Controllers\PaymentController::class, 'process'])->name('payment.process'); Route::any('/payment/success', [\App\Http\Controllers\PaymentController::class, 'success'])->name('payment.success');