diff --git a/lib/screens/teacher_attendance_page.dart b/lib/screens/teacher_attendance_page.dart index 1531efa..9073a46 100644 --- a/lib/screens/teacher_attendance_page.dart +++ b/lib/screens/teacher_attendance_page.dart @@ -211,6 +211,54 @@ class _TeacherAttendancePageState extends State { _setAttendanceTime(formatted); } + /// πŸ§ͺ ν…ŒμŠ€νŠΈμš©: ν•˜κ΅(12μ‹œκ°„)/반좜 ν—ˆμš© μ‹œκ°„ μ„€μ • λ“±μœΌλ‘œ 켜져 μžˆλŠ” ν—ˆμš© μ‹œκ°„λŒ€λ₯Ό μ¦‰μ‹œ ν•΄μ œν•œλ‹€. + Future _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 { style: TextStyle(color: Colors.white), ), ), + IconButton( + onPressed: _showTestResetConfirmDialog, + icon: const Icon(Icons.bug_report_outlined, color: Colors.white70), + tooltip: 'πŸ§ͺ ν…ŒμŠ€νŠΈμš©: ν—ˆμš©μ‹œκ°„ μ΄ˆκΈ°ν™”', + ), const SizedBox(width: 8), ], ),