스마트기기 반출: "기기 반납 확인" 버튼 추가

자동 감지 하드웨어가 아직 없어서, 승인된(APPROVED) 요청에 선생님이
기기를 실제로 돌려받았을 때 누르는 "기기 반납 확인" 버튼을 추가.
누르면 상태가 반납완료로 바뀌어 10분 후 미반납 알림이 더 이상
가지 않는다 (백엔드는 별도 저장소에서 이미 배포 완료).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-01 14:05:19 +09:00
co-authored by Claude Sonnet 5
parent 383de8b3a1
commit 2b3227f268
2 changed files with 41 additions and 0 deletions
@@ -67,6 +67,11 @@ class DeviceCheckoutLedgerController extends ChangeNotifier {
return _postAction('/api/device-checkout/reject', {"requestId": requestId}); return _postAction('/api/device-checkout/reject', {"requestId": requestId});
} }
// 🖐️ [하드웨어 자동 감지 전까지 임시] 선생님이 기기를 실제로 돌려받았을 때 누르는 버튼.
Future<(bool success, String message)> confirmReturn(int requestId) async {
return _postAction('/api/device-checkout/return', {"requestId": requestId});
}
Future<(bool success, String message)> _postAction( Future<(bool success, String message)> _postAction(
String path, String path,
Map<String, dynamic> body, Map<String, dynamic> body,
+36
View File
@@ -50,12 +50,23 @@ class _DeviceCheckoutLedgerPageState extends State<DeviceCheckoutLedgerPage> {
).showSnackBar(SnackBar(content: Text(message))); ).showSnackBar(SnackBar(content: Text(message)));
} }
// 🖐️ [하드웨어 자동 감지 전까지 임시] 기기를 실제로 돌려받았을 때 누르는 버튼.
Future<void> _confirmReturn(int id) async {
final (_, message) = await _controller.confirmReturn(id);
if (!mounted) return;
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(message)));
}
({Color color, String label}) _statusInfo(String status) { ({Color color, String label}) _statusInfo(String status) {
switch (status) { switch (status) {
case 'PENDING': case 'PENDING':
return (color: Colors.orange, label: '⏳ 대기중'); return (color: Colors.orange, label: '⏳ 대기중');
case 'APPROVED': case 'APPROVED':
return (color: Colors.blue, label: '✅ 승인됨'); return (color: Colors.blue, label: '✅ 승인됨');
case 'RETURNED':
return (color: Colors.grey, label: '↩️ 반납완료');
case 'REJECTED': case 'REJECTED':
return (color: Colors.red, label: '🚫 거절됨'); return (color: Colors.red, label: '🚫 거절됨');
default: default:
@@ -262,6 +273,31 @@ class _DeviceCheckoutLedgerPageState extends State<DeviceCheckoutLedgerPage> {
], ],
), ),
], ],
if (status == 'APPROVED') ...[
const SizedBox(height: 12),
SizedBox(
width: double.infinity,
child: OutlinedButton.icon(
onPressed: _controller.isWorking
? null
: () =>
_confirmReturn(r['id']),
style: OutlinedButton.styleFrom(
foregroundColor:
Colors.grey[800],
side: BorderSide(
color: Colors.grey[400]!,
),
),
icon: const Icon(
Icons
.assignment_turned_in_outlined,
size: 18,
),
label: const Text('기기 반납 확인'),
),
),
],
], ],
), ),
), ),