From 2b3227f268793f9a30e048381f5f334fcd2be305 Mon Sep 17 00:00:00 2001 From: sihoo Date: Tue, 1 Sep 2026 14:05:19 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=EB=A7=88=ED=8A=B8=EA=B8=B0=EA=B8=B0?= =?UTF-8?q?=20=EB=B0=98=EC=B6=9C:=20"=EA=B8=B0=EA=B8=B0=20=EB=B0=98?= =?UTF-8?q?=EB=82=A9=20=ED=99=95=EC=9D=B8"=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 자동 감지 하드웨어가 아직 없어서, 승인된(APPROVED) 요청에 선생님이 기기를 실제로 돌려받았을 때 누르는 "기기 반납 확인" 버튼을 추가. 누르면 상태가 반납완료로 바뀌어 10분 후 미반납 알림이 더 이상 가지 않는다 (백엔드는 별도 저장소에서 이미 배포 완료). Co-Authored-By: Claude Sonnet 5 --- .../device_checkout_ledger_controller.dart | 5 +++ lib/ui/device_checkout_ledger_page.dart | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/lib/function/device_checkout_ledger_controller.dart b/lib/function/device_checkout_ledger_controller.dart index 3184651..d66237a 100644 --- a/lib/function/device_checkout_ledger_controller.dart +++ b/lib/function/device_checkout_ledger_controller.dart @@ -67,6 +67,11 @@ class DeviceCheckoutLedgerController extends ChangeNotifier { 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( String path, Map body, diff --git a/lib/ui/device_checkout_ledger_page.dart b/lib/ui/device_checkout_ledger_page.dart index d4d8597..f2401e5 100644 --- a/lib/ui/device_checkout_ledger_page.dart +++ b/lib/ui/device_checkout_ledger_page.dart @@ -50,12 +50,23 @@ class _DeviceCheckoutLedgerPageState extends State { ).showSnackBar(SnackBar(content: Text(message))); } + // 🖐️ [하드웨어 자동 감지 전까지 임시] 기기를 실제로 돌려받았을 때 누르는 버튼. + Future _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) { switch (status) { case 'PENDING': return (color: Colors.orange, label: '⏳ 대기중'); case 'APPROVED': return (color: Colors.blue, label: '✅ 승인됨'); + case 'RETURNED': + return (color: Colors.grey, label: '↩️ 반납완료'); case 'REJECTED': return (color: Colors.red, label: '🚫 거절됨'); default: @@ -262,6 +273,31 @@ class _DeviceCheckoutLedgerPageState extends State { ], ), ], + 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('기기 반납 확인'), + ), + ), + ], ], ), ),