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:
JiWoong Sul
2025-09-02 19:51:40 +09:00
parent 650cd4be55
commit c419f8f458
149 changed files with 12934 additions and 3644 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_it/get_it.dart';
import 'package:superport/core/constants/app_constants.dart';
import 'package:superport/data/models/equipment_history_dto.dart';
import 'package:superport/services/equipment_service.dart';
import 'package:superport/core/errors/failures.dart';
@@ -50,7 +51,7 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
bool _isInitialLoad = true;
String? _error;
int _currentPage = 1;
final int _perPage = 20;
final int _perPage = AppConstants.historyPageSize;
bool _hasMore = true;
String _searchQuery = '';
@@ -339,11 +340,11 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
horizontal: isDesktop ? 40 : 10,
vertical: isDesktop ? 40 : 20,
),
child: RawKeyboardListener(
child: KeyboardListener(
focusNode: FocusNode(),
autofocus: true,
onKey: (RawKeyEvent event) {
if (event is RawKeyDownEvent &&
onKeyEvent: (KeyEvent event) {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.escape) {
Navigator.of(context).pop();
}

View File

@@ -0,0 +1,210 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../common/theme_shadcn.dart';
import '../../../data/models/equipment/equipment_dto.dart';
import '../../../injection_container.dart';
import '../controllers/equipment_controller.dart';
/// 장비 복구 확인 다이얼로그
class EquipmentRestoreDialog extends StatefulWidget {
final EquipmentDto equipment;
final VoidCallback? onRestored;
const EquipmentRestoreDialog({
super.key,
required this.equipment,
this.onRestored,
});
@override
State<EquipmentRestoreDialog> createState() => _EquipmentRestoreDialogState();
}
class _EquipmentRestoreDialogState extends State<EquipmentRestoreDialog> {
late final EquipmentController _controller;
bool _isRestoring = false;
@override
void initState() {
super.initState();
_controller = sl<EquipmentController>();
}
Future<void> _restore() async {
setState(() {
_isRestoring = true;
});
final success = await _controller.restoreEquipment(widget.equipment.id);
if (mounted) {
if (success) {
Navigator.of(context).pop(true);
if (widget.onRestored != null) {
widget.onRestored!();
}
// 성공 메시지
ShadToaster.of(context).show(
ShadToast(
title: const Text('복구 완료'),
description: Text('${widget.equipment.serialNumber} 장비가 복구되었습니다.'),
),
);
} else {
setState(() {
_isRestoring = false;
});
// 실패 메시지
ShadToaster.of(context).show(
ShadToast.destructive(
title: const Text('복구 실패'),
description: Text(_controller.error ?? '장비 복구에 실패했습니다.'),
),
);
}
}
}
@override
Widget build(BuildContext context) {
return ShadDialog(
child: SizedBox(
width: 400,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 헤더
Row(
children: [
Icon(Icons.restore, color: Colors.green, size: 24),
const SizedBox(width: 12),
Expanded(
child: Text('장비 복구', style: ShadcnTheme.headingH3),
),
],
),
const SizedBox(height: 24),
// 복구 정보
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.green.withValues(alpha: 0.2)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'다음 장비를 복구하시겠습니까?',
style: ShadcnTheme.bodyLarge.copyWith(fontWeight: FontWeight.w500),
),
const SizedBox(height: 12),
_buildInfoRow('시리얼 번호', widget.equipment.serialNumber),
if (widget.equipment.barcode != null)
_buildInfoRow('바코드', widget.equipment.barcode!),
if (widget.equipment.modelName != null)
_buildInfoRow('모델명', widget.equipment.modelName!),
if (widget.equipment.companyName != null)
_buildInfoRow('소속 회사', widget.equipment.companyName!),
],
),
),
const SizedBox(height: 16),
Text(
'복구된 장비는 다시 활성 상태로 변경됩니다.',
style: ShadcnTheme.bodyMedium.copyWith(
color: ShadcnTheme.foregroundMuted,
),
),
const SizedBox(height: 24),
// 버튼들
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ShadButton.outline(
onPressed: _isRestoring ? null : () => Navigator.of(context).pop(false),
child: const Text('취소'),
),
const SizedBox(width: 12),
ShadButton(
onPressed: _isRestoring ? null : _restore,
child: _isRestoring
? Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
),
const SizedBox(width: 8),
const Text('복구 중...'),
],
)
: const Text('복구'),
),
],
),
],
),
),
);
}
Widget _buildInfoRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 80,
child: Text(
'$label:',
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.foregroundMuted,
),
),
),
Expanded(
child: Text(
value,
style: ShadcnTheme.bodySmall.copyWith(
fontWeight: FontWeight.w500,
),
),
),
],
),
);
}
}
/// 장비 복구 다이얼로그 표시 유틸리티
Future<bool?> showEquipmentRestoreDialog(
BuildContext context, {
required EquipmentDto equipment,
VoidCallback? onRestored,
}) async {
return await showDialog<bool>(
context: context,
barrierDismissible: false,
builder: (context) => EquipmentRestoreDialog(
equipment: equipment,
onRestored: onRestored,
),
);
}

View File

@@ -0,0 +1,374 @@
import 'package:flutter/material.dart';
import '../../../injection_container.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../common/theme_shadcn.dart';
import '../../../domain/usecases/equipment/search_equipment_usecase.dart';
import '../../../data/models/equipment/equipment_dto.dart';
/// 장비 시리얼/바코드 검색 다이얼로그
class EquipmentSearchDialog extends StatefulWidget {
final Function(EquipmentDto equipment)? onEquipmentFound;
const EquipmentSearchDialog({super.key, this.onEquipmentFound});
@override
State<EquipmentSearchDialog> createState() => _EquipmentSearchDialogState();
}
class _EquipmentSearchDialogState extends State<EquipmentSearchDialog> {
final _serialController = TextEditingController();
final _barcodeController = TextEditingController();
late final GetEquipmentBySerialUseCase _serialUseCase;
late final GetEquipmentByBarcodeUseCase _barcodeUseCase;
bool _isLoading = false;
String? _errorMessage;
EquipmentDto? _foundEquipment;
@override
void initState() {
super.initState();
_serialUseCase = sl<GetEquipmentBySerialUseCase>();
_barcodeUseCase = sl<GetEquipmentByBarcodeUseCase>();
}
@override
void dispose() {
_serialController.dispose();
_barcodeController.dispose();
super.dispose();
}
Future<void> _searchBySerial() async {
final serial = _serialController.text.trim();
if (serial.isEmpty) {
setState(() {
_errorMessage = '시리얼 번호를 입력해주세요.';
});
return;
}
setState(() {
_isLoading = true;
_errorMessage = null;
_foundEquipment = null;
});
final result = await _serialUseCase(serial);
result.fold(
(failure) {
setState(() {
_errorMessage = failure.message;
_isLoading = false;
});
},
(equipment) {
setState(() {
_foundEquipment = equipment;
_isLoading = false;
});
},
);
}
Future<void> _searchByBarcode() async {
final barcode = _barcodeController.text.trim();
if (barcode.isEmpty) {
setState(() {
_errorMessage = '바코드를 입력해주세요.';
});
return;
}
setState(() {
_isLoading = true;
_errorMessage = null;
_foundEquipment = null;
});
final result = await _barcodeUseCase(barcode);
result.fold(
(failure) {
setState(() {
_errorMessage = failure.message;
_isLoading = false;
});
},
(equipment) {
setState(() {
_foundEquipment = equipment;
_isLoading = false;
});
},
);
}
@override
Widget build(BuildContext context) {
return ShadDialog(
child: SizedBox(
width: 500,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 헤더
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('장비 검색', style: ShadcnTheme.headingH3),
ShadButton.ghost(
onPressed: () => Navigator.of(context).pop(),
child: const Icon(Icons.close),
),
],
),
const SizedBox(height: 24),
// 시리얼 검색
Text('시리얼 번호로 검색', style: ShadcnTheme.bodyLarge.copyWith(fontWeight: FontWeight.w500)),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: ShadInput(
controller: _serialController,
placeholder: const Text('시리얼 번호 입력'),
onSubmitted: (_) => _searchBySerial(),
),
),
const SizedBox(width: 12),
ShadButton(
onPressed: _isLoading ? null : _searchBySerial,
child: const Text('검색'),
),
],
),
const SizedBox(height: 16),
// 바코드 검색
Text('바코드로 검색', style: ShadcnTheme.bodyLarge.copyWith(fontWeight: FontWeight.w500)),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: ShadInput(
controller: _barcodeController,
placeholder: const Text('바코드 입력'),
onSubmitted: (_) => _searchByBarcode(),
),
),
const SizedBox(width: 12),
ShadButton(
onPressed: _isLoading ? null : _searchByBarcode,
child: const Text('검색'),
),
const SizedBox(width: 8),
ShadButton.outline(
onPressed: () => _showQRScanDialog(),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.qr_code_scanner, size: 16),
const SizedBox(width: 4),
const Text('QR 스캔'),
],
),
),
],
),
const SizedBox(height: 24),
// 로딩 표시
if (_isLoading)
Center(
child: Column(
children: [
ShadProgress(value: null),
const SizedBox(height: 8),
Text('검색 중...', style: ShadcnTheme.bodyMedium),
],
),
),
// 오류 메시지
if (_errorMessage != null)
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.red.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.red.withValues(alpha: 0.2)),
),
child: Row(
children: [
Icon(Icons.error_outline, color: Colors.red, size: 16),
const SizedBox(width: 8),
Expanded(
child: Text(
_errorMessage!,
style: ShadcnTheme.bodyMedium.copyWith(color: Colors.red),
),
),
],
),
),
// 검색 결과
if (_foundEquipment != null)
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.green.withValues(alpha: 0.2)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.check_circle, color: Colors.green, size: 20),
const SizedBox(width: 8),
Text(
'장비를 찾았습니다!',
style: ShadcnTheme.bodyLarge.copyWith(
color: Colors.green,
fontWeight: FontWeight.w500,
),
),
],
),
const SizedBox(height: 12),
_buildEquipmentInfo(_foundEquipment!),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ShadButton.outline(
onPressed: () => Navigator.of(context).pop(),
child: const Text('닫기'),
),
const SizedBox(width: 8),
ShadButton(
onPressed: () {
if (widget.onEquipmentFound != null) {
widget.onEquipmentFound!(_foundEquipment!);
}
Navigator.of(context).pop();
},
child: const Text('선택'),
),
],
),
],
),
),
const SizedBox(height: 16),
],
),
),
);
}
/// 장비 정보 표시
Widget _buildEquipmentInfo(EquipmentDto equipment) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoRow('시리얼 번호', equipment.serialNumber),
if (equipment.barcode != null)
_buildInfoRow('바코드', equipment.barcode!),
if (equipment.modelName != null)
_buildInfoRow('모델명', equipment.modelName!),
if (equipment.companyName != null)
_buildInfoRow('소속 회사', equipment.companyName!),
_buildInfoRow('활성 상태', equipment.isActive ? '활성' : '비활성'),
],
);
}
Widget _buildInfoRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 80,
child: Text(
'$label:',
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.foregroundMuted,
),
),
),
Expanded(
child: Text(
value,
style: ShadcnTheme.bodySmall.copyWith(
fontWeight: FontWeight.w500,
),
),
),
],
),
);
}
/// QR 스캔 다이얼로그 (임시 구현)
void _showQRScanDialog() {
showDialog(
context: context,
builder: (context) => ShadDialog(
child: SizedBox(
width: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.qr_code_scanner, size: 64, color: ShadcnTheme.primary),
const SizedBox(height: 16),
Text(
'QR 스캔 기능',
style: ShadcnTheme.headingH3,
),
const SizedBox(height: 8),
Text(
'QR 스캔 기능은 추후 구현 예정입니다.',
style: ShadcnTheme.bodyMedium.copyWith(
color: ShadcnTheme.foregroundMuted,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 24),
ShadButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('확인'),
),
],
),
),
),
);
}
}
/// 장비 검색 다이얼로그 표시 유틸리티
Future<EquipmentDto?> showEquipmentSearchDialog(
BuildContext context, {
Function(EquipmentDto equipment)? onEquipmentFound,
}) async {
return await showDialog<EquipmentDto>(
context: context,
barrierDismissible: false,
builder: (context) => EquipmentSearchDialog(
onEquipmentFound: onEquipmentFound,
),
);
}

View File

@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:superport/data/models/model_dto.dart';
import 'package:superport/data/models/model/model_dto.dart';
import 'package:superport/data/models/vendor_dto.dart';
import 'package:superport/screens/vendor/controllers/vendor_controller.dart';
import 'package:superport/screens/model/controllers/model_controller.dart';
import 'package:superport/injection_container.dart';
import 'package:superport/screens/common/widgets/standard_dropdown.dart';
/// Equipment 등록/수정 폼에서 사용할 Vendor→Model cascade 선택 위젯
class EquipmentVendorModelSelector extends StatefulWidget {
@@ -141,6 +141,7 @@ class _EquipmentVendorModelSelectorState extends State<EquipmentVendorModelSelec
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// Vendor 선택 드롭다운
_buildVendorDropdown(),
@@ -153,96 +154,59 @@ class _EquipmentVendorModelSelectorState extends State<EquipmentVendorModelSelec
}
Widget _buildVendorDropdown() {
if (_isLoadingVendors) {
return const Center(child: CircularProgressIndicator());
}
final vendors = _vendorController.vendors;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.isReadOnly ? '제조사 * 🔒' : '제조사 *',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
ShadSelect<int>(
placeholder: const Text('제조사를 선택하세요'),
options: vendors.map((vendor) {
return ShadOption(
value: vendor.id!,
child: Text(vendor.name),
);
}).toList(),
selectedOptionBuilder: (context, value) {
final vendor = vendors.firstWhere(
(v) => v.id == value,
orElse: () => VendorDto(
id: value,
name: '로딩중...',
),
);
return Text(vendor.name);
},
onChanged: widget.isReadOnly ? null : _onVendorChanged,
initialValue: _selectedVendorId,
enabled: !widget.isReadOnly,
),
],
return Container(
width: double.infinity,
child: StandardIntDropdown<VendorDto>(
label: widget.isReadOnly ? '제조사 * 🔒' : '제조사 *',
isRequired: true,
items: vendors,
isLoading: _isLoadingVendors,
selectedValue: _selectedVendorId != null
? vendors.where((v) => v.id == _selectedVendorId).firstOrNull
: null,
onChanged: (VendorDto? selectedVendor) {
if (!widget.isReadOnly) {
_onVendorChanged(selectedVendor?.id);
}
},
itemBuilder: (VendorDto vendor) => Text(vendor.name),
selectedItemBuilder: (VendorDto vendor) => Text(vendor.name),
idExtractor: (VendorDto vendor) => vendor.id!,
placeholder: '제조사를 선택하세요',
enabled: !widget.isReadOnly,
),
);
}
Widget _buildModelDropdown() {
if (_isLoadingModels) {
return const Center(child: CircularProgressIndicator());
}
// Vendor가 선택되지 않으면 비활성화
final isEnabled = !widget.isReadOnly && _selectedVendorId != null;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.isReadOnly ? '모델 * 🔒' : '모델 *',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
ShadSelect<int>(
placeholder: Text(
_selectedVendorId == null
? '먼저 제조사를 선택하세요'
: '모델을 선택하세요'
),
options: _filteredModels.map((model) {
return ShadOption(
value: model.id,
child: Text(model.name),
);
}).toList(),
selectedOptionBuilder: (context, value) {
final model = _filteredModels.firstWhere(
(m) => m.id == value,
orElse: () => ModelDto(
id: value,
name: '로딩중...',
vendorsId: 0,
),
);
return Text(model.name);
},
onChanged: isEnabled ? _onModelChanged : null,
initialValue: _selectedModelId,
enabled: isEnabled,
),
],
return Container(
width: double.infinity,
child: StandardIntDropdown<ModelDto>(
label: widget.isReadOnly ? '모델 * 🔒' : '모델 *',
isRequired: true,
items: _filteredModels,
isLoading: _isLoadingModels,
selectedValue: _selectedModelId != null
? _filteredModels.where((m) => m.id == _selectedModelId).firstOrNull
: null,
onChanged: (ModelDto? selectedModel) {
if (isEnabled) {
_onModelChanged(selectedModel?.id);
}
},
itemBuilder: (ModelDto model) => Text(model.name),
selectedItemBuilder: (ModelDto model) => Text(model.name),
idExtractor: (ModelDto model) => model.id ?? 0,
placeholder: _selectedVendorId == null
? '먼저 제조사를 선택하세요'
: '모델을 선택하세요',
enabled: isEnabled,
),
);
}
}