| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/domains/technicrayong.ac.th/public_html/rytc/tobe/admin/ |
Upload File : |
<?php
require_once __DIR__ . '/auth.php';
$status = $_GET['status'] ?? '';
if ($status) {
$stmt = $pdo->prepare('SELECT * FROM consultations WHERE status=? ORDER BY created_at DESC');
$stmt->execute([$status]);
$rows = $stmt->fetchAll();
} else {
$rows = $pdo->query('SELECT * FROM consultations ORDER BY created_at DESC')->fetchAll();
}
function status_class($s){ return $s==='ดำเนินการแล้ว'?'status-done':($s==='กำลังติดต่อ'?'status-contact':'status-wait'); }
include __DIR__ . '/header.php';
?>
<div class="page-header"><div class="container"><h1 class="fw-bold">รายการขอคำปรึกษา</h1><p class="mb-0">ตรวจสอบข้อมูลนักเรียน ปรับสถานะการติดต่อตอบกลับ และลบข้อมูลที่ไม่ต้องการ</p></div></div>
<div class="container mb-5">
<?php if (!empty($_GET['updated'])): ?><div class="alert alert-success rounded-4">บันทึกข้อมูลเรียบร้อยแล้ว</div><?php endif; ?>
<?php if (!empty($_GET['deleted'])): ?><div class="alert alert-success rounded-4">ลบข้อมูลคำปรึกษาเรียบร้อยแล้ว</div><?php endif; ?>
<?php if (!empty($_GET['delete_error'])): ?><div class="alert alert-danger rounded-4">ไม่สามารถลบข้อมูลได้ กรุณาลองใหม่อีกครั้ง</div><?php endif; ?>
<div class="content-card p-4">
<form class="row g-2 mb-3" method="get">
<div class="col-md-4"><select name="status" class="form-select"><option value="">ทุกสถานะ</option><?php foreach(['รอดำเนินการ','กำลังติดต่อ','ดำเนินการแล้ว'] as $s): ?><option value="<?= e($s) ?>" <?= $status===$s?'selected':'' ?>><?= e($s) ?></option><?php endforeach; ?></select></div>
<div class="col-md-2"><button class="btn btn-gradient w-100">กรอง</button></div>
</form>
<div class="table-responsive"><table class="table table-hover align-middle"><thead><tr><th>วันที่</th><th>ชื่อ</th><th>ชั้น</th><th>เบอร์</th><th>หัวข้อ</th><th>สถานะ</th><th class="text-end">จัดการ</th></tr></thead><tbody>
<?php foreach($rows as $r): ?><tr>
<td><?= e($r['created_at']) ?></td>
<td><?= e($r['fullname']) ?><br><small class="text-muted"><?= e($r['student_id']) ?></small></td>
<td><?= e($r['classroom']) ?></td>
<td><?= e($r['phone']) ?></td>
<td><?= e($r['topic']) ?></td>
<td><span class="status-pill <?= status_class($r['status']) ?>"><?= e($r['status']) ?></span></td>
<td class="text-end">
<div class="d-flex gap-2 justify-content-end flex-wrap">
<a class="btn btn-sm btn-outline-primary rounded-pill" href="consult_view.php?id=<?= (int)$r['id'] ?>">ดูข้อมูล</a>
<form method="post" action="consult_delete.php" class="d-inline" onsubmit="return confirm('ยืนยันการลบข้อมูลคำปรึกษาของ <?= e($r['fullname']) ?> ?');">
<input type="hidden" name="id" value="<?= (int)$r['id'] ?>">
<button type="submit" class="btn btn-sm btn-outline-danger rounded-pill"><i class="bi bi-trash"></i> ลบ</button>
</form>
</div>
</td>
</tr><?php endforeach; ?>
<?php if(!$rows): ?><tr><td colspan="7" class="text-center text-muted">ไม่พบข้อมูล</td></tr><?php endif; ?>
</tbody></table></div>
</div>
</div>
<?php include __DIR__ . '/footer.php'; ?>