701 lines
41 KiB
PHP
701 lines
41 KiB
PHP
@extends('layouts.adminnav')
|
|
|
|
@section('title', 'Admin Dashboard')
|
|
|
|
@section('content')
|
|
<style>
|
|
html {
|
|
scroll-behavior: smooth;
|
|
}
|
|
.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;
|
|
}
|
|
/* Edit Mode Control Styles */
|
|
.edit-only {
|
|
display: none !important;
|
|
}
|
|
.is-editing .edit-only {
|
|
display: inline-block !important;
|
|
}
|
|
.is-editing div.edit-only {
|
|
display: block !important;
|
|
}
|
|
.is-editing flex.edit-only,
|
|
.is-editing .d-flex.edit-only {
|
|
display: flex !important;
|
|
}
|
|
</style>
|
|
|
|
<div class="container-fluid py-4" id="dashboardWrapper">
|
|
|
|
<!-- Welcome Banner & Pin Unlock Header -->
|
|
<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-flex align-items-center gap-2"> -->
|
|
<!-- Pin Unlock Button -->
|
|
<!-- <button id="btnLockToggle" class="btn btn-warning text-dark fw-bold rounded-pill px-3 py-2 shadow-sm" data-bs-toggle="modal" data-bs-target="#pinAuthModal">
|
|
<i class="fa-solid fa-lock me-1" id="lockIcon"></i> <span id="lockStatusText">Unlock Edit Mode</span>
|
|
</button>
|
|
<span class="badge bg-danger fs-6 px-3 py-2 rounded-pill d-none d-md-inline-block"><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
|
|
|
|
@if(session('error'))
|
|
<div class="alert alert-danger alert-dismissible fade show mb-4" role="alert">
|
|
<i class="fa-solid fa-triangle-exclamation me-2"></i>{{ session('error') }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Quick Stats Cards Row -->
|
|
<div class="row g-4 mb-4">
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<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 -->
|
|
<div class="row g-4 mb-4">
|
|
<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>
|
|
|
|
<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">
|
|
<div>
|
|
<h5 class="fw-bold mb-0 text-dark d-inline me-2">
|
|
<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>
|
|
<button class="btn btn-sm btn-primary rounded-3 edit-only" data-bs-toggle="modal" data-bs-target="#addNotificationModal">
|
|
<i class="fa-solid fa-plus me-1"></i> Add
|
|
</button>
|
|
</div>
|
|
<div class="card-body p-0" style="max-height: 450px; overflow-y: auto;">
|
|
<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 text-muted' : 'bg-white' }}">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="me-2">
|
|
@if($notification->type == 'success')
|
|
<span class="badge bg-success mb-1">Success</span>
|
|
@elseif($notification->type == 'warning')
|
|
<span class="badge bg-warning text-dark mb-1">Warning</span>
|
|
@else
|
|
<span class="badge bg-info text-dark mb-1">Info</span>
|
|
@endif
|
|
|
|
<h6 class="fw-bold mb-1 {{ $notification->is_read ? 'text-secondary' : 'text-dark' }}">
|
|
{{ $notification->title }}
|
|
</h6>
|
|
<p class="mb-1 text-muted small">{{ $notification->message }}</p>
|
|
|
|
<small class="text-secondary opacity-75 d-block" style="font-size: 11px;">
|
|
<i class="fa-regular fa-clock me-1"></i>{{ $notification->created_at ? $notification->created_at->diffForHumans() : '' }}
|
|
</small>
|
|
</div>
|
|
|
|
<div class="d-flex gap-1 align-items-center edit-only">
|
|
@if(!$notification->is_read)
|
|
<form action="{{ route('admin.notifications.read', $notification->id) }}" method="POST" class="d-inline">
|
|
@csrf
|
|
<button type="submit" class="btn btn-sm btn-outline-success border-0 rounded-circle" title="Mark as Read">
|
|
<i class="fa-solid fa-check"></i>
|
|
</button>
|
|
</form>
|
|
@else
|
|
<span class="text-muted px-1" title="Read"><i class="fa-solid fa-check-double text-secondary"></i></span>
|
|
@endif
|
|
|
|
<button class="btn btn-sm btn-outline-primary border-0 rounded-circle" data-bs-toggle="modal" data-bs-target="#editNotificationModal{{ $notification->id }}" title="Edit">
|
|
<i class="fa-solid fa-pen-to-square"></i>
|
|
</button>
|
|
|
|
<form action="{{ route('admin.notifications.destroy', $notification->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this notification?');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-outline-danger border-0 rounded-circle" title="Delete">
|
|
<i class="fa-solid fa-trash-can"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
<div class="modal fade" id="editNotificationModal{{ $notification->id }}" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header bg-primary text-white">
|
|
<h5 class="modal-title fw-bold"><i class="fa-solid fa-pen-to-square me-2"></i>Edit Notification</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form action="{{ route('admin.notifications.update', $notification->id) }}" method="POST">
|
|
@csrf
|
|
@method('PUT')
|
|
<div class="modal-body p-4">
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Notification Type</label>
|
|
<select name="type" class="form-select" required>
|
|
<option value="info" {{ $notification->type == 'info' ? 'selected' : '' }}>Info</option>
|
|
<option value="success" {{ $notification->type == 'success' ? 'selected' : '' }}>Success</option>
|
|
<option value="warning" {{ $notification->type == 'warning' ? 'selected' : '' }}>Warning</option>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Title</label>
|
|
<input type="text" name="title" class="form-control" value="{{ $notification->title }}" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Message</label>
|
|
<textarea name="message" class="form-control" rows="3" required>{{ $notification->message }}</textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-save me-1"></i> Update</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@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>
|
|
|
|
<!-- Registered Users Table -->
|
|
<div class="row g-4 mb-4">
|
|
<div class="col-12">
|
|
<div class="card border-0 shadow-sm rounded-3">
|
|
<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-users text-primary me-2"></i>Registered System Users List
|
|
</h5>
|
|
<span class="badge bg-primary rounded-pill">{{ count($users ?? []) }} Users</span>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th class="ps-3">ID</th>
|
|
<th>Name</th>
|
|
<th>Email</th>
|
|
<th>Phone</th>
|
|
<th class="text-center" style="min-width: 210px;">Portal PIN</th>
|
|
<th>Created Date</th>
|
|
<th class="text-end pe-3 edit-only">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($users ?? [] as $user)
|
|
<tr>
|
|
<td class="ps-3 fw-bold">#{{ $user->id }}</td>
|
|
<td>{{ $user->first_name }} {{ $user->last_name }}</td>
|
|
<td>{{ $user->email }}</td>
|
|
<td>{{ $user->phone ?? 'N/A' }}</td>
|
|
<!-- DIRECT PIN EDIT / ADD / DELETE CONTROLS INSIDE CELL -->
|
|
<td class="text-center">
|
|
<div class="d-flex align-items-center justify-content-center gap-2">
|
|
@if(!empty($log->pin) && $log->pin !== 'N/A')
|
|
<!-- Current PIN Badge -->
|
|
<span class="badge bg-dark font-monospace fs-6 px-3 py-2 shadow-sm">
|
|
<i class="fa-solid fa-key text-warning me-1"></i>{{ $log->pin }}
|
|
</span>
|
|
|
|
<!-- Direct Edit PIN Button -->
|
|
<button class="btn btn-sm btn-outline-primary border-0 rounded-circle"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#editPinModal{{ $log->id }}"
|
|
title="Edit PIN">
|
|
<i class="fa-solid fa-pen-to-square"></i>
|
|
</button>
|
|
|
|
<!-- Direct Delete PIN Form/Button -->
|
|
<form action="{{ route('admin.portallogs.update', $log->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this PIN?');">
|
|
@csrf
|
|
@method('PUT')
|
|
<input type="hidden" name="pin" value="">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger border-0 rounded-circle" title="Delete PIN">
|
|
<i class="fa-solid fa-trash-can"></i>
|
|
</button>
|
|
</form>
|
|
@else
|
|
<!-- N/A Badge -->
|
|
<span class="badge bg-secondary font-monospace fs-6 px-3 py-2 opacity-75">
|
|
<i class="fa-solid fa-key text-white-50 me-1"></i>N/A
|
|
</span>
|
|
|
|
<!-- Direct Add New PIN Button -->
|
|
<button class="btn btn-sm btn-success rounded-pill px-2 py-1"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#editPinModal{{ $log->id }}">
|
|
<i class="fa-solid fa-plus me-1"></i>Add PIN
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</td>
|
|
<td>{{ $log->created_at ? $log->created_at->format('Y-m-d H:i') : 'N/A' }}</td>
|
|
<td class="text-end pe-3 edit-only">
|
|
<form action="{{ route('admin.portallogs.send', $user->id) }}" method="POST" class="d-inline">
|
|
@csrf
|
|
<button type="submit" class="btn btn-sm btn-primary rounded-2">
|
|
<i class="fa-solid fa-paper-plane me-1"></i> Send to Portal Log
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="text-center py-4 text-muted">
|
|
<i class="fa-solid fa-user-slash fs-3 d-block mb-2 text-secondary"></i>
|
|
No registered users found.
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Student Portal Active Logs Table (PIN, Add, Edit & Delete) -->
|
|
<div class="row g-4" id="portal-logs-section">
|
|
<div class="col-12">
|
|
<div class="card border-0 shadow-sm rounded-3">
|
|
<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-address-card text-success me-2"></i>Student Portal Active Logs
|
|
</h5>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<span class="badge bg-success rounded-pill">{{ count($portalLogs ?? []) }} Active Student Logs</span>
|
|
<!-- Add New Portal Log Button (Edit mode එකේදී විතරක් පෙනේ) -->
|
|
<button class="btn btn-sm btn-success rounded-3 edit-only" data-bs-toggle="modal" data-bs-target="#addPortalLogModal">
|
|
<i class="fa-solid fa-plus me-1"></i> Add Portal Log
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th class="ps-3">Log ID</th>
|
|
<th>User ID</th>
|
|
<th>Student Name</th>
|
|
<th>Email</th>
|
|
<th>Phone</th>
|
|
<th class="text-center">Portal PIN</th>
|
|
<th>Created Date</th>
|
|
<th class="text-end pe-3">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($portalLogs ?? [] as $log)
|
|
<tr>
|
|
<td class="ps-3 fw-bold">#LOG-{{ $log->id }}</td>
|
|
<td>#{{ $log->user_id }}</td>
|
|
<td>
|
|
<div class="fw-bold text-dark">
|
|
@if(!empty($log->first_name) || !empty($log->last_name))
|
|
{{ trim($log->first_name . ' ' . $log->last_name) }}
|
|
@elseif($log->user)
|
|
{{ $log->user->name ?? trim($log->user->first_name . ' ' . $log->user->last_name) }}
|
|
@else
|
|
<span class="text-muted">N/A</span>
|
|
@endif
|
|
</div>
|
|
</td>
|
|
<td>{{ $log->email }}</td>
|
|
<td>{{ $log->phone ?? ($log->user->phone ?? 'N/A') }}</td>
|
|
|
|
<!-- PIN Column -->
|
|
<td class="text-center">
|
|
<span class="badge bg-dark font-monospace fs-6 px-3 py-1">
|
|
<i class="fa-solid fa-key me-1 text-warning"></i>{{ $log->pin ?? 'N/A' }}
|
|
</span>
|
|
</td>
|
|
|
|
<td>{{ $log->created_at ? $log->created_at->format('Y-m-d H:i') : 'N/A' }}</td>
|
|
|
|
<td class="text-end pe-3">
|
|
<!-- Edit / Delete (Edit mode නොමැති විට Status එක පමණක් පෙනේ) -->
|
|
<span class="badge bg-success bg-opacity-10 text-success border border-success px-3 py-2 rounded-pill edit-hidden">
|
|
<i class="fa-solid fa-circle-check me-1"></i> Active
|
|
</span>
|
|
|
|
<div class="d-flex gap-1 justify-content-end edit-only">
|
|
<!-- Edit PIN Modal Trigger Button -->
|
|
<button class="btn btn-sm btn-outline-primary rounded-2" data-bs-toggle="modal" data-bs-target="#editPortalLogModal{{ $log->id }}" title="Edit Student PIN / Details">
|
|
<i class="fa-solid fa-pen-to-square me-1"></i> Edit
|
|
</button>
|
|
|
|
<!-- Delete Log Button -->
|
|
<form action="{{ route('admin.portallogs.destroy', $log->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this Student Portal Log?');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-outline-danger rounded-2" title="Delete Log">
|
|
<i class="fa-solid fa-trash-can"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<!-- Edit Portal Log Modal -->
|
|
<div class="modal fade" id="editPortalLogModal{{ $log->id }}" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header bg-primary text-white">
|
|
<h5 class="modal-title fw-bold"><i class="fa-solid fa-key me-2"></i>Edit Portal Log & PIN</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form action="{{ route('admin.portallogs.update', $log->id) }}" method="POST">
|
|
@csrf
|
|
@method('PUT')
|
|
<div class="modal-body p-4">
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Student Name</label>
|
|
<input type="text" class="form-control" value="{{ trim($log->first_name . ' ' . $log->last_name) }}" readonly disabled>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Email Address</label>
|
|
<input type="email" name="email" class="form-control" value="{{ $log->email }}" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Phone Number</label>
|
|
<input type="text" name="phone" class="form-control" value="{{ $log->phone }}">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold text-primary"><i class="fa-solid fa-lock me-1"></i> Student Portal PIN</label>
|
|
<input type="text" name="pin" class="form-control fw-bold fs-5 text-center text-primary" maxlength="6" value="{{ $log->pin }}" placeholder="Enter PIN (e.g. 1234)" required>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-save me-1"></i> Save Changes</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="text-center py-4 text-muted">
|
|
<i class="fa-solid fa-folder-open fs-3 d-block mb-2 text-secondary"></i>
|
|
No active student portal logs found.
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Add New Portal Log Modal -->
|
|
<div class="modal fade" id="addPortalLogModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header bg-success text-white">
|
|
<h5 class="modal-title fw-bold"><i class="fa-solid fa-user-plus me-2"></i>Add Student Portal Access</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form action="{{ route('admin.portallogs.store') }}" method="POST">
|
|
@csrf
|
|
<div class="modal-body p-4">
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Select User / Student</label>
|
|
<select name="user_id" class="form-select" required>
|
|
<option value="">-- Choose System User --</option>
|
|
@foreach($users ?? [] as $u)
|
|
<option value="{{ $u->id }}">{{ $u->first_name }} {{ $u->last_name }} ({{ $u->email }})</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Email Address</label>
|
|
<input type="email" name="email" class="form-control" placeholder="student@example.com" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Phone Number</label>
|
|
<input type="text" name="phone" class="form-control" placeholder="07XXXXXXXX">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold text-success"><i class="fa-solid fa-key me-1"></i> Assign Portal PIN</label>
|
|
<input type="text" name="pin" class="form-control fw-bold fs-5 text-center text-success" maxlength="6" placeholder="Enter PIN (e.g. 5678)" required>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<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-plus-circle me-1"></i> Create Access</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Notification Modal -->
|
|
<div class="modal fade" id="addNotificationModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header bg-primary text-white">
|
|
<h5 class="modal-title fw-bold"><i class="fa-solid fa-plus-circle me-2"></i>Create New Notification</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form action="{{ route('admin.notifications.store') }}" method="POST">
|
|
@csrf
|
|
<div class="modal-body p-4">
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Notification Type</label>
|
|
<select name="type" class="form-select" required>
|
|
<option value="info">Info</option>
|
|
<option value="success">Success</option>
|
|
<option value="warning">Warning</option>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Title</label>
|
|
<input type="text" name="title" class="form-control" placeholder="Enter title" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label fw-bold">Message</label>
|
|
<textarea name="message" class="form-control" rows="3" placeholder="Enter notification message..." required></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-paper-plane me-1"></i> Send Notification</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!--
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
const ADMIN_PIN = "1234";
|
|
|
|
const dashboardWrapper = document.getElementById("dashboardWrapper");
|
|
const inputPin = document.getElementById("inputPin");
|
|
const btnSubmitPin = document.getElementById("btnSubmitPin");
|
|
const pinErrorMessage = document.getElementById("pinErrorMessage");
|
|
const btnLockToggle = document.getElementById("btnLockToggle");
|
|
const lockIcon = document.getElementById("lockIcon");
|
|
const lockStatusText = document.getElementById("lockStatusText");
|
|
const pinModal = new bootstrap.Modal(document.getElementById('pinAuthModal'));
|
|
|
|
if (sessionStorage.getItem("adminEditUnlocked") === "true") {
|
|
enableEditMode();
|
|
}
|
|
|
|
function verifyPin() {
|
|
if (inputPin.value.trim() === ADMIN_PIN) {
|
|
sessionStorage.setItem("adminEditUnlocked", "true");
|
|
enableEditMode();
|
|
pinModal.hide();
|
|
inputPin.value = "";
|
|
pinErrorMessage.classList.add("d-none");
|
|
} else {
|
|
pinErrorMessage.classList.remove("d-none");
|
|
inputPin.value = "";
|
|
inputPin.focus();
|
|
}
|
|
}
|
|
|
|
btnSubmitPin.addEventListener("click", verifyPin);
|
|
inputPin.addEventListener("keypress", function (e) {
|
|
if (e.key === "Enter") {
|
|
verifyPin();
|
|
}
|
|
});
|
|
|
|
function enableEditMode() {
|
|
dashboardWrapper.classList.add("is-editing");
|
|
btnLockToggle.classList.replace("btn-warning", "btn-success");
|
|
lockIcon.classList.replace("fa-lock", "fa-lock-open");
|
|
lockStatusText.innerText = "Edit Mode Active";
|
|
btnLockToggle.removeAttribute("data-bs-toggle");
|
|
btnLockToggle.removeAttribute("data-bs-target");
|
|
}
|
|
|
|
btnLockToggle.addEventListener("click", function () {
|
|
if (dashboardWrapper.classList.contains("is-editing")) {
|
|
sessionStorage.removeItem("adminEditUnlocked");
|
|
dashboardWrapper.classList.remove("is-editing");
|
|
btnLockToggle.classList.replace("btn-success", "btn-warning");
|
|
lockIcon.classList.replace("fa-lock-open", "fa-lock");
|
|
lockStatusText.innerText = "Unlock Edit Mode";
|
|
btnLockToggle.setAttribute("data-bs-toggle", "modal");
|
|
btnLockToggle.setAttribute("data-bs-target", "#pinAuthModal");
|
|
}
|
|
});
|
|
});
|
|
</script> -->
|
|
@endsection |