admin pages
This commit is contained in:
parent
679e37b780
commit
d24235a2b7
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class AdminAuthController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function showLoginForm()
|
||||||
|
{
|
||||||
|
return view('adminlogin');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function login(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'username' => 'required',
|
||||||
|
'password' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$admin = DB::table('adminlogins')->where('username', $request->username)->first();
|
||||||
|
|
||||||
|
if ($admin && Hash::check($request->password, $admin->password)) {
|
||||||
|
|
||||||
|
session([
|
||||||
|
'admin_id' => $admin->id,
|
||||||
|
'admin_username' => $admin->username
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Login Successful!',
|
||||||
|
'redirect_url' => url('admin/adminmycourese')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Wrong Username or Password!'
|
||||||
|
], 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
// 1. Session එකෙන් Admin දත්ත ඉවත් කර Session එක Invalidate කිරීම
|
||||||
|
$request->session()->forget(['admin_id', 'admin_username']);
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
// 2. Request එක AJAX / JSON එකක් නම් JSON Response එකක් යැවීම
|
||||||
|
if ($request->ajax() || $request->wantsJson()) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'redirect_url' => route('admin.login')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Normal Form submit එකක් නම් කෙලින්ම Login page එකට Redirect කිරීම
|
||||||
|
return redirect()->route('admin.login')->with('success', 'Logged out successfully!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Timetable;
|
||||||
|
use App\Models\Notification;
|
||||||
|
|
||||||
|
class AdminDashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (!session()->has('admin_id')) {
|
||||||
|
return redirect()->route('admin.login')->with('error', 'Please login first.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$totalTimetableSlots = Timetable::count();
|
||||||
|
|
||||||
|
$unreadNotifications = Notification::where('target_role', 'admin')
|
||||||
|
->where('is_read', false)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$notifications = Notification::where('target_role', 'admin')
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->take(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('admin.admindashboard', compact(
|
||||||
|
'totalTimetableSlots',
|
||||||
|
'unreadNotifications',
|
||||||
|
'notifications'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsRead($id)
|
||||||
|
{
|
||||||
|
$notification = Notification::findOrFail($id);
|
||||||
|
$notification->update(['is_read' => true]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Notification marked as read!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use App\Models\AdminLogin;
|
||||||
|
|
||||||
|
class AdminProfileController extends Controller
|
||||||
|
{
|
||||||
|
// Display Admin Profile
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$adminId = session('admin_id');
|
||||||
|
$admin = AdminLogin::find($adminId);
|
||||||
|
|
||||||
|
return view('admin.adminprofile', compact('admin'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Username Information
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$adminId = session('admin_id');
|
||||||
|
$admin = AdminLogin::findOrFail($adminId);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'username' => 'required|string|max:255|unique:adminlogins,username,' . $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$admin->update([
|
||||||
|
'username' => $request->username,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Username updated successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change Password
|
||||||
|
public function updatePassword(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => 'required',
|
||||||
|
'new_password' => 'required|min:6|confirmed',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$adminId = session('admin_id');
|
||||||
|
$admin = AdminLogin::findOrFail($adminId);
|
||||||
|
|
||||||
|
// Verify current password
|
||||||
|
if (!Hash::check($request->current_password, $admin->password)) {
|
||||||
|
return redirect()->back()->withErrors(['current_password' => 'Current password does not match our records.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update to new password
|
||||||
|
$admin->update([
|
||||||
|
'password' => Hash::make($request->new_password)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Password updated successfully!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Result; // Adjust based on your model name
|
||||||
|
|
||||||
|
class AdminResultsController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$results = Result::orderBy('id', 'desc')->get();
|
||||||
|
return view('admin.adminresults', compact('results'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'student_log_id' => 'required|string|max:255',
|
||||||
|
'module_code' => 'required|string|max:255',
|
||||||
|
'module_name' => 'required|string|max:255',
|
||||||
|
'academic_year' => 'required|string|max:255',
|
||||||
|
'semester' => 'required|string|max:255',
|
||||||
|
'marks' => 'required|numeric|min:0|max:100',
|
||||||
|
'grade' => 'required|string|max:10',
|
||||||
|
'status' => 'required|in:Pass,Fail',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Result::create($validated);
|
||||||
|
|
||||||
|
return redirect()->route('admin.results')->with('success', 'Exam result added successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'student_log_id' => 'required|string|max:255',
|
||||||
|
'module_code' => 'required|string|max:255',
|
||||||
|
'module_name' => 'required|string|max:255',
|
||||||
|
'academic_year' => 'required|string|max:255',
|
||||||
|
'semester' => 'required|string|max:255',
|
||||||
|
'marks' => 'required|numeric|min:0|max:100',
|
||||||
|
'grade' => 'required|string|max:10',
|
||||||
|
'status' => 'required|in:Pass,Fail',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$result = Result::findOrFail($id);
|
||||||
|
$result->update($validated);
|
||||||
|
|
||||||
|
return redirect()->route('admin.results')->with('success', 'Exam result updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$result = Result::findOrFail($id);
|
||||||
|
$result->delete();
|
||||||
|
|
||||||
|
return redirect()->route('admin.results')->with('success', 'Exam result deleted successfully.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Timetable;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class AdminTimetableController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (!session()->has('admin_id')) {
|
||||||
|
return redirect()->route('admin.login')->with('error', 'Please login first.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// DB එකේ තියෙන ඔක්කොම Timetable entries ගන්නවා
|
||||||
|
$allTimetables = Timetable::all();
|
||||||
|
|
||||||
|
// ඊට පස්සේ Time Slot එකයි Day එකයි අනුව Map කරගන්නවා
|
||||||
|
$grid = [];
|
||||||
|
foreach ($allTimetables as $item) {
|
||||||
|
$grid[$item->time_slot][$item->day] = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
$days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'];
|
||||||
|
|
||||||
|
$timeSlots = [
|
||||||
|
'08:30 - 10:00',
|
||||||
|
'10:45 - 12:15',
|
||||||
|
'12:15 - 01:00', // Lunch / Interval
|
||||||
|
'01:00 - 03:00'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Today's Day Name
|
||||||
|
$today = Carbon::now()->format('l');
|
||||||
|
$todaySchedule = Timetable::where('day', $today)->get();
|
||||||
|
|
||||||
|
return view('admin.admintimetable', compact('allTimetables', 'days', 'timeSlots', 'grid', 'todaySchedule', 'today'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save or Update Entry
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'time_slot' => 'required|string',
|
||||||
|
'day' => 'required|string',
|
||||||
|
'subject_name' => 'required|string|max:255',
|
||||||
|
'type' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// අදාළ Day එකටයි Time Slot එකටයි කලින් Data තිබුණොත් Update කරනවා, නැත්නම් අලුතෙන් Add කරනවා
|
||||||
|
Timetable::updateOrCreate(
|
||||||
|
[
|
||||||
|
'day' => $request->day,
|
||||||
|
'time_slot' => $request->time_slot,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'subject_name' => $request->subject_name,
|
||||||
|
'type' => $request->type,
|
||||||
|
'student_log_id' => $request->student_log_id,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Timetable updated successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete Single Slot
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$timetable = Timetable::findOrFail($id);
|
||||||
|
$timetable->delete();
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Timetable slot cleared successfully!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class adminmycoursesController extends Controller
|
||||||
|
{
|
||||||
|
// 1. Courses ලැයිස්තුව පෙන්වීම (Read)
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (!session()->has('admin_id')) {
|
||||||
|
return redirect('/adminlogin')->with('error', 'Please login first!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$courses = DB::table('courses')->orderBy('id', 'desc')->get();
|
||||||
|
return view('admin.adminmycourses', compact('courses'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. අලුත් Course එකක් එකතු කිරීම (Create)
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'course_code' => 'required|string|max:50',
|
||||||
|
'image' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048',
|
||||||
|
'duration' => 'required|string',
|
||||||
|
'level' => 'required|string',
|
||||||
|
'author' => 'nullable|string',
|
||||||
|
'desc' => 'nullable|string',
|
||||||
|
'status' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$imagePath = null;
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
$imagePath = $request->file('image')->store('courses', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::table('courses')->insert([
|
||||||
|
'title' => $request->title,
|
||||||
|
'course_code' => $request->course_code,
|
||||||
|
'image' => $imagePath,
|
||||||
|
'duration' => $request->duration,
|
||||||
|
'level' => $request->level,
|
||||||
|
'author' => $request->author ?? 'Admin',
|
||||||
|
'desc' => $request->desc,
|
||||||
|
'student' => $request->student ?? 0,
|
||||||
|
'rating' => $request->rating ?? 0.0,
|
||||||
|
'badge' => $request->badge,
|
||||||
|
'trending' => $request->has('trending') ? 1 : 0,
|
||||||
|
'status' => $request->status,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Course added successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Course එක Update කිරීම (Update)
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'course_code' => 'required|string|max:50',
|
||||||
|
'image' => 'nullable|image|mimes:jpeg,png,jpg,gif,webp|max:2048',
|
||||||
|
'duration' => 'required|string',
|
||||||
|
'level' => 'required|string',
|
||||||
|
'status' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$course = DB::table('courses')->where('id', $id)->first();
|
||||||
|
|
||||||
|
if (!$course) {
|
||||||
|
return redirect()->back()->with('error', 'Course not found!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$imagePath = $course->image;
|
||||||
|
if ($request->hasFile('image')) {
|
||||||
|
if ($course->image && Storage::disk('public')->exists($course->image)) {
|
||||||
|
Storage::disk('public')->delete($course->image);
|
||||||
|
}
|
||||||
|
$imagePath = $request->file('image')->store('courses', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::table('courses')->where('id', $id)->update([
|
||||||
|
'title' => $request->title,
|
||||||
|
'course_code' => $request->course_code,
|
||||||
|
'image' => $imagePath,
|
||||||
|
'duration' => $request->duration,
|
||||||
|
'level' => $request->level,
|
||||||
|
'author' => $request->author,
|
||||||
|
'desc' => $request->desc,
|
||||||
|
'badge' => $request->badge,
|
||||||
|
'trending' => $request->has('trending') ? 1 : 0,
|
||||||
|
'status' => $request->status,
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Course updated successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Course එක Delete කිරීම (Delete)
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$course = DB::table('courses')->where('id', $id)->first();
|
||||||
|
|
||||||
|
if ($course) {
|
||||||
|
if ($course->image && Storage::disk('public')->exists($course->image)) {
|
||||||
|
Storage::disk('public')->delete($course->image);
|
||||||
|
}
|
||||||
|
DB::table('courses')->where('id', $id)->delete();
|
||||||
|
return redirect()->back()->with('success', 'Course deleted successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('error', 'Course not found!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Notification extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'message',
|
||||||
|
'type',
|
||||||
|
'link',
|
||||||
|
'is_read',
|
||||||
|
'target_role',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class adminlogin extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'adminlogins';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'username',
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('adminlogins', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('username')->unique();
|
||||||
|
$table->string('password');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('adminlogins');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title');
|
||||||
|
$table->text('message');
|
||||||
|
$table->string('type')->default('info');
|
||||||
|
$table->string('link')->nullable();
|
||||||
|
$table->boolean('is_read')->default(false);
|
||||||
|
$table->string('target_role')->default('admin');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('notifications');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
@extends('layouts.adminnav')
|
||||||
|
|
||||||
|
@section('title', 'Admin Dashboard')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<style>
|
||||||
|
.welcome-card {
|
||||||
|
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
|
||||||
|
color: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.stat-card {
|
||||||
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
.icon-box {
|
||||||
|
width: 55px;
|
||||||
|
height: 55px;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container-fluid py-4">
|
||||||
|
|
||||||
|
<!-- Welcome Banner -->
|
||||||
|
<div class="welcome-card p-4 mb-4 shadow-sm d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<h3 class="fw-bold mb-1"><i class="fa-solid fa-gauge me-2"></i>Welcome to Admin Dashboard</h3>
|
||||||
|
<p class="mb-0 text-white-50">Automobile Engineering Academy System Overview</p>
|
||||||
|
</div>
|
||||||
|
<div class="text-end d-none d-md-block">
|
||||||
|
<span class="badge bg-danger fs-6 px-3 py-2 rounded-pill"><i class="fa-solid fa-shield-halved me-1"></i> System Active</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Alert Messages -->
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert alert-success alert-dismissible fade show mb-4" role="alert">
|
||||||
|
<i class="fa-solid fa-circle-check me-2"></i>{{ session('success') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- Quick Stats Cards Row -->
|
||||||
|
<div class="row g-4 mb-4">
|
||||||
|
<!-- Courses Card -->
|
||||||
|
<div class="col-md-6 col-lg-3">
|
||||||
|
<div class="card stat-card shadow-sm h-100">
|
||||||
|
<div class="card-body d-flex align-items-center justify-content-between p-4">
|
||||||
|
<div>
|
||||||
|
<span class="text-muted fw-bold small text-uppercase">My Courses</span>
|
||||||
|
<h3 class="fw-bold text-dark mt-1 mb-0">Manage</h3>
|
||||||
|
</div>
|
||||||
|
<div class="icon-box bg-primary bg-opacity-10 text-primary">
|
||||||
|
<i class="fa-solid fa-book"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-light border-0 py-2 text-center">
|
||||||
|
<a href="{{ route('admin.mycourses') }}" class="text-primary fw-bold text-decoration-none small">
|
||||||
|
View Details <i class="fa-solid fa-arrow-right ms-1"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Timetable Card -->
|
||||||
|
<div class="col-md-6 col-lg-3">
|
||||||
|
<div class="card stat-card shadow-sm h-100">
|
||||||
|
<div class="card-body d-flex align-items-center justify-content-between p-4">
|
||||||
|
<div>
|
||||||
|
<span class="text-muted fw-bold small text-uppercase">Active Slots</span>
|
||||||
|
<h3 class="fw-bold text-dark mt-1 mb-0">{{ $totalTimetableSlots ?? 0 }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="icon-box bg-success bg-opacity-10 text-success">
|
||||||
|
<i class="fa-solid fa-calendar-days"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-light border-0 py-2 text-center">
|
||||||
|
<a href="{{ route('admin.timetable') }}" class="text-success fw-bold text-decoration-none small">
|
||||||
|
Manage Timetable <i class="fa-solid fa-arrow-right ms-1"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Exam Results Card -->
|
||||||
|
<div class="col-md-6 col-lg-3">
|
||||||
|
<div class="card stat-card shadow-sm h-100">
|
||||||
|
<div class="card-body d-flex align-items-center justify-content-between p-4">
|
||||||
|
<div>
|
||||||
|
<span class="text-muted fw-bold small text-uppercase">Results</span>
|
||||||
|
<h3 class="fw-bold text-dark mt-1 mb-0">Publish</h3>
|
||||||
|
</div>
|
||||||
|
<div class="icon-box bg-warning bg-opacity-10 text-warning">
|
||||||
|
<i class="fa-solid fa-graduation-cap"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-light border-0 py-2 text-center">
|
||||||
|
<a href="{{ route('admin.results') }}" class="text-warning fw-bold text-decoration-none small">
|
||||||
|
Manage Results <i class="fa-solid fa-arrow-right ms-1"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Notifications Card -->
|
||||||
|
<div class="col-md-6 col-lg-3">
|
||||||
|
<div class="card stat-card shadow-sm h-100">
|
||||||
|
<div class="card-body d-flex align-items-center justify-content-between p-4">
|
||||||
|
<div>
|
||||||
|
<span class="text-muted fw-bold small text-uppercase">Notifications</span>
|
||||||
|
<h3 class="fw-bold text-dark mt-1 mb-0">{{ $unreadNotifications ?? 0 }} New</h3>
|
||||||
|
</div>
|
||||||
|
<div class="icon-box bg-danger bg-opacity-10 text-danger">
|
||||||
|
<i class="fa-solid fa-bell"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-light border-0 py-2 text-center">
|
||||||
|
<a href="#notifications-section" class="text-danger fw-bold text-decoration-none small">
|
||||||
|
View All <i class="fa-solid fa-arrow-down ms-1"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Main Content Area: Quick Navigation & Live Notifications -->
|
||||||
|
<div class="row g-4">
|
||||||
|
|
||||||
|
<!-- Quick Action Shortcuts Panel -->
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 h-100">
|
||||||
|
<div class="card-header bg-white py-3 border-0">
|
||||||
|
<h5 class="fw-bold mb-0 text-dark">
|
||||||
|
<i class="fa-solid fa-bolt text-warning me-2"></i>Quick Management Shortcuts
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a href="{{ route('admin.timetable') }}" class="btn btn-outline-primary p-3 w-100 text-start d-flex align-items-center rounded-3">
|
||||||
|
<i class="fa-solid fa-calendar-plus fs-3 me-3"></i>
|
||||||
|
<div>
|
||||||
|
<strong class="d-block">Manage Timetable</strong>
|
||||||
|
<small class="text-muted">Edit weekly schedules and subjects</small>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a href="{{ route('admin.mycourses') }}" class="btn btn-outline-success p-3 w-100 text-start d-flex align-items-center rounded-3">
|
||||||
|
<i class="fa-solid fa-folder-plus fs-3 me-3"></i>
|
||||||
|
<div>
|
||||||
|
<strong class="d-block">Courses & Modules</strong>
|
||||||
|
<small class="text-muted">Add or edit active modules</small>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a href="{{ route('admin.results') }}" class="btn btn-outline-warning p-3 w-100 text-start d-flex align-items-center rounded-3">
|
||||||
|
<i class="fa-solid fa-file-invoice fs-3 me-3"></i>
|
||||||
|
<div>
|
||||||
|
<strong class="d-block">Student Results</strong>
|
||||||
|
<small class="text-muted">Upload and update grades</small>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a href="{{ route('admin.profile') }}" class="btn btn-outline-danger p-3 w-100 text-start d-flex align-items-center rounded-3">
|
||||||
|
<i class="fa-solid fa-user-gear fs-3 me-3"></i>
|
||||||
|
<div>
|
||||||
|
<strong class="d-block">Account Settings</strong>
|
||||||
|
<small class="text-muted">Update profile and password</small>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Live Notifications Feed Panel -->
|
||||||
|
<div class="col-lg-5" id="notifications-section">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 h-100">
|
||||||
|
<div class="card-header bg-white py-3 border-0 d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="fw-bold mb-0 text-dark">
|
||||||
|
<i class="fa-solid fa-bell text-danger me-2"></i>System Notifications
|
||||||
|
</h5>
|
||||||
|
<span class="badge bg-danger rounded-pill">{{ $unreadNotifications ?? 0 }} Unread</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
@forelse($notifications ?? [] as $notification)
|
||||||
|
<li class="list-group-item p-3 border-bottom {{ $notification->is_read ? 'bg-light' : '' }}">
|
||||||
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div>
|
||||||
|
<h6 class="fw-bold mb-1 text-dark">{{ $notification->title }}</h6>
|
||||||
|
<p class="mb-1 text-muted small">{{ $notification->message }}</p>
|
||||||
|
<small class="text-secondary opacity-75" style="font-size: 11px;">
|
||||||
|
<i class="fa-regular fa-clock me-1"></i>{{ $notification->created_at->diffForHumans() }}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
@if(!$notification->is_read)
|
||||||
|
<form action="{{ route('admin.notifications.read', $notification->id) }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-success" title="Mark as Read">
|
||||||
|
<i class="fa-solid fa-check"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@empty
|
||||||
|
<li class="list-group-item text-center py-4 text-muted">
|
||||||
|
<i class="fa-solid fa-inbox fs-3 d-block mb-2 text-secondary"></i>
|
||||||
|
No notifications found.
|
||||||
|
</li>
|
||||||
|
@endforelse
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,517 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
<title>Course Management - Admin Portal</title>
|
||||||
|
|
||||||
|
<!-- Font Awesome Icons & Bootstrap 5 -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--theme-navy: #2D355B;
|
||||||
|
--theme-footer-navy: #1F2541;
|
||||||
|
--theme-red: #822424;
|
||||||
|
--theme-red-hover: #df2c3e;
|
||||||
|
--theme-yellow: #FFEA85;
|
||||||
|
--theme-bg: #F6F6F6;
|
||||||
|
--sidebar-width: 260px;
|
||||||
|
--text-dark: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: 'Segoe UI', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--theme-bg);
|
||||||
|
color: var(--text-dark);
|
||||||
|
display: flex;
|
||||||
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
height: 100vh;
|
||||||
|
background: var(--theme-navy);
|
||||||
|
color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 24px 0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
z-index: 1030;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .brand {
|
||||||
|
padding: 0 24px 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #ffffff;
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,.15);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .admin-badge {
|
||||||
|
background-color: var(--theme-red);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-left: 8px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
padding: 14px 24px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
color: var(--theme-yellow) !important;
|
||||||
|
padding-left: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link.active {
|
||||||
|
background: var(--theme-footer-navy);
|
||||||
|
color: var(--theme-yellow) !important;
|
||||||
|
border-left: 4px solid #F73F52;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user-profile {
|
||||||
|
padding: 15px 24px;
|
||||||
|
border-top: 1px solid rgba(255,255,255,.15);
|
||||||
|
margin-top: auto;
|
||||||
|
background: var(--theme-footer-navy);
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
margin-left: var(--sidebar-width);
|
||||||
|
width: calc(100% - var(--sidebar-width));
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 40px;
|
||||||
|
background: var(--theme-bg);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-header {
|
||||||
|
display: none;
|
||||||
|
background: var(--theme-navy);
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 12px 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1020;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-toggle {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0; left: 0; right: 0; bottom: 0;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
z-index: 1025;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay.show { display: block; }
|
||||||
|
|
||||||
|
@media (max-width: 991px) {
|
||||||
|
.sidebar { left: calc(-1 * var(--sidebar-width)); }
|
||||||
|
.sidebar.show { left: 0; }
|
||||||
|
.main { margin-left: 0; padding: 85px 20px 20px 20px; width: 100%; }
|
||||||
|
.mobile-header { display: flex; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.course-img-preview {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Mobile Top Navigation Bar -->
|
||||||
|
<header class="mobile-header">
|
||||||
|
<button class="sidebar-toggle" id="toggleBtn" aria-label="Toggle Sidebar">
|
||||||
|
<i class="fa-solid fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
<div class="fw-bold">Admin Panel</div>
|
||||||
|
<a href="/admin/login" class="btn btn-sm btn-outline-light">Sign In</a>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
||||||
|
|
||||||
|
<!-- Sidebar Navigation -->
|
||||||
|
<aside class="sidebar" id="sidebar">
|
||||||
|
<div class="brand">
|
||||||
|
<i class="fa-solid fa-car-side me-2"></i> AutoEdu
|
||||||
|
<span class="admin-badge">Admin</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="nav">
|
||||||
|
<a href="/admin/dashboard" class="nav-link">
|
||||||
|
<i class="fa-solid fa-chart-line"></i> Admin Dashboard
|
||||||
|
</a>
|
||||||
|
<a href="/admin/adminmycourses" class="nav-link active">
|
||||||
|
<i class="fa-solid fa-book-bookmark"></i> Course Management
|
||||||
|
</a>
|
||||||
|
<a href="/admin/timetable" class="nav-link">
|
||||||
|
<i class="fa-solid fa-calendar-check"></i> Class Timetable
|
||||||
|
</a>
|
||||||
|
<a href="/admin/results" class="nav-link">
|
||||||
|
<i class="fa-solid fa-file-invoice-dollar"></i> Exam Results
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="sidebar-user-profile">
|
||||||
|
<div class="dropdown dropup">
|
||||||
|
<a class="text-white text-decoration-none dropdown-toggle d-flex align-items-center gap-2" href="#" data-bs-toggle="dropdown">
|
||||||
|
<i class="fa-solid fa-circle-user" style="font-size: 24px; color: var(--theme-yellow);"></i>
|
||||||
|
<span>{{ session('admin_username', 'Admin') }}</span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-start shadow w-100">
|
||||||
|
<li>
|
||||||
|
<button type="button" onclick="submitAdminLogout()" class="dropdown-item text-danger border-0 bg-transparent">
|
||||||
|
<i class="fa-solid fa-right-from-bracket me-2"></i> Logout
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<!-- Main Content Area -->
|
||||||
|
<main class="main">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h3 class="fw-bold"><i class="fa-solid fa-book-bookmark me-2"></i> Course Management</h3>
|
||||||
|
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addCourseModal">
|
||||||
|
<i class="fa-solid fa-plus me-1"></i> Add New Course
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Success/Error Alerts -->
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
{{ session('success') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(session('error'))
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
{{ session('error') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- Courses Table Card -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-3">
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover align-middle mb-0">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Image</th>
|
||||||
|
<th>Code</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
<th>Level</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th class="text-center">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($courses as $course)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td>
|
||||||
|
@if($course->image)
|
||||||
|
<img src="{{ asset('storage/' . $course->image) }}" class="course-img-preview" alt="Course Image">
|
||||||
|
@else
|
||||||
|
<span class="badge bg-secondary">No Image</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td><span class="badge bg-light text-dark border">{{ $course->course_code }}</span></td>
|
||||||
|
<td class="fw-semibold">{{ $course->title }}</td>
|
||||||
|
<td>{{ $course->duration }}</td>
|
||||||
|
<td>{{ $course->level }}</td>
|
||||||
|
<td>
|
||||||
|
@if($course->status == 'Active')
|
||||||
|
<span class="badge bg-success">Active</span>
|
||||||
|
@else
|
||||||
|
<span class="badge bg-secondary">Inactive</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<!-- Edit Button -->
|
||||||
|
<button class="btn btn-sm btn-outline-warning me-1"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#editCourseModal{{ $course->id }}">
|
||||||
|
<i class="fa-solid fa-pen-to-square"></i> Edit
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Delete Form -->
|
||||||
|
<form action="{{ route('admin.courses.delete', $course->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this course?')">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||||
|
<i class="fa-solid fa-trash"></i> Delete
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- EDIT COURSE MODAL -->
|
||||||
|
<div class="modal fade" id="editCourseModal{{ $course->id }}" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="{{ route('admin.courses.update', $course->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
<div class="modal-header bg-warning text-dark">
|
||||||
|
<h5 class="modal-title fw-bold"><i class="fa-solid fa-pen-to-square me-2"></i>Edit Course</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label class="form-label fw-semibold">Course Title</label>
|
||||||
|
<input type="text" name="title" class="form-control" value="{{ $course->title }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Course Code</label>
|
||||||
|
<input type="text" name="course_code" class="form-control" value="{{ $course->course_code }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Duration</label>
|
||||||
|
<input type="text" name="duration" class="form-control" value="{{ $course->duration }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Level</label>
|
||||||
|
<select name="level" class="form-select" required>
|
||||||
|
<option value="Beginner" {{ $course->level == 'Beginner' ? 'selected' : '' }}>Beginner</option>
|
||||||
|
<option value="Intermediate" {{ $course->level == 'Intermediate' ? 'selected' : '' }}>Intermediate</option>
|
||||||
|
<option value="Advanced" {{ $course->level == 'Advanced' ? 'selected' : '' }}>Advanced</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Status</label>
|
||||||
|
<select name="status" class="form-select" required>
|
||||||
|
<option value="Active" {{ $course->status == 'Active' ? 'selected' : '' }}>Active</option>
|
||||||
|
<option value="Inactive" {{ $course->status == 'Inactive' ? 'selected' : '' }}>Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-semibold">Author/Lecturer</label>
|
||||||
|
<input type="text" name="author" class="form-control" value="{{ $course->author }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-semibold">Badge (e.g. Popular, New)</label>
|
||||||
|
<input type="text" name="badge" class="form-control" value="{{ $course->badge }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-semibold">Change Image (Optional)</label>
|
||||||
|
<input type="file" name="image" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-semibold">Description</label>
|
||||||
|
<textarea name="desc" class="form-control" rows="3">{{ $course->desc }}</textarea>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="trending" value="1" id="trendingEdit{{ $course->id }}" {{ $course->trending ? 'checked' : '' }}>
|
||||||
|
<label class="form-check-label fw-semibold" for="trendingEdit{{ $course->id }}">
|
||||||
|
Mark as Trending Course
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-warning">Save Changes</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="8" class="text-center py-4 text-muted">No courses found. Click "Add New Course" to create one.</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- ADD COURSE MODAL -->
|
||||||
|
<div class="modal fade" id="addCourseModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="{{ route('admin.courses.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
<div class="modal-header bg-navy text-white" style="background-color: var(--theme-navy);">
|
||||||
|
<h5 class="modal-title fw-bold text-white"><i class="fa-solid fa-plus me-2"></i>Add New Course</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label class="form-label fw-semibold">Course Title</label>
|
||||||
|
<input type="text" name="title" class="form-control" placeholder="e.g. Engine Diagnostics Masterclass" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Course Code</label>
|
||||||
|
<input type="text" name="course_code" class="form-control" placeholder="e.g. AUTO-101" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Duration</label>
|
||||||
|
<input type="text" name="duration" class="form-control" placeholder="e.g. 6 Months" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Level</label>
|
||||||
|
<select name="level" class="form-select" required>
|
||||||
|
<option value="Beginner">Beginner</option>
|
||||||
|
<option value="Intermediate">Intermediate</option>
|
||||||
|
<option value="Advanced">Advanced</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-semibold">Status</label>
|
||||||
|
<select name="status" class="form-select" required>
|
||||||
|
<option value="Active">Active</option>
|
||||||
|
<option value="Inactive">Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-semibold">Author/Lecturer</label>
|
||||||
|
<input type="text" name="author" class="form-control" placeholder="Lecturer Name">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-semibold">Badge</label>
|
||||||
|
<input type="text" name="badge" class="form-control" placeholder="e.g. Popular">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-semibold">Course Image</label>
|
||||||
|
<input type="file" name="image" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-semibold">Description</label>
|
||||||
|
<textarea name="desc" class="form-control" rows="3" placeholder="Enter course description..."></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="trending" value="1" id="trendingAdd">
|
||||||
|
<label class="form-check-label fw-semibold" for="trendingAdd">
|
||||||
|
Mark as Trending Course
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Save Course</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Sidebar Toggle Logic
|
||||||
|
const toggleBtn = document.getElementById('toggleBtn');
|
||||||
|
const sidebar = document.getElementById('sidebar');
|
||||||
|
const overlay = document.getElementById('sidebarOverlay');
|
||||||
|
|
||||||
|
if(toggleBtn) {
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
sidebar.classList.toggle('show');
|
||||||
|
overlay.classList.toggle('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(overlay) {
|
||||||
|
overlay.addEventListener('click', () => {
|
||||||
|
sidebar.classList.remove('show');
|
||||||
|
overlay.classList.remove('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin Logout Logic
|
||||||
|
function submitAdminLogout() {
|
||||||
|
const tokenEl = document.querySelector('meta[name="csrf-token"]');
|
||||||
|
|
||||||
|
fetch('/admin/logout', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': tokenEl ? tokenEl.getAttribute('content') : ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
window.location.href = '/adminlogin';
|
||||||
|
} else {
|
||||||
|
alert('Logout failed. Please try again.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('Error:', err);
|
||||||
|
alert('Server side error occurred during logout.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
@extends('layouts.adminnav')
|
||||||
|
|
||||||
|
@section('title', 'Admin Profile - Admin Panel')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container py-4">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 mb-4">
|
||||||
|
<h3 class="fw-bold text-navy">
|
||||||
|
<i class="fa-solid fa-user-gear me-2"></i>Admin Profile Management
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Success & Error Alerts -->
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert alert-success alert-dismissible fade show mb-4" role="alert">
|
||||||
|
<i class="fa-solid fa-circle-check me-2"></i>{{ session('success') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($errors->any())
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show mb-4" role="alert">
|
||||||
|
<i class="fa-solid fa-triangle-exclamation me-2"></i>
|
||||||
|
<strong>Please check the form for errors:</strong>
|
||||||
|
<ul class="mb-0 mt-1">
|
||||||
|
@foreach($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<!-- Profile Summary Card -->
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 text-center p-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="rounded-circle bg-navy text-white d-inline-flex align-items-center justify-content-center shadow" style="width: 100px; height: 100px; font-size: 40px;">
|
||||||
|
<i class="fa-solid fa-user-shield"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="fw-bold mb-1">{{ $admin->username ?? 'Administrator' }}</h4>
|
||||||
|
<span class="badge bg-danger fs-6 px-3 py-2 rounded-pill mt-2">System Administrator</span>
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<div class="text-start">
|
||||||
|
<p class="mb-2"><strong><i class="fa-solid fa-id-badge text-navy me-2"></i>Admin ID:</strong> {{ $admin->id ?? session('admin_id') }}</p>
|
||||||
|
<p class="mb-2"><strong><i class="fa-solid fa-user text-navy me-2"></i>Username:</strong> {{ $admin->username ?? 'N/A' }}</p>
|
||||||
|
<p class="mb-0"><strong><i class="fa-solid fa-clock text-navy me-2"></i>Created At:</strong> {{ isset($admin->created_at) ? $admin->created_at->format('Y-m-d') : 'N/A' }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Edit Profile & Password Forms -->
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<!-- Update Username Card -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 mb-4">
|
||||||
|
<div class="card-header bg-white py-3 border-0">
|
||||||
|
<h5 class="fw-bold mb-0 text-navy">
|
||||||
|
<i class="fa-solid fa-pen-to-square me-2"></i>Update Account Details
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('admin.profile.update') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-bold">Username</label>
|
||||||
|
<input type="text" name="username" class="form-control" value="{{ old('username', $admin->username ?? '') }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 text-end mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<i class="fa-solid fa-floppy-disk me-1"></i> Save Changes
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Change Password Card -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-3">
|
||||||
|
<div class="card-header bg-white py-3 border-0">
|
||||||
|
<h5 class="fw-bold mb-0 text-navy">
|
||||||
|
<i class="fa-solid fa-key me-2"></i>Change Password
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ route('admin.profile.password') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-bold">Current Password</label>
|
||||||
|
<input type="password" name="current_password" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">New Password</label>
|
||||||
|
<input type="password" name="new_password" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Confirm New Password</label>
|
||||||
|
<input type="password" name="new_password_confirmation" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 text-end mt-4">
|
||||||
|
<button type="submit" class="btn btn-danger">
|
||||||
|
<i class="fa-solid fa-shield-halved me-1"></i> Update Password
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
@extends('layouts.adminnav')
|
||||||
|
|
||||||
|
@section('title', 'Exam Results Management - Admin Panel')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h3 class="fw-bold text-navy">
|
||||||
|
<i class="fa-solid fa-square-poll-vertical me-2"></i>Exam Results Management
|
||||||
|
</h3>
|
||||||
|
<button class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#addResultModal">
|
||||||
|
<i class="fa-solid fa-plus me-1"></i> Add New Result
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<i class="fa-solid fa-circle-check me-2"></i>{{ session('success') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($errors->any())
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<i class="fa-solid fa-triangle-exclamation me-2"></i>
|
||||||
|
<strong>Please fix the following errors:</strong>
|
||||||
|
<ul class="mb-0 mt-1">
|
||||||
|
@foreach($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- Results Table -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-3">
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover align-middle mb-0">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Student Log ID</th>
|
||||||
|
<th>Module Code</th>
|
||||||
|
<th>Module Name</th>
|
||||||
|
<th>Academic Year</th>
|
||||||
|
<th>Semester</th>
|
||||||
|
<th>Marks</th>
|
||||||
|
<th>Grade</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th class="text-center">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($results as $result)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $result->id }}</td>
|
||||||
|
<td><span class="badge bg-secondary">{{ $result->student_log_id }}</span></td>
|
||||||
|
<td><strong>{{ $result->module_code }}</strong></td>
|
||||||
|
<td>{{ $result->module_name }}</td>
|
||||||
|
<td>{{ $result->academic_year }}</td>
|
||||||
|
<td>{{ $result->semester }}</td>
|
||||||
|
<td><span class="fw-bold">{{ $result->marks }}</span></td>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-primary fs-6">{{ $result->grade }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if(strtolower($result->status) == 'pass')
|
||||||
|
<span class="badge bg-success">Pass</span>
|
||||||
|
@else
|
||||||
|
<span class="badge bg-danger">Fail</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<!-- Edit Button -->
|
||||||
|
<button class="btn btn-sm btn-outline-primary me-1"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#editResultModal{{ $result->id }}">
|
||||||
|
<i class="fa-solid fa-pen-to-square"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Delete Button -->
|
||||||
|
<form action="{{ route('admin.results.delete', $result->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this result?');">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||||
|
<i class="fa-solid fa-trash-can"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Edit Result Modal -->
|
||||||
|
<div class="modal fade" id="editResultModal{{ $result->id }}" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-navy text-white">
|
||||||
|
<h5 class="modal-title"><i class="fa-solid fa-pen-to-square me-2"></i>Edit Student Result</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('admin.results.update', $result->id) }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="modal-body text-start">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Student Log ID</label>
|
||||||
|
<input type="text" name="student_log_id" class="form-control" value="{{ $result->student_log_id }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Module Code</label>
|
||||||
|
<input type="text" name="module_code" class="form-control" value="{{ $result->module_code }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-bold">Module Name</label>
|
||||||
|
<input type="text" name="module_name" class="form-control" value="{{ $result->module_name }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Academic Year</label>
|
||||||
|
<input type="text" name="academic_year" class="form-control" value="{{ $result->academic_year }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Semester</label>
|
||||||
|
<input type="text" name="semester" class="form-control" value="{{ $result->semester }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Marks</label>
|
||||||
|
<input type="number" step="0.01" name="marks" class="form-control" value="{{ $result->marks }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Grade</label>
|
||||||
|
<input type="text" name="grade" class="form-control" value="{{ $result->grade }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Status</label>
|
||||||
|
<select name="status" class="form-select" required>
|
||||||
|
<option value="Pass" {{ $result->status == 'Pass' ? 'selected' : '' }}>Pass</option>
|
||||||
|
<option value="Fail" {{ $result->status == 'Fail' ? 'selected' : '' }}>Fail</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Update Result</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" class="text-center py-4 text-muted">No examination results found.</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add Result Modal -->
|
||||||
|
<div class="modal fade" id="addResultModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-navy text-white">
|
||||||
|
<h5 class="modal-title"><i class="fa-solid fa-plus-circle me-2"></i>Add New Examination Result</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('admin.results.store') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Student Log ID</label>
|
||||||
|
<input type="text" name="student_log_id" class="form-control" placeholder="e.g. ST1001" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Module Code</label>
|
||||||
|
<input type="text" name="module_code" class="form-control" placeholder="e.g. AME201" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label class="form-label fw-bold">Module Name</label>
|
||||||
|
<input type="text" name="module_name" class="form-control" placeholder="e.g. Automobile Technology II" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Academic Year</label>
|
||||||
|
<input type="text" name="academic_year" class="form-control" placeholder="e.g. 2025/2026" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-bold">Semester</label>
|
||||||
|
<input type="text" name="semester" class="form-control" placeholder="e.g. Semester 1" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Marks</label>
|
||||||
|
<input type="number" step="0.01" name="marks" class="form-control" placeholder="0 - 100" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Grade</label>
|
||||||
|
<input type="text" name="grade" class="form-control" placeholder="e.g. A+, B, C" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-bold">Status</label>
|
||||||
|
<select name="status" class="form-select" required>
|
||||||
|
<option value="Pass">Pass</option>
|
||||||
|
<option value="Fail">Fail</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button type="submit" class="btn btn-success"><i class="fa-solid fa-floppy-disk me-1"></i> Save Result</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,260 @@
|
||||||
|
@extends('layouts.adminnav')
|
||||||
|
|
||||||
|
@section('title', 'Admin Timetable Management')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<style>
|
||||||
|
.bg-custom-header {
|
||||||
|
background: linear-gradient(135deg, #2c2a4a 0%, #4a4773 100%);
|
||||||
|
color: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
/* Badge Colors based on UI design */
|
||||||
|
.badge-theory { background-color: #1e293b; color: #ffffff; }
|
||||||
|
.badge-practical { background-color: #881337; color: #ffffff; }
|
||||||
|
.badge-workshop { background-color: #c2410c; color: #ffffff; }
|
||||||
|
.badge-exam { background-color: #ca8a04; color: #ffffff; }
|
||||||
|
|
||||||
|
.table-timetable th {
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
.table-timetable td {
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 85px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.timetable-cell {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.timetable-cell:hover {
|
||||||
|
background-color: #e2e8f0;
|
||||||
|
}
|
||||||
|
.today-header {
|
||||||
|
background-color: #dc2626 !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container-fluid py-4">
|
||||||
|
|
||||||
|
<!-- Header Banner -->
|
||||||
|
<div class="p-4 mb-4 bg-custom-header shadow-sm d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<h3 class="fw-bold mb-1"><i class="fa-solid fa-calendar-days me-2"></i>My Class Timetable</h3>
|
||||||
|
<p class="mb-0 text-white-50 small">Automobile Engineering Academy Timetable Management</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Alert Messages -->
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="alert alert-success alert-dismissible fade show mb-4" role="alert">
|
||||||
|
<i class="fa-solid fa-circle-check me-2"></i>{{ session('success') }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="row g-4 mb-4">
|
||||||
|
<!-- Today's Schedule Card -->
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 h-100">
|
||||||
|
<div class="card-header bg-white py-3 border-0">
|
||||||
|
<h6 class="fw-bold mb-0 text-danger">
|
||||||
|
<i class="fa-solid fa-clock me-2"></i>Today's Schedule ({{ $today }})
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
@forelse($todaySchedule as $item)
|
||||||
|
<div class="p-3 mb-2 bg-light rounded border-start border-4 border-danger d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<span class="badge badge-{{ strtolower($item->type) }} mb-1">{{ $item->type }}</span>
|
||||||
|
<h6 class="fw-bold mb-0">{{ $item->subject_name }}</h6>
|
||||||
|
</div>
|
||||||
|
<small class="text-muted fw-bold">{{ $item->time_slot }}</small>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<p class="text-muted text-center py-4 mb-0">No classes scheduled for today.</p>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Legend Card -->
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 h-100">
|
||||||
|
<div class="card-header bg-white py-3 border-0">
|
||||||
|
<h6 class="fw-bold mb-0 text-primary">
|
||||||
|
<i class="fa-solid fa-layer-group me-2"></i>Timetable Legend
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex flex-wrap gap-2 mb-3">
|
||||||
|
<span class="badge badge-theory px-3 py-2">Theory</span>
|
||||||
|
<span class="badge badge-practical px-3 py-2">Practical</span>
|
||||||
|
<span class="badge badge-workshop px-3 py-2">Workshop</span>
|
||||||
|
<span class="badge badge-exam px-3 py-2">Exam</span>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<p class="text-muted small mb-0">
|
||||||
|
<i class="fa-solid fa-hand-pointer me-1 text-primary"></i> <strong>How to Edit:</strong> Click on any timetable slot in the table below to edit or add subject details.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Main Timetable Grid -->
|
||||||
|
<div class="card border-0 shadow-sm rounded-3">
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-timetable mb-0 align-middle">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th style="width: 15%;">Time</th>
|
||||||
|
@foreach($days as $day)
|
||||||
|
<th class="{{ strtolower($today) == strtolower($day) ? 'today-header' : '' }}">
|
||||||
|
{{ $day }} {{ strtolower($today) == strtolower($day) ? '(Today)' : '' }}
|
||||||
|
</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($timeSlots as $slot)
|
||||||
|
<tr>
|
||||||
|
<!-- Time Column -->
|
||||||
|
<td class="fw-bold text-secondary bg-light">{{ $slot }}</td>
|
||||||
|
|
||||||
|
@if($slot == '12:15 - 01:00')
|
||||||
|
<!-- Interval Row -->
|
||||||
|
<td colspan="5" class="bg-light text-center fw-bold text-muted py-3">
|
||||||
|
☕ Interval / Lunch Break
|
||||||
|
</td>
|
||||||
|
@else
|
||||||
|
<!-- Days Columns -->
|
||||||
|
@foreach($days as $day)
|
||||||
|
@php
|
||||||
|
$item = $grid[$slot][$day] ?? null;
|
||||||
|
@endphp
|
||||||
|
<td class="p-1">
|
||||||
|
<div class="timetable-cell"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#editSlotModal"
|
||||||
|
onclick="openEditModal('{{ $day }}', '{{ $slot }}', '{{ $item->subject_name ?? '' }}', '{{ $item->type ?? 'Theory' }}', '{{ $item->id ?? '' }}')">
|
||||||
|
|
||||||
|
@if($item)
|
||||||
|
<span class="badge badge-{{ strtolower($item->type) }} mb-1">
|
||||||
|
{{ $item->type }}
|
||||||
|
</span>
|
||||||
|
<div class="fw-bold text-dark small">{{ $item->subject_name }}</div>
|
||||||
|
@else
|
||||||
|
<span class="text-muted small"><i class="fa-solid fa-plus text-primary"></i> Add</span>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal for Edit / Update Slot -->
|
||||||
|
<div class="modal fade" id="editSlotModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-custom-header text-white">
|
||||||
|
<h5 class="modal-title"><i class="fa-solid fa-pen-to-square me-2"></i>Update Timetable Slot</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('admin.timetable.store') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="day" id="modal_day">
|
||||||
|
<input type="hidden" name="time_slot" id="modal_time_slot">
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-bold">Day & Time Slot</label>
|
||||||
|
<input type="text" id="display_day_time" class="form-control bg-light" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-bold">Subject Name</label>
|
||||||
|
<input type="text" name="subject_name" id="modal_subject" class="form-control" placeholder="e.g. Engine Repair" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-bold">Subject Type</label>
|
||||||
|
<select name="type" id="modal_type" class="form-select" required>
|
||||||
|
<option value="Theory">Theory</option>
|
||||||
|
<option value="Practical">Practical</option>
|
||||||
|
<option value="Workshop">Workshop</option>
|
||||||
|
<option value="Exam">Exam</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer d-flex justify-content-between">
|
||||||
|
<button type="button" id="clearBtn" class="btn btn-outline-danger d-none" onclick="clearSlotData()">
|
||||||
|
<i class="fa-solid fa-trash me-1"></i> Clear Slot
|
||||||
|
</button>
|
||||||
|
<div>
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-success"><i class="fa-solid fa-floppy-disk me-1"></i> Save / Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Hidden Form to Clear Slot -->
|
||||||
|
<form id="deleteSlotForm" method="POST" class="d-none">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var currentSlotId = null;
|
||||||
|
|
||||||
|
function openEditModal(day, timeSlot, subject, type, id) {
|
||||||
|
document.getElementById('modal_day').value = day;
|
||||||
|
document.getElementById('modal_time_slot').value = timeSlot;
|
||||||
|
document.getElementById('display_day_time').value = day + ' (' + timeSlot + ')';
|
||||||
|
document.getElementById('modal_subject').value = subject;
|
||||||
|
document.getElementById('modal_type').value = type || 'Theory';
|
||||||
|
|
||||||
|
currentSlotId = id;
|
||||||
|
var clearBtn = document.getElementById('clearBtn');
|
||||||
|
|
||||||
|
if(id) {
|
||||||
|
clearBtn.classList.remove('d-none');
|
||||||
|
} else {
|
||||||
|
clearBtn.classList.add('d-none');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearSlotData() {
|
||||||
|
if(currentSlotId && confirm('Are you sure you want to clear this timetable slot?')) {
|
||||||
|
var form = document.getElementById('deleteSlotForm');
|
||||||
|
form.action = "/admin/timetable/delete/" + currentSlotId;
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
<title>Admin Login - AutoEdu</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--theme-navy: #2D355B;
|
||||||
|
--theme-red: #822424;
|
||||||
|
--theme-yellow: #FFEA85;
|
||||||
|
--theme-bg: #F6F6F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--theme-bg);
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-family: 'Segoe UI', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 400px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-header {
|
||||||
|
background: var(--theme-navy);
|
||||||
|
color: #fff;
|
||||||
|
padding: 25px 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-theme-red {
|
||||||
|
background-color: var(--theme-red);
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
padding: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-theme-red:hover {
|
||||||
|
background-color: #a32d2d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="login-card">
|
||||||
|
<div class="login-header">
|
||||||
|
<i class="fa-solid fa-user-shield fa-2x mb-2" style="color: var(--theme-yellow);"></i>
|
||||||
|
<h5 class="fw-bold mb-0">Admin Login</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="p-4">
|
||||||
|
<!-- Error Alert -->
|
||||||
|
<div id="errorAlert" class="alert alert-danger d-none py-2 text-center small" role="alert"></div>
|
||||||
|
|
||||||
|
<form id="adminLoginForm">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-semibold text-dark">Username</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text"><i class="fa-solid fa-user"></i></span>
|
||||||
|
<input type="text" id="username" class="form-control" placeholder="Username" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-semibold text-dark">Password</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text"><i class="fa-solid fa-lock"></i></span>
|
||||||
|
<input type="password" id="password" class="form-control" placeholder="Password" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-theme-red w-100" id="loginBtn">
|
||||||
|
<i class="fa-solid fa-right-to-bracket me-2"></i> Login
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('adminLoginForm').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const username = document.getElementById('username').value;
|
||||||
|
const password = document.getElementById('password').value;
|
||||||
|
const errorAlert = document.getElementById('errorAlert');
|
||||||
|
const loginBtn = document.getElementById('loginBtn');
|
||||||
|
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||||
|
|
||||||
|
errorAlert.classList.add('d-none');
|
||||||
|
loginBtn.disabled = true;
|
||||||
|
loginBtn.innerHTML = '<i class="fa-solid fa-spinner fa-spin me-2"></i> Logging in...';
|
||||||
|
|
||||||
|
fetch('/admin/login', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ username: username, password: password })
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
window.location.href = '/admin/adminmycourses';
|
||||||
|
} else {
|
||||||
|
errorAlert.innerText = data.message || 'Login failed!';
|
||||||
|
errorAlert.classList.remove('d-none');
|
||||||
|
loginBtn.disabled = false;
|
||||||
|
loginBtn.innerHTML = '<i class="fa-solid fa-right-to-bracket me-2"></i> Login';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('Error:', err);
|
||||||
|
errorAlert.innerText = 'Server error occurred!';
|
||||||
|
errorAlert.classList.remove('d-none');
|
||||||
|
loginBtn.disabled = false;
|
||||||
|
loginBtn.innerHTML = '<i class="fa-solid fa-right-to-bracket me-2"></i> Login';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,368 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
<title>@yield('title', 'Admin Portal - Automobile Academic')</title>
|
||||||
|
|
||||||
|
<!-- Font Awesome Icons & Bootstrap 5 -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--theme-navy: #2D355B;
|
||||||
|
--theme-footer-navy: #1F2541;
|
||||||
|
--theme-red: #822424;
|
||||||
|
--theme-red-hover: #df2c3e;
|
||||||
|
--theme-yellow: #FFEA85;
|
||||||
|
--theme-bg: #F6F6F6;
|
||||||
|
--sidebar-width: 260px;
|
||||||
|
--text-dark: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: 'Segoe UI', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--theme-bg);
|
||||||
|
color: var(--text-dark);
|
||||||
|
display: flex;
|
||||||
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
height: 100vh;
|
||||||
|
background: var(--theme-navy);
|
||||||
|
color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 24px 0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
z-index: 1030;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .brand {
|
||||||
|
padding: 0 24px 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #ffffff;
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,.15);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .admin-badge {
|
||||||
|
background-color: var(--theme-red);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-left: 8px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
padding: 14px 24px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
color: var(--theme-yellow) !important;
|
||||||
|
padding-left: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar .nav-link.active {
|
||||||
|
background: var(--theme-footer-navy);
|
||||||
|
color: var(--theme-yellow) !important;
|
||||||
|
border-left: 4px solid #F73F52;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user-profile {
|
||||||
|
padding: 15px 24px;
|
||||||
|
border-top: 1px solid rgba(255,255,255,.15);
|
||||||
|
margin-top: auto;
|
||||||
|
background: var(--theme-footer-navy);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user-profile .user-dropdown-toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user-profile .user-dropdown-toggle:hover {
|
||||||
|
color: var(--theme-yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
margin-left: var(--sidebar-width);
|
||||||
|
width: calc(100% - var(--sidebar-width));
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 40px;
|
||||||
|
background: var(--theme-bg);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-header {
|
||||||
|
display: none;
|
||||||
|
background: var(--theme-navy);
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 12px 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1020;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-toggle {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-toggle:hover {
|
||||||
|
color: var(--theme-yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
z-index: 1025;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay.show {
|
||||||
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991px) {
|
||||||
|
.sidebar {
|
||||||
|
left: calc(-1 * var(--sidebar-width));
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar.show {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
margin-left: 0;
|
||||||
|
padding: 85px 20px 20px 20px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-header {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Mobile Top Navigation Bar -->
|
||||||
|
<header class="mobile-header">
|
||||||
|
<button class="sidebar-toggle" id="toggleBtn" aria-label="Toggle Sidebar">
|
||||||
|
<i class="fa-solid fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
<div class="mobile-brand">
|
||||||
|
<i class="fa-solid fa-user-shield me-1"></i> Admin Panel
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mobile-user-profile">
|
||||||
|
@if(session()->has('admin_id'))
|
||||||
|
<div class="dropdown">
|
||||||
|
<a class="text-white text-decoration-none dropdown-toggle d-flex align-items-center gap-2" href="#" role="button" id="userMenuMobile" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="fa-solid fa-circle-user" style="font-size: 26px; color: var(--theme-yellow);"></i>
|
||||||
|
<span class="fw-semibold small">{{ session('admin_name', 'Admin') }}</span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="userMenuMobile">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="{{ route('admin.profile') }}">
|
||||||
|
<i class="fa-solid fa-user-gear me-2"></i> Admin Profile
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li>
|
||||||
|
<button type="button" onclick="submitAdminLogout()" class="dropdown-item text-danger w-100 text-start border-0 bg-transparent">
|
||||||
|
<i class="fa-solid fa-right-from-bracket me-2"></i> Logout
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<a href="{{ route('admin.login') }}" class="btn btn-sm btn-outline-light"><i class="fa-solid fa-right-to-bracket me-1"></i> Sign In</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
||||||
|
|
||||||
|
<!-- Sidebar Navigation -->
|
||||||
|
<aside class="sidebar" id="sidebar">
|
||||||
|
<div class="brand">
|
||||||
|
<i class="fa-solid fa-car-side me-2"></i> AutoEdu
|
||||||
|
<span class="admin-badge">Admin</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="nav">
|
||||||
|
<a href="/admin/dashboard" class="nav-link {{ request()->is('admin/dashboard*') ? 'active' : '' }}">
|
||||||
|
<i class="fa-solid fa-chart-line"></i> Admin Dashboard
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('admin.mycourses') }}" class="nav-link {{ request()->is('admin/adminmycourses*') ? 'active' : '' }}">
|
||||||
|
<i class="fa-solid fa-book-bookmark"></i> Course Management
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('admin.timetable') }}" class="nav-link {{ request()->is('admin/timetable*') ? 'active' : '' }}">
|
||||||
|
<i class="fa-solid fa-calendar-check"></i> Class Timetable
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('admin.results') }}" class="nav-link {{ request()->is('admin/results*') ? 'active' : '' }}">
|
||||||
|
<i class="fa-solid fa-file-invoice-dollar"></i> Exam Results
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('admin.profile') }}" class="nav-link {{ request()->is('admin/profile*') ? 'active' : '' }}">
|
||||||
|
<i class="fa-solid fa-user-gear"></i> Admin Profile
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="sidebar-user-profile">
|
||||||
|
@if(session()->has('admin_id'))
|
||||||
|
<div class="dropdown dropup">
|
||||||
|
<a class="user-dropdown-toggle dropdown-toggle" href="#" role="button" id="userMenuDesktop" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="fa-solid fa-circle-user" style="font-size: 24px; color: var(--theme-yellow);"></i>
|
||||||
|
<span class="text-truncate" style="max-width: 150px;">{{ session('admin_name', 'Admin') }}</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu dropdown-menu-start shadow w-100" aria-labelledby="userMenuDesktop">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="{{ route('admin.profile') }}">
|
||||||
|
<i class="fa-solid fa-user-gear me-2"></i> Admin Profile
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li>
|
||||||
|
<button type="button" onclick="submitAdminLogout()" class="dropdown-item text-danger border-0 bg-transparent w-100 text-start">
|
||||||
|
<i class="fa-solid fa-right-from-bracket me-2"></i> Logout
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<a href="{{ route('admin.login') }}" class="btn btn-outline-light btn-sm w-100">Sign In</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
@yield('content')
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Sidebar Toggle Logic
|
||||||
|
const toggleBtn = document.getElementById('toggleBtn');
|
||||||
|
const sidebar = document.getElementById('sidebar');
|
||||||
|
const overlay = document.getElementById('sidebarOverlay');
|
||||||
|
|
||||||
|
if(toggleBtn) {
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
sidebar.classList.toggle('show');
|
||||||
|
overlay.classList.toggle('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(overlay) {
|
||||||
|
overlay.addEventListener('click', () => {
|
||||||
|
sidebar.classList.remove('show');
|
||||||
|
overlay.classList.remove('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin Logout Logic
|
||||||
|
function submitAdminLogout() {
|
||||||
|
const tokenEl = document.querySelector('meta[name="csrf-token"]');
|
||||||
|
|
||||||
|
fetch('/admin/logout', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': tokenEl ? tokenEl.getAttribute('content') : ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
window.location.href = '/adminlogin';
|
||||||
|
} else {
|
||||||
|
alert('Logout failed. Please try again.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('Error:', err);
|
||||||
|
alert('Server side error occurred during logout.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -12,8 +12,12 @@ use App\Http\Controllers\ApplyController;
|
||||||
use App\Http\Controllers\ResultsController;
|
use App\Http\Controllers\ResultsController;
|
||||||
use App\Http\Controllers\TimetableController;
|
use App\Http\Controllers\TimetableController;
|
||||||
use App\Http\Controllers\CoureseAssignController;
|
use App\Http\Controllers\CoureseAssignController;
|
||||||
|
use App\Http\Controllers\AdminAuthController;
|
||||||
|
use App\Http\Controllers\adminmycoursesController;
|
||||||
|
use App\Http\Controllers\AdminResultsController;
|
||||||
|
use App\Http\Controllers\AdminProfileController;
|
||||||
|
use App\Http\Controllers\AdminTimetableController;
|
||||||
|
use App\Http\Controllers\AdminDashboardController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -21,7 +25,6 @@ use App\Http\Controllers\CoureseAssignController;
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Home Page
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
@ -31,7 +34,6 @@ Route::view('/students', 'students')->name('students');
|
||||||
Route::view('/abouts', 'abouts')->name('abouts');
|
Route::view('/abouts', 'abouts')->name('abouts');
|
||||||
Route::view('/contact', 'contacts')->name('contact');
|
Route::view('/contact', 'contacts')->name('contact');
|
||||||
|
|
||||||
// Guest Authentication View Routes
|
|
||||||
Route::view('/signin', 'signin')->name('signin');
|
Route::view('/signin', 'signin')->name('signin');
|
||||||
Route::view('/signup', 'signup')->name('signup');
|
Route::view('/signup', 'signup')->name('signup');
|
||||||
|
|
||||||
|
|
@ -43,12 +45,11 @@ Route::view('/signup', 'signup')->name('signup');
|
||||||
Route::post('/signuppage', [AuthController::class, 'register']);
|
Route::post('/signuppage', [AuthController::class, 'register']);
|
||||||
Route::post('/signin', [AuthController::class, 'login']);
|
Route::post('/signin', [AuthController::class, 'login']);
|
||||||
Route::post('/custom-logout', [AuthController::class, 'logout']);
|
Route::post('/custom-logout', [AuthController::class, 'logout']);
|
||||||
|
|
||||||
Route::post('/contact-submit', [ContactMsgController::class, 'store'])->name('contact.store');
|
Route::post('/contact-submit', [ContactMsgController::class, 'store'])->name('contact.store');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Password Reset Routes (For Guest Users)
|
| Password Reset Routes
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Route::middleware('guest')->group(function () {
|
Route::middleware('guest')->group(function () {
|
||||||
|
|
@ -60,7 +61,7 @@ Route::middleware('guest')->group(function () {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Regular Auth Protected Routes (Laravel Default Auth)
|
| Regular Auth Protected Routes
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Route::middleware(['auth'])->group(function () {
|
Route::middleware(['auth'])->group(function () {
|
||||||
|
|
@ -72,18 +73,13 @@ Route::middleware(['auth'])->group(function () {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| STUDENT PORTAL ROUTES (Session-Based Auth)
|
| STUDENT PORTAL ROUTES
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Student Login & Logout Action Routes
|
|
||||||
Route::post('/student-login', [StudentPortalController::class, 'studentlogin'])->name('student.login.submit');
|
Route::post('/student-login', [StudentPortalController::class, 'studentlogin'])->name('student.login.submit');
|
||||||
Route::post('/studentlogout', [StudentPortalController::class, 'studentlogout'])->name('student.logout');
|
Route::post('/studentlogout', [StudentPortalController::class, 'studentlogout'])->name('student.logout');
|
||||||
|
|
||||||
// Student Portal Section (Protected by Student Session Check)
|
|
||||||
Route::middleware(['web'])->group(function () {
|
Route::middleware(['web'])->group(function () {
|
||||||
|
|
||||||
|
|
||||||
Route::get('/student-portal', function () {
|
Route::get('/student-portal', function () {
|
||||||
if (!session()->has('student_id') && !session()->has('student_log_id')) {
|
if (!session()->has('student_id') && !session()->has('student_log_id')) {
|
||||||
return redirect('/signin')->with('error', 'Please login first!');
|
return redirect('/signin')->with('error', 'Please login first!');
|
||||||
|
|
@ -91,41 +87,76 @@ Route::middleware(['web'])->group(function () {
|
||||||
return view('StudentPortal');
|
return view('StudentPortal');
|
||||||
})->name('student.portal');
|
})->name('student.portal');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/StudentProfile', [StudentPortalController::class, 'showProfile'])->name('StudentProfile');
|
Route::get('/StudentProfile', [StudentPortalController::class, 'showProfile'])->name('StudentProfile');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/results', [ResultsController::class, 'index'])->name('results');
|
Route::get('/results', [ResultsController::class, 'index'])->name('results');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/Dashboard', function () {
|
Route::get('/Dashboard', function () {
|
||||||
if (!session()->has('student_id') && !session()->has('student_log_id')) { return redirect('/signin')->with('error', 'Please login first!'); }
|
if (!session()->has('student_id') && !session()->has('student_log_id')) {
|
||||||
|
return redirect('/signin')->with('error', 'Please login first!');
|
||||||
|
}
|
||||||
return view('StudentPortal');
|
return view('StudentPortal');
|
||||||
})->name('Dashboard');
|
})->name('Dashboard');
|
||||||
|
|
||||||
Route::get('/mycourse', function () {
|
|
||||||
if (!session()->has('student_id') && !session()->has('student_log_id')) { return redirect('/signin')->with('error', 'Please login first!'); }
|
|
||||||
return view('mycourse');
|
|
||||||
})->name('mycourse');
|
|
||||||
|
|
||||||
// 2. Dynamic Timetable Controller Route එක මෙතැනට යෙදුවා
|
|
||||||
Route::get('/timetable', [TimetableController::class, 'index'])->name('timetable');
|
Route::get('/timetable', [TimetableController::class, 'index'])->name('timetable');
|
||||||
|
|
||||||
Route::get('/Assignments', function () {
|
Route::get('/Assignments', function () {
|
||||||
if (!session()->has('student_id') && !session()->has('student_log_id')) { return redirect('/signin')->with('error', 'Please login first!'); }
|
if (!session()->has('student_id') && !session()->has('student_log_id')) {
|
||||||
|
return redirect('/signin')->with('error', 'Please login first!');
|
||||||
|
}
|
||||||
return view('Assignments');
|
return view('Assignments');
|
||||||
})->name('Assignments');
|
})->name('Assignments');
|
||||||
|
|
||||||
Route::get('/Studentguidelines', function () {
|
Route::get('/Studentguidelines', function () {
|
||||||
if (!session()->has('student_id') && !session()->has('student_log_id')) { return redirect('/signin')->with('error', 'Please login first!'); }
|
if (!session()->has('student_id') && !session()->has('student_log_id')) {
|
||||||
|
return redirect('/signin')->with('error', 'Please login first!');
|
||||||
|
}
|
||||||
return view('Studentguidelines');
|
return view('Studentguidelines');
|
||||||
})->name('Studentguidelines');
|
})->name('Studentguidelines');
|
||||||
|
|
||||||
Route::get('/Feedback&Complain', [FeedbackController::class, 'index'])->name('feedback.index');
|
Route::get('/Feedback&Complain', [FeedbackController::class, 'index'])->name('feedback.index');
|
||||||
Route::post('/Feedback&Complain/store', [FeedbackController::class, 'store'])->name('feedback.store');
|
Route::post('/Feedback&Complain/store', [FeedbackController::class, 'store'])->name('feedback.store');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/mycourse', [CoureseAssignController::class, 'showMyCourse'])->name('mycourse');
|
Route::get('/mycourse', [CoureseAssignController::class, 'showMyCourse'])->name('mycourse');
|
||||||
|
|
||||||
Route::get('/module/{id}', [CoureseAssignController::class, 'showModule'])->name('module.show');
|
Route::get('/module/{id}', [CoureseAssignController::class, 'showModule'])->name('module.show');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ADMIN PORTAL ROUTES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::get('/admin/login', [AdminAuthController::class, 'showLoginForm'])->name('admin.login');
|
||||||
|
Route::post('/admin/login', [AdminAuthController::class, 'login']);
|
||||||
|
Route::post('/admin/logout', [AdminAuthController::class, 'logout'])->name('admin.logout');
|
||||||
|
|
||||||
|
Route::middleware(['web'])->prefix('admin')->group(function () {
|
||||||
|
|
||||||
|
// Admin Dashboard Routes
|
||||||
|
Route::get('/dashboard', [AdminDashboardController::class, 'index'])->name('admin.admindashboard');
|
||||||
|
Route::post('/notifications/read/{id}', [AdminDashboardController::class, 'markAsRead'])->name('admin.notifications.read');
|
||||||
|
|
||||||
|
// Admin Courses
|
||||||
|
Route::get('/adminmycourses', [adminmycoursesController::class, 'index'])->name('admin.mycourses');
|
||||||
|
Route::post('/adminmycourses/store', [adminmycoursesController::class, 'store'])->name('admin.courses.store');
|
||||||
|
Route::post('/adminmycourses/update/{id}', [adminmycoursesController::class, 'update'])->name('admin.courses.update');
|
||||||
|
Route::delete('/adminmycourses/delete/{id}', [adminmycoursesController::class, 'destroy'])->name('admin.courses.delete');
|
||||||
|
|
||||||
|
// Admin Timetable Routes
|
||||||
|
Route::get('/timetable', [AdminTimetableController::class, 'index'])->name('admin.timetable');
|
||||||
|
Route::post('/timetable/store', [AdminTimetableController::class, 'store'])->name('admin.timetable.store');
|
||||||
|
Route::put('/timetable/update/{id}', [AdminTimetableController::class, 'update'])->name('admin.timetable.update');
|
||||||
|
Route::delete('/timetable/delete/{id}', [AdminTimetableController::class, 'destroy'])->name('admin.timetable.delete');
|
||||||
|
|
||||||
|
// Admin Results
|
||||||
|
Route::get('/results', [AdminResultsController::class, 'index'])->name('admin.results');
|
||||||
|
Route::post('/results/store', [AdminResultsController::class, 'store'])->name('admin.results.store');
|
||||||
|
Route::put('/results/update/{id}', [AdminResultsController::class, 'update'])->name('admin.results.update');
|
||||||
|
Route::delete('/results/delete/{id}', [AdminResultsController::class, 'destroy'])->name('admin.results.delete');
|
||||||
|
|
||||||
|
// Admin Profile
|
||||||
|
Route::get('/profile', [AdminProfileController::class, 'index'])->name('admin.profile');
|
||||||
|
Route::put('/profile/update', [AdminProfileController::class, 'update'])->name('admin.profile.update');
|
||||||
|
Route::put('/profile/password', [AdminProfileController::class, 'updatePassword'])->name('admin.profile.password');
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue