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:injectable/injectable.dart';
import '../../../core/constants/app_constants.dart';
import '../../../data/models/rent_dto.dart';
import '../../../domain/usecases/rent_usecase.dart';
@@ -34,7 +35,7 @@ class RentController with ChangeNotifier {
// 페이징 관련 getter (UI 호환성)
int get currentPage => 1; // 단순화된 페이징 구조
int get totalPages => (_rents.length / 10).ceil();
int get totalPages => (_rents.length / AppConstants.rentPageSize).ceil();
int get totalItems => _rents.length;
@@ -53,11 +54,15 @@ class RentController with ChangeNotifier {
notifyListeners();
}
/// 임대 목록 조회
/// 임대 목록 조회 (백엔드 실제 파라미터)
Future<void> loadRents({
int page = 1,
int pageSize = 10,
String? search,
int perPage = AppConstants.rentPageSize,
int? equipmentId,
int? companyId,
bool? isActive,
DateTime? dateFrom,
DateTime? dateTo,
bool refresh = false,
}) async {
try {
@@ -70,14 +75,16 @@ class RentController with ChangeNotifier {
final response = await _rentUseCase.getRents(
page: page,
pageSize: pageSize,
search: search,
// status: _selectedStatus, // 삭제된 파라미터
equipmentHistoryId: _selectedEquipmentHistoryId,
perPage: perPage,
equipmentId: equipmentId,
companyId: companyId,
isActive: isActive,
dateFrom: dateFrom,
dateTo: dateTo,
);
// response를 List<RentDto>로 캐스팅
_rents = response as List<RentDto>;
// 올바른 RentListResponse.items 접근
_rents = response.items;
clearError();
} catch (e) {
@@ -192,16 +199,36 @@ class RentController with ChangeNotifier {
);
}
/// 상태 필터 설정
void setStatusFilter(String? status) {
_selectedStatus = status;
notifyListeners();
/// 진행중인 임대 조회 (백엔드 실존 API)
Future<void> loadActiveRents() async {
try {
_setLoading(true);
final activeRents = await _rentUseCase.getActiveRents();
_rents = activeRents;
clearError();
} catch (e) {
_setError('진행중인 임대를 불러오는데 실패했습니다: $e');
} finally {
_setLoading(false);
}
}
/// 장비 이력 필터 설정
void setEquipmentHistoryFilter(int? equipmentHistoryId) {
_selectedEquipmentHistoryId = equipmentHistoryId;
notifyListeners();
/// 장비별 임대 조회 (백엔드 필터링)
Future<void> loadRentsByEquipment(int equipmentId) async {
try {
_setLoading(true);
final equipmentRents = await _rentUseCase.getRentsByEquipment(equipmentId);
_rents = equipmentRents;
clearError();
} catch (e) {
_setError('장비별 임대를 불러오는데 실패했습니다: $e');
} finally {
_setLoading(false);
}
}
/// 필터 초기화
@@ -210,6 +237,12 @@ class RentController with ChangeNotifier {
_selectedEquipmentHistoryId = null;
notifyListeners();
}
/// 장비 이력 필터 설정 (UI 호환성)
void setEquipmentHistoryFilter(int? equipmentHistoryId) {
_selectedEquipmentHistoryId = equipmentHistoryId;
notifyListeners();
}
/// 선택된 임대 초기화
void clearSelectedRent() {
@@ -217,19 +250,28 @@ class RentController with ChangeNotifier {
notifyListeners();
}
// 간단한 기간 계산 (클라이언트 사이드)
int calculateRentDays(DateTime startDate, DateTime endDate) {
return endDate.difference(startDate).inDays;
}
// 임대 상태 간단 판단
// 백엔드 계산 필드 활용 (강력한 기능)
String getRentStatus(RentDto rent) {
// 백엔드에서 계산된 is_active 필드 활용
if (rent.isActive == true) return '진행중';
// 날짜 기반 판단 (Fallback)
final now = DateTime.now();
if (rent.startedAt.isAfter(now)) return '예약';
if (rent.endedAt.isBefore(now)) return '종료';
return '진행중';
}
// 백엔드에서 계산된 남은 일수 활용
int getRemainingDays(RentDto rent) {
return rent.daysRemaining ?? 0;
}
// 백엔드에서 계산된 총 일수 활용
int getTotalDays(RentDto rent) {
return rent.totalDays ?? 0;
}
// UI 호환성을 위한 상태 표시명
String getRentStatusDisplayName(String status) {
switch (status.toLowerCase()) {
@@ -252,13 +294,24 @@ class RentController with ChangeNotifier {
await loadRents(refresh: true);
}
/// 임대 반납 처리 (endedAt를 현재 시간으로 수정)
/// 임대 반납 처리 (백엔드 PUT API 활용)
Future<bool> returnRent(int id) async {
return await updateRent(
id: id,
endedAt: DateTime.now(),
);
}
/// 상태 필터 설정 (UI 호환성)
void setStatusFilter(String? status) {
_selectedStatus = status;
notifyListeners();
}
/// 임대 기간 계산 (UI 호환성)
int calculateRentDays(DateTime startDate, DateTime endDate) {
return endDate.difference(startDate).inDays;
}
/// 임대 총 비용 계산 (문자열 날짜 기반)
double calculateTotalRent(String startDate, String endDate, double dailyRate) {

View File

@@ -1,10 +1,16 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../common/theme_shadcn.dart';
import '../../injection_container.dart';
import '../common/widgets/standard_states.dart';
import 'controllers/rent_controller.dart';
import '../maintenance/controllers/maintenance_controller.dart';
import '../inventory/controllers/equipment_history_controller.dart';
import '../../data/models/rent_dto.dart';
import '../../data/models/maintenance_dto.dart';
import '../../data/models/stock_status_dto.dart';
class RentDashboard extends StatefulWidget {
const RentDashboard({super.key});
@@ -14,34 +20,49 @@ class RentDashboard extends StatefulWidget {
}
class _RentDashboardState extends State<RentDashboard> {
late final RentController _controller;
late final RentController _rentController;
late final MaintenanceController _maintenanceController;
late final EquipmentHistoryController _equipmentHistoryController;
@override
void initState() {
super.initState();
_controller = getIt<RentController>();
_rentController = getIt<RentController>();
_maintenanceController = getIt<MaintenanceController>();
_equipmentHistoryController = getIt<EquipmentHistoryController>();
_loadData();
}
Future<void> _loadData() async {
await _controller.loadRents();
await Future.wait([
_rentController.loadActiveRents(),
_maintenanceController.loadExpiringMaintenances(days: 30),
_equipmentHistoryController.loadStockStatus(),
]);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ShadcnTheme.background,
body: ChangeNotifierProvider.value(
value: _controller,
child: Consumer<RentController>(
builder: (context, controller, child) {
if (controller.isLoading) {
return const StandardLoadingState(message: '임대 정보를 불러오는 중...');
body: MultiProvider(
providers: [
ChangeNotifierProvider.value(value: _rentController),
ChangeNotifierProvider.value(value: _maintenanceController),
ChangeNotifierProvider.value(value: _equipmentHistoryController),
],
child: Consumer3<RentController, MaintenanceController, EquipmentHistoryController>(
builder: (context, rentController, maintenanceController, equipmentHistoryController, child) {
bool isLoading = rentController.isLoading || maintenanceController.isLoading || equipmentHistoryController.isLoading;
if (isLoading) {
return const StandardLoadingState(message: '대시보드 정보를 불러오는 중...');
}
if (controller.hasError) {
if (rentController.hasError || maintenanceController.error != null || equipmentHistoryController.errorMessage != null) {
String errorMsg = rentController.error ?? maintenanceController.error ?? equipmentHistoryController.errorMessage ?? '알 수 없는 오류';
return StandardErrorState(
message: controller.error!,
message: errorMsg,
onRetry: _loadData,
);
}
@@ -52,35 +73,29 @@ class _RentDashboardState extends State<RentDashboard> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 제목
Text('임대 현황', style: ShadcnTheme.headingH3),
const SizedBox(height: 24),
// 임대 목록 보기 버튼
_buildViewRentListButton(),
Row(
children: [
Icon(Icons.dashboard_outlined, size: 32, color: ShadcnTheme.primary),
const SizedBox(width: 12),
Text('ERP 대시보드', style: ShadcnTheme.headingH2),
],
),
const SizedBox(height: 32),
// 백엔드에 대시보드 API가 없어 연체/진행중 데이터를 표시할 수 없음
Center(
child: Container(
padding: const EdgeInsets.all(40),
child: Column(
children: [
Icon(Icons.info_outline, size: 64, color: Colors.blue[400]),
const SizedBox(height: 16),
Text(
'임대 대시보드 기능은 백엔드 API가 준비되면 제공될 예정입니다.',
style: ShadcnTheme.bodyLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'임대 목록에서 단순 데이터를 확인하세요.',
style: ShadcnTheme.bodyMedium.copyWith(color: ShadcnTheme.foregroundMuted),
),
],
),
),
),
// 대시보드 카드들
_buildDashboardCards(rentController, maintenanceController, equipmentHistoryController),
const SizedBox(height: 32),
// 진행중 임대 현황
_buildActiveRentsSection(rentController),
const SizedBox(height: 24),
// 만료 예정 정비
_buildExpiringMaintenanceSection(maintenanceController),
const SizedBox(height: 24),
// 재고 현황 요약
_buildStockStatusSection(equipmentHistoryController),
],
),
);
@@ -90,27 +105,392 @@ class _RentDashboardState extends State<RentDashboard> {
);
}
Widget _buildViewRentListButton() {
return Center(
child: ElevatedButton.icon(
onPressed: () {
Navigator.pushNamed(context, '/rent/list');
},
icon: const Icon(Icons.list),
label: const Text('임대 목록 보기'),
style: ElevatedButton.styleFrom(
backgroundColor: ShadcnTheme.primary,
foregroundColor: ShadcnTheme.primaryForeground,
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
/// 대시보드 카드들
Widget _buildDashboardCards(RentController rentController, MaintenanceController maintenanceController, EquipmentHistoryController equipmentHistoryController) {
return Row(
children: [
Expanded(
child: _buildDashboardCard(
'진행중 임대',
rentController.rents.length.toString(),
Icons.business,
ShadcnTheme.primary,
() => Navigator.pushNamed(context, '/rent/list'),
),
),
const SizedBox(width: 16),
Expanded(
child: _buildDashboardCard(
'만료 예정 정비',
maintenanceController.expiringMaintenances.length.toString(),
Icons.warning,
Colors.orange,
() => Navigator.pushNamed(context, '/maintenance/list'),
),
),
const SizedBox(width: 16),
Expanded(
child: _buildDashboardCard(
'재고 현황',
equipmentHistoryController.stockStatus.length.toString(),
Icons.inventory,
Colors.green,
() => Navigator.pushNamed(context, '/inventory/history'),
),
),
],
);
}
/// 대시보드 카드 단일 사용자
Widget _buildDashboardCard(String title, String count, IconData icon, Color color, VoidCallback onTap) {
return ShadCard(
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(icon, size: 28, color: color),
Text(
count,
style: ShadcnTheme.headingH1.copyWith(color: color),
),
],
),
const SizedBox(height: 12),
Text(
title,
style: ShadcnTheme.bodyLarge.copyWith(
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
Text(
'자세히 보기',
style: ShadcnTheme.bodySmall.copyWith(
color: color,
),
),
],
),
),
),
);
}
String _formatCurrency(dynamic amount) {
if (amount == null) return '0';
final num = amount is String ? double.tryParse(amount) ?? 0 : amount.toDouble();
return num.toStringAsFixed(0);
/// 진행중 임대 섹션
Widget _buildActiveRentsSection(RentController controller) {
return ShadCard(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('진행중 임대 현황', style: ShadcnTheme.headingH3),
ShadButton.outline(
onPressed: () => Navigator.pushNamed(context, '/rent/list'),
child: const Text('전체 보기'),
),
],
),
const SizedBox(height: 16),
if (controller.rents.isEmpty)
Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Text('진행중인 임대가 없습니다.', style: ShadcnTheme.bodyMedium),
),
)
else
...controller.rents.take(5).map((rent) => _buildRentItem(rent)),
],
),
),
);
}
/// 임대 아이템
Widget _buildRentItem(RentDto rent) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: ShadcnTheme.border,
width: 0.5,
),
),
),
child: Row(
children: [
// 장비 정보
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
rent.equipmentSerial ?? 'N/A',
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
),
if (rent.equipmentModel != null)
Text(
rent.equipmentModel!,
style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.foregroundMuted),
),
],
),
),
// 임대 회사
Expanded(
flex: 2,
child: Text(
rent.companyName ?? 'N/A',
style: ShadcnTheme.bodyMedium,
),
),
// 남은 일수
Expanded(
flex: 1,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
color: _getRentStatusColor(rent).withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'${rent.daysRemaining ?? 0}',
style: ShadcnTheme.bodySmall.copyWith(
color: _getRentStatusColor(rent),
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
],
),
);
}
/// 만료 예정 정비 섹션
Widget _buildExpiringMaintenanceSection(MaintenanceController controller) {
return ShadCard(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('만료 예정 정비 (30일 이내)', style: ShadcnTheme.headingH3),
ShadButton.outline(
onPressed: () => Navigator.pushNamed(context, '/maintenance/list'),
child: const Text('전체 보기'),
),
],
),
const SizedBox(height: 16),
if (controller.expiringMaintenances.isEmpty)
Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Text('만료 예정 정비가 없습니다.', style: ShadcnTheme.bodyMedium),
),
)
else
...controller.expiringMaintenances.take(5).map((maintenance) => _buildMaintenanceItem(maintenance)),
],
),
),
);
}
/// 정비 아이템
Widget _buildMaintenanceItem(MaintenanceDto maintenance) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: ShadcnTheme.border,
width: 0.5,
),
),
),
child: Row(
children: [
// 정비 정보
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_getMaintenanceTypeName(maintenance.maintenanceType),
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
),
Text(
'종료일: ${_formatDate(maintenance.endedAt)}',
style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.foregroundMuted),
),
],
),
),
// 남은 일수
Expanded(
flex: 1,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
color: Colors.orange.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'${maintenance.daysRemaining ?? 0}',
style: ShadcnTheme.bodySmall.copyWith(
color: Colors.orange,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
],
),
);
}
/// 재고 현황 섹션
Widget _buildStockStatusSection(EquipmentHistoryController controller) {
return ShadCard(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('재고 현황 요약', style: ShadcnTheme.headingH3),
ShadButton.outline(
onPressed: () => Navigator.pushNamed(context, '/inventory/dashboard'),
child: const Text('상세 보기'),
),
],
),
const SizedBox(height: 16),
if (controller.stockStatus.isEmpty)
Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Text('재고 정보가 없습니다.', style: ShadcnTheme.bodyMedium),
),
)
else
...controller.stockStatus.take(5).map((stock) => _buildStockItem(stock)),
],
),
),
);
}
/// 재고 아이템
Widget _buildStockItem(StockStatusDto stock) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: ShadcnTheme.border,
width: 0.5,
),
),
),
child: Row(
children: [
// 장비 정보
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
stock.equipmentSerial,
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
),
if (stock.modelName != null)
Text(
stock.modelName!,
style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.foregroundMuted),
),
],
),
),
// 창고 위치
Expanded(
flex: 1,
child: Text(
stock.warehouseName,
style: ShadcnTheme.bodyMedium,
),
),
// 재고 수량
Expanded(
flex: 1,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
color: stock.currentQuantity > 0 ? Colors.green.withValues(alpha: 0.1) : Colors.red.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'${stock.currentQuantity}',
style: ShadcnTheme.bodySmall.copyWith(
color: stock.currentQuantity > 0 ? Colors.green : Colors.red,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
],
),
);
}
// 유틸리티 메서드들
Color _getRentStatusColor(RentDto rent) {
final remainingDays = rent.daysRemaining ?? 0;
if (remainingDays <= 0) return Colors.red;
if (remainingDays <= 7) return Colors.orange;
return Colors.green;
}
String _getMaintenanceTypeName(String? type) {
switch (type) {
case 'WARRANTY':
return '무상보증';
case 'CONTRACT':
return '유상계약';
case 'INSPECTION':
return '점검';
default:
return '알수없음';
}
}
String _formatDate(DateTime date) {
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
}
}

View File

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:get_it/get_it.dart';
import '../../data/models/rent_dto.dart';
import '../equipment/controllers/equipment_history_controller.dart';
class RentFormDialog extends StatefulWidget {
final RentDto? rent;
@@ -19,6 +21,7 @@ class RentFormDialog extends StatefulWidget {
class _RentFormDialogState extends State<RentFormDialog> {
final _formKey = GlobalKey<FormState>();
late final EquipmentHistoryController _historyController;
// 백엔드 스키마에 맞는 필드만 유지
int? _selectedEquipmentHistoryId;
@@ -26,13 +29,43 @@ class _RentFormDialogState extends State<RentFormDialog> {
DateTime? _endDate;
bool _isLoading = false;
bool _isLoadingHistories = false;
String? _historiesError;
@override
void initState() {
super.initState();
_historyController = GetIt.instance<EquipmentHistoryController>();
if (widget.rent != null) {
_initializeForm(widget.rent!);
}
_loadEquipmentHistories();
}
Future<void> _loadEquipmentHistories() async {
setState(() {
_isLoadingHistories = true;
_historiesError = null; // 오류 상태 초기화
});
try {
await _historyController.loadHistory();
setState(() => _historiesError = null); // 성공 시 오류 상태 클리어
} catch (e) {
debugPrint('장비 이력 로딩 실패: $e');
setState(() => _historiesError = '장비 이력을 불러오는 중 오류가 발생했습니다: ${e.toString()}');
} finally {
if (mounted) {
setState(() => _isLoadingHistories = false);
}
}
}
// 재시도 기능 추가 (UserForm 패턴과 동일)
void _retryLoadHistories() {
_loadEquipmentHistories();
}
@override
@@ -132,26 +165,109 @@ class _RentFormDialogState extends State<RentFormDialog> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 장비 이력 ID (백엔드 필수 필드)
TextFormField(
decoration: const InputDecoration(
labelText: '장비 이력 ID *',
border: OutlineInputBorder(),
helperText: '임대할 장비의 이력 ID를 입력하세요',
),
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
validator: (value) {
if (value == null || value.isEmpty) {
return '장비 이력 ID는 필수입니다';
}
return null;
},
onChanged: (value) {
_selectedEquipmentHistoryId = int.tryParse(value);
},
initialValue: _selectedEquipmentHistoryId?.toString(),
),
// 장비 이력 선택 (백엔드 필수 필드)
Text('장비 선택 *', style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 8),
// 3단계 상태 처리 (UserForm 패턴 적용)
_isLoadingHistories
? const SizedBox(
height: 56,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ShadProgress(),
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),
ShadButton(
onPressed: _retryLoadHistories,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.refresh, size: 16),
SizedBox(width: 4),
Text('다시 시도'),
],
),
),
],
),
)
// 정상 상태: 드롭다운 표시
: ShadSelect<int>(
placeholder: const Text('장비를 선택하세요'),
options: _historyController.historyList.map((history) {
return ShadOption(
value: history.id!,
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${history.equipment?.serialNumber ?? "Serial N/A"} - ${history.equipment?.modelName ?? "Model N/A"}',
style: const TextStyle(fontWeight: FontWeight.w500),
overflow: TextOverflow.ellipsis,
),
Text(
'거래: ${history.transactionType} | 수량: ${history.quantity} | ${history.transactedAt.toString().split(' ')[0]}',
style: const TextStyle(fontSize: 12, color: Colors.grey),
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
);
}).toList(),
selectedOptionBuilder: (context, value) {
final selectedHistory = _historyController.historyList
.firstWhere((h) => h.id == value);
return Text(
'${selectedHistory.equipment?.serialNumber ?? "Serial N/A"} - ${selectedHistory.equipment?.modelName ?? "Model N/A"}',
overflow: TextOverflow.ellipsis,
);
},
onChanged: (value) {
setState(() {
_selectedEquipmentHistoryId = value;
});
},
initialValue: _selectedEquipmentHistoryId,
),
const SizedBox(height: 20),
// 임대 기간 (백엔드 필수 필드)

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../core/constants/app_constants.dart';
import '../../data/models/rent_dto.dart';
import '../../injection_container.dart';
import '../common/widgets/pagination.dart';
@@ -37,10 +38,6 @@ class _RentListScreenState extends State<RentListScreen> {
await _controller.loadRents();
}
Future<void> _refresh() async {
await _controller.loadRents(refresh: true);
}
void _showCreateDialog() {
showDialog(
context: context,
@@ -313,19 +310,6 @@ class _RentListScreenState extends State<RentListScreen> {
);
}
Color _getStatusColor(String? status) {
switch (status) {
case '진행중':
return Colors.blue;
case '종료':
return Colors.green;
case '예약':
return Colors.orange;
default:
return Colors.grey;
}
}
/// 상태 배지 빌더
Widget _buildStatusChip(String? status) {
switch (status) {
@@ -486,7 +470,7 @@ class _RentListScreenState extends State<RentListScreen> {
return Pagination(
totalCount: controller.totalRents,
currentPage: controller.currentPage,
pageSize: 20,
pageSize: AppConstants.rentPageSize,
onPageChanged: (page) => controller.loadRents(page: page),
);
},