테스트용 허용시간 초기화 디버그 버튼 추가
This commit is contained in:
@@ -211,6 +211,54 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
|
|||||||
_setAttendanceTime(formatted);
|
_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) {
|
void _showAllowDialog(String studentId, String studentName) {
|
||||||
final controller = TextEditingController(text: "5");
|
final controller = TextEditingController(text: "5");
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -445,6 +493,11 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
|
|||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: _showTestResetConfirmDialog,
|
||||||
|
icon: const Icon(Icons.bug_report_outlined, color: Colors.white70),
|
||||||
|
tooltip: '🧪 테스트용: 허용시간 초기화',
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user