테스트용 허용시간 초기화 디버그 버튼 추가

This commit is contained in:
2026-08-04 14:15:20 +09:00
parent 4137a6815c
commit 26fb4c32cf
+53
View File
@@ -211,6 +211,54 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
_setAttendanceTime(formatted);
}
/// 🧪 테스트용: 하교(12시간)/반출 허용 시간 설정 등으로 켜져 있는 허용 시간대를 즉시 해제한다.
Future<void> _resetTestPermissions() async {
try {
final response = await http.post(Uri.parse('$baseUrl/api/debug/reset-permissions'));
final result = jsonDecode(utf8.decode(response.bodyBytes));
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(result['message'] ?? '처리되었습니다.')),
);
_fetchAll();
} catch (e) {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('❌ 초기화 실패: $e')),
);
}
}
void _showTestResetConfirmDialog() {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('🧪 테스트용 허용시간 초기화'),
content: const Text(
'하교 처리나 반출 허용 시간 설정으로 켜져 있는 모든 허용 시간대를 지금 즉시 해제합니다.\n'
'(무단반출 감지 테스트할 때만 사용하세요)',
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('취소'),
),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
_resetTestPermissions();
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[700],
foregroundColor: Colors.white,
),
child: const Text('초기화'),
),
],
),
);
}
void _showAllowDialog(String studentId, String studentName) {
final controller = TextEditingController(text: "5");
showDialog(
@@ -445,6 +493,11 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
style: TextStyle(color: Colors.white),
),
),
IconButton(
onPressed: _showTestResetConfirmDialog,
icon: const Icon(Icons.bug_report_outlined, color: Colors.white70),
tooltip: '🧪 테스트용: 허용시간 초기화',
),
const SizedBox(width: 8),
],
),