Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
@@ -0,0 +1,84 @@
</main>
<?php
// Fetch footer text
$footer_text_display = 'ระบบแจ้งเตือนส่งงาน';
if (isset($pdo)) {
try {
$stmt_footer = $pdo->prepare("SELECT setting_value FROM settings WHERE setting_key = 'footer_text'");
$stmt_footer->execute();
if ($row_footer = $stmt_footer->fetch()) {
$footer_text_display = $row_footer['setting_value'];
}
} catch (Exception $e) {}
}
?>
<footer class="bg-white border-t border-gray-200 p-4 text-center text-sm text-gray-600 shrink-0">
&copy; <?= date('Y') ?> <?= htmlspecialchars($footer_text_display) ?>
</footer>
</div>
</div>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.5.0/js/dataTables.responsive.min.js"></script>
<script>
// Initialize DataTables globally if table exists and not already initialized
$(document).ready(function() {
if ($('.dataTable').length > 0) {
$('.dataTable').each(function() {
if (!$.fn.dataTable.isDataTable(this)) {
$(this).DataTable({
responsive: true,
columnDefs: [{ className: "dt-head-center", targets: "_all" }],
language: {
url: '//cdn.datatables.net/plug-ins/1.13.6/i18n/th.json',
}
});
}
});
}
});
</script>
<?php if (isset($_SESSION['login_notified']) && $_SESSION['login_notified'] === false): ?>
<script>
// Show notification only once after login
$(document).ready(function() {
$.ajax({
url: 'api/get_notifications.php',
method: 'GET',
dataType: 'json',
success: function(response) {
if(response.status === 'success' && response.data.length > 0) {
let htmlList = '<div style="max-height: 200px; overflow-y: auto;" class="custom-scrollbar"><ul class="text-left mt-2 pr-2">';
response.data.forEach(function(item) {
htmlList += `<li class="mb-2 pb-2 border-b border-gray-200">
<strong>${item.title}</strong><br>
<span class="text-sm text-red-500">กำหนดส่ง: ${item.due_date} (เหลือ ${item.days_left} วัน)</span>
</li>`;
});
htmlList += '</ul></div>';
Swal.fire({
title: 'คุณมีงานใกล้ถึงกำหนดส่ง!',
html: htmlList,
icon: 'warning',
confirmButtonText: 'รับทราบ',
confirmButtonColor: '#3085d6'
});
}
}
});
});
</script>
<?php
// Mark as notified so it doesn't show again in this session
$_SESSION['login_notified'] = true;
endif;
?>
<script src="assets/js/app.js"></script>
</body>
</html>
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ระบบแจ้งเตือนส่งงาน</title>
<link rel="icon" type="image/png" href="assets/img/logo.png">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- DataTables CSS -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.5.0/css/responsive.dataTables.min.css">
<!-- Custom CSS to make DataTables look good with Tailwind -->
<style>
.dataTables_wrapper .dataTables_paginate .paginate_button {
padding: 0.25em 0.75em;
margin-left: 2px;
border-radius: 0.25rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
th, .dataTable th, table.dataTable thead th, table.dataTable thead td { text-align: center !important; }
background: #2563eb !important;
color: white !important;
border: 1px solid #2563eb !important;
}
body { font-family: 'Sarabun', sans-serif; background-color: #f3f4f6; }
.shiny-logo {
position: relative;
overflow: hidden;
display: inline-block;
border-radius: 50%;
}
.shiny-logo::after {
content: '';
position: absolute;
top: 0;
left: -150%;
width: 50%;
height: 100%;
background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0) 100%);
transform: skewX(-25deg);
animation: shine 6s infinite ease-in-out;
}
@keyframes shine {
0% { left: -150%; }
15% { left: 200%; }
100% { left: 200%; }
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</head>
<body class="text-gray-800">
<div class="flex h-screen overflow-hidden">
@@ -0,0 +1,85 @@
<!-- Sidebar -->
<div class="bg-gray-800 text-white w-64 flex-shrink-0 flex flex-col hidden md:flex">
<div class="h-16 flex items-center justify-center border-b border-gray-700">
<h1 class="text-xl font-bold flex items-center">
<div class="shiny-logo mr-2">
<img src="assets/img/logo.png" alt="Logo" class="w-8 h-8 object-contain">
</div>
ระบบแจ้งเตือน
</h1>
</div>
<div class="flex-1 overflow-y-auto py-4">
<nav class="px-2 space-y-1">
<?php $currentPage = basename($_SERVER['PHP_SELF']); ?>
<a href="dashboard.php" class="<?= $currentPage == 'dashboard.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md">
<i class="fas fa-tachometer-alt mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
หน้าแรก (Dashboard)
</a>
<?php if (isAdmin()): ?>
<a href="assignments.php" class="<?= $currentPage == 'assignments.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md mt-1">
<i class="fas fa-tasks mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
จัดการงาน
</a>
<a href="users.php" class="<?= $currentPage == 'users.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md mt-1">
<i class="fas fa-users mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
จัดการผู้ใช้
</a>
<a href="settings.php" class="<?= $currentPage == 'settings.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md mt-1">
<i class="fas fa-cog mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
ตั้งค่าระบบ
</a>
<?php else: ?>
<a href="my_assignments.php" class="<?= $currentPage == 'my_assignments.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md mt-1">
<i class="fas fa-tasks mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
งานของฉัน
</a>
<?php endif; ?>
<div class="pt-4 mt-4 border-t border-gray-700"></div>
<a href="manual.php" class="<?= $currentPage == 'manual.php' ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' ?> group flex items-center px-2 py-2 text-sm font-medium rounded-md">
<i class="fas fa-book mr-3 text-lg text-gray-400 group-hover:text-gray-300"></i>
คู่มือการใช้งาน
</a>
</nav>
</div>
<div class="p-4 border-t border-gray-700">
<div class="flex items-center">
<div>
<img class="inline-block h-9 w-9 rounded-full" src="https://ui-avatars.com/api/?name=<?= urlencode($_SESSION['name']) ?>&background=0D8ABC&color=fff" alt="">
</div>
<div class="ml-3">
<p class="text-sm font-medium text-white"><?= htmlspecialchars($_SESSION['name']) ?></p>
<p class="text-xs font-medium text-gray-400 group-hover:text-gray-300"><?= ucfirst($_SESSION['role']) ?></p>
</div>
</div>
<a href="logout.php" class="mt-4 block text-center bg-red-600 hover:bg-red-700 text-white py-2 px-4 rounded text-sm transition duration-150 ease-in-out">
<i class="fas fa-sign-out-alt mr-1"></i> ออกจากระบบ
</a>
</div>
</div>
<!-- Main Content wrapper -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Mobile header -->
<div class="md:hidden bg-gray-800 text-white h-16 flex items-center justify-between px-4">
<h1 class="text-xl font-bold flex items-center">
<div class="shiny-logo mr-2">
<img src="assets/img/logo.png" alt="Logo" class="w-8 h-8 object-contain">
</div>
ระบบแจ้งเตือน
</h1>
<button id="mobile-menu-button" class="text-gray-300 hover:text-white focus:outline-none focus:text-white">
<i class="fas fa-bars text-2xl"></i>
</button>
</div>
<!-- Main content -->
<main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-100 p-6">