backup: 사용하지 않는 파일 삭제 전 복구 지점
- 전체 371개 파일 중 82개 미사용 파일 식별 - Phase 1: 33개 파일 삭제 예정 (100% 안전) - Phase 2: 30개 파일 삭제 검토 예정 - Phase 3: 19개 파일 수동 검토 예정 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ class _MaintenanceFormDialogState extends State<MaintenanceFormDialog> {
|
||||
|
||||
List<EquipmentHistoryDto> _equipmentHistories = [];
|
||||
bool _isLoadingHistories = false;
|
||||
String? _historiesError;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -66,6 +67,7 @@ class _MaintenanceFormDialogState extends State<MaintenanceFormDialog> {
|
||||
void _loadEquipmentHistories() async {
|
||||
setState(() {
|
||||
_isLoadingHistories = true;
|
||||
_historiesError = null; // 오류 상태 초기화
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -75,20 +77,21 @@ class _MaintenanceFormDialogState extends State<MaintenanceFormDialog> {
|
||||
setState(() {
|
||||
_equipmentHistories = controller.historyList;
|
||||
_isLoadingHistories = false;
|
||||
_historiesError = null; // 성공 시 오류 상태 클리어
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_isLoadingHistories = false;
|
||||
_historiesError = '장비 이력을 불러오는 중 오류가 발생했습니다: ${e.toString()}';
|
||||
});
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('장비 이력 로드 실패: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 재시도 기능 추가
|
||||
void _retryLoadHistories() {
|
||||
_loadEquipmentHistories();
|
||||
}
|
||||
|
||||
// _calculateNextDate 메서드 제거 - 백엔드에 nextMaintenanceDate 필드 없음
|
||||
|
||||
@override
|
||||
@@ -196,36 +199,89 @@ class _MaintenanceFormDialogState extends State<MaintenanceFormDialog> {
|
||||
}
|
||||
|
||||
Widget _buildEquipmentHistorySelector() {
|
||||
if (_isLoadingHistories) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
return DropdownButtonFormField<int>(
|
||||
value: _selectedEquipmentHistoryId,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '장비 이력 선택',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
items: _equipmentHistories.map((history) {
|
||||
final equipment = history.equipment;
|
||||
return DropdownMenuItem(
|
||||
value: history.id,
|
||||
child: Text(
|
||||
'${equipment?.serialNumber ?? "Unknown"} - '
|
||||
'${equipment?.serialNumber ?? "No Serial"} '
|
||||
'(${history.transactionType == "I" ? "입고" : "출고"})',
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: widget.maintenance == null
|
||||
? (value) => setState(() => _selectedEquipmentHistoryId = value)
|
||||
: null, // 수정 모드에서는 변경 불가
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return '장비 이력을 선택해주세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('장비 이력 선택 *', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// 3단계 상태 처리 (UserForm 패턴 적용)
|
||||
_isLoadingHistories
|
||||
? const SizedBox(
|
||||
height: 56,
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(width: 8),
|
||||
Text('장비 이력을 불러오는 중...'),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
// 오류 발생 시 오류 컨테이너 표시
|
||||
: _historiesError != null
|
||||
? Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.shade50,
|
||||
border: Border.all(color: Colors.red.shade200),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.error, color: Colors.red.shade600, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
const Text('장비 이력 로딩 실패', style: TextStyle(fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
_historiesError!,
|
||||
style: TextStyle(color: Colors.red.shade700, fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ElevatedButton.icon(
|
||||
onPressed: _retryLoadHistories,
|
||||
icon: const Icon(Icons.refresh, size: 16),
|
||||
label: const Text('다시 시도'),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
// 정상 상태: shadcn_ui 드롭다운 표시
|
||||
: DropdownButtonFormField<int>(
|
||||
value: _selectedEquipmentHistoryId,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '장비 이력 선택',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
items: _equipmentHistories.map((history) {
|
||||
final equipment = history.equipment;
|
||||
return DropdownMenuItem(
|
||||
value: history.id,
|
||||
child: Text(
|
||||
'${equipment?.serialNumber ?? "Unknown"} - '
|
||||
'${equipment?.modelName ?? "No Model"} '
|
||||
'(${TransactionType.getDisplayName(history.transactionType)})',
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: widget.maintenance == null
|
||||
? (value) => setState(() => _selectedEquipmentHistoryId = value)
|
||||
: null, // 수정 모드에서는 변경 불가
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return '장비 이력을 선택해주세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user