100 lines
4.0 KiB
PHP
100 lines
4.0 KiB
PHP
<?php
|
|
/**
|
|
* 班级操行分管理系统 - 管理端考勤管理
|
|
*
|
|
* 开发者: Canglan
|
|
* 联系方式: admin@sea-studio.top
|
|
* 版权归属: Sea Network Technology Studio
|
|
* 许可证: MIT License
|
|
*
|
|
* 版权所有 © Sea Network Technology Studio
|
|
*/
|
|
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
|
|
header('Location: /index.php');
|
|
exit();
|
|
}
|
|
|
|
$page_title = '考勤管理';
|
|
$role = $_SESSION['role'] ?? '';
|
|
|
|
if (!in_array($role, ['班主任', '考勤委员'])) {
|
|
header('Location: /admin/dashboard.php');
|
|
exit();
|
|
}
|
|
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
|
|
<?php include __DIR__ . '/../includes/nav.php'; ?>
|
|
|
|
<div class="container">
|
|
<!-- 考勤操作工具栏 -->
|
|
<div class="card">
|
|
<div class="attendance-toolbar" style="flex-direction:column;gap:8px;">
|
|
<!-- 第一行:日期 + 时段 + 状态按钮 + 自定义扣分 -->
|
|
<div style="display:flex;align-items:center;gap:12px;flex-wrap:wrap;">
|
|
<div class="form-group" style="margin:0">
|
|
<label>日期</label>
|
|
<input type="date" id="attendanceDate" value="<?php echo date('Y-m-d'); ?>">
|
|
</div>
|
|
<div class="form-group" style="margin:0">
|
|
<label>时段</label>
|
|
<select id="attendanceSlot">
|
|
<option value="morning">早上 7:15</option>
|
|
<option value="afternoon">中午 14:00</option>
|
|
<option value="evening">晚修 19:30</option>
|
|
</select>
|
|
</div>
|
|
<div class="status-group">
|
|
<button class="status-btn active" data-status="absent" onclick="selectStatus(this)" id="btnAbsent">缺勤</button>
|
|
<button class="status-btn" data-status="late" onclick="selectStatus(this)" id="btnLate">迟到</button>
|
|
<button class="status-btn" data-status="leave" onclick="selectStatus(this)" id="btnLeave">请假</button>
|
|
<input type="number" id="customDeduction" placeholder="自定义扣分" min="0" max="20" style="width:100px;margin-left:10px;" title="留空或0使用默认值">
|
|
</div>
|
|
</div>
|
|
<!-- 第二行:原因 + 操作按钮 -->
|
|
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap;">
|
|
<input type="text" id="attendanceReason" placeholder="原因(可选)" style="flex:1;min-width:150px;">
|
|
<button class="btn btn-primary" onclick="selectAllStudents()">全选</button>
|
|
<button class="btn" onclick="deselectAllStudents()">取消全选</button>
|
|
<button class="btn btn-danger" onclick="submitAttendance()">提交考勤</button>
|
|
<button class="btn btn-secondary" onclick="loadAttendanceRecords()">查询记录</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 学生方格网格 -->
|
|
<div class="card">
|
|
<div class="card-title">点击选择有考勤异常的学生</div>
|
|
<div class="student-grid" id="studentGrid">
|
|
<!-- JS 动态生成 -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 历史考勤记录 -->
|
|
<div class="card">
|
|
<div class="card-title">考勤记录</div>
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<thead>
|
|
<tr><th>学号</th><th>姓名</th><th>状态</th><th>原因</th><th>记录人</th><th>扣分</th></tr>
|
|
</thead>
|
|
<tbody id="attendanceList"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.student-cell { display: flex; flex-direction: column; align-items: center; }
|
|
.student-cell-name { font-size: 14px; font-weight: 500; }
|
|
.student-cell-no { font-size: 11px; color: #999; }
|
|
</style>
|
|
<script src="/assets/js/modules/modal-utils.js"></script>
|
|
<script src="/assets/js/attendance-manage.js"></script>
|
|
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|